Skip to content

Commit 9e814f3

Browse files
middleware: usb: update mcux usb host controller driver to support zephyr
- add one porting file to use SDK usb host driver files in Zephyr - EHCI, KHCI, OHCI and IP3516HS driver include Zephyr USB port file if it is Zephyr environment - update hal_nxp.cmake to include controller drivers, phy driver and zephyr osa. - update patch list Signed-off-by: Mark Wang <yichang.wang@nxp.com>
1 parent a8bd66e commit 9e814f3

File tree

7 files changed

+455
-35
lines changed

7 files changed

+455
-35
lines changed

mcux/README

+6
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,9 @@ Patch List:
136136
- drivers: rtwdog: Fix the issue that driver doesn't wait the over status after CS register operation
137137
- drivers: elemu: undefine BIT macro to avoid collision from util_macro.h in Zephyr
138138
- mcux-sdk-middleware-ieee_802.15.4: adapt code to be supported with Zephyr
139+
- Add usb_host_mcux_drv_port.h file for using MCUX SDK USB host controller driver easily in Zephyr.
140+
- usb_host_mcux_drv_port.h contains the simplified structs, enums and APIs that MCUX SDK USB host controller drivers need.
141+
- Update usb_host_ehci.c, usb_host_khci.c, usb_host_ohci.c and usb_host_ip3516hs.c if in Zephyr environment.
142+
- Add include of usb_host_mcux_drv_port.h.
143+
- Remove include of usb_host.h, usb_host_hci.h, usb_host_devices.h and usb_host_framework.h.
144+
- Update usb_host_ehci.c and usb_host_ip3516hs.c to not depend on usb_host_device_instance_t struct.

mcux/hal_nxp.cmake

+21
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,27 @@ if (CONFIG_UDC_DRIVER)
457457
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/include)
458458
endif()
459459

460+
if (CONFIG_UHC_DRIVER)
461+
set(CONFIG_USE_component_osa_zephyr true)
462+
463+
list(APPEND CMAKE_MODULE_PATH
464+
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/osa
465+
)
466+
list(APPEND CMAKE_MODULE_PATH
467+
${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb
468+
)
469+
include_ifdef(CONFIG_DT_HAS_NXP_USBPHY_ENABLED middleware_usb_phy)
470+
include_ifdef(CONFIG_UHC_NXP_EHCI middleware_usb_host_ehci)
471+
include_ifdef(CONFIG_UHC_NXP_KHCI middleware_usb_host_khci)
472+
include_ifdef(CONFIG_UHC_NXP_OHCI middleware_usb_host_ohci)
473+
include_ifdef(CONFIG_UHC_NXP_IP3516HS middleware_usb_host_ip3516hs)
474+
include(set_component_osa)
475+
476+
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/host)
477+
zephyr_include_directories_ifdef(CONFIG_DT_HAS_NXP_USBPHY_ENABLED, ${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/phy)
478+
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/include)
479+
endif()
480+
460481
if(${MCUX_DEVICE} MATCHES "RW61")
461482
set(CONFIG_USE_component_osa_zephyr true)
462483
if(CONFIG_NXP_FW_LOADER)

mcux/middleware/mcux-sdk-middleware-usb/host/usb_host_ehci.c

