原创作品,允许转载,转载时请务必以超链接形式标明文章
原始出处 、作者信息和本声明。否则将追究法律责任。
http://lancelot.blog.51cto.com/393579/274093
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
typedefstruct
_ENUM_USB_DEV
{
unsignedchar
state
;
unsignedchar
newState
;
unsignedchar
oldState
;
//unsigned char count;
unsignedchar
errReason
;
//unsigned int delay;
}
ENUM_USB_DEV
;
|