2 ******************************************************************************
4 * @author MCD Application Team
7 * @brief general defines for the usb device library
8 ******************************************************************************
11 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
19 ******************************************************************************
22 /* Define to prevent recursive inclusion -------------------------------------*/
26 /* Includes ------------------------------------------------------------------*/
27 #include "usbd_conf.h"
29 /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
34 * @brief general defines for the usb device library file
38 /** @defgroup USB_DEF_Exported_Defines
46 #define USB_LEN_DEV_QUALIFIER_DESC 0x0A
47 #define USB_LEN_DEV_DESC 0x12
48 #define USB_LEN_CFG_DESC 0x09
49 #define USB_LEN_IF_DESC 0x09
50 #define USB_LEN_EP_DESC 0x07
51 #define USB_LEN_OTG_DESC 0x03
53 #define USBD_IDX_LANGID_STR 0x00
54 #define USBD_IDX_MFC_STR 0x01
55 #define USBD_IDX_PRODUCT_STR 0x02
56 #define USBD_IDX_SERIAL_STR 0x03
57 #define USBD_IDX_CONFIG_STR 0x04
58 #define USBD_IDX_INTERFACE_STR 0x05
60 #define USB_REQ_TYPE_STANDARD 0x00
61 #define USB_REQ_TYPE_CLASS 0x20
62 #define USB_REQ_TYPE_VENDOR 0x40
63 #define USB_REQ_TYPE_MASK 0x60
65 #define USB_REQ_RECIPIENT_DEVICE 0x00
66 #define USB_REQ_RECIPIENT_INTERFACE 0x01
67 #define USB_REQ_RECIPIENT_ENDPOINT 0x02
68 #define USB_REQ_RECIPIENT_MASK 0x03
70 #define USB_REQ_GET_STATUS 0x00
71 #define USB_REQ_CLEAR_FEATURE 0x01
72 #define USB_REQ_SET_FEATURE 0x03
73 #define USB_REQ_SET_ADDRESS 0x05
74 #define USB_REQ_GET_DESCRIPTOR 0x06
75 #define USB_REQ_SET_DESCRIPTOR 0x07
76 #define USB_REQ_GET_CONFIGURATION 0x08
77 #define USB_REQ_SET_CONFIGURATION 0x09
78 #define USB_REQ_GET_INTERFACE 0x0A
79 #define USB_REQ_SET_INTERFACE 0x0B
80 #define USB_REQ_SYNCH_FRAME 0x0C
82 #define USB_DESC_TYPE_DEVICE 1
83 #define USB_DESC_TYPE_CONFIGURATION 2
84 #define USB_DESC_TYPE_STRING 3
85 #define USB_DESC_TYPE_INTERFACE 4
86 #define USB_DESC_TYPE_ENDPOINT 5
87 #define USB_DESC_TYPE_DEVICE_QUALIFIER 6
88 #define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 7
91 #define USB_CONFIG_REMOTE_WAKEUP 2
92 #define USB_CONFIG_SELF_POWERED 1
94 #define USB_FEATURE_EP_HALT 0
95 #define USB_FEATURE_REMOTE_WAKEUP 1
96 #define USB_FEATURE_TEST_MODE 2
103 /** @defgroup USBD_DEF_Exported_TypesDefinitions
112 /** @defgroup USBD_DEF_Exported_Macros
115 #define SWAPBYTE(addr) (((uint16_t)(*((uint8_t *)(addr)))) + \
116 (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8))
118 #define LOBYTE(x) ((uint8_t)(x & 0x00FF))
119 #define HIBYTE(x) ((uint8_t)((x & 0xFF00) >>8))
124 /** @defgroup USBD_DEF_Exported_Variables
132 /** @defgroup USBD_DEF_Exported_FunctionsPrototype
140 #endif /* __USBD_DEF_H */
149 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/