Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Tom Hert <git@annsann.eu>
3 * SPDX-FileCopyrightText: 2025 HAW Hamburg
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
18
19#include <stdbool.h>
20#include <stdint.h>
21
22#include "RP2350.h"
23#include "clock_conf.h"
24#include "cpu.h"
25#include "gpio_conf.h"
26#include "helpers.h"
27#include "uart_conf.h"
28
30#define HAVE_GPIO_T
31typedef uint32_t gpio_t;
32
33#include "periph/gpio.h"
34
36#define OSC_DEBUG_PIN_ID 15u
37
39#define RESET_PLL_SYS (1u << 14u)
40
42#define RESET_PADS_BANK0 (1u << 9u)
43
45#define RESET_UART0 (1u << 26u)
46
48#define RESET_UART1 (1u << 27u)
49
51#define RESET_IO_BANK0 (1u << 6u)
52
54#define PADS_BANK0_GPIO0_IE_BITS (1u << 6u)
55
57#define PADS_BANK0_ISO_BITS (1u << 8u)
58
59#ifdef __cplusplus
60extern "C" {
61#endif
62
68static inline uint32_t calculate_gpio_pad_register_addr(gpio_t pin) {
69 /* Each pin has a 4 byte register, so we can calculate the address
70 * by adding 4 bytes for each pin, starting at the base address of PADS_BANK0
71 * and adding 4 bytes to skip VOLTAGE_SELECT */
72 return PADS_BANK0_BASE + 4 * (pin + 1);
73}
74
80static uint32_t calculate_gpio_io_status_register_addr(gpio_t pin) {
81 /* Each status register is followed by a ctrl register, */
82 return IO_BANK0_BASE + 8 * pin;
83}
84
91static inline uint32_t calculate_gpio_io_ctrl_register_addr(gpio_t pin) {
92 /* Each pin has a 8 byte register (4 Bytes of Status, 4 Bytes of CTRL),
93 * so we can calculate the address by adding 8 bytes for each pin,
94 * starting at the base address of IO_BANK0 */
96}
97
98#ifdef __cplusplus
99}
100#endif
101
Clock configuration for the RP2350.
Low-level GPIO peripheral driver interface definitions.
GPIO configuration for the RP2350.
Helper functions for atomic register operations.
static uint32_t calculate_gpio_io_status_register_addr(gpio_t pin)
Calculate the address of the GPIO IO status register for a given pin.
Definition periph_cpu.h:80
static uint32_t calculate_gpio_pad_register_addr(gpio_t pin)
Calculate the address of the GPIO pad register for a given pin.
Definition periph_cpu.h:68
static uint32_t calculate_gpio_io_ctrl_register_addr(gpio_t pin)
Calculate the address of the GPIO IO control register for a given pin.
Definition periph_cpu.h:91
UART configuration for the RP2350.