32 #ifndef __LPC_OHCI_H__
33 #define __LPC_OHCI_H__
35 #ifndef __LPC_OHCI_C__ // TODO INCLUDE FROM OHCI.C
36 #error OHCI.h is private header and can only be included by OHCI.c, try to include HCD.h instead
39 #ifdef __TEST__ // suppress static/inline for Testing purpose
44 #define MAX_ED HCD_MAX_ENDPOINT
45 #define MAX_GTD (MAX_ED + 3)
46 #define MAX_STATIC_ED 3
54 #define CONTROL_BULK_SERVICE_RATIO 3
55 #define INTERRUPT_ROUTING 0
56 #define REMOTE_WAKEUP_CONNECTED NO
57 #define REMOTE_WAKEUP_ENABLE NO
59 #define SCHEDULING_OVRERRUN_INTERRUPT NO
61 #define SOF_INTERRUPT NO
62 #define RESUME_DETECT_INTERRUPT NO
63 #define UNRECOVERABLE_ERROR_INTERRUPT NO
64 #define FRAMENUMBER_OVERFLOW_INTERRUPT NO
66 #define OWNERSHIP_CHANGE_INTERRUPT NO
68 #define FRAME_INTERVAL 0x2EDF
69 #define HC_FMINTERVAL_DEFAULT ((((6 * (FRAME_INTERVAL - 210)) / 7) << 16) | FRAME_INTERVAL)
71 #define PERIODIC_START 0x00002A27UL
73 #define PORT_POWER_SWITCHING NO
74 #define PER_PORT_POWER_SWITCHING NO
75 #define PER_PORT_OVER_CURRENT_REPORT NO
76 #define OVER_CURRENT_PROTECTION NO
78 #define INTERRUPT_1ms_LIST_HEAD 0
79 #define INTERRUPT_2ms_LIST_HEAD 1
80 #define INTERRUPT_4ms_LIST_HEAD 3
81 #define INTERRUPT_8ms_LIST_HEAD 7
82 #define INTERRUPT_16ms_LIST_HEAD 15
83 #define INTERRUPT_32ms_LIST_HEAD 31
84 #define ISO_LIST_HEAD (MAX_STATIC_ED - 3)
85 #define CONTROL_LIST_HEAD (MAX_STATIC_ED - 2)
86 #define BULK_LIST_HEAD (MAX_STATIC_ED - 1)
87 #define TD_MAX_XFER_LENGTH 0x2000
89 #define TD_NoInterruptOnComplete (7)
91 #define HC_REVISION 0x000000FFUL
93 #define HC_FM_REMAIN 0x00003FFFUL
95 #define HC_FM_NUMBER 0x0000FFFFUL
97 #define HC_CONTROL_ControlBulkServiceRatio 0x00000003UL
98 #define HC_CONTROL_PeriodListEnable 0x00000004UL
99 #define HC_CONTROL_IsochronousEnable 0x00000008UL
100 #define HC_CONTROL_ControlListEnable 0x00000010UL
101 #define HC_CONTROL_BulkListEnable 0x00000020UL
102 #define HC_CONTROL_HostControllerFunctionalState 0x000000C0UL
103 #define HC_CONTROL_InterruptRouting 0x00000100UL
104 #define HC_CONTROL_RemoteWakeupConnected 0x00000200UL
105 #define HC_CONTROL_RemoteWakeupEnable 0x00000400UL
107 #define HC_HOST_RESET 0x00000000UL
108 #define HC_HOST_RESUME 0X00000001UL
109 #define HC_HOST_OPERATIONAL 0x00000002UL
110 #define HC_HOST_SUSPEND 0x00000003UL
112 #define HC_COMMAND_STATUS_HostControllerReset 0x00000001UL
113 #define HC_COMMAND_STATUS_ControlListFilled 0x00000002UL
114 #define HC_COMMAND_STATUS_BulkListFilled 0x00000004UL
116 #define HC_INTERRUPT_SchedulingOverrun 0x00000001UL
117 #define HC_INTERRUPT_WritebackDoneHead 0x00000002UL
118 #define HC_INTERRUPT_StartofFrame 0x00000004UL
119 #define HC_INTERRUPT_ResumeDetected 0x00000008UL
120 #define HC_INTERRUPT_UnrecoverableError 0x00000010UL
121 #define HC_INTERRUPT_FrameNumberOverflow 0x00000020UL
122 #define HC_INTERRUPT_RootHubStatusChange 0x00000040UL
123 #define HC_INTERRUPT_OwnershipChange 0x40000000UL
124 #define HC_INTERRUPT_MasterInterruptEnable 0x80000000UL
125 #define HC_INTERRUPT_ALL 0xC000007FUL
127 #define HC_RH_DESCRIPTORA_NumberDownstreamPorts 0x000000FFUL
128 #define HC_RH_DESCRIPTORA_PowerSwitchingMode 0x00000100UL
129 #define HC_RH_DESCRIPTORA_NoPowerSwitching 0x00000200UL
130 #define HC_RH_DESCRIPTORA_OverCurrentProtectionMode 0x00000800UL
131 #define HC_RH_DESCRIPTORA_NoOverCurrentProtection 0x00001000UL
132 #define HC_RH_DESCRIPTORA_PowerOnToPowerGoodTime 0xFF000000UL
134 #define HC_RH_DESCRIPTORB_PortPowerControlMask 0xFFFF0000UL
135 #define HC_RH_DESCRIPTORB_DeviceRemovable 0x0000FFFFUL
137 #define HC_RH_STATUS_LocalPowerStatus 0x00000001UL
138 #define HC_RH_STATUS_LocalPowerStatusChange 0x00010000UL
139 #define HC_RH_STATUS_DeviceRemoteWakeupEnable 0x00008000UL
141 #define HC_RH_PORT_STATUS_CurrentConnectStatus 0x00000001UL
142 #define HC_RH_PORT_STATUS_PowerEnableStatus 0x00000002UL
143 #define HC_RH_PORT_STATUS_PortSuspendStatus 0x00000004UL
144 #define HC_RH_PORT_STATUS_PortOverCurrentIndicator 0x00000008UL
145 #define HC_RH_PORT_STATUS_PortResetStatus 0x00000010UL
146 #define HC_RH_PORT_STATUS_PortPowerStatus 0x00000100UL
147 #define HC_RH_PORT_STATUS_LowSpeedDeviceAttached 0x00000200UL
149 #define HC_RH_PORT_STATUS_ConnectStatusChange 0x00010000UL
150 #define HC_RH_PORT_STATUS_PortEnableStatusChange 0x00020000UL
151 #define HC_RH_PORT_STATUS_PortSuspendStatusChange 0x00040000UL
152 #define HC_RH_PORT_STATUS_OverCurrentIndicatorChange 0x00080000UL
153 #define HC_RH_PORT_STATUS_PortResetStatusChange 0x00100000UL
193 typedef struct st_HCD_EndpointDescriptor {
231 typedef struct st_HCD_GeneralTransferDescriptor {
283 typedef struct st_OHCI_HOST {
293 #define OHCI_REG(x) LPC_USB
317 static INLINE PHCD_GeneralTransferDescriptor
HcdGTD(uint8_t idx);
336 uint16_t MaxPacketSize,