Skip to content

Commit

Permalink
[ext] Update TinyUSB to v0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Nov 3, 2024
1 parent bd36edf commit 31f8141
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/hathach/tinyusb
Submodule tinyusb updated 120 files
11 changes: 10 additions & 1 deletion ext/rp/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ irq_set_exclusive_handler(int irqn, void (*handler)(void))
{
(void) irqn;
(void) handler;
// do nothing, irq implemented at modm
// do nothing, irq implemented in modm
}

static inline void
Expand All @@ -37,6 +37,15 @@ irq_add_shared_handler(unsigned int irqn, void (*handler)(void), uint8_t order_p
(void) irqn;
(void) handler;
(void) order_priority;
// do nothing, irq implemented in modm
}

static inline void
irq_remove_handler(unsigned int irqn, void (*handler)(void))
{
(void) irqn;
(void) handler;
// do nothing, irq implemented in modm
}

#define PICO_SHARED_IRQ_HANDLER_HIGHEST_ORDER_PRIORITY 0xff
7 changes: 7 additions & 0 deletions ext/rp/pico.cpp.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "pico.h"
#include "hardware/resets.h"
#include "hardware/regs/sysinfo.h"

#include <modm/platform/core/resets.hpp>
%% if with_debug
Expand Down Expand Up @@ -31,3 +32,9 @@ extern "C" void panic(const char *fmt, ...)
%% endif
modm_assert(0, "pico", "Pico-SDK panic!");
}

extern "C" uint8_t rp2040_chip_version(void)
{
const uint32_t chip_id = *((const uint32_t*)(SYSINFO_BASE + SYSINFO_CHIP_ID_OFFSET));
return (chip_id & SYSINFO_CHIP_ID_REVISION_BITS) >> SYSINFO_CHIP_ID_REVISION_LSB;
}
12 changes: 12 additions & 0 deletions ext/rp/pico.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ typedef unsigned int uint;
void
panic(const char* /*fmt*/, ...);

uint8_t rp2040_chip_version(void);

static inline void
busy_wait_at_least_cycles(uint32_t minimum_cycles)
{
asm volatile(
"1: sub %0, #3\t\n"
"bcs 1b\t\n"
: "+l" (minimum_cycles) : : "cc", "memory"
);
}

#ifdef __cplusplus
}
#endif

0 comments on commit 31f8141

Please sign in to comment.