+13-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
*/
88
#include "usb_host_config.h"
99
#if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI > 0U))
10+
/* CONFIG_UHC_DRIVER is for Zephyr, it will not be defined in NXP MCUXpresso SDK */
11+
#if (defined CONFIG_UHC_DRIVER)
12+
#include "usb_host_mcux_drv_port.h"
13+
#include "fsl_device_registers.h"
14+
#include "usb_host_ehci.h"
15+
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT))
16+
#include "usb_phy.h"
17+
#endif
18+
#else
1019
#include "usb_host.h"
1120
#include "usb_host_hci.h"
1221
#include "usb_host_devices.h"
@@ -21,6 +30,7 @@
2130
#if ((defined USB_HOST_CONFIG_COMPLIANCE_TEST) && (USB_HOST_CONFIG_COMPLIANCE_TEST))
2231
#include "usb_host.h"
2332
#endif
33+
#endif
2434
#if (defined(FSL_FEATURE_MEMORY_HAS_ADDRESS_OFFSET) && (FSL_FEATURE_MEMORY_HAS_ADDRESS_OFFSET > 0U))
2535
#include "fsl_memory.h"
2636
#endif
@@ -3849,6 +3859,7 @@ static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstanc
38493859
case kUSB_HostBusL1Sleep:
38503860
if (0U != (ehciInstance->ehciIpBase->PORTSC1 & USBHS_PORTSC1_CCS_MASK))
38513861
{
3862+
uint32_t info_val;
38523863
volatile uint32_t lpm_count = 200000U;
38533864
OSA_SR_ALLOC();
38543865
/* set timer1 */
@@ -3874,11 +3885,9 @@ static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstanc
38743885
((uint32_t)ehciInstance->hirdValue << USBNC_LPM_CSR2_LPM_HST_BESL_SHIFT) |
38753886
((uint32_t)ehciInstance->L1remoteWakeupEnable << USBNC_LPM_CSR2_LPM_HST_RWKEN_SHIFT));
38763887
ehciInstance->registerNcBase->LPM_CSR2 = portScRegister;
3877-
3878-
usb_host_device_instance_t *deviceInstance;
38793888

