Skip to content

Commit fa1e385

Browse files
zeonchewkartben
authored andcommitted
drivers: udc_ambiq: fix compilation issue after dwc2 header removal
udc_ambiq was using USB test mode definition in dwc2 header, which the include was removed, hence compilation now fails. This commit fixes the compilation failure. Signed-off-by: Chew Zeh Yang <zeon.chew@ambiq.com>
1 parent 932953d commit fa1e385

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

drivers/usb/udc/udc_ambiq.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,16 +403,16 @@ static int udc_ambiq_test_mode(const struct device *dev, const uint8_t mode, con
403403
struct udc_ambiq_data *priv = udc_get_private(dev);
404404

405405
switch (mode) {
406-
case USB_DWC2_DCTL_TSTCTL_TESTJ:
406+
case USB_SFS_TEST_MODE_J:
407407
am_usb_test_mode = AM_HAL_USB_TEST_J;
408408
break;
409-
case USB_DWC2_DCTL_TSTCTL_TESTK:
409+
case USB_SFS_TEST_MODE_K:
410410
am_usb_test_mode = AM_HAL_USB_TEST_K;
411411
break;
412-
case USB_DWC2_DCTL_TSTCTL_TESTSN:
412+
case USB_SFS_TEST_MODE_SE0_NAK:
413413
am_usb_test_mode = AM_HAL_USB_TEST_SE0_NAK;
414414
break;
415-
case USB_DWC2_DCTL_TSTCTL_TESTPM:
415+
case USB_SFS_TEST_MODE_PACKET:
416416
am_usb_test_mode = AM_HAL_USB_TEST_PACKET;
417417
break;
418418
default:

include/zephyr/usb/usb_ch9.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ static inline bool usb_reqtype_is_to_device(const struct usb_setup_packet *setup
136136
#define USB_SFS_REMOTE_WAKEUP 0x01
137137
#define USB_SFS_TEST_MODE 0x02
138138

139+
/** USB Test Mode Selectors defined in spec. Table 9-7 */
140+
#define USB_SFS_TEST_MODE_J 0x01
141+
#define USB_SFS_TEST_MODE_K 0x02
142+
#define USB_SFS_TEST_MODE_SE0_NAK 0x03
143+
#define USB_SFS_TEST_MODE_PACKET 0x04
144+
#define USB_SFS_TEST_MODE_FORCE_ENABLE 0x05
145+
139146
/** Bits used for GetStatus response defined in spec. Figure 9-4 */
140147
#define USB_GET_STATUS_SELF_POWERED BIT(0)
141148
#define USB_GET_STATUS_REMOTE_WAKEUP BIT(1)

0 commit comments

Comments
 (0)