📄 usb200.h
字号:
/* usb200.h - USB 2.0 Specification header */
/* Copyright 2004 TAEBAEK Soft Corp. */
/*
modification history
--------------------
02e,22sep05,jmLee support OTG.
02d,01aug05,jmLee version control sync.
02c,25jul05,jmLee version control sync.
02a,29jun05,jmLee integrate SAMSUNG patch.
01a,01jun04,jmLee created.
*/
#ifndef __INCusb200h
#define __INCusb200h
#ifdef __cplusplus
extern "C" {
#endif
/* USB 2.0 Specifications */
#define USB_RELEASE_0110 0x0110
#define USB_RELEASE_0200 0x0200
#define USB_MAX_DEVICE_ADDRESS 127 /* Function Address, 0:default, 1 ~ 127 */
#define USB_MAX_ENDPOINT 15 /* Endpoint Number, 0:default, 1 ~ 15 */
#define USB_MAX_DESCR_LEN 255 /* Descriptor Length */
#define USB_MAX_HUB_PORT 255 /* Hub Port, 0:reserved, 1 ~ 255 */
/* Defaults until SET_ADDRESS command is received */
#define USB_DEFAULT_DEVICE_ADDRESS 0 /* Default Device Address */
#define USB_DEFAULT_MAX_PACKET 8 /* Maximum Packet Size of the Default Endpoint */
/* USB Device Classes */
#define USB_DEV_CLASS_PER_INTERFACE 0x00 /* Device class is indicated in the interface descriptors. */
#define USB_DEV_CLASS_COMM 0x02 /* Communication Device or WMC 1.0 */
#define USB_DEV_CLASS_HUB 0x09 /* Hub Device */
#define USB_DEV_CLASS_DIAGNOSTIC 0xDC /* Diagnostic Device */
#define USB_DEV_CLASS_WIRELESS 0xE0 /* Wireless Controller */
#define USB_DEV_CLASS_MISCELL 0xEF /* Miscellaneous Device */
#define USB_DEV_CLASS_VENDOR_SPECIFIC 0xFF /* Vendor Specific Device */
/* USB Interface Classes */
#define USB_IF_CLASS_AUDIO 0x01 /* Audio Interface */
#define USB_IF_CLASS_CDC 0x02 /* CDC-Control Interface */
#define USB_IF_CLASS_HID 0x03 /* Human Interface */
#define USB_IF_CLASS_MONITOR 0x04 /* Monitor Interface */
#define USB_IF_CLASS_PHYSICAL 0x05 /* Physical Interface */
#define USB_IF_CLASS_IMAGE 0x06 /* Image Interface (subclass & protocol must be 1) */
#define USB_IF_CLASS_PRINTER 0x07 /* Printing Interface */
#define USB_IF_CLASS_MASS_STORAGE 0x08 /* Mass Storage Interface */
#define USB_IF_CLASS_HUB 0x09 /* Hub Interface */
#define USB_IF_CLASS_DATA 0x0A /* CDC-Data Interface */
#define USB_IF_CLASS_CCID 0x0B /* Chip Card Interface */
#define USB_IF_CLASS_CONTENT_SECURITY 0x0D /* Content Security Interface */
#define USB_IF_CLASS_VIDEO 0x0E /* Video Imterface */
#define USB_IF_CLASS_DIAGNOSTIC 0xDC /* Diagnostic Device */
#define USB_IF_CLASS_WIRELESS 0xE0 /* Wireless Controller */
#define USB_IF_CLASS_APP 0xFE /* Application Specific Interface */
#define USB_IF_CLASS_VENDOR_SPECIFIC 0xFF /* Vendor Specific Interface */
/* USB Request Types */
#define USB_REQ_TYPE_DIRECTION_MASK 0x80
#define USB_REQ_TYPE_HOST_TO_DEV 0x00
#define USB_REQ_TYPE_DEV_TO_HOST 0x80
#define USB_REQ_TYPE_CATEGORY_MASK 0x60
#define USB_REQ_TYPE_STANDARD 0x00
#define USB_REQ_TYPE_CLASS 0x20
#define USB_REQ_TYPE_VENDOR 0x40
#define USB_REQ_TYPE_RESERVED 0x60
#define USB_REQ_TYPE_RECIPIENT_MASK 0x03
#define USB_REQ_TYPE_DEVICE 0x00
#define USB_REQ_TYPE_INTERFACE 0x01
#define USB_REQ_TYPE_ENDPOINT 0x02
#define USB_REQ_TYPE_OTHER 0x03
/* USB Request Codes */
#define USB_REQ_GET_STATUS 0x00
#define USB_REQ_CLEAR_FEATURE 0x01
#define USB_REQ_GET_STATE 0x02
#define USB_REQ_SET_FEATURE 0x03
#define USB_REQ_RESERVED_04 0x04
#define USB_REQ_SET_ADDRESS 0x05
#define USB_REQ_GET_DESCRIPTOR 0x06
#define USB_REQ_SET_DESCRIPTOR 0x07
#define USB_REQ_GET_CONFIGURATION 0x08
#define USB_REQ_SET_CONFIGURATION 0x09
#define USB_REQ_GET_INTERFACE 0x0A
#define USB_REQ_SET_INTERFACE 0x0B
#define USB_REQ_SYNC_FRAME 0x0C
/* USB Request Length */
#define USB_REQ_LEN_GET_DEV_STATUS 2
#define USB_REQ_LEN_GET_IF_STATUS 2
#define USB_REQ_LEN_GET_EP_STATUS 2
#define USB_REQ_LEN_GET_HUB_STATUS 4
#define USB_REQ_LEN_GET_PORT_STATUS 4
#define USB_REQ_LEN_CLEAR_FEATURE 0
#define USB_REQ_LEN_SET_FEATURE 0
#define USB_REQ_LEN_SET_ADDRESS 0
#define USB_REQ_LEN_GET_DESCRIPTOR -1
#define USB_REQ_LEN_SET_DESCRIPTOR -1
#define USB_REQ_LEN_GET_CONFIGURATION 1
#define USB_REQ_LEN_SET_CONFIGURATION 0
#define USB_REQ_LEN_GET_INTERFACE 1
#define USB_REQ_LEN_SET_INTERFACE 0
#define USB_REQ_LEN_GET_SYNC_FRAME 2
/* USB Port State */
#define USB_PORT_STATE_NOT_CONFIGURED 1 /* Port is not configured */
#define USB_PORT_STATE_POWERED_OFF 2 /* Port is powered off */
#define USB_PORT_STATE_DISCONNECTED 3 /* Port is disconnedted */
#define USB_PORT_STATE_DISABLED 4 /* Port is disabled */
#define USB_PORT_STATE_RESETTING 5 /* Port is resetting */
#define USB_PORT_STATE_ENABLED 6 /* Port is enabled */
#define USB_PORT_STATE_TRANSMIT 7 /* Port is transmit */
#define USB_PORT_STATE_SUSPENDED 8 /* Port is suspended */
#define USB_PORT_STATE_RESUMING 9 /* Port is resuming */
/* USB Device State */
#define USB_DEVICE_STATE_ATTACHED 1 /* Device is attached */
#define USB_DEVICE_STATE_POWERED 2 /* Device is powered */
#define USB_DEVICE_STATE_DEFAULT 3 /* Device has been reset */
#define USB_DEVICE_STATE_ADDRESS 4 /* Device address is assigned */
#define USB_DEVICE_STATE_CONFIGURED 5 /* Device is configured */
#define USB_DEVICE_STATE_SUSPENDED 6 /* Device is suspended */
/* USB Device Status */
#define USB_STATUS_DEVICE_SELF_POWERED 0x0001
#define USB_STATUS_DEVICE_REMOTE_WAKEUP 0x0002
/* Max power available from a hub port, mA */
#define USB_POWER_SELF_POWERED 500
#define USB_POWER_BUS_POWERED 100
/* USB Endpoint Status */
#define USB_STATUS_ENDPOINT_HALT 0x0001
/* USB Hub Status */
#define USB_STATUS_HUB_OVER_CURRENT 0x0002
#define USB_STATUS_HUB_LOCAL_POWER 0x0001
/* USB Hub Status Change */
#define USB_STATUS_C_HUB_OVER_CURRENT 0x0002
#define USB_STATUS_C_HUB_LOCAL_POWER 0x0001
/* USB Port Status */
#define USB_STATUS_PORT_LOW_SPEED 0x0200
#define USB_STATUS_PORT_POWER 0x0100
#define USB_STATUS_PORT_RESET 0x0010
#define USB_STATUS_PORT_OVER_CURRENT 0x0008
#define USB_STATUS_PORT_SUSPEND 0x0004
#define USB_STATUS_PORT_ENABLE 0x0002
#define USB_STATUS_PORT_CONNECTION 0x0001
/* USB Port Status Change */
#define USB_STATUS_C_PORT_RESET 0x0010
#define USB_STATUS_C_PORT_OVER_CURRENT 0x0008
#define USB_STATUS_C_PORT_SUSPEND 0x0004
#define USB_STATUS_C_PORT_ENABLE 0x0002
#define USB_STATUS_C_PORT_CONNECTION 0x0001
/* USB Core defined Standard Feature Selectors */
#define USB_FSEL_ENDPOINT_HALT 0x0000
#define USB_FSEL_DEVICE_REMOTE_WAKEUP 0x0001
#define USB_FSEL_DEVICE_TEST_MODE 0x0002
#define USB_FSEL_OTG_B_HNP_ENABLE 0x0003
#define USB_FSEL_OTG_A_HNP_SUPPORT 0x0004
#define USB_FSEL_OTG_A_ALT_HNP_SUPPORT 0x0005
/* USB Core defined Hub Class Feature Selectors */
#define USB_FSEL_C_HUB_LOCAL_POWER 0x0000
#define USB_FSEL_C_HUB_OVER_CURRENT 0x0001
#define USB_FSEL_PORT_CONNECTION 0x0000
#define USB_FSEL_PORT_ENABLE 0x0001
#define USB_FSEL_PORT_SUSPEND 0x0002
#define USB_FSEL_PORT_OVER_CURRENT 0x0003
#define USB_FSEL_PORT_RESET 0x0004
#define USB_FSEL_PORT_POWER 0x0008
#define USB_FSEL_PORT_LOW_SPEED 0x0009
#define USB_FSEL_C_PORT_CONNECTION 0x0010
#define USB_FSEL_C_PORT_ENABLE 0x0011
#define USB_FSEL_C_PORT_SUSPEND 0x0012
#define USB_FSEL_C_PORT_OVER_CURRENT 0x0013
#define USB_FSEL_C_PORT_RESET 0x0014
/* USB Core defined Test Selectors */
#define USB_TEST_RESERVED 0x00
#define USB_TEST_J 0x01
#define USB_TEST_K 0x02
#define USB_TEST_SE0_NAK 0x03
#define USB_TEST_PACKET 0x04
#define USB_TEST_FORCE_ENABLE 0x05
/*
0x06 ~ 0x3F Reserved for standard test selectors
0x40 ~ 0xBF Reserved
0xC0 ~ 0xFF Reserved for vendor-specific test modes
*/
/* USB DWG defined Feature Selectors */
#define USB_FSEL_INTERFACE_POWER_D0 0x0002
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -