Usermode/libaxwin4 - Handle demarshal failure
[tpg/acess2.git] / KernelLand / Modules / USB / OHCI / ohci.h
1 /*
2  * Acess2 OHCI Driver
3  * - By John Hodge (thePowersGang)
4  *
5  * ohci.h
6  * - Core Header
7  */
8 #ifndef _OHCI_H_
9 #define _OHCI_H_
10
11 typedef struct sOHCI_Controller tOHCI_Controller;
12 typedef struct sEndpointDesc    tOHCI_Endpoint;
13 typedef struct sGeneralTD       tOHCI_GeneralTD;
14
15 struct sEndpointDesc
16 {
17         //  0: 6 = Address
18         //  7:10 = Endpoint Num
19         // 11:12 = Direction (TD, OUT, IN, TD)
20         // 13    = Speed (Full, Low)
21         // 14    = Skip entry
22         // 15    = Format (Others, Isochronous)
23         // 16:26 = Max Packet Size
24         // 27:30 = AVAIL - Used for Controller ID
25         // 31    = AVAIL - Used for allocated flag (1 = allocated)
26         Uint32  Flags;
27         //  0: 3 = AVAIL
28         //  4:31 = TailP
29         Uint32  TailP;  // Last TD in queue
30         //  0    = Halted (Queue stopped due to error)
31         //  1    = Data toggle carry
32         //  2: 3 = ZERO
33         //  4:31 = HeadP
34         Uint32  HeadP;  // First TD in queue
35         //  0: 3 = AVAIL
36         //  4:31 = NextED
37         Uint32  NextED; // Next endpoint descriptor
38 };
39
40 struct sGeneralTD
41 {
42         //  0:17 = AVAIL
43         // 18    = Buffer Rounding (Allow an undersized packet)
44         // 19:20 = Direction (SETUP, OUT, IN, Resvd)
45         // 21:23 = Delay Interrupt (Frame count, 7 = no int)
46         // 24:25 = Data Toggle (ToggleCarry, ToggleCarry, 0, 1)
47         // 26:27 = Error Count
48         // 28:31 = Condition Code
49         Uint32  Flags;
50         
51         // Base address of packet (or current when being read)
52         Uint32  CBP;
53         
54         Uint32  NextTD;
55         
56         // Address of final byte in buffer
57         Uint32  BE;
58         
59         // -- Acess Information
60         Uint64  CbPointer;
61         Uint64  CbArg;
62 };
63
64 struct sIsochronousTD
65 {
66         //  0:15 = Starting Frame
67         // 16:20 = AVAIL
68         // 21:23 = Delay Interrupt
69         // 24:26 = Frame Count - 1 (1, 2, 3, 4, 5, 6, 7, 8)
70         // 27    = AVAIL
71         // 28:31 = Condition Code
72         Uint32  Flags;
73         
74         //  0:11 = AVAIL
75         // 12:31 = Page number of first byte in buffer
76         Uint32  BP0;    // Buffer Page 0
77         
78         Uint32  NextTD;
79         
80         // Address of last byte in buffer
81         Uint32  BufferEnd;
82         
83         //  0:11 = Page Offset
84         // 12    = Page selector (BufferPage0, BufferEnd)
85         // 13:15 = Unused?
86         Uint16  Offsets[8];
87 };
88
89 struct sRegisters
90 {
91         Uint32  HcRevision;
92         Uint32  HcControl;
93         Uint32  HcCommandStatus;
94         Uint32  HcInterruptStatus;
95         Uint32  HcInterruptEnable;
96         Uint32  HcInterruptDisable;
97         
98         Uint32  HcHCCA;
99         Uint32  HcPeriodCurrentED;
100         Uint32  HcControlHeadED;
101         Uint32  HcControlCurrentED;
102         Uint32  HcBulkHeadED;
103         Uint32  HcBulkCurrentED;
104         Uint32  HcDoneHead;
105
106         Uint32  HcFmInterval;
107         Uint32  HcFmRemaining;
108         Uint32  HcFmNumber;
109         Uint32  HcPeriodicStart;
110         Uint32  HcLSThreshold;
111         
112         //  0: 7 = NDP (Max of 15)
113         Uint32  HcRhDescriptorA;
114         Uint32  HcRhDescriptorB;
115         Uint32  HcRhStatus;
116         Uint32  HcRhPortStatus[15];
117 };
118
119 struct sHCCA
120 {
121         Uint32  HccaInterruptTable[128/4];
122         Uint16  HccaFrameNumber;
123         Uint16  HccaPad1;
124         Uint32  HccaDoneHead;
125         Uint32  HccaReserved[116/4];
126 };
127
128 struct sOHCI_IntLists
129 {
130         tOHCI_Endpoint  Period16[16];
131         tOHCI_Endpoint  Period8[8];
132         tOHCI_Endpoint  Period4[4];
133         tOHCI_Endpoint  Period2[2];
134         tOHCI_Endpoint  Period1[1];
135         tOHCI_Endpoint  StopED;
136 };
137
138 struct sOHCI_Controller
139 {
140          int    ID;
141
142          int    PciId;  
143         Uint    IRQNum; 
144         tPAddr  ControlSpacePhys;
145
146         volatile struct sRegisters      *ControlSpace;
147
148         tPAddr  HCCAPhys;
149         volatile struct sHCCA   *HCCA;
150         struct sOHCI_IntLists   *IntLists;      // At HCCA+512
151
152          int    nPorts;
153         tUSBHub *RootHub;
154 };
155
156 #endif
157

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