summaryrefslogtreecommitdiff
path: root/hw/bsp
diff options
context:
space:
mode:
authorZixun LI <[email protected]>2025-12-02 12:00:59 +0100
committerZixun LI <[email protected]>2025-12-02 12:00:59 +0100
commit7a4af1e9b833d334cca8fa98bc200d4738cb6b82 (patch)
treed92ff05ba76c9f752a418089bad64cdc3c42535d /hw/bsp
parent97c5151b34158f08fbfb51684cbfbc807abd77e5 (diff)
parent7ee288bc223db393d68c7bdb09bf7c05ffd2eb03 (diff)
Merge remote-tracking branch 'tinyusb/master' into hcd_fsdev
Diffstat (limited to 'hw/bsp')
-rw-r--r--hw/bsp/nrf/family.c9
-rw-r--r--hw/bsp/nrf/family.cmake4
2 files changed, 12 insertions, 1 deletions
diff --git a/hw/bsp/nrf/family.c b/hw/bsp/nrf/family.c
index 25062b18f..ee3ac61e2 100644
--- a/hw/bsp/nrf/family.c
+++ b/hw/bsp/nrf/family.c
@@ -100,7 +100,9 @@ static nrfx_uarte_t _uart_id = NRFX_UARTE_INSTANCE(120);
#define OUTPUTRDY_Msk POWER_USBREGSTATUS_OUTPUTRDY_Msk
#endif
+#if CFG_TUSB_OS != OPT_OS_ZEPHYR
static nrfx_uarte_t _uart_id = NRFX_UARTE_INSTANCE(0);
+#endif
void USBD_IRQHandler(void) {
tud_int_handler(0);
@@ -163,6 +165,7 @@ void board_init(void) {
irq_enable(DT_INST_IRQN(0));
#endif
+#if CFG_TUSB_OS != OPT_OS_ZEPHYR
// UART
nrfx_uarte_config_t uart_cfg = {
.txd_pin = UART_TX_PIN,
@@ -179,6 +182,7 @@ void board_init(void) {
};
nrfx_uarte_init(&_uart_id, &uart_cfg, NULL);
+#endif
//------------- USB -------------//
#if CFG_TUD_ENABLED
@@ -276,8 +280,13 @@ int board_uart_read(uint8_t* buf, int len) {
}
int board_uart_write(void const* buf, int len) {
+#if CFG_TUSB_OS == OPT_OS_ZEPHYR
+ (void) buf;
+ return len;
+#else
nrfx_err_t err = nrfx_uarte_tx(&_uart_id, (uint8_t const*) buf, (size_t) len ,0);
return (NRFX_SUCCESS == err) ? len : 0;
+#endif
}
#if CFG_TUSB_OS == OPT_OS_NONE
diff --git a/hw/bsp/nrf/family.cmake b/hw/bsp/nrf/family.cmake
index 4e999b636..3a6e7cc8b 100644
--- a/hw/bsp/nrf/family.cmake
+++ b/hw/bsp/nrf/family.cmake
@@ -127,7 +127,9 @@ function(family_configure_example TARGET RTOS)
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
)
- if (NOT RTOS STREQUAL zephyr)
+ if (RTOS STREQUAL zephyr)
+ target_include_directories(${TARGET} PUBLIC ${ZEPHYR_HAL_NORDIC_MODULE_DIR}/nrfx/bsp/stable/mdk)
+ else ()
target_sources(${TARGET} PRIVATE ${STARTUP_FILE_${CMAKE_C_COMPILER_ID}})
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")