Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

792 lines
24 KiB

  1. /*++
  2. Copyright (c) 1999, 2000 Microsoft Corporation
  3. Module Name:
  4. ehci.h
  5. Abstract:
  6. Definitions from Enhanced USB 2.0
  7. controller specification
  8. Environment:
  9. Kernel & user mode
  10. Revision History:
  11. 1-1-00 : created jdunn
  12. --*/
  13. #ifndef EHCI_H
  14. #define EHCI_H
  15. #include <PSHPACK4.H>
  16. //
  17. // Don't use <PSHPACK1.H> on shared memory data structures that should only
  18. // be accessed using 4-byte load/store instructions (e.g use ld4 instructions
  19. // instead of ld1 instructions on ia64 machines).
  20. //
  21. // maximum time to wait for reset to go low in microseconds
  22. #define USBEHCI_MAX_RESET_TIME 500
  23. #define EHCI_PAGE_SIZE 0x1000
  24. //
  25. // Host Controler Hardware Registers as accessed in memory
  26. //
  27. //
  28. // HCLENGTHVERION - Capability Register Length / Interface Versoin Number
  29. //
  30. typedef union _HCLENGTHVERSION {
  31. ULONG ul;
  32. struct {
  33. ULONG HcCapLength:8; // 0-7
  34. ULONG Reserved:8; // 8-15
  35. ULONG HcVersion:16; // 16-31
  36. };
  37. } HCLENGTHVERSION, *PHCLENGTHVERSION;
  38. C_ASSERT((sizeof(HCLENGTHVERSION) == sizeof(ULONG)));
  39. //
  40. // HCSPARAMS - Structural Parameters
  41. //
  42. typedef union _HCSPARAMS {
  43. ULONG ul;
  44. struct {
  45. ULONG NumberOfPorts:4; // 0-3
  46. ULONG PortPowerControl:1; // 4
  47. ULONG Reserved1:3; // 5-7
  48. ULONG NumberOfPortsPerCompConroller:4; // 8-11
  49. ULONG NumberOfCompControllers:4; // 12-15
  50. ULONG PortLEDs:1; // 16
  51. ULONG Reserved2:15; // 17-31
  52. };
  53. } HCSPARAMS, *PHCSPARMS;
  54. C_ASSERT((sizeof(HCSPARAMS) == sizeof(ULONG)));
  55. //
  56. // HCCPARAMS - Capability Parameters
  57. //
  58. typedef union _HCCPARAMS {
  59. ULONG ul;
  60. struct {
  61. ULONG Bit64Addressing:1; // 0
  62. ULONG ProgramableFrameList:1; // 1
  63. ULONG AsynSchedulePark:1; // 2
  64. ULONG Reserved1:1; // 3
  65. ULONG IsochronousThreshold:4; // 4-7
  66. ULONG EECP:8; // 8-15
  67. ULONG Reserved2:16; // 16-31
  68. };
  69. } HCCPARAMS, *PHCCPARMS;
  70. C_ASSERT((sizeof(HCCPARAMS) == sizeof(ULONG)));
  71. //
  72. // EECP Register
  73. //
  74. #define EECP_CAP_RESERVED 0x00
  75. #define EECP_PRE_OS_HANDOFF 0x01
  76. typedef union _HC_EECP {
  77. ULONG ul;
  78. struct {
  79. ULONG CapId:8; // 0-7
  80. ULONG NextCap:8; // 8-15
  81. ULONG CapData:16; // 16-31
  82. };
  83. } HC_EECP, *PHC_EECP;
  84. C_ASSERT((sizeof(HC_EECP) == sizeof(ULONG)));
  85. //
  86. // EECP BIOS Registers
  87. //
  88. typedef union _USBLEGSUP {
  89. ULONG ul;
  90. struct {
  91. ULONG CapId:8; // 0-7
  92. ULONG NextCap:8; // 8-15
  93. ULONG HcBIOSowned:1; // 16
  94. ULONG Reserved1:7; // 17-23
  95. ULONG HcOSowned:1; // 24
  96. ULONG Reserved2:7; // 25-31
  97. };
  98. } USBLEGSUP, *PUSBLEGSUP;
  99. C_ASSERT((sizeof(USBLEGSUP) == sizeof(ULONG)));
  100. typedef union _USBLEGCTLSTS {
  101. ULONG ul;
  102. struct {
  103. ULONG UsbSMIEnable:1; // 0
  104. ULONG SMIonUSBErrorEn:1; // 1
  105. ULONG SMIonPortChangeEn:1; // 2
  106. ULONG SMIonFrameListRolloverEn:1; // 3
  107. ULONG SMIonHostSystemErrorEn:1; // 4
  108. ULONG SMIonAsyncAdvanceEn:1; // 5
  109. ULONG Reserved1:7; // 6-12
  110. ULONG SMIonOSownershipEn:1; // 13
  111. ULONG SMIonPCICommandEn:1; // 14
  112. ULONG SMIonBAREn:1; // 15
  113. ULONG SMIonUSBComplete:1; // 16
  114. ULONG SMIonUSBError:1; // 17
  115. ULONG SMIonPortChange:1; // 18
  116. ULONG SMIonFrameListRollover:1; // 19
  117. ULONG SMIonHostSystemError:1; // 20
  118. ULONG SMIonAsyncAdvance:1; // 21
  119. ULONG Reserved2:7; // 22-28
  120. ULONG SMIonOSownership:1; // 29
  121. ULONG SMIonPCIcommand:1; // 30
  122. ULONG SMIonBAR:1; // 31
  123. };
  124. } USBLEGCTLSTS, *PUSBLEGCTLSTS;
  125. C_ASSERT((sizeof(USBLEGCTLSTS) == sizeof(ULONG)));
  126. typedef struct _USB_LEGACYBIOS_REGISTERS {
  127. USBLEGSUP Caps;
  128. USBLEGCTLSTS CtlSts;
  129. } USB_LEGACYBIOS_REGISTERS, *PUSB_LEGACYBIOS_REGISTERS;
  130. C_ASSERT((sizeof(USB_LEGACYBIOS_REGISTERS) == (2 * sizeof(ULONG))));
  131. //
  132. // CAPABILITIES REGISTER
  133. //
  134. typedef struct _HC_CAPABILITIES_REGISTER {
  135. HCLENGTHVERSION HcLengthVersion;
  136. HCSPARAMS HcStructuralParameters;
  137. HCCPARAMS HcCapabilityParameters;
  138. } HC_CAPABILITIES_REGISTER, *PHC_CAPABILITIES_REGISTER;
  139. C_ASSERT((sizeof(HC_CAPABILITIES_REGISTER) == (3 * sizeof(ULONG))));
  140. //
  141. // USBCMD - USB Command Register
  142. //
  143. //
  144. // Definitions for HC_QTD_TOKEN.Pid
  145. //
  146. #define HcCmd_FrameListSizeIs1024 0
  147. #define HcCmd_FrameListSizeIs512 1
  148. #define HcCmd_FrameListSizeIs256 2
  149. typedef union _USBCMD {
  150. ULONG ul;
  151. struct {
  152. ULONG HostControllerRun:1; // 0
  153. ULONG HostControllerReset:1; // 1
  154. ULONG FrameListSize:2; // 2-3
  155. ULONG PeriodicScheduleEnable:1; // 4
  156. ULONG AsyncScheduleEnable:1; // 5
  157. ULONG IntOnAsyncAdvanceDoorbell:1;// 6
  158. ULONG HostControllerLightReset:1; // 7
  159. ULONG Reserved1:8; // 8-15
  160. ULONG InterruptThreshold:8; // 16-23
  161. ULONG Reserved2:8; // 24-31
  162. };
  163. } USBCMD, *PUSBCMD;
  164. C_ASSERT((sizeof(USBCMD) == sizeof(ULONG)));
  165. //
  166. // USBSTS - USB Status Register
  167. //
  168. #define HcInterruptStatusMask 0x0000003F
  169. #define HcInt_IntOnasyncAdvance 0x00000020
  170. #define HcInt_HostSystemError 0x00000010
  171. #define HcInt_FrameListRollover 0x00000008
  172. #define HcInt_PortChangeDetect 0x00000004
  173. #define HcInt_UsbError 0x00000002
  174. #define HcInt_UsbInterrupt 0x00000001
  175. typedef union _USBSTS {
  176. ULONG ul;
  177. struct {
  178. // controller interrupt status bits
  179. ULONG UsbInterrupt:1; // 0
  180. ULONG UsbError:1; // 1
  181. ULONG PortChangeDetect:1; // 2
  182. ULONG FrameListRollover:1; // 3
  183. ULONG HostSystemError:1; // 4
  184. ULONG IntOnAsyncAdvance:1; // 5
  185. ULONG ReservedStatus:6; // 6-11
  186. // controller status
  187. ULONG HcHalted:1; // 12
  188. ULONG Reclimation:1; // 13
  189. ULONG PeriodicScheduleStatus:1; // 14
  190. ULONG AsyncScheduleStatus:1; // 15
  191. ULONG Reserved:16; // 16-31
  192. };
  193. } USBSTS, *PUSBSTS;
  194. C_ASSERT((sizeof(USBSTS) == sizeof(ULONG)));
  195. //
  196. // USBINTR - USB Interrupt Enable Register
  197. //
  198. typedef union _USBINTR {
  199. ULONG ul;
  200. struct {
  201. ULONG UsbInterrupt:1; // 0
  202. ULONG UsbError:1; // 1
  203. ULONG PortChangeDetect:1; // 2
  204. ULONG FrameListRollover:1; // 3
  205. ULONG HostSystemError:1; // 4
  206. ULONG IntOnAsyncAdvance:1; // 5
  207. //HostSystemError
  208. //HostControllerProcessError
  209. ULONG Reserved:26; // 6-31
  210. };
  211. } USBINTR, *PUSBINTR;
  212. C_ASSERT((sizeof(USBINTR) == sizeof(ULONG)));
  213. //
  214. // FRNUM - Frame Number Register
  215. //
  216. typedef union _FRINDEX {
  217. ULONG ul;
  218. struct {
  219. ULONG FrameListCurrentIndex:14;
  220. ULONG Reserved:18;
  221. };
  222. } FRINDEX, *PFRINDEX;
  223. C_ASSERT((sizeof(FRINDEX) == sizeof(ULONG)));
  224. //
  225. // CONFIGFLAG -
  226. //
  227. typedef union _CONFIGFLAG {
  228. ULONG ul;
  229. struct {
  230. ULONG RoutePortsToEHCI:1;
  231. ULONG Reserved:31;
  232. };
  233. } CONFIGFLAG, *PCONFIGFLAG;
  234. C_ASSERT((sizeof(CONFIGFLAG) == sizeof(ULONG)));
  235. //
  236. // PORTSC - Port Status and Control Register
  237. //
  238. typedef union _PORTSC {
  239. ULONG ul;
  240. struct {
  241. ULONG PortConnect:1; // 0
  242. ULONG PortConnectChange:1; // 1
  243. ULONG PortEnable:1; // 2
  244. ULONG PortEnableChange:1; // 3
  245. ULONG OvercurrentActive:1; // 4
  246. ULONG OvercurrentChange:1; // 5
  247. ULONG ForcePortResume:1; // 6
  248. ULONG PortSuspend:1; // 7
  249. ULONG PortReset:1; // 8
  250. ULONG HighSpeedDevice:1; // 9
  251. ULONG LineStatus:2; // 10-11
  252. ULONG PortPower:1; // 12
  253. ULONG PortOwnedByCC:1; // 13
  254. ULONG PortIndicator:2; // 14-15
  255. ULONG PortTestControl:4; // 16-19
  256. ULONG WakeOnConnect:1; // 20
  257. ULONG WakeOnDisconnect:1; // 21
  258. ULONG WakeOnOvercurrent:1; // 22
  259. ULONG Reserved:9; // 23-31
  260. };
  261. } PORTSC, *PPORTSC;
  262. C_ASSERT((sizeof(PORTSC) == sizeof(ULONG)));
  263. // OPERATIONAL REGISTER
  264. typedef struct _HC_OPERATIONAL_REGISTER {
  265. // 00h
  266. USBCMD UsbCommand;
  267. USBSTS UsbStatus;
  268. USBINTR UsbInterruptEnable;
  269. FRINDEX UsbFrameIndex;
  270. // 10h
  271. HW_32BIT_PHYSICAL_ADDRESS SegmentSelector;
  272. HW_32BIT_PHYSICAL_ADDRESS PeriodicListBase;
  273. HW_32BIT_PHYSICAL_ADDRESS AsyncListAddr;
  274. //ULONG Reserved;
  275. ULONG PciTrigger;
  276. // 20h
  277. ULONG ReservedB0[4];
  278. // 30h
  279. ULONG ReservedB1[4];
  280. // 40h
  281. CONFIGFLAG ConfigFlag;
  282. PORTSC PortRegister[1];
  283. } HC_OPERATIONAL_REGISTER, *PHC_OPERATIONAL_REGISTER;
  284. //#define HcDTYPE_iTD 0 // iterative TD
  285. //#define HcDTYPE_QH 1 // queue head
  286. //#define HcDTYPE_siTD 2 // isochronousTD
  287. // note that bits 0,1,2 are used for QH type
  288. // bits 4, and 5 are used for the nak cnt in the
  289. // transfer overlay
  290. #define HW_LINK_FLAGS_MASK 0x0000001f
  291. typedef union _HW_LINK_POINTER {
  292. HW_32BIT_PHYSICAL_ADDRESS HwAddress;
  293. // this screws up the 64-bit compiler
  294. #if 0
  295. struct {
  296. ULONG Terminate:1; // 0
  297. ULONG DType:2; // 1-2
  298. ULONG ReservedMBZ:2; // 3-4
  299. ULONG PhysicalAddressBits:27; // 5-31
  300. };
  301. #endif
  302. } HW_LINK_POINTER, *PHW_LINK_POINTER;
  303. #define EHCI_TERMINATE_BIT 0x00000001 // 00001
  304. #define EHCI_DTYPE_QH 0x00000002 // 00010
  305. #define EHCI_DTYPE_SITD 0x00000004 // 00100
  306. #define EHCI_RsvdMBZ 0x00000018 // 11000
  307. #define EHCI_DTYPE_Mask 0x0000001E // 11110
  308. #define SET_T_BIT(addr) ((addr) |= EHCI_TERMINATE_BIT)
  309. #define SET_SITD(addr) do {\
  310. ((addr) &= ~EHCI_DTYPE_Mask);\
  311. ((addr) |= EHCI_DTYPE_SITD);\
  312. } while (0)
  313. #define SET_QH(addr) do {\
  314. ((addr) &= ~EHCI_DTYPE_Mask);\
  315. ((addr) |= EHCI_DTYPE_QH);\
  316. } while (0)
  317. C_ASSERT((sizeof(HW_LINK_POINTER) == sizeof(ULONG)));
  318. //
  319. // Isochronous Transfer Descriptor
  320. //
  321. typedef union _HC_ITD_BUFFER_POINTER0 {
  322. ULONG ul;
  323. struct {
  324. ULONG DeviceAddress:7; // 0-6
  325. ULONG Reserved:1; // 7
  326. ULONG EndpointNumber:4; // 8-11
  327. ULONG BufferPointer:20; // 12-31
  328. };
  329. } HC_ITD_BUFFER_POINTER0, *PHC_ITD_BUFFER_POINTER0;
  330. C_ASSERT((sizeof(HC_ITD_BUFFER_POINTER0) == sizeof(ULONG)));
  331. typedef union _HC_ITD_BUFFER_POINTER1 {
  332. ULONG ul;
  333. struct {
  334. ULONG MaxPacketSize:11; // 0-10
  335. ULONG Direction:1; // 11
  336. ULONG BufferPointer:20; // 12-31
  337. };
  338. } HC_ITD_BUFFER_POINTER1, *PHC_ITD_BUFFER_POINTER1;
  339. C_ASSERT((sizeof(HC_ITD_BUFFER_POINTER1) == sizeof(ULONG)));
  340. typedef union _HC_ITD_BUFFER_POINTER2 {
  341. ULONG ul;
  342. struct {
  343. ULONG Multi:2; // 0-1
  344. ULONG Reserved:10; // 2-11
  345. ULONG BufferPointer:20; // 12-31
  346. };
  347. } HC_ITD_BUFFER_POINTER2, *PHC_ITD_BUFFER_POINTER2;
  348. C_ASSERT((sizeof(HC_ITD_BUFFER_POINTER2) == sizeof(ULONG)));
  349. typedef union _HC_ITD_BUFFER_POINTER {
  350. ULONG ul;
  351. struct {
  352. ULONG Reserved:12; // 0-11
  353. ULONG BufferPointer:20; // 12-31
  354. };
  355. } HC_ITD_BUFFER_POINTER, *PHC_ITD_BUFFER_POINTER;
  356. C_ASSERT((sizeof(HC_ITD_BUFFER_POINTER) == sizeof(ULONG)));
  357. typedef union _HC_ITD_TRANSACTION {
  358. ULONG ul;
  359. struct {
  360. ULONG Offset:12; // 0-11
  361. ULONG PageSelect:3; // 12-14
  362. ULONG InterruptOnComplete:1; // 15
  363. ULONG Length:12; // 16-27
  364. ULONG XactError:1; // 28
  365. ULONG BabbleDetect:1; // 29
  366. ULONG DataBufferError:1; // 30
  367. ULONG Active:1; // 31
  368. };
  369. } HC_ITD_TRANSACTION, *PHC_ITD_TRANSACTION;
  370. C_ASSERT((sizeof(HC_ITD_TRANSACTION) == sizeof(ULONG)));
  371. typedef struct _HW_ISOCHRONOUS_TD {
  372. HW_LINK_POINTER NextLink;
  373. HC_ITD_TRANSACTION Transaction[8];
  374. HC_ITD_BUFFER_POINTER0 BufferPointer0;
  375. HC_ITD_BUFFER_POINTER1 BufferPointer1;
  376. HC_ITD_BUFFER_POINTER2 BufferPointer2;
  377. HC_ITD_BUFFER_POINTER BufferPointer3;
  378. HC_ITD_BUFFER_POINTER BufferPointer4;
  379. HC_ITD_BUFFER_POINTER BufferPointer5;
  380. HC_ITD_BUFFER_POINTER BufferPointer6;
  381. ULONG BufferPointer64[7];
  382. ULONG Pad[9];
  383. } HW_ISOCHRONOUS_TD, *PHW_ISOCHRONOUS_TD;
  384. C_ASSERT((sizeof(HW_ISOCHRONOUS_TD) == 128));
  385. //
  386. // Split Transaction Isochronous Transfer Descriptor
  387. //
  388. typedef union _HC_SITD_CAPS {
  389. ULONG ul;
  390. struct {
  391. ULONG DeviceAddress:7; // 0-6
  392. ULONG Reserved0:1; // 7
  393. ULONG EndpointNumber:4; // 8-11
  394. ULONG Reserved1:4; // 12-15
  395. ULONG HubAddress:7; // 16-22
  396. ULONG Reserved2:1; // 23
  397. ULONG PortNumber:7; // 24-30
  398. ULONG Direction:1; // 31
  399. };
  400. } HC_SITD_CAPS, *PHC_SITD_CAPS;
  401. C_ASSERT((sizeof(HC_SITD_CAPS) == sizeof(ULONG)));
  402. typedef union _HC_SITD_CONTROL {
  403. ULONG ul;
  404. struct {
  405. ULONG sMask:8; // 0-7
  406. ULONG cMask:8; // 8-15
  407. ULONG Reserved:16; // 16-31
  408. };
  409. } HC_SITD_CONTROL, *PHC_SITD_CONTROL;
  410. C_ASSERT((sizeof(HC_SITD_CONTROL) == sizeof(ULONG)));
  411. typedef union _HC_SITD_STATE {
  412. ULONG ul;
  413. struct {
  414. ULONG Reserved0:1; // 0
  415. ULONG SplitXState:1; // 1
  416. ULONG MissedMicroframe:1; // 2
  417. ULONG XactErr:1; // 3
  418. ULONG BabbleDetected:1; // 4
  419. ULONG DataBufferError:1; // 5
  420. ULONG ERR:1; // 6
  421. ULONG Active:1; // 7
  422. ULONG cProgMask:8; // 8-15
  423. ULONG BytesToTransfer:10; // 16-25
  424. ULONG Reserved1:4; // 26-29
  425. ULONG PageSelect:1; // 30
  426. ULONG InterruptOnComplete:1; // 31
  427. };
  428. } HC_SITD_STATE, *PHC_SITD_STATE;
  429. C_ASSERT((sizeof(HC_SITD_STATE) == sizeof(ULONG)));
  430. // Tposition
  431. #define TPOS_ALL 0
  432. #define TPOS_BEGIN 1
  433. typedef union _HC_SITD_BUFFER_POINTER1 {
  434. ULONG ul;
  435. struct {
  436. ULONG Tcount:3; // 0-2
  437. ULONG Tposition:2; // 3-4
  438. ULONG Reseved:7; // 5-11
  439. ULONG BufferPointer:20; // 12-31
  440. };
  441. } HC_SITD_BUFFER_POINTER1, *PHC_SITD_BUFFER_POINTER1;
  442. C_ASSERT((sizeof(HC_SITD_BUFFER_POINTER1) == sizeof(ULONG)));
  443. typedef union _HC_SITD_BUFFER_POINTER0 {
  444. ULONG ul;
  445. struct {
  446. ULONG CurrentOffset:12; // 0-11
  447. ULONG BufferPointer:20; // 12-31
  448. };
  449. } HC_SITD_BUFFER_POINTER0, *PHC_SITD_BUFFER_POINTER0;
  450. C_ASSERT((sizeof(HC_SITD_BUFFER_POINTER0) == sizeof(ULONG)));
  451. typedef struct _HW_SPLIT_ISOCHRONOUS_TD {
  452. HW_LINK_POINTER NextLink;
  453. HC_SITD_CAPS Caps;
  454. HC_SITD_CONTROL Control;
  455. HC_SITD_STATE State;
  456. HC_SITD_BUFFER_POINTER0 BufferPointer0;
  457. HC_SITD_BUFFER_POINTER1 BufferPointer1;
  458. HW_LINK_POINTER BackPointer;
  459. ULONG BufferPointer64_0;
  460. ULONG BufferPointer64_1;
  461. ULONG Pad[7];
  462. } HW_SPLIT_ISOCHRONOUS_TD, *PHW_SPLIT_ISOCHRONOUS_TD;
  463. C_ASSERT((sizeof(HW_SPLIT_ISOCHRONOUS_TD) == 64));
  464. //
  465. // Queue Element Transfer Descriptor
  466. //
  467. //
  468. // Definitions for HC_QTD_TOKEN.Pid
  469. //
  470. #define HcTOK_Out 0
  471. #define HcTOK_In 1
  472. #define HcTOK_Setup 2
  473. #define HcTOK_Reserved 3
  474. #define HcTOK_PingDoOut 0
  475. #define HcTOK_PingDoPing 1
  476. #define HcTOK_Toggle0 0
  477. #define HcTOK_Toggle1 1
  478. typedef union _HC_BUFFER_POINTER {
  479. ULONG ul;
  480. struct {
  481. ULONG CurrentOffset:12; // 0-11
  482. ULONG BufferPointer:20; // 12-31
  483. };
  484. } HC_BUFFER_POINTER, *PHC_BUFFER_POINTER;
  485. C_ASSERT((sizeof(HC_BUFFER_POINTER) == sizeof(ULONG)));
  486. typedef union _HC_QTD_TOKEN {
  487. ULONG ul;
  488. struct {
  489. // status bits
  490. ULONG PingState:1; // 0
  491. ULONG SplitXstate:1; // 1
  492. ULONG MissedMicroFrame:1; // 2
  493. ULONG XactErr:1; // 3
  494. ULONG BabbleDetected:1; // 4
  495. ULONG DataBufferError:1; // 5
  496. ULONG Halted:1; // 6
  497. ULONG Active:1; // 7
  498. ULONG Pid:2; // 8-9
  499. ULONG ErrorCounter:2; // 10-11
  500. ULONG C_Page:3; // 12-14
  501. ULONG InterruptOnComplete:1; // 15
  502. ULONG BytesToTransfer:15; // 16-30
  503. ULONG DataToggle:1; // 31
  504. };
  505. } HC_QTD_TOKEN, *PHC_QTD_TOKEN;
  506. C_ASSERT((sizeof(HC_QTD_TOKEN) == sizeof(ULONG)));
  507. typedef struct _HW_QUEUE_ELEMENT_TD {
  508. HW_LINK_POINTER Next_qTD;
  509. HW_LINK_POINTER AltNext_qTD;
  510. HC_QTD_TOKEN Token;
  511. HC_BUFFER_POINTER BufferPage[5];
  512. ULONG BufferPage64[5];
  513. ULONG Pad[3];
  514. } HW_QUEUE_ELEMENT_TD, *PHW_QUEUE_ELEMENT_TD;
  515. C_ASSERT((sizeof(HW_QUEUE_ELEMENT_TD) == 64));
  516. typedef union HC_OVLAY_8 {
  517. ULONG ul;
  518. struct {
  519. // status bits
  520. ULONG CprogMask:8; // 0-7
  521. ULONG Buffer:24;
  522. };
  523. } HC_OVLAY_8, *PHC_OVLAY_8;
  524. C_ASSERT((sizeof(HC_OVLAY_8) == sizeof(ULONG)));
  525. typedef union HC_OVLAY_9 {
  526. ULONG ul;
  527. struct {
  528. // status bits
  529. ULONG fTag:5; // 0-4
  530. ULONG Sbytes:7; // 5-11
  531. ULONG Buffer:20;
  532. };
  533. } HC_OVLAY_9, *PHC_OVLAY_9;
  534. C_ASSERT((sizeof(HC_OVLAY_9) == sizeof(ULONG)));
  535. typedef struct _HW_OVERLAY_AREA {
  536. HW_LINK_POINTER Next_qTD; // dw4
  537. HW_LINK_POINTER AltNext_qTD; // dw5
  538. HC_QTD_TOKEN Token; // dw6
  539. HC_BUFFER_POINTER BufferPage0; // dw7
  540. HC_OVLAY_8 OverlayDw8;
  541. HC_OVLAY_9 OverlayDw9;
  542. HC_BUFFER_POINTER BufferPage3;
  543. HC_BUFFER_POINTER BufferPage4;
  544. ULONG BufferPage64[5];
  545. ULONG Pad[3];
  546. } HW_OVERLAY_AREA, *PHW_OVERLAY_AREA;
  547. C_ASSERT((sizeof(HW_QUEUE_ELEMENT_TD) == 64));
  548. //
  549. // General Transfer Descriptor
  550. //
  551. typedef union _HW_TRANSFER_DESCRIPTOR {
  552. HW_QUEUE_ELEMENT_TD qTD;
  553. HW_OVERLAY_AREA Ov;
  554. } HW_TRANSFER_DESCRIPTOR, *PHW_TRANSFER_DESCRIPTOR;
  555. C_ASSERT((sizeof(HW_TRANSFER_DESCRIPTOR) == 64));
  556. //
  557. // Definitions for HC_ENDPOINT_CHARACTERSITICS.DataToggleControl
  558. //
  559. #define HcEPCHAR_Ignore_Toggle 0 // ignore DT bit from incomming QTD
  560. #define HcEPCHAR_Toggle_From_qTD 1 // DT from incomming QTD
  561. //
  562. // Definitions for HC_ENDPOINT_CHARACTERSITICS.EndpointSpeed
  563. //
  564. #define HcEPCHAR_FullSpeed 0 // 12Mbs
  565. #define HcEPCHAR_LowSpeed 1 // 1.5Mbs
  566. #define HcEPCHAR_HighSpeed 2 // 480Mbs
  567. #define HcEPCHAR_Reserved 3
  568. typedef union _HC_ENDPOINT_CHARACTERSITICS {
  569. ULONG ul;
  570. struct {
  571. ULONG DeviceAddress:7; // 0-6
  572. ULONG Reserved1:1; // 7
  573. ULONG EndpointNumber:4; // 8-11
  574. ULONG EndpointSpeed:2; // 12-13
  575. ULONG DataToggleControl:1; // 14
  576. ULONG HeadOfReclimationList:1; // 15
  577. ULONG MaximumPacketLength:11; // 16-26
  578. ULONG ControlEndpointFlag:1; // 27
  579. ULONG NakReloadCount:4; // 28-31
  580. } ;
  581. } HC_ENDPOINT_CHARACTERSITICS, *PHC_ENDPOINT_CHARACTERSITICS;
  582. C_ASSERT((sizeof(HC_ENDPOINT_CHARACTERSITICS) == sizeof(ULONG)));
  583. typedef union _HC_ENDPOINT_CAPABILITIES {
  584. ULONG ul;
  585. struct {
  586. ULONG InterruptScheduleMask:8; // 0-7
  587. ULONG SplitCompletionMask:8; // 8-15
  588. ULONG HubAddress:7; // 16-22
  589. ULONG PortNumber:7; // 23-29
  590. ULONG HighBWPipeMultiplier:2; // 30-31
  591. };
  592. } HC_ENDPOINT_CAPABILITIES, *PHC_ENDPOINT_CAPABILITIES;
  593. C_ASSERT((sizeof(HC_ENDPOINT_CAPABILITIES) == sizeof(ULONG)));
  594. //
  595. // Queue Head Descriptor
  596. //
  597. typedef struct _HW_QUEUEHEAD_DESCRIPTOR {
  598. HW_LINK_POINTER HLink; // horizontal link ptr dw:0
  599. HC_ENDPOINT_CHARACTERSITICS EpChars; // dw:1
  600. HC_ENDPOINT_CAPABILITIES EpCaps; // dw:2
  601. HW_LINK_POINTER CurrentTD; // dw:3
  602. HW_TRANSFER_DESCRIPTOR Overlay; // dw:4-11
  603. } HW_QUEUEHEAD_DESCRIPTOR, *PHW_QUEUEHEAD_DESCRIPTOR;
  604. C_ASSERT((sizeof(HW_QUEUEHEAD_DESCRIPTOR) == 80));
  605. #include <POPPACK.H>
  606. #endif /* EHCI_H */