USB 设备枚举过程中使用到的常量定义如下:
/*-------------------------------------------------------------------------
 * Standard Chapter 9 definition
 *-------------------------------------------------------------------------
 */
#define GET_STATUS      0x00                                                       
#define CLEAR_FEATURE   0x01
#define SET_FEATURE     0x03
#define SET_ADDRESS     0x05
#define GET_DESCRIPTOR  0x06
#define SET_DESCRIPTOR  0x07
#define GET_CONFIG      0x08
#define SET_CONFIG      0x09
#define GET_INTERFACE   0x0a
#define SET_INTERFACE   0x0b
#define SYNCH_FRAME     0x0c
 
#define DESC_DEVICE          0x0100
#define DESC_CONFIGURATION   0x0200
#define DESC_STRING          0x0300
#define DESC_INTERFACE       0x0400
#define DESC_ENDPOINT        0x0500
 
#define USB_BUF_SIZE 512
 
#define ENUM_DEV_IDLE              0
#define ENUM_DEV_SEND_DEV_DESC_0   1
#define ENUM_DEV_SET_ADDRESS       2
#define ENUM_DEV_GET_DESC_CFG      3
#define ENUM_DEV_FILL_DESC_DEV     4
#define ENUM_DEV_SEND_DEV_DESC_1   5
#define ENUM_DEV_FILL_DESC_SET     6
#define ENUM_DEV_SET_INTERFACE     7
#define ENUM_DEV_SET_CONFIGURATION 8
#define ENUM_DEV_GET_CONFIGURATION 9
#define ENUM_DEV_CHECK_CONFIG      10
#define ENUM_DEV_CHECK_INTERFACE   11
#define ENUM_DEV_WAIT_CMD_OVER     12
#define ENUM_DEV_WAIT_RESET_OVER   13
#define ENUM_DEV_GET_MAX_LUN       14
#define ENUM_DEV_CHECK_MAX_LUN     15
#define ENUM_DEV_RESET_ING         16
#define ENUM_DEV_IDLE_DALAY        17
#define ENUM_DEV_OVER              100
 
#define USB_CMD_OVER            100
 
#define DEV_ERROR_TD            1
#define DEV_ERROR_CONFIGURATION    2
#define DEV_ERROR_RESET_TIME_OUT   3
 
#define USB_DEV_ENUM_OK            1
#define USB_DEV_NOT_CONNECTED      2
 
#define CC_STALL                4
 
#define DESC_TYPE_DEVICE        1
#define DESC_TYPE_CONFIG        2
#define DESC_TYPE_INTERFACE        3
#define DESC_TYPE_END_POINT        4
 
typedef struct _ENUM_USB_DEV
{
    unsigned char state ;
    unsigned char newState ;
    unsigned char oldState ;
    //unsigned char count;
    unsigned char errReason ;
    //unsigned int delay;
} ENUM_USB_DEV ;