00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00033 #ifndef _USBSTRUCT_H_
00034 #define _USBSTRUCT_H_
00035
00036
00037 #include "type.h"
00038
00039
00041 typedef struct {
00042 U8 bmRequestType;
00043 U8 bRequest;
00044 U16 wValue;
00045 U16 wIndex;
00046 U16 wLength;
00047 } TSetupPacket;
00048
00049
00050 #define REQTYPE_GET_DIR(x) (((x)>>7)&0x01)
00051 #define REQTYPE_GET_TYPE(x) (((x)>>5)&0x03)
00052 #define REQTYPE_GET_RECIP(x) ((x)&0x1F)
00053
00054 #define REQTYPE_DIR_TO_DEVICE 0
00055 #define REQTYPE_DIR_TO_HOST 1
00056
00057 #define REQTYPE_TYPE_STANDARD 0
00058 #define REQTYPE_TYPE_CLASS 1
00059 #define REQTYPE_TYPE_VENDOR 2
00060 #define REQTYPE_TYPE_RESERVED 3
00061
00062 #define REQTYPE_RECIP_DEVICE 0
00063 #define REQTYPE_RECIP_INTERFACE 1
00064 #define REQTYPE_RECIP_ENDPOINT 2
00065 #define REQTYPE_RECIP_OTHER 3
00066
00067
00068 #define REQ_GET_STATUS 0x00
00069 #define REQ_CLEAR_FEATURE 0x01
00070 #define REQ_SET_FEATURE 0x03
00071 #define REQ_SET_ADDRESS 0x05
00072 #define REQ_GET_DESCRIPTOR 0x06
00073 #define REQ_SET_DESCRIPTOR 0x07
00074 #define REQ_GET_CONFIGURATION 0x08
00075 #define REQ_SET_CONFIGURATION 0x09
00076 #define REQ_GET_INTERFACE 0x0A
00077 #define REQ_SET_INTERFACE 0x0B
00078 #define REQ_SYNCH_FRAME 0x0C
00079
00080
00081 #define HID_GET_REPORT 0x01
00082 #define HID_GET_IDLE 0x02
00083 #define HID_GET_PROTOCOL 0x03
00084 #define HID_SET_REPORT 0x09
00085 #define HID_SET_IDLE 0x0A
00086 #define HID_SET_PROTOCOL 0x0B
00087
00088
00089 #define FEA_ENDPOINT_HALT 0x00
00090 #define FEA_REMOTE_WAKEUP 0x01
00091 #define FEA_TEST_MODE 0x02
00092
00093
00094
00095
00096
00098 typedef struct {
00099 U8 bLength;
00100 U8 bDescriptorType;
00101 } TUSBDescHeader;
00102
00103 #define DESC_DEVICE 1
00104 #define DESC_CONFIGURATION 2
00105 #define DESC_STRING 3
00106 #define DESC_INTERFACE 4
00107 #define DESC_ENDPOINT 5
00108 #define DESC_DEVICE_QUALIFIER 6
00109 #define DESC_OTHER_SPEED 7
00110 #define DESC_INTERFACE_POWER 8
00111
00112 #define DESC_HID_HID 0x21
00113 #define DESC_HID_REPORT 0x22
00114 #define DESC_HID_PHYSICAL 0x23
00115
00116 #define GET_DESC_TYPE(x) (((x)>>8)&0xFF)
00117 #define GET_DESC_INDEX(x) ((x)&0xFF)
00118
00119 #endif
00120