diff options
| author | Phil Howard <phil@gadgetoid.com> | 2024-06-27 14:51:12 +0100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-07-01 11:27:42 +1000 |
| commit | 0e261443be9a9201fd786b54aa2d0198f21543f7 (patch) | |
| tree | 2e792aa1c1a4de4f360998d0a0ff4a7452050ae8 | |
| parent | 0dd25a369e70118829b3f176151c50440286e3fe (diff) | |
rp2: Replace CMSIS funcs with Pico SDK equivalents.
Pico SDK defines `__dsb()` and `__sev()` so use those instead of the CMSIS
equivalents. This matches the use of `__wfi()` in lieu of `__WFI()` and
lowers the dependency on CMSIS headers.
And then, move the include of "RP2040.h" from the widely-included
"mphalport.h" to specific source files that need this header, to keep its
inclusion contained.
Signed-off-by: Phil Howard <phil@gadgetoid.com>
| -rw-r--r-- | ports/rp2/machine_uart.c | 4 | ||||
| -rw-r--r-- | ports/rp2/main.c | 1 | ||||
| -rw-r--r-- | ports/rp2/mphalport.h | 1 | ||||
| -rw-r--r-- | ports/rp2/mpnetworkport.c | 3 |
4 files changed, 5 insertions, 4 deletions
diff --git a/ports/rp2/machine_uart.c b/ports/rp2/machine_uart.c index ccbf8f781..d9e97685f 100644 --- a/ports/rp2/machine_uart.c +++ b/ports/rp2/machine_uart.c @@ -369,9 +369,9 @@ static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, uart_init(self->uart, self->baudrate); uart_set_format(self->uart, self->bits, self->stop, self->parity); - __DSB(); // make sure UARTLCR_H register is written to + __dsb(); // make sure UARTLCR_H register is written to uart_set_fifo_enabled(self->uart, true); - __DSB(); // make sure UARTLCR_H register is written to + __dsb(); // make sure UARTLCR_H register is written to gpio_set_function(self->tx, GPIO_FUNC_UART); gpio_set_function(self->rx, GPIO_FUNC_UART); if (self->invert & UART_INVERT_RX) { diff --git a/ports/rp2/main.c b/ports/rp2/main.c index 5fb47cc40..3b4d351a7 100644 --- a/ports/rp2/main.c +++ b/ports/rp2/main.c @@ -47,6 +47,7 @@ #include "genhdr/mpversion.h" #include "mp_usbd.h" +#include "RP2040.h" // cmsis, for PendSV_IRQn and SCB/SCB_SCR_SEVONPEND_Msk #include "pico/stdlib.h" #include "pico/binary_info.h" #include "pico/unique_id.h" diff --git a/ports/rp2/mphalport.h b/ports/rp2/mphalport.h index bc09f8c4a..16ac4259a 100644 --- a/ports/rp2/mphalport.h +++ b/ports/rp2/mphalport.h @@ -30,7 +30,6 @@ #include "pico/time.h" #include "hardware/clocks.h" #include "hardware/structs/systick.h" -#include "RP2040.h" // cmsis, for __WFI #include "pendsv.h" #define SYSTICK_MAX (0xffffff) diff --git a/ports/rp2/mpnetworkport.c b/ports/rp2/mpnetworkport.c index 4690a4e51..e58adb3ba 100644 --- a/ports/rp2/mpnetworkport.c +++ b/ports/rp2/mpnetworkport.c @@ -43,6 +43,7 @@ static soft_timer_entry_t mp_network_soft_timer; #include "lib/cyw43-driver/src/cyw43.h" #include "lib/cyw43-driver/src/cyw43_stats.h" #include "hardware/irq.h" +#include "RP2040.h" // cmsis, for NVIC_SetPriority and PendSV_IRQn #define CYW43_IRQ_LEVEL GPIO_IRQ_LEVEL_HIGH #define CYW43_SHARED_IRQ_HANDLER_PRIORITY PICO_SHARED_IRQ_HANDLER_HIGHEST_ORDER_PRIORITY @@ -57,7 +58,7 @@ static void gpio_irq_handler(void) { // CYW43_POST_POLL_HOOK which is called at the end of cyw43_poll_func. gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, CYW43_IRQ_LEVEL, false); cyw43_has_pending = 1; - __SEV(); + __sev(); pendsv_schedule_dispatch(PENDSV_DISPATCH_CYW43, cyw43_poll); CYW43_STAT_INC(IRQ_COUNT); } |
