1 /*! 2 \file cdc_acm_core.h 3 \brief the header file of cdc acm driver 4 5 \version 2020-08-04, V1.1.0, firmware for GD32VF103 6 */ 7 8 /* 9 Copyright (c) 2020, GigaDevice Semiconductor Inc. 10 11 Redistribution and use in source and binary forms, with or without modification, 12 are permitted provided that the following conditions are met: 13 14 1. Redistributions of source code must retain the above copyright notice, this 15 list of conditions and the following disclaimer. 16 2. Redistributions in binary form must reproduce the above copyright notice, 17 this list of conditions and the following disclaimer in the documentation 18 and/or other materials provided with the distribution. 19 3. Neither the name of the copyright holder nor the names of its contributors 20 may be used to endorse or promote products derived from this software without 21 specific prior written permission. 22 23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 32 OF SUCH DAMAGE. 33 */ 34 35 #ifndef __CDC_ACM_CORE_H 36 #define __CDC_ACM_CORE_H 37 38 #include "usbd_enum.h" 39 #include "usb_cdc.h" 40 41 #define USB_CDC_RX_LEN 64 42 43 typedef struct { 44 uint8_t packet_sent; 45 uint8_t packet_receive; 46 47 uint8_t data[USB_CDC_RX_LEN]; 48 uint8_t cmd[USB_CDC_CMD_PACKET_SIZE]; 49 50 uint32_t receive_length; 51 52 acm_line line_coding; 53 } usb_cdc_handler; 54 55 extern usb_desc cdc_desc; 56 extern usb_class_core cdc_class; 57 58 /* function declarations */ 59 /* check cdc acm is ready for data transfer */ 60 uint8_t cdc_acm_check_ready(usb_dev *udev); 61 /* send CDC ACM data */ 62 void cdc_acm_data_send(usb_dev *udev); 63 /* receive CDC ACM data */ 64 void cdc_acm_data_receive(usb_dev *udev); 65 66 #endif /* __CDC_ACM_CORE_H */ 67