Skip to content

Commit 4fa5cab

Browse files
MarkWangChinesedleach02
authored andcommitted
sdk-ng: usb: disable usb controller zlt
Zephyr USB device stack handles the zlt and the NXP usb controller drivers process the control endpoint zlt defaultly, disable it in controller driver if in Zephyr environment. Signed-off-by: Mark Wang <[email protected]>
1 parent 0481c98 commit 4fa5cab

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

mcux/mcux-sdk-ng/middleware/usb/device/usb_device_ehci.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,10 @@ static usb_status_t USB_DeviceEhciTransfer(usb_device_ehci_state_struct_t *ehciS
10821082
uint8_t qhIdle = 0U;
10831083
uint8_t waitingSafelyAccess = 1U;
10841084
uint32_t primeTimesCount = 0U;
1085+
/* CONFIG_UDC_DRIVER is for Zephyr, it will not be defined in NXP MCUXpresso SDK */
1086+
#if !((defined CONFIG_UDC_DRIVER) && (CONFIG_UDC_DRIVER))
10851087
void *temp;
1088+
#endif
10861089
OSA_SR_ALLOC();
10871090

10881091
if (NULL == ehciState)
@@ -1202,6 +1205,8 @@ static usb_status_t USB_DeviceEhciTransfer(usb_device_ehci_state_struct_t *ehciS
12021205
qhIdle = 1U;
12031206
}
12041207
} while (0U != length);
1208+
/* CONFIG_UDC_DRIVER is for Zephyr, it will not be defined in NXP MCUXpresso SDK */
1209+
#if !((defined CONFIG_UDC_DRIVER) && (CONFIG_UDC_DRIVER))
12051210
if ((USB_CONTROL_ENDPOINT == (endpointAddress & USB_ENDPOINT_NUMBER_MASK)) &&
12061211
(USB_IN == ((endpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_MASK) >>
12071212
USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT)))
@@ -1222,6 +1227,7 @@ static usb_status_t USB_DeviceEhciTransfer(usb_device_ehci_state_struct_t *ehciS
12221227
}
12231228
}
12241229
}
1230+
#endif
12251231
/* If the QH is not empty */
12261232
if (0U == qhIdle)
12271233
{

mcux/mcux-sdk-ng/middleware/usb/device/usb_device_lpcip3511.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,11 @@ static void USB_DeviceLpc3511IpInterruptToken(usb_device_lpc3511ip_state_struct_
11261126
usb_device_callback_message_struct_t message;
11271127
uint32_t length;
11281128
uint32_t remainLength;
1129+
/* CONFIG_UDC_DRIVER is for Zephyr, it will not be defined in NXP MCUXpresso SDK */
1130+
#if !((defined CONFIG_UDC_DRIVER) && (CONFIG_UDC_DRIVER))
11291131
usb_setup_struct_t *setupPacket;
11301132
void *temp;
1133+
#endif
11311134
usb_device_lpc3511ip_endpoint_state_struct_t *epState =
11321135
USB_DeviceLpc3511IpGetEndpointStateStruct(lpc3511IpState, endpointIndex);
11331136
#if (defined USB_DEVICE_IP3511_DOUBLE_BUFFER_ENABLE) && (USB_DEVICE_IP3511_DOUBLE_BUFFER_ENABLE)
@@ -1366,6 +1369,8 @@ static void USB_DeviceLpc3511IpInterruptToken(usb_device_lpc3511ip_state_struct_
13661369
if ((0U != (endpointIndex & 0x01U)) && (0U != length) &&
13671370
(0U == (length % epState->stateUnion.stateBitField.maxPacketSize)))
13681371
{
1372+
/* CONFIG_UDC_DRIVER is for Zephyr, it will not be defined in NXP MCUXpresso SDK */
1373+
#if !((defined CONFIG_UDC_DRIVER) && (CONFIG_UDC_DRIVER))
13691374
if ((endpointIndex >> 1U) == USB_CONTROL_ENDPOINT)
13701375
{
13711376
temp = (void *)(&(lpc3511IpState->setupData[0]));
@@ -1389,7 +1394,9 @@ static void USB_DeviceLpc3511IpInterruptToken(usb_device_lpc3511ip_state_struct_
13891394
return;
13901395
}
13911396
}
1392-
else if ((0U != epState->stateUnion.stateBitField.zlt))
1397+
else
1398+
#endif
1399+
if ((0U != epState->stateUnion.stateBitField.zlt))
13931400
{
13941401
#if (defined(USB_DEVICE_CONFIG_RETURN_VALUE_CHECK) && (USB_DEVICE_CONFIG_RETURN_VALUE_CHECK > 0U))
13951402
if (kStatus_USB_Success !=

0 commit comments

Comments
 (0)