4 * - Universal Host Controller Interface
10 typedef struct sUHCI_Controller tUHCI_Controller;
11 typedef struct sUHCI_ExtraTDInfo tUHCI_ExtraTDInfo;
13 typedef struct sUHCI_TD tUHCI_TD;
14 typedef struct sUHCI_QH tUHCI_QH;
17 struct sUHCI_ExtraTDInfo
30 * \brief Next Entry in list
34 * 2 - Depth/Breadth Select
36 * 0 - Terminate (Last in List)
41 * \brief Control and Status Field
44 * 29 - Short Packet Detect (Input Only)
45 * 28:27 - Number of Errors Allowed
46 * 26 - Low Speed Device (Communicating with a low speed device)
47 * 25 - Isynchonious Select
48 * 24 - Interrupt on Completion (IOC)
52 * 21 - Data Buffer Error
53 * 20 - Babble Detected
55 * 18 - CRC/Timout Error
59 * 10:0 - Actual Length (Number of bytes transfered)
64 * \brief Packet Header
66 * 31:21 - Maximum Length (0=1, Max 0x4FF, 0x7FF=0)
70 * 14:8 - Device Address
71 * 7:0 - PID (Packet Identifcation) - Only 96, E1, 2D allowed
80 * \brief Pointer to the data to send
86 tUHCI_ExtraTDInfo *ExtraInfo;
87 char bActive; // Allocated
88 char bComplete; // Job complete
89 char bFreePointer; // Free \a BufferPointer once done
91 } __attribute__((aligned(16)));
96 * \brief Next Entry in list
101 * 0 - Terminate (Last in List)
107 * \brief Next Entry in list
112 * 0 - Terminate (Last in List)
117 * \note Area for software use
118 * \brief Last TD in this list, used to add things to the end
121 } __attribute__((aligned(16)));
123 struct sUHCI_Controller
126 * \brief PCI Device ID
131 * \brief IO Base Address
136 * \brief Memory Mapped-IO base address
141 * \brief IRQ Number assigned to the device
146 * \brief Number of the last frame to be cleaned
148 int LastCleanedFrame;
153 * 31:4 - Frame Pointer
156 * 0 - Terminate (Empty Pointer)
161 * \brief Physical Address of the Frame List
163 tPAddr PhysFrameList;
167 tUHCI_QH InterruptQH;
172 // === ENUMERATIONS ===
175 * \brief USB Command Register
178 * 7 - Maximum Packet Size selector (1: 64 bytes, 0: 32 bytes)
179 * 6 - Configure Flag (No Hardware Effect)
180 * 5 - Software Debug (Don't think it will be needed)
181 * 4 - Force Global Resume
182 * 3 - Enter Global Suspend Mode
183 * 2 - Global Reset (Resets all devices on the bus)
184 * 1 - Host Controller Reset (Reset just the controller)
189 * \brief USB Status Register
192 * 5 - HC Halted, set to 1 when USBCMD:RS is set to 0
193 * 4 - Host Controller Process Error (Errors related to the bus)
194 * 3 - Host System Error (Errors related to the OS/PCI Bus)
195 * 2 - Resume Detect (Set if a RESUME command is sent to the Controller)
196 * 1 - USB Error Interrupt
197 * 0 - USB Interrupts (Set if a transaction with the IOC bit set is completed)
201 * \brief USB Interrupt Enable Register
204 * 3 - Short Packet Interrupt Enable
205 * 2 - Interrupt on Complete (IOC) Enable
206 * 1 - Resume Interrupt Enable
207 * 0 - Timout / CRC Error Interrupt Enable
211 * \brief Frame Number (Index into the Frame List)
214 * 10:0 - Index (Incremented each approx 1ms)
218 * \brief Frame List Base Address
220 * 31:12 - Pysical Address >> 12
221 * 11:0 - Reserved (Set to Zero)
223 FLBASEADD = 0x08, // 32-bit
225 * \brief Start-of-frame Modify Register
228 * Sets the size of a frame
229 * Frequency = (11936+n)/12000 kHz
234 SOFMOD = 0x0C, // 8bit
236 * \brief Port Status and Controll Register (Port 1)
242 * 8 - Low Speed Device Attached
244 * 3 - Port Enable/Disable Change - Used for detecting device removal
245 * 2 - Port Enable/Disable
246 * 1 - Connect Status Change
247 * 0 - Current Connect Status
251 * \brief Port Status and Controll Register (Port 2)