ports: Adapt mimxrt, nrf and rp2 ports to work with latest TinyUSB.

rp2: change tud_task() to tud_task_ext().

mimxrt: use lib/tinyusb/src/portable/chipidea/ci_hs/dcd_ci_hs.c instead of
lib/tinyusb/src/portable/nxp/transdimension/dcd_transdimension.c.

nrf: add a definition for the changed tud_task().  tud_task() is changed
to tud_task_ext(), and the #define for backward compatibility is in
src/device/usbd.h.

The items I know which are fixed with this version:
- Fix for the SAMD USB lock-up.
- Support the MIMXRT11XX series of MCUs.
- Fix a wrong pin definition for MIMXRT1050_EVKB.

Tested with the MIMXRT boards, rp2 Pico, SAMD boards, nrf board.
This commit is contained in:
robert-hh 2022-07-18 15:38:04 +02:00 committed by Damien George
parent d1ef3815e6
commit 80339f1a33
3 changed files with 3 additions and 2 deletions

View File

@ -91,7 +91,7 @@ SRC_TINYUSB_C += \
lib/tinyusb/src/common/tusb_fifo.c \
lib/tinyusb/src/device/usbd.c \
lib/tinyusb/src/device/usbd_control.c \
lib/tinyusb/src/portable/nxp/transdimension/dcd_transdimension.c \
lib/tinyusb/src/portable/chipidea/ci_hs/dcd_ci_hs.c \
lib/tinyusb/src/tusb.c
# All settings for Ethernet support are controller by the value of MICROPY_PY_LWIP

View File

@ -311,6 +311,7 @@ typedef long mp_off_t;
#define MP_STATE_PORT MP_STATE_VM
#if MICROPY_HW_USB_CDC
#include "device/usbd.h"
#define MICROPY_HW_USBDEV_TASK_HOOK extern void tud_task(void); tud_task();
#else
#define MICROPY_HW_USBDEV_TASK_HOOK ;

View File

@ -220,7 +220,7 @@ extern void mp_thread_end_atomic_section(uint32_t);
#define MICROPY_PY_LWIP_EXIT lwip_lock_release();
#if MICROPY_HW_ENABLE_USBDEV
#define MICROPY_HW_USBDEV_TASK_HOOK extern void tud_task(void); tud_task();
#define MICROPY_HW_USBDEV_TASK_HOOK extern void tud_task_ext(uint32_t, bool); tud_task_ext(0, false);
#define MICROPY_VM_HOOK_COUNT (10)
#define MICROPY_VM_HOOK_INIT static uint vm_hook_divisor = MICROPY_VM_HOOK_COUNT;
#define MICROPY_VM_HOOK_POLL if (get_core_num() == 0 && --vm_hook_divisor == 0) { \