/****************************************************************************** * USB Definitions: Standard Descriptors *****************************************************************************/ #ifndef USBDEFS_STD_DSC_H #define USBDEFS_STD_DSC_H /** D E F I N I T I O N S ****************************************************/ /* Descriptor Types */ #define DSC_DEV 0x01 #define DSC_CFG 0x02 #define DSC_STR 0x03 #define DSC_INTF 0x04 #define DSC_EP 0x05 /****************************************************************************** * USB Endpoint Definitions * USB Standard EP Address Format: DIR:X:X:X:EP3:EP2:EP1:EP0 * This is used in the descriptors. See autofiles\usbdsc.c * * NOTE: Do not use these values for checking against USTAT. * To check against USTAT, use values defined in "system\usb\usbdrv\usbdrv.h" *****************************************************************************/ #define _EP01_OUT 0x01 #define _EP01_IN 0x81 #define _EP02_OUT 0x02 #define _EP02_IN 0x82 #define _EP03_OUT 0x03 #define _EP03_IN 0x83 #define _EP04_OUT 0x04 #define _EP04_IN 0x84 #define _EP05_OUT 0x05 #define _EP05_IN 0x85 #define _EP06_OUT 0x06 #define _EP06_IN 0x86 #define _EP07_OUT 0x07 #define _EP07_IN 0x87 #define _EP08_OUT 0x08 #define _EP08_IN 0x88 #define _EP09_OUT 0x09 #define _EP09_IN 0x89 #define _EP10_OUT 0x0A #define _EP10_IN 0x8A #define _EP11_OUT 0x0B #define _EP11_IN 0x8B #define _EP12_OUT 0x0C #define _EP12_IN 0x8C #define _EP13_OUT 0x0D #define _EP13_IN 0x8D #define _EP14_OUT 0x0E #define _EP14_IN 0x8E #define _EP15_OUT 0x0F #define _EP15_IN 0x8F /* Configuration Attributes */ #define _DEFAULT 0x01<<7 //Default Value (Bit 7 is set) #define _SELF 0x01<<6 //Self-powered (Supports if set) #define _RWU 0x01<<5 //Remote Wakeup (Supports if set) /* Endpoint Transfer Type */ #define _CTRL 0x00 //Control Transfer #define _ISO 0x01 //Isochronous Transfer #define _BULK 0x02 //Bulk Transfer #define _INT 0x03 //Interrupt Transfer /* Isochronous Endpoint Synchronization Type */ #define _NS 0x00<<2 //No Synchronization #define _AS 0x01<<2 //Asynchronous #define _AD 0x02<<2 //Adaptive #define _SY 0x03<<2 //Synchronous /* Isochronous Endpoint Usage Type */ #define _DE 0x00<<4 //Data endpoint #define _FE 0x01<<4 //Feedback endpoint #define _IE 0x02<<4 //Implicit feedback Data endpoint /** S T R U C T U R E ********************************************************/ /****************************************************************************** * USB Device Descriptor Structure *****************************************************************************/ typedef struct _USB_DEV_DSC { unsigned char bLength; unsigned char bDscType; unsigned short bcdUSB; unsigned char bDevCls; unsigned char bDevSubCls; unsigned char bDevProtocol; unsigned char bMaxPktSize0; unsigned short idVendor; unsigned short idProduct; unsigned short bcdDevice; unsigned char iMFR; unsigned char iProduct; unsigned char iSerialNum; unsigned char bNumCfg; } USB_DEV_DSC; /****************************************************************************** * USB Configuration Descriptor Structure *****************************************************************************/ typedef struct _USB_CFG_DSC { unsigned char bLength; unsigned char bDscType; unsigned short wTotalLength; unsigned char bNumIntf; unsigned char bCfgValue; unsigned char iCfg; unsigned char bmAttributes; unsigned char bMaxPower; } USB_CFG_DSC; /****************************************************************************** * USB Interface Descriptor Structure *****************************************************************************/ typedef struct _USB_INTF_DSC { unsigned char bLength; unsigned char bDscType; unsigned char bIntfNum; unsigned char bAltSetting; unsigned char bNumEPs; unsigned char bIntfCls; unsigned char bIntfSubCls; unsigned char bIntfProtocol; unsigned char iIntf; } USB_INTF_DSC; /****************************************************************************** * USB Endpoint Descriptor Structure *****************************************************************************/ typedef struct _USB_EP_DSC { unsigned char bLength; unsigned char bDscType; unsigned char bEPAdr; unsigned char bmAttributes; unsigned short wMaxPktSize; unsigned char bInterval; } USB_EP_DSC; // // Standard Request Codes USB 2.0 Spec Ref Table 9-4 // #define GET_STATUS 0 #define CLEAR_FEATURE 1 #define SET_FEATURE 3 #define SET_ADDRESS 5 #define GET_DESCRIPTOR 6 #define SET_DESCRIPTOR 7 #define GET_CONFIGURATION 8 #define SET_CONFIGURATION 9 #define GET_INTERFACE 10 #define SET_INTERFACE 11 #define SYNCH_FRAME 12 // Standard Feature Selectors #define DEVICE_REMOTE_WAKEUP 0x01 #define ENDPOINT_HALT 0x00 // Descriptor Types #define DEVICE_DESCRIPTOR 0x01 #define CONFIGURATION_DESCRIPTOR 0x02 #define STRING_DESCRIPTOR 0x03 #define INTERFACE_DESCRIPTOR 0x04 #define ENDPOINT_DESCRIPTOR 0x05 #define QUALIFIER_DESCRIPTOR 0x06 // Device states (Chap 9.1.1) #define DETACHED 0 #define ATTACHED 1 #define POWERED 2 #define DEFAULT 3 #define ADDRESS 4 #define CONFIGURED 5 #endif //USBDEFS_STD_DSC_H