diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-18 11:18:02 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-18 11:18:02 -0600 |
commit | 4469398272d78adb81968178276180f16cc8e647 (patch) | |
tree | c360226922c543a5d2fd985ca1e078bb8a603f72 /usb_common.c | |
parent | 05ce08877ff420ca9fc77599dd947ff610d02cb0 (diff) |
fixes for arm?
Diffstat (limited to 'usb_common.c')
-rw-r--r-- | usb_common.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/usb_common.c b/usb_common.c index 65882b2..f10ace8 100644 --- a/usb_common.c +++ b/usb_common.c @@ -8,7 +8,7 @@ #include <string.h> /* memcpy(newlib) */ #include <assert.h> /* for assert(newlib) */ #include <stdlib.h> /* for malloc(pico_malloc), realloc(pico_malloc), reallocarray(pico_malloc) */ -#include "bsp/board_api.h" /* for board_usb_get_serial(TinyUSB) */ +#include "bsp/board_api.h" /* for board_init(), board_init_after_usb(), board_usb_get_serial(TinyUSB) */ #include "tusb.h" /* for various tusb_*_t types */ #include "tusb_helpers.h" /* for LANGID_*, TU_UTF16() */ @@ -71,7 +71,7 @@ uint16_t const *tud_descriptor_string_cb(uint8_t strid, uint16_t langid) { uint8_t cfgnum_std = 0; -void usb_common_init(void) { +void usb_common_earlyinit(void) { if (cfgnum_std) return; cfgnum_std = usb_add_config( @@ -80,6 +80,25 @@ void usb_common_init(void) { 100); /* bMaxPower (in mA) ; Maximum power consumption of the device when in this configuration */ } +void usb_common_lateinit(void) { + board_init(); + tud_init(BOARD_TUD_RHPORT); + if (board_init_after_tusb) + board_init_after_tusb(); +} + +COROUTINE usb_common_cr(void *_arg) { + (void) _arg; + cr_begin(); + + for (;;) { + tud_task(); + cr_yield(); + } + + cr_end(); +} + /* Main utilities *************************************************************/ static uint8_t configc = 0; |