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>
This commit is contained in:
committed by
Damien George
parent
0dd25a369e
commit
0e261443be
@@ -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) {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user