Skip to content

Commit 0e26144

Browse files
Gadgetoiddpgeorge
authored andcommitted
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 <[email protected]>
1 parent 0dd25a3 commit 0e26144

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

ports/rp2/machine_uart.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,9 @@ static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
369369

370370
uart_init(self->uart, self->baudrate);
371371
uart_set_format(self->uart, self->bits, self->stop, self->parity);
372-
__DSB(); // make sure UARTLCR_H register is written to
372+
__dsb(); // make sure UARTLCR_H register is written to
373373
uart_set_fifo_enabled(self->uart, true);
374-
__DSB(); // make sure UARTLCR_H register is written to
374+
__dsb(); // make sure UARTLCR_H register is written to
375375
gpio_set_function(self->tx, GPIO_FUNC_UART);
376376
gpio_set_function(self->rx, GPIO_FUNC_UART);
377377
if (self->invert & UART_INVERT_RX) {

ports/rp2/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "genhdr/mpversion.h"
4848
#include "mp_usbd.h"
4949

50+
#include "RP2040.h" // cmsis, for PendSV_IRQn and SCB/SCB_SCR_SEVONPEND_Msk
5051
#include "pico/stdlib.h"
5152
#include "pico/binary_info.h"
5253
#include "pico/unique_id.h"

ports/rp2/mphalport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "pico/time.h"
3131
#include "hardware/clocks.h"
3232
#include "hardware/structs/systick.h"
33-
#include "RP2040.h" // cmsis, for __WFI
3433
#include "pendsv.h"
3534

3635
#define SYSTICK_MAX (0xffffff)

ports/rp2/mpnetworkport.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ static soft_timer_entry_t mp_network_soft_timer;
4343
#include "lib/cyw43-driver/src/cyw43.h"
4444
#include "lib/cyw43-driver/src/cyw43_stats.h"
4545
#include "hardware/irq.h"
46+
#include "RP2040.h" // cmsis, for NVIC_SetPriority and PendSV_IRQn
4647

4748
#define CYW43_IRQ_LEVEL GPIO_IRQ_LEVEL_HIGH
4849
#define CYW43_SHARED_IRQ_HANDLER_PRIORITY PICO_SHARED_IRQ_HANDLER_HIGHEST_ORDER_PRIORITY
@@ -57,7 +58,7 @@ static void gpio_irq_handler(void) {
5758
// CYW43_POST_POLL_HOOK which is called at the end of cyw43_poll_func.
5859
gpio_set_irq_enabled(CYW43_PIN_WL_HOST_WAKE, CYW43_IRQ_LEVEL, false);
5960
cyw43_has_pending = 1;
60-
__SEV();
61+
__sev();
6162
pendsv_schedule_dispatch(PENDSV_DISPATCH_CYW43, cyw43_poll);
6263
CYW43_STAT_INC(IRQ_COUNT);
6364
}

0 commit comments

Comments
 (0)