Modules/USB - Parsing interface descriptors now
[tpg/acess2.git] / Modules / USB / Core / usb_proto.h
1 /**
2  */
3 #ifndef _USB_PROTO_H_
4 #define _USB_PROTO_H_
5
6 struct sDeviceRequest
7 {
8         Uint8   ReqType;
9         Uint8   Request;
10         Uint16  Value;
11         Uint16  Index;
12         Uint16  Length;
13 };
14
15 /*
16  */
17 struct sDescriptor_Device
18 {
19         Uint8   Length;
20         Uint8   Type;   // = 1
21         Uint16  USBVersion;     // BCD, 0x210 = 2.10
22         Uint8   DeviceClass;
23         Uint8   DeviceSubClass;
24         Uint8   DeviceProtocol;
25         Uint8   MaxPacketSize;
26         
27         Uint16  VendorID;
28         Uint16  ProductID;
29         Uint16  DeviceID;       // BCD
30         
31         Uint8   ManufacturerStr;
32         Uint8   ProductStr;
33         Uint8   SerialNumberStr;
34         
35         Uint8   NumConfigurations;
36 } PACKED;
37
38 struct sDescriptor_Configuration
39 {
40         Uint8   Length;
41         Uint8   Type;   // = 2
42         
43         Uint16  TotalLength;
44         Uint8   NumInterfaces;
45         Uint8   ConfigurationValue;
46         Uint8   ConfigurationStr;
47         Uint8   AttributesBmp;
48         Uint8   MaxPower;       // in units of 2 mA
49 } PACKED;
50
51 struct sDescriptor_String
52 {
53         Uint8   Length;
54         Uint8   Type;   // = 3
55         
56         Uint16  Data[62];       // 62 is arbitary
57 } PACKED;
58
59 struct sDescriptor_Interface
60 {
61         Uint8   Length;
62         Uint8   Type;   // = 4
63         
64         Uint8   InterfaceNum;
65         Uint8   AlternateSetting;
66         Uint8   NumEndpoints;   // Excludes endpoint 0
67         
68         Uint8   InterfaceClass; // 
69         Uint8   InterfaceSubClass;
70         Uint8   InterfaceProtocol;
71         
72         Uint8   InterfaceStr;
73 } PACKED;
74
75 struct sDescriptor_Endpoint
76 {
77         Uint8   Length;
78         Uint8   Type;   // = 5
79         Uint8   Address;        // 3:0 Endpoint Num, 7: Direction (IN/OUT)
80         /**
81          * 1:0 - Transfer Type
82          * - 00 = Control
83          * - 01 = Isochronous
84          * - 10 = Bulk
85          * - 11 = Interrupt
86          * 3:2 - Synchronisation type (Isonchronous only)
87          * - 00 = No Synchronisation
88          * - 01 = Asynchronous
89          * - 10 = Adaptive
90          * - 11 = Synchronous
91          * 5:4 - Usage type (Isonchronous only)
92          * - 00 = Data endpoint
93          * - 01 = Feedback endpoint
94          */
95         Uint8   Attributes;
96         
97         Uint16  MaxPacketSize;
98         
99         /**
100          * 
101          */
102         Uint8   PollingInterval;
103 } PACKED;
104
105 #endif
106

UCC git Repository :: git.ucc.asn.au