GD32F1x0: USB/GD32_USB_Device_Library/Core/inc/usbd_def.h Source File

GD32F1x0

usbd_def.h
Go to the documentation of this file.
1 
11 /* Define to prevent recursive inclusion -------------------------------------*/
12 #ifndef __GD32F1X0_USBD_DEF_H
13 #define __GD32F1X0_USBD_DEF_H
14 
15 /* Includes ------------------------------------------------------------------*/
16 #include "usbd_conf.h"
17 #include "stdbool.h"
18 
34 #ifndef NULL
35  #define NULL 0
36 #endif
37 
38 #define USB_DEV_QUALIFIER_DESC_LEN 0x0A
39 #define USB_CFG_DESC_LEN 0x09
40 
41 #define USBD_LANGID_STR_IDX 0x00
42 #define USBD_MFC_STR_IDX 0x01
43 #define USBD_PRODUCT_STR_IDX 0x02
44 #define USBD_SERIAL_STR_IDX 0x03
45 #define USBD_CONFIG_STR_IDX 0x04
46 #define USBD_INTERFACE_STR_IDX 0x05
47 
48 #define USB_STANDARD_REQ 0x00
49 #define USB_CLASS_REQ 0x20
50 #define USB_VENDOR_REQ 0x40
51 #define USB_REQ_MASK 0x60
52 
53 #define USB_REQTYPE_DEVICE 0x00
54 #define USB_REQTYPE_INTERFACE 0x01
55 #define USB_REQTYPE_ENDPOINT 0x02
56 #define USB_REQ_RECIPIENT_MASK 0x1f
57 
58 #define USBREQ_GET_STATUS 0x00
59 #define USBREQ_CLEAR_FEATURE 0x01
60 #define USBREQ_SET_FEATURE 0x03
61 #define USBREQ_SET_ADDRESS 0x05
62 #define USBREQ_GET_DESCRIPTOR 0x06
63 #define USBREQ_GET_CONFIGURATION 0x08
64 #define USBREQ_SET_CONFIGURATION 0x09
65 #define USBREQ_GET_INTERFACE 0x0A
66 #define USBREQ_SET_INTERFACE 0x0B
67 
68 #define USB_DESCTYPE_DEVICE 0x01
69 #define USB_DESCTYPE_CONFIGURATION 0x02
70 #define USB_DESCTYPE_STRING 0x03
71 #define USB_DESCTYPE_INTERFACE 0x04
72 #define USB_DESCTYPE_ENDPOINT 0x05
73 #define USB_DESCTYPE_DEVICE_QUALIFIER 0x06
74 #define USB_DESCTYPE_OTHER_SPEED_CONFIGURATION 0x07
75 #define USB_DESCTYPE_BOS 0x0F
76 
77 #define USB_STATUS_REMOTE_WAKEUP 2
78 #define USB_STATUS_SELF_POWERED 1
79 
80 #define USB_FEATURE_ENDP_HALT 0
81 #define USB_FEATURE_REMOTE_WAKEUP 1
82 #define USB_FEATURE_TEST_MODE 2
83 
91 #define SWAPBYTE(addr) (((uint16_t)(*((uint8_t *)(addr)))) + \
92  (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8))
93 
94 #define LOWBYTE(x) ((uint8_t)(x & 0x00FF))
95 #define HIGHBYTE(x) ((uint8_t)((x & 0xFF00) >> 8))
96 
97 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
98 
103 #endif /* __GD32F1X0_USBD_DEF_H */
104 
117 /************************ (C) COPYRIGHT 2014 GIGADEVICE *****END OF FILE****/
Generated by   doxygen 1.8.10