38803889
ehciInstance->busSuspendStatus = kBus_EhciL1StartSleep;
3881-
deviceInstance = (usb_host_device_instance_t *)hostPointer->suspendedDevice;
3890+
USB_HostHelperGetPeripheralInformation(hostPointer->suspendedDevice, kUSB_HostGetDeviceAddress, &info_val);
38823891
OSA_ENTER_CRITICAL();
38833892
/* Workaroud for TKT0634948: begin */
38843893
ehciInstance->ehciIpBase->USBSTS |= USB_USBSTS_SRI_MASK;
@@ -3888,7 +3897,7 @@ static usb_status_t USB_HostEhciControlBus(usb_host_ehci_instance_t *ehciInstanc
38883897
lpm_count--;
38893898
}
38903899
ehciInstance->registerNcBase->LPM_CSR2 |= ((uint32_t)USBNC_LPM_CSR2_LPM_HST_SEND_MASK |
3891-
(((uint32_t)deviceInstance->setAddress << USBNC_LPM_CSR2_LPM_HST_DEVADD_SHIFT) &
3900+
(((uint32_t)info_val << USBNC_LPM_CSR2_LPM_HST_DEVADD_SHIFT) &
38923901
(uint32_t)USBNC_LPM_CSR2_LPM_HST_DEVADD_MASK));
38933902
/* Workaroud for TKT0634948: end */
38943903
OSA_EXIT_CRITICAL();

mcux/middleware/mcux-sdk-middleware-usb/host/usb_host_ip3516hs.c

+37-25
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@
88

99
#include "usb_host_config.h"
1010
#if (defined(USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS > 0U))
11+
#if (defined CONFIG_UHC_DRIVER)
12+
#include "usb_host_mcux_drv_port.h"
13+
#include "fsl_device_registers.h"
14+
#include "usb_host_ip3516hs.h"
15+
#else
1116
#include "usb_host.h"
1217
#include "usb_host_hci.h"
1318
#include "fsl_device_registers.h"
1419
#include "usb_host_ip3516hs.h"
1520
#include "usb_host_devices.h"
21+
#endif
1622
#if ((defined FSL_FEATURE_SOC_USBPHY_COUNT) && (FSL_FEATURE_SOC_USBPHY_COUNT > 0U))
1723
#include "usb_phy.h"
1824
#endif
@@ -352,6 +358,15 @@ static void USB_HostIp3516HsDelay(usb_host_ip3516hs_state_struct_t *usbHostState
352358
(USB_HOST_IP3516HS_FLADJ_FRINDEX_MASK >> USB_HOST_IP3516HS_FLADJ_FRINDEX_SHIFT));
353359
} while ((distance) < (ms)); /* compute the distance between sofStart and SofEnd */
354360
}
361+
362+
static uint8_t USB_HostIp3516HsGetDeviceInfo(usb_device_handle deviceHandle, uint32_t infoCode)
363+
{
364+
uint32_t info_val = 0U;
365+
366+
USB_HostHelperGetPeripheralInformation(deviceHandle, (uint32_t)infoCode, &info_val);
367+
return (uint8_t)info_val;
368+
}
369+
355370
/*seperate bus control to standlone alone function for misra Rule17.2*/
356371
static usb_status_t USB_HostIp3516HsControlBusReset(usb_host_ip3516hs_state_struct_t *usbHostState)
357372
{
@@ -471,14 +486,11 @@ static usb_status_t USB_HostIp3516HsControlBus(usb_host_ip3516hs_state_struct_t
471486
((uint32_t)usbHostState->L1remoteWakeupEnable << USB_HOST_IP3516HS_USBCMD_LPM_RWU_SHIFT));
472487
usbHostState->usbRegBase->USBCMD = portStatus;
473488

474-
usb_host_device_instance_t *deviceInstance;
475-
476489
usbHostState->busSuspendStatus = (uint8_t)kBus_Ip3516HsL1StartSleep;
477490

478-
deviceInstance = (usb_host_device_instance_t *)hostPointer->suspendedDevice;
479491
usbHostState->usbRegBase->PORTSC1 |= (uint32_t)(
480492
(uint32_t)USB_HOST_IP3516HS_PORTSC1_SUSP_MASK | (uint32_t)USB_HOST_IP3516HS_PORTSC1_SUS_L1_MASK |
481-
(((uint32_t)deviceInstance->setAddress << USB_HOST_IP3516HS_PORTSC1_DEV_ADD_SHIFT) &
493+
(((uint32_t)USB_HostIp3516HsGetDeviceInfo(hostPointer->suspendedDevice, kUSB_HostGetDeviceAddress) << USB_HOST_IP3516HS_PORTSC1_DEV_ADD_SHIFT) &
482494
(uint32_t)USB_HOST_IP3516HS_PORTSC1_DEV_ADD_MASK));
483495
#if (defined(FSL_FEATURE_USBHSH_VERSION) && (FSL_FEATURE_USBHSH_VERSION >= 300U))
484496
#else
@@ -1126,7 +1138,7 @@ static usb_status_t USB_HostIp3516HsFindStartFrame(usb_host_ip3516hs_state_struc
11261138
uint32_t total = 0U;
11271139
void *temp;
11281140
uint8_t slotTime[8];
1129-
uint8_t speed = ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed;
1141+
uint8_t speed = USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed);
11301142

11311143
pipe->startUFrame = 0U;
11321144

@@ -1280,7 +1292,7 @@ static usb_status_t USB_HostIp3516BaudWidthCheck(usb_host_ip3516hs_state_struct_
12801292
usb_host_ip3516hs_pipe_struct_t *pipe)
12811293
{
12821294
usb_status_t error;
1283-
uint8_t speed = ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed;
1295+
uint8_t speed = USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed);
12841296
OSA_SR_ALLOC();
12851297

12861298
pipe->busHsTime = (uint16_t)USB_HostIp3516HsBusTime(
@@ -1334,11 +1346,11 @@ static usb_status_t USB_HostIp3516HsOpenControlBulkPipe(usb_host_ip3516hs_state_
13341346
atl->control1Union.stateBitField.Mult = pipe->pipeCommon.numberPerUframe;
13351347
atl->control2Union.stateBitField.EP = pipe->pipeCommon.endpointAddress;
13361348
atl->control2Union.stateBitField.DeviceAddress =
1337-
((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->setAddress;
1349+
USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress);
13381350
if (USB_SPEED_HIGH == usbHostState->portState[0].portSpeed)
13391351
{
13401352
atl->control2Union.stateBitField.S =
1341-
(USB_SPEED_HIGH == ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed) ? 0U : 1U;
1353+
(USB_SPEED_HIGH == USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed)) ? 0U : 1U;
13421354
}
13431355
else
13441356
{
@@ -1347,16 +1359,16 @@ static usb_status_t USB_HostIp3516HsOpenControlBulkPipe(usb_host_ip3516hs_state_
13471359
atl->control2Union.stateBitField.RL = 0xFU;
13481360
atl->stateUnion.stateBitField.NakCnt = 0xFU;
13491361
atl->control2Union.stateBitField.SE =
1350-
(USB_SPEED_LOW == ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed) ? 2U : 0U;
1362+
(USB_SPEED_LOW == USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed)) ? 2U : 0U;
13511363
atl->control2Union.stateBitField.PortNumber =
13521364
#if (defined(USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB > 0U))
1353-
((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->hsHubPort;
1365+
USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubPort);
13541366
#else
13551367
0U;
13561368
#endif
13571369
atl->control2Union.stateBitField.HubAddress =
13581370
#if (defined(USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB > 0U))
1359-
((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->hsHubNumber;
1371+
USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubNumber);
13601372
#else
13611373
0U;
13621374
#endif
@@ -1433,11 +1445,11 @@ static usb_status_t USB_HostIp3516HsOpenIsoPipe(usb_host_ip3516hs_state_struct_t
14331445
ptl->control1Union.stateBitField.Mult = pipe->pipeCommon.numberPerUframe;
14341446
ptl->control2Union.stateBitField.EP = pipe->pipeCommon.endpointAddress;
14351447
ptl->control2Union.stateBitField.DeviceAddress =
1436-
((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->setAddress;
1448+
USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress);
14371449
if (USB_SPEED_HIGH == usbHostState->portState[0].portSpeed)
14381450
{
14391451
ptl->control2Union.stateBitField.S =
1440-
(USB_SPEED_HIGH == ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed) ? 0U : 1U;
1452+
(USB_SPEED_HIGH == USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed)) ? 0U : 1U;
14411453
}
14421454
else
14431455
{
@@ -1446,18 +1458,18 @@ static usb_status_t USB_HostIp3516HsOpenIsoPipe(usb_host_ip3516hs_state_struct_t
14461458
ptl->control2Union.stateBitField.RL = 0U;
14471459
ptl->stateUnion.stateBitField.NakCnt = 0U;
14481460
ptl->control2Union.stateBitField.SE =
1449-
(USB_SPEED_LOW == ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed) ? 2U : 0U;
1461+
(USB_SPEED_LOW == USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed)) ? 2U : 0U;
14501462
if (0U != ptl->control2Union.stateBitField.S)
14511463
{
14521464
sptl->control2Union.stateBitField.PortNumber =
14531465
#if (defined(USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB > 0U))
1454-
((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->hsHubPort;
1466+
USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubPort);
14551467
#else
14561468
0U;
14571469
#endif
14581470
sptl->control2Union.stateBitField.HubAddress =
14591471
#if (defined(USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB > 0U))
1460-
((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->hsHubNumber;
1472+
USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubNumber);
14611473
#else
14621474
0U;
14631475
#endif
@@ -1523,11 +1535,11 @@ static usb_status_t USB_HostIp3516HsOpenInterruptPipe(usb_host_ip3516hs_state_st
15231535
ptl->control1Union.stateBitField.Mult = pipe->pipeCommon.numberPerUframe;
15241536
ptl->control2Union.stateBitField.EP = pipe->pipeCommon.endpointAddress;
15251537
ptl->control2Union.stateBitField.DeviceAddress =
1526-
((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->setAddress;
1538+
USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceAddress);
15271539
if (USB_SPEED_HIGH == usbHostState->portState[0].portSpeed)
15281540
{
15291541
ptl->control2Union.stateBitField.S =
1530-
(USB_SPEED_HIGH == ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed) ? 0U : 1U;
1542+
(USB_SPEED_HIGH == USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed)) ? 0U : 1U;
15311543
}
15321544
else
15331545
{
@@ -1536,18 +1548,18 @@ static usb_status_t USB_HostIp3516HsOpenInterruptPipe(usb_host_ip3516hs_state_st
15361548
ptl->control2Union.stateBitField.RL = 0xFU;
15371549
ptl->stateUnion.stateBitField.NakCnt = 0xFU;
15381550
ptl->control2Union.stateBitField.SE =
1539-
(USB_SPEED_LOW == ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed) ? 2U : 0U;
1551+
(USB_SPEED_LOW == USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed)) ? 2U : 0U;
15401552
if (0U != ptl->control2Union.stateBitField.S)
15411553
{
15421554
sptl->control2Union.stateBitField.PortNumber =
15431555
#if (defined(USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB > 0U))
1544-
((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->hsHubPort;
1556+
USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubPort);
15451557
#else
15461558
0U;
15471559
#endif
15481560
sptl->control2Union.stateBitField.HubAddress =
15491561
#if (defined(USB_HOST_CONFIG_HUB) && (USB_HOST_CONFIG_HUB > 0U))
1550-
((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->hsHubNumber;
1562+
USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceHSHubNumber);
15511563
#else
15521564
0U;
15531565
#endif
@@ -2221,7 +2233,7 @@ static usb_status_t USB_HostIp3516HsWriteIsoPipe(usb_host_ip3516hs_state_struct_
22212233
indexLength_t indexLength;
22222234
uint8_t *bufferAddress;
22232235
void *temp;
2224-
uint8_t speed = ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed;
2236+
uint8_t speed = USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed);
22252237
OSA_SR_ALLOC();
22262238

22272239
OSA_ENTER_CRITICAL();
@@ -2425,7 +2437,7 @@ static usb_status_t USB_HostIp3516HsWriteInterruptPipe(usb_host_ip3516hs_state_s
24252437
uint32_t insertUFrame;
24262438
uint8_t *bufferAddress;
24272439
void *temp;
2428-
uint8_t speed = ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed;
2440+
uint8_t speed = USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed);
24292441
temp = (void *)ptl;
24302442
sptl = (usb_host_ip3516hs_sptl_struct_t *)temp;
24312443
OSA_SR_ALLOC();
@@ -3586,7 +3598,7 @@ usb_status_t USB_HostIp3516HsOpenPipe(usb_host_controller_handle controllerHandl
35863598
}
35873599
else if (USB_ENDPOINT_INTERRUPT == pipe->pipeCommon.pipeType)
35883600
{
3589-
if (USB_SPEED_HIGH != ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed)
3601+
if (USB_SPEED_HIGH != USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed))
35903602
{
35913603
uint32_t interval = 0U;
35923604
/* FS/LS interrupt interval should be the power of 2, it is used for ip3516hs bandwidth */
@@ -3613,7 +3625,7 @@ usb_status_t USB_HostIp3516HsOpenPipe(usb_host_controller_handle controllerHandl
36133625
pipe->pipeCommon.interval = 0U;
36143626
}
36153627

3616-
if (USB_SPEED_HIGH != ((usb_host_device_instance_t *)pipe->pipeCommon.deviceHandle)->speed)
3628+
if (USB_SPEED_HIGH != USB_HostIp3516HsGetDeviceInfo(pipe->pipeCommon.deviceHandle, kUSB_HostGetDeviceSpeed))
36173629
{
36183630
pipe->pipeCommon.interval = pipe->pipeCommon.interval << 3;
36193631
}

mcux/middleware/mcux-sdk-middleware-usb/host/usb_host_khci.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88

99
#include "usb_host_config.h"
1010
#if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI))
11+
/* CONFIG_UHC_DRIVER is for Zephyr, it will not be defined in NXP MCUXpresso SDK */
12+
#if (defined CONFIG_UHC_DRIVER)
13+
#include "usb_host_mcux_drv_port.h"
14+
#include "fsl_device_registers.h"
15+
#include "usb_host_khci.h"
16+
#else
1117
#include "usb_host.h"
1218
#include "usb_host_hci.h"
1319
#include "fsl_device_registers.h"
1420
#include "usb_host_khci.h"
1521
#include "usb_host_devices.h"
1622
#include "usb_host_framework.h"
23+
#endif
1724
/*******************************************************************************
1825
* Variables
1926
******************************************************************************/
@@ -1723,11 +1730,11 @@ usb_status_t USB_HostKhciOpenPipe(usb_host_controller_handle controllerHandle,
17231730
else
17241731
{
17251732
tempPipePointer = usbHostPointer->pipeDescriptorBasePointer;
1726-
while (NULL != tempPipePointer)
1733+
do
17271734
{
17281735
prePipePointer = tempPipePointer;
17291736
tempPipePointer = tempPipePointer->next;
1730-
}
1737+
} while (NULL != tempPipePointer);
17311738
prePipePointer->next = pipePointer;
17321739
}
17331740
pipePointer->next = NULL;

0 commit comments

Comments
 (0)