Skip to content

Commit 62815c1

Browse files
committed
# This is a combination of 11 commits.
# This is the 1st commit message: cpu/rp2350_common: create shared folder for RISCV & ARM # The commit message #2 will be skipped: # fixup! cpu/rp2350_common: create shared folder for RISCV & ARM # The commit message #3 will be skipped: # fixup! cpu/rp2350_common: create shared folder for RISCV & ARM # The commit message #4 will be skipped: # fixup! cpu/rp2350_common: create shared folder for RISCV & ARM # The commit message #5 will be skipped: # fixup! cpu/rp2350_common: create shared folder for RISCV & ARM # The commit message #6 will be skipped: # fixup! cpu/rp2350_common: create shared folder for RISCV & ARM # The commit message #7 will be skipped: # fixup! fixup! cpu/rp2350_common: create shared folder for RISCV & ARM # The commit message #8 will be skipped: # fixup! fixup! cpu/rp2350_common: create shared folder for RISCV & ARM # The commit message #9 will be skipped: # fixup! fixup! cpu/rp2350_common: create shared folder for RISCV & ARM # The commit message #10 will be skipped: # fixup! cpu/rp2350_common: create shared folder for RISCV & ARM # The commit message #11 will be skipped: # fixup! fixup! cpu/rp2350_common: create shared folder for RISCV & ARM
1 parent 0e26a7c commit 62815c1

File tree

3 files changed

+55
-11
lines changed

3 files changed

+55
-11
lines changed

cpu/rp2350/doc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@defgroup cpu_rp2350 RP2350 MCUs
1+
@defgroup cpu_rp2350_arm RP2350 MCUs
22
@ingroup cpu
33
@brief RP2350 MCU code and definitions
44

cpu/rp2350_common/include/compat_layer.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 Tom Hert <[email protected]>
3+
* SPDX-FileCopyrightText: 2025 HAW Hamburg
4+
* SPDX-License-Identifier: LGPL-2.1-only
5+
*/
6+
17
#pragma once
28

9+
/**
10+
* @ingroup cpu_rp2350
11+
* @{
12+
*
13+
* @file
14+
* @brief Compatibility layer for different CPU architectures
15+
*
16+
* @author Tom Hert <[email protected]>
17+
*/
18+
319
#include "periph_cpu.h"
420

521
#ifdef RP2350_USE_RISCV
622
# include "xh3irq.h"
723
#endif
824

25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
/**
30+
* @brief Enable the given IRQ
31+
* @param[in] irq_no IRQ number to enable
32+
*/
933
static inline void rp_irq_enable(uint32_t irq_no)
1034
{
1135
#ifdef RP2350_USE_RISCV
@@ -15,9 +39,18 @@ static inline void rp_irq_enable(uint32_t irq_no)
1539
#endif
1640
}
1741

42+
/**
43+
* @brief Called upon the end of an ISR
44+
*/
1845
static inline void rp_end_isr(void)
1946
{
2047
#ifdef RP2350_USE_ARM
2148
cortexm_isr_end();
2249
#endif
2350
}
51+
52+
#ifdef __cplusplus
53+
}
54+
#endif
55+
56+
/** @} */

cpu/rp2350_common/periph/uart.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,13 @@ int uart_mode(uart_t uart, uart_data_bits_t data_bits, uart_parity_t parity,
7272
switch (parity) {
7373
case UART_PARITY_NONE:
7474
break;
75-
// case UART_PARITY_EVEN:
76-
// io_reg_atomic_set(&dev->UARTLCR_H, UART0_UARTLCR_H_EPS_Msk | UART0_UARTLCR_H_PEN_Msk);
77-
// break;
78-
// case UART_PARITY_ODD:
79-
// io_reg_atomic_set(&dev->UARTLCR_H, UART0_UARTLCR_H_PEN_Msk);
80-
// break;
75+
/* Currently we don't support parity settings yet
76+
* case UART_PARITY_EVEN:
77+
* io_reg_atomic_set(&dev->UARTLCR_H, UART0_UARTLCR_H_EPS_Msk | UART0_UARTLCR_H_PEN_Msk);
78+
* break;
79+
* case UART_PARITY_ODD:
80+
* io_reg_atomic_set(&dev->UARTLCR_H, UART0_UARTLCR_H_PEN_Msk);
81+
* break; */
8182
default:
8283
return UART_NOMODE;
8384
}
@@ -110,11 +111,17 @@ void uart_init_pins(uart_t uart) {
110111
*(uint32_t *)calculate_gpio_io_ctrl_register_addr(uart_config[uart].tx_pin) = FUNCTION_SELECT_UART;
111112
*(uint32_t *)calculate_gpio_io_ctrl_register_addr(uart_config[uart].rx_pin) = FUNCTION_SELECT_UART;
112113
/* Clear the ISO bits */
113-
atomic_clear((uint32_t *)calculate_gpio_pad_register_addr(uart_config[uart].tx_pin), PADS_BANK0_ISO_BITS);
114-
atomic_clear((uint32_t *)calculate_gpio_pad_register_addr(uart_config[uart].rx_pin), PADS_BANK0_ISO_BITS);
114+
atomic_clear(
115+
calculate_gpio_pad_register_addr(uart_config[uart].tx_pin),
116+
PADS_BANK0_ISO_BITS);
117+
atomic_clear(
118+
calculate_gpio_pad_register_addr(uart_config[uart].rx_pin),
119+
PADS_BANK0_ISO_BITS);
115120

116121
/* Set Input Enable Flag */
117-
atomic_set((uint32_t *)calculate_gpio_pad_register_addr(uart_config[uart].rx_pin), PADS_BANK0_GPIO0_IE_BITS);
122+
atomic_set(
123+
calculate_gpio_pad_register_addr(uart_config[uart].rx_pin),
124+
PADS_BANK0_GPIO0_IE_BITS);
118125

119126
/* We reset UART0 here, so we can be sure it is in a known state */
120127
_reset_uart(uart);
@@ -136,7 +143,11 @@ int uart_init(uart_t uart, uint32_t baud, uart_rx_cb_t rx_cb, void *arg) {
136143

137144
uart_init_pins(uart);
138145

139-
if (uart_mode(uart, UART_DATA_BITS_8, UART_PARITY_NONE, UART_STOP_BITS_1) != UART_OK) {
146+
if (uart_mode(
147+
uart,
148+
UART_DATA_BITS_8,
149+
UART_PARITY_NONE,
150+
UART_STOP_BITS_1) != UART_OK) {
140151
return UART_NOMODE;
141152
}
142153

0 commit comments

Comments
 (0)