9#ifndef _USB_HOST_CONTROLLER_EHCI_H_
10#define _USB_HOST_CONTROLLER_EHCI_H_
20#define EHCI_HOST_T_INVALID_VALUE (1U)
21#define EHCI_HOST_POINTER_TYPE_ITD (0x00U)
22#define EHCI_HOST_POINTER_TYPE_QH (0x00000002U)
23#define EHCI_HOST_POINTER_TYPE_SITD (0x00000004U)
24#define EHCI_HOST_POINTER_TYPE_FSTN (0x00000006U)
25#define EHCI_HOST_POINTER_TYPE_MASK (0x00000006U)
26#define EHCI_HOST_POINTER_ADDRESS_MASK (0xFFFFFFE0U)
27#define EHCI_HOST_PID_OUT (0UL)
28#define EHCI_HOST_PID_IN (1UL)
29#define EHCI_HOST_PID_SETUP (2UL)
31#define EHCI_HOST_QH_RL_SHIFT (28U)
32#define EHCI_HOST_QH_RL_MASK (0xF0000000U)
33#define EHCI_HOST_QH_C_SHIFT (27U)
34#define EHCI_HOST_QH_MAX_PACKET_LENGTH_SHIFT (16U)
35#define EHCI_HOST_QH_MAX_PACKET_LENGTH_MASK (0x07FF0000U)
36#define EHCI_HOST_QH_H_SHIFT (15U)
37#define EHCI_HOST_QH_DTC_SHIFT (14U)
38#define EHCI_HOST_QH_EPS_SHIFT (12U)
39#define EHCI_HOST_QH_ENDPT_SHIFT (8U)
40#define EHCI_HOST_QH_I_SHIFT (7U)
41#define EHCI_HOST_QH_DEVICE_ADDRESS_SHIFT (0U)
42#define EHCI_HOST_QH_MULT_SHIFT (30U)
43#define EHCI_HOST_QH_PORT_NUMBER_SHIFT (23U)
44#define EHCI_HOST_QH_HUB_ADDR_SHIFT (16U)
45#define EHCI_HOST_QH_UFRAME_CMASK_SHIFT (8U)
46#define EHCI_HOST_QH_UFRAME_SMASK_SHIFT (0U)
47#define EHCI_HOST_QH_STATUS_ERROR_MASK (0x0000007EU)
48#define EHCI_HOST_QH_STATUS_NOSTALL_ERROR_MASK (0x0000003EU)
50#define EHCI_HOST_QTD_DT_SHIFT (31U)
51#define EHCI_HOST_QTD_DT_MASK (0x80000000U)
52#define EHCI_HOST_QTD_TOTAL_BYTES_SHIFT (16U)
53#define EHCI_HOST_QTD_TOTAL_BYTES_MASK (0x7FFF0000U)
54#define EHCI_HOST_QTD_IOC_MASK (0x00008000U)
55#define EHCI_HOST_QTD_C_PAGE_SHIFT (12U)
56#define EHCI_HOST_QTD_CERR_SHIFT (10U)
57#define EHCI_HOST_QTD_CERR_MAX_VALUE (0x00000003UL)
58#define EHCI_HOST_QTD_PID_CODE_SHIFT (8U)
59#define EHCI_HOST_QTD_STATUS_SHIFT (0U)
60#define EHCI_HOST_QTD_CURRENT_OFFSET_MASK (0x00000FFFU)
61#define EHCI_HOST_QTD_BUFFER_POINTER_SHIFT (12U)
62#define EHCI_HOST_QTD_STATUS_ACTIVE_MASK (0x00000080U)
63#define EHCI_HOST_QTD_STATUS_MASK (0x000000ffU)
64#define EHCI_HOST_QTD_STATUS_ERROR_MASK (0x0000007EU)
65#define EHCI_HOST_QTD_STATUS_STALL_ERROR_MASK (0x00000040U)
67#define EHCI_HOST_ITD_STATUS_ACTIVE_MASK (0x80000000U)
68#define EHCI_HOST_ITD_TRANSACTION_LEN_SHIFT (16U)
69#define EHCI_HOST_ITD_TRANSACTION_LEN_MASK (0x0FFF0000U)
70#define EHCI_HOST_ITD_IOC_SHIFT (15U)
71#define EHCI_HOST_ITD_PG_SHIFT (12U)
72#define EHCI_HOST_ITD_TRANSACTION_OFFSET_SHIFT (0U)
73#define EHCI_HOST_ITD_TRANSACTION_OFFSET_MASK (0x00000FFFU)
74#define EHCI_HOST_ITD_BUFFER_POINTER_SHIFT (12U)
75#define EHCI_HOST_ITD_ENDPT_SHIFT (8U)
76#define EHCI_HOST_ITD_DEVICE_ADDRESS_SHIFT (0U)
77#define EHCI_HOST_ITD_MAX_PACKET_SIZE_SHIFT (0U)
78#define EHCI_HOST_ITD_MULT_SHIFT (0U)
79#define EHCI_HOST_ITD_DIRECTION_SHIFT (11U)
81#define EHCI_HOST_SITD_STATUS_ACTIVE_MASK (0x00000080U)
82#define EHCI_HOST_SITD_DIRECTION_SHIFT (31U)
83#define EHCI_HOST_SITD_PORT_NUMBER_SHIFT (24U)
84#define EHCI_HOST_SITD_HUB_ADDR_SHIFT (16U)
85#define EHCI_HOST_SITD_ENDPT_SHIFT (8U)
86#define EHCI_HOST_SITD_DEVICE_ADDRESS_SHIFT (0U)
87#define EHCI_HOST_SITD_CMASK_SHIFT (8U)
88#define EHCI_HOST_SITD_SMASK_SHIFT (0U)
89#define EHCI_HOST_SITD_TOTAL_BYTES_SHIFT (16U)
90#define EHCI_HOST_SITD_TOTAL_BYTES_MASK (0x03FF0000U)
91#define EHCI_HOST_SITD_TP_SHIFT (3U)
92#define EHCI_HOST_SITD_TCOUNT_SHIFT (0U)
93#define EHCI_HOST_SITD_IOC_SHIFT (31U)
96#define EHCI_PORTSC1_W1_BITS (0x0000002AU)
97#define EHCI_MAX_UFRAME_VALUE (0x00003FFFU)
100#define EHCI_TASK_EVENT_DEVICE_ATTACH (0x01U)
101#define EHCI_TASK_EVENT_TRANSACTION_DONE (0x02U)
102#define EHCI_TASK_EVENT_DEVICE_DETACH (0x04U)
103#define EHCI_TASK_EVENT_PORT_CHANGE (0x08U)
104#define EHCI_TASK_EVENT_TIMER0 (0x10U)
105#define EHCI_TASK_EVENT_TIMER1 (0x20U)
106#if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U))
107#if ((defined(USB_HOST_CONFIG_LPM_L1)) && (USB_HOST_CONFIG_LPM_L1 > 0U))
108#define EHCI_TASK_EVENT_HOST_COMPLETED_LPM (0x40U)
112#define USB_HostEhciLock() (void)OSA_MutexLock(ehciInstance->ehciMutex, USB_OSA_WAIT_TIMEOUT)
113#define USB_HostEhciUnlock() (void)OSA_MutexUnlock(ehciInstance->ehciMutex)
125#define USB_HOST_EHCI_ISO_NUMBER USB_HOST_CONFIG_EHCI_MAX_ITD
127#define USB_HOST_EHCI_PORT_CONNECT_DEBOUNCE_DELAY (101U)
129#define USB_HOST_EHCI_PORT_RESET_DELAY (11U)
131#define USB_HOST_EHCI_ISO_MAX_CONTINUOUS_TRANSFER (8U)
144#define USB_HOST_EHCI_ISO_BOUNCE_FRAME_NUMBER (2U)
157#define USB_HOST_EHCI_ISO_BOUNCE_UFRAME_NUMBER (16U)
159#define USB_HOST_EHCI_CONTROL_BULK_TIME_OUT_VALUE (50U)
161#if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U))
162typedef enum _bus_ehci_suspend_request_state
165 kBus_EhciStartSuspend,
167 kBus_EhciStartResume,
168 kBus_EhciL1StartSleep,
170 kBus_EhciL1StartResume,
172} bus_ehci_suspend_request_state_t;
319#if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U))
321#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
322 USBPHY_Type *registerPhyBase;
324#if (defined(FSL_FEATURE_SOC_USBNC_COUNT) && (FSL_FEATURE_SOC_USBNC_COUNT > 0U))
325 USBNC_Type *registerNcBase;
335#if ((defined(USB_HOST_CONFIG_LOW_POWER_MODE)) && (USB_HOST_CONFIG_LOW_POWER_MODE > 0U))
336#if ((defined(USB_HOST_CONFIG_LPM_L1)) && (USB_HOST_CONFIG_LPM_L1 > 0U))
338 uint8_t L1remoteWakeupEnable;
340 bus_ehci_suspend_request_state_t busSuspendStatus;
347#if ((defined(USB_HOST_CONFIG_EHCI_MAX_QH)) && (USB_HOST_CONFIG_EHCI_MAX_QH > 0U))
350#if ((defined(USB_HOST_CONFIG_EHCI_MAX_QTD)) && (USB_HOST_CONFIG_EHCI_MAX_QTD > 0U))
353#if ((defined(USB_HOST_CONFIG_EHCI_MAX_ITD)) && (USB_HOST_CONFIG_EHCI_MAX_ITD > 0U))
358 uint32_t reserved[8];
360#if ((defined(USB_HOST_CONFIG_EHCI_MAX_SITD)) && (USB_HOST_CONFIG_EHCI_MAX_SITD > 0U))
363#if ((defined(USB_HOST_EHCI_ISO_NUMBER)) && (USB_HOST_EHCI_ISO_NUMBER > 0U))
366#if ((defined(USB_HOST_CONFIG_MAX_PIPES)) && (USB_HOST_CONFIG_MAX_PIPES > 0U))
enum _usb_status usb_status_t
USB error code.
void * usb_host_handle
USB host handle type define.
Definition nxp_usb.h:70
struct _usb_host_ehci_itd usb_host_ehci_itd_t
EHCI ITD structure. See the USB EHCI specification.
struct _usb_host_ehci_pipe usb_host_ehci_pipe_t
EHCI pipe structure.
usb_status_t USB_HostEhciIoctl(usb_host_controller_handle controllerHandle, uint32_t ioctlEvent, void *ioctlParam)
Controls the EHCI.
#define USB_HOST_EHCI_ISO_NUMBER
The maximum supported ISO pipe number.
Definition usb_host_ehci.h:125
_host_ehci_device_state_
EHCI state for device attachment/detachment.
Definition usb_host_ehci.h:177
usb_status_t USB_HostEhciCreate(uint8_t controllerId, usb_host_handle upperLayerHandle, usb_host_controller_handle *controllerHandle)
Creates the USB host EHCI instance.
struct _usb_host_ehci_sitd usb_host_ehci_sitd_t
EHCI SITD structure. See the USB EHCI specification.
struct _usb_host_ehci_instance usb_host_ehci_instance_t
EHCI instance structure.
usb_status_t USB_HostEhciDestory(usb_host_controller_handle controllerHandle)
Destroys the USB host EHCI instance.
struct _usb_host_ehci_data usb_host_ehci_data_t
EHCI data structure.
enum _host_ehci_device_state_ host_ehci_device_state_t
EHCI state for device attachment/detachment.
usb_status_t USB_HostEhciReadpipe(usb_host_controller_handle controllerHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer)
Receives data from the pipe.
usb_status_t USB_HostEhciWritePipe(usb_host_controller_handle controllerHandle, usb_host_pipe_handle pipeHandle, usb_host_transfer_t *transfer)
Sends data to the pipe.
struct _usb_host_ehci_qtd usb_host_ehci_qtd_t
EHCI QTD structure. See the USB EHCI specification.
usb_status_t USB_HostEhciOpenPipe(usb_host_controller_handle controllerHandle, usb_host_pipe_handle *pipeHandle, usb_host_pipe_init_t *pipeInit)
Opens the USB host pipe.
struct _usb_host_ehci_qh usb_host_ehci_qh_t
EHCI QH structure. See the USB EHCI specification.
usb_status_t USB_HostEhciClosePipe(usb_host_controller_handle controllerHandle, usb_host_pipe_handle pipeHandle)
Closes the USB host pipe.
struct _usb_host_ehci_iso usb_host_ehci_iso_t
EHCI ISO structure; An ISO pipe has an instance of this structure to keep the ISO pipe-specific infor...
@ kEHCIDevicePhyAttached
Definition usb_host_ehci.h:178
@ kEHCIDeviceAttached
Definition usb_host_ehci.h:179
@ kEHCIDeviceDetached
Definition usb_host_ehci.h:180
void * usb_host_controller_handle
USB host controller handle type define.
Definition usb_host.h:31
void * usb_host_pipe_handle
USB host pipe handle type define.
Definition usb_host.h:40
EHCI data structure.
Definition usb_host_ehci.h:346
EHCI instance structure.
Definition usb_host_ehci.h:299
usb_host_ehci_qtd_t * ehciQtdHead
Definition usb_host_ehci.h:304
uint32_t mutexBuffer[(OSA_MUTEX_HANDLE_SIZE+3)/4]
Definition usb_host_ehci.h:316
uint8_t ehciSitdNumber
Definition usb_host_ehci.h:333
uint8_t deviceAttached
Definition usb_host_ehci.h:330
usb_host_ehci_qtd_t * ehciQtdTail
Definition usb_host_ehci.h:305
uint8_t * ehciFrameList
Definition usb_host_ehci.h:302
osa_event_handle_t taskEventHandle
Definition usb_host_ehci.h:317
osa_mutex_handle_t ehciMutex
Definition usb_host_ehci.h:315
usb_host_ehci_pipe_t * ehciPipeList
Definition usb_host_ehci.h:313
uint32_t taskEventHandleBuffer[(OSA_EVENT_HANDLE_SIZE+3)/4]
Definition usb_host_ehci.h:318
usb_host_ehci_sitd_t * ehciSitdList
Definition usb_host_ehci.h:308
usb_host_handle hostHandle
Definition usb_host_ehci.h:300
usb_host_ehci_qh_t * shedFirstQh
Definition usb_host_ehci.h:311
usb_host_ehci_iso_t * ehciIsoList
Definition usb_host_ehci.h:309
usb_host_ehci_qh_t * ehciQhList
Definition usb_host_ehci.h:303
usb_host_ehci_pipe_t * ehciPipeIndexBase
Definition usb_host_ehci.h:312
usb_host_ehci_sitd_t * ehciSitdIndexBase
Definition usb_host_ehci.h:307
USBHS_Type * ehciIpBase
Definition usb_host_ehci.h:310
uint8_t ehciQtdNumber
Definition usb_host_ehci.h:334
uint8_t controllerId
Definition usb_host_ehci.h:329
uint8_t firstDeviceSpeed
Definition usb_host_ehci.h:331
usb_host_ehci_itd_t * ehciItdList
Definition usb_host_ehci.h:306
uint8_t ehciItdNumber
Definition usb_host_ehci.h:332
uint32_t * ehciUnitBase
Definition usb_host_ehci.h:301
usb_host_ehci_pipe_t * ehciRunningPipeList
Definition usb_host_ehci.h:314
EHCI ISO structure; An ISO pipe has an instance of this structure to keep the ISO pipe-specific infor...
Definition usb_host_ehci.h:287
usb_host_pipe_t * ehciPipePointer
Definition usb_host_ehci.h:289
usb_host_transfer_t * ehciTransferHead
Definition usb_host_ehci.h:290
usb_host_transfer_t * ehciTransferTail
Definition usb_host_ehci.h:291
uint16_t lastLinkFrame
Definition usb_host_ehci.h:293
struct _usb_host_ehci_iso * next
Definition usb_host_ehci.h:288
EHCI ITD structure. See the USB EHCI specification.
Definition usb_host_ehci.h:258
uint32_t transactions[8]
Definition usb_host_ehci.h:260
uint32_t reserved[6]
Definition usb_host_ehci.h:266
struct _usb_host_ehci_itd * nextItdPointer
Definition usb_host_ehci.h:264
uint32_t frameEntryIndex
Definition usb_host_ehci.h:265
uint32_t nextLinkPointer
Definition usb_host_ehci.h:259
uint32_t bufferPointers[7]
Definition usb_host_ehci.h:261
EHCI pipe structure.
Definition usb_host_ehci.h:185
usb_host_pipe_t pipeCommon
Definition usb_host_ehci.h:186
uint8_t uframeCmask
Definition usb_host_ehci.h:219
void * ehciQh
Definition usb_host_ehci.h:187
uint16_t completeSplitTime
Definition usb_host_ehci.h:205
uint8_t uframeSmask
Definition usb_host_ehci.h:212
uint8_t startUframe
Definition usb_host_ehci.h:209
uint16_t dataTime
Definition usb_host_ehci.h:194
uint16_t startFrame
Definition usb_host_ehci.h:191
uint16_t startSplitTime
Definition usb_host_ehci.h:201
uint16_t uframeInterval
Definition usb_host_ehci.h:190
EHCI QH structure. See the USB EHCI specification.
Definition usb_host_ehci.h:228
usb_host_ehci_pipe_t * ehciPipePointer
Definition usb_host_ehci.h:239
uint32_t nextQtdPointer
Definition usb_host_ehci.h:233
uint32_t horizontalLinkPointer
Definition usb_host_ehci.h:229
uint32_t currentQtdPointer
Definition usb_host_ehci.h:232
uint16_t timeOutValue
Definition usb_host_ehci.h:242
usb_host_transfer_t * ehciTransferHead
Definition usb_host_ehci.h:240
uint32_t transferOverlayResults[6]
Definition usb_host_ehci.h:236
uint32_t staticEndpointStates[2]
Definition usb_host_ehci.h:231
uint32_t alternateNextQtdPointer
Definition usb_host_ehci.h:234
usb_host_transfer_t * ehciTransferTail
Definition usb_host_ehci.h:241
uint16_t timeOutLabel
Definition usb_host_ehci.h:244
EHCI QTD structure. See the USB EHCI specification.
Definition usb_host_ehci.h:249
uint32_t alternateNextQtdPointer
Definition usb_host_ehci.h:251
uint32_t bufferPointers[4]
Definition usb_host_ehci.h:253
uint32_t transferResults[2]
Definition usb_host_ehci.h:252
uint32_t nextQtdPointer
Definition usb_host_ehci.h:250
EHCI SITD structure. See the USB EHCI specification.
Definition usb_host_ehci.h:271
uint16_t frameEntryIndex
Definition usb_host_ehci.h:278
uint32_t endpointStates[2]
Definition usb_host_ehci.h:273
uint8_t nextSitdIndex
Definition usb_host_ehci.h:279
uint8_t reserved
Definition usb_host_ehci.h:281
uint32_t nextLinkPointer
Definition usb_host_ehci.h:272
uint32_t backPointer
Definition usb_host_ehci.h:275
uint32_t transferResults[3]
Definition usb_host_ehci.h:274
USB host pipe information structure for opening pipe.
Definition usb_host.h:272
USB host pipe common structure.
Definition usb_host.h:224
USB host transfer structure.
Definition usb_host.h:241