Skip to content

Commit 0e26a7c

Browse files
committed
cpu/rp2350_common: create shared folder for RISCV & ARM
1 parent 677b63f commit 0e26a7c

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma once
2+
3+
#include "periph_cpu.h"
4+
5+
#ifdef RP2350_USE_RISCV
6+
# include "xh3irq.h"
7+
#endif
8+
9+
static inline void rp_irq_enable(uint32_t irq_no)
10+
{
11+
#ifdef RP2350_USE_RISCV
12+
xh3irq_enable_irq(irq_no);
13+
#else
14+
NVIC_EnableIRQ(irq_no);
15+
#endif
16+
}
17+
18+
static inline void rp_end_isr(void)
19+
{
20+
#ifdef RP2350_USE_ARM
21+
cortexm_isr_end();
22+
#endif
23+
}

cpu/rp2350_common/periph/uart.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
* @author Tom Hert <[email protected]>
1515
*/
1616

17-
#include "periph/uart.h"
18-
17+
#include "board.h"
18+
#include "compat_layer.h"
1919
#include "periph_cpu.h"
2020

2121
#include "regs/uart.h"
22-
#include <RP2350.h>
22+
#include "periph/uart.h"
2323

2424
#define ENABLE_DEBUG 0
2525
#include "debug.h"
@@ -47,12 +47,8 @@ void _irq_enable(uart_t uart) {
4747
UART0_Type *dev = uart_config[uart].dev;
4848
/* We set the UART Receive Interrupt Mask (Bit 4) [See p979 UART 12.1]*/
4949
dev->UARTIMSC = UART0_UARTIMSC_RXIM_Msk;
50-
/* Enable the IRQ in the NVIC */
51-
#ifdef RP2350_USE_RISCV
52-
xh3irq_enable_irq(uart_config[uart].irqn);
53-
#else
54-
NVIC_EnableIRQ(uart_config[uart].irqn);
55-
#endif
50+
/* Enable the IRQ */
51+
rp_irq_enable(uart_config[uart].irqn);
5652
}
5753

5854
int uart_mode(uart_t uart, uart_data_bits_t data_bits, uart_parity_t parity,
@@ -222,16 +218,12 @@ void isr_handler(uint8_t num) {
222218
/** Overwrites the WEAK_DEFAULT isr_uart0 */
223219
void isr_uart0(void) {
224220
isr_handler(0);
225-
#ifdef RP2350_USE_ARM
226-
cortexm_isr_end();
227-
#endif
221+
rp_end_isr();
228222
}
229223

230224
void isr_uart1(void) {
231225
isr_handler(1);
232-
#ifdef RP2350_USE_ARM
233-
cortexm_isr_end();
234-
#endif
226+
rp_end_isr();
235227
}
236228

237229
/** @} */

0 commit comments

Comments
 (0)