APM:Libraries
usbd_cdc_core.h
Go to the documentation of this file.
1 
28 /* Includes ------------------------------------------------------------------*/
29 
30 #ifndef __USB_CDC_CORE_H_
31 #define __USB_CDC_CORE_H_
32 
33 #include "usbd_ioreq.h"
34 
48 #define USB_CDC_CONFIG_DESC_SIZ (67)
49 #define USB_CDC_DESC_SIZ (67-9)
50 
51 #define CDC_DESCRIPTOR_TYPE 0x21
52 
53 #define DEVICE_CLASS_CDC 0x02
54 #define DEVICE_SUBCLASS_CDC 0x00
55 
56 
57 #define USB_DEVICE_DESCRIPTOR_TYPE 0x01
58 #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
59 #define USB_STRING_DESCRIPTOR_TYPE 0x03
60 #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
61 #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
62 
63 #define STANDARD_ENDPOINT_DESC_SIZE 0x09
64 
65 #define CDC_DATA_IN_PACKET_SIZE CDC_DATA_MAX_PACKET_SIZE
66 
67 #define CDC_DATA_OUT_PACKET_SIZE CDC_DATA_MAX_PACKET_SIZE
68 
69 /*---------------------------------------------------------------------*/
70 /* CDC definitions */
71 /*---------------------------------------------------------------------*/
72 
73 /**************************************************/
74 /* CDC Requests */
75 /**************************************************/
76 #define SEND_ENCAPSULATED_COMMAND 0x00
77 #define GET_ENCAPSULATED_RESPONSE 0x01
78 #define SET_COMM_FEATURE 0x02
79 #define GET_COMM_FEATURE 0x03
80 #define CLEAR_COMM_FEATURE 0x04
81 #define SET_LINE_CODING 0x20
82 #define GET_LINE_CODING 0x21
83 #define SET_CONTROL_LINE_STATE 0x22
84 #define SEND_BREAK 0x23
85 #define NO_CMD 0xFF
86 
95 typedef struct _CDC_IF_PROP
96 {
97  uint16_t (*pIf_Init) (void);
98  uint16_t (*pIf_DeInit) (void);
99  uint16_t (*pIf_Ctrl) (uint32_t Cmd, uint8_t* Buf, uint32_t Len);
100  uint16_t (*pIf_DataTx) (const uint8_t* Buf, uint32_t Len);
101  uint16_t (*pIf_DataRx) (uint8_t* Buf, uint32_t Len);
102 }
134 /*
135  * CDC data buffers
136  */
137 
138 #ifndef USB_TX_BUFF_SIZE
139  #define USB_TX_BUFF_SIZE 512
140  #define USB_RX_BUFF_SIZE 1024
141 #endif
142 
143 /*
144  * IN ring endpoint buffer (data to be sent to host)
145  */
146 extern uint8_t USB_Tx_Buffer[];
147 extern uint32_t USB_Tx_buff_head;
148 extern uint32_t USB_Tx_buff_tail;
149 
150 /*
151  * OUT endpoint ring buffer (data received from host)
152  */
153 extern uint8_t USB_Rx_Buffer[];
154 extern uint32_t USB_Rx_buff_head;
155 extern uint32_t USB_Rx_buff_tail;
156 extern uint32_t USB_Rx_buff_size;
157 
158 #endif // __USB_CDC_CORE_H_
159 
167 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
struct _CDC_IF_PROP CDC_IF_Prop_TypeDef
uint32_t USB_Rx_buff_size
uint8_t USB_Tx_Buffer[]
uint16_t(* pIf_DeInit)(void)
Definition: usbd_cdc_core.h:98
uint16_t(* pIf_DataRx)(uint8_t *Buf, uint32_t Len)
uint16_t(* pIf_DataTx)(const uint8_t *Buf, uint32_t Len)
uint32_t USB_Rx_buff_head
uint8_t USB_Rx_Buffer[]
uint32_t USB_Tx_buff_head
uint16_t(* pIf_Ctrl)(uint32_t Cmd, uint8_t *Buf, uint32_t Len)
Definition: usbd_cdc_core.h:99
header file for the usbd_ioreq.c file
const USBD_Class_cb_TypeDef USBD_CDC_cb
uint32_t USB_Tx_buff_tail
uint16_t(* pIf_Init)(void)
Definition: usbd_cdc_core.h:97
uint32_t USB_Rx_buff_tail