Zephyr API 3.6.99
Loading...
Searching...
No Matches
pio_rpi_pico.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Tokita, Hiroshi <tokita.hiroshi@fujitsu.com>
3 * Copyright (c) 2023 Yonatan Schachter
4 * Copyright (c) 2023 Ionut Pavel <iocapa@iocapa.com>
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9#ifndef ZEPHYR_DRIVERS_MISC_PIO_PICO_RPI_PIO_PICO_RPI_H_
10#define ZEPHYR_DRIVERS_MISC_PIO_PICO_RPI_PIO_PICO_RPI_H_
11
13
14#include <hardware/pio.h>
15
25#define RPI_PICO_PIO_DEFINE_PROGRAM(name, wrap_target, wrap, ...) \
26 static const uint32_t name ## _wrap_target = wrap_target; \
27 static const uint32_t name ## _wrap = wrap; \
28 static const uint16_t name ## _program_instructions[] = { \
29 __VA_ARGS__ \
30 }; \
31 static const struct pio_program name ## _program = { \
32 .instructions = name ## _program_instructions, \
33 .length = ARRAY_SIZE(name ## _program_instructions), \
34 .origin = -1, \
35 }
36
42#define RPI_PICO_PIO_GET_WRAP_TARGET(name) name ## _wrap_target
43
49#define RPI_PICO_PIO_GET_WRAP(name) name ## _wrap
50
56#define RPI_PICO_PIO_GET_PROGRAM(name) &name ## _program
57
103#define DT_RPI_PICO_PIO_PIN_BY_NAME(node_id, p_name, p_idx, g_name, g_idx) \
104 RP2_GET_PIN_NUM(DT_PROP_BY_IDX( \
105 DT_CHILD(DT_PINCTRL_BY_NAME(node_id, p_name, p_idx), g_name), pinmux, g_idx))
106
119#define DT_INST_RPI_PICO_PIO_PIN_BY_NAME(inst, p_name, p_idx, g_name, g_idx) \
120 DT_RPI_PICO_PIO_PIN_BY_NAME(DT_DRV_INST(inst), p_name, p_idx, g_name, g_idx)
121
128#define DT_INST_PIO_PIN_BY_NAME(inst, name) \
129 DT_PIO_PIN_BY_NAME(DT_DRV_INST(inst), name)
130
137PIO pio_rpi_pico_get_pio(const struct device *dev);
138
147int pio_rpi_pico_allocate_sm(const struct device *dev, size_t *sm);
148
149#endif /* ZEPHYR_DRIVERS_MISC_PIO_PICO_RPI_PIO_PICO_RPI_H_ */
GPIO Devicetree macro public API header file.
int pio_rpi_pico_allocate_sm(const struct device *dev, size_t *sm)
Allocate a state machine.
PIO pio_rpi_pico_get_pio(const struct device *dev)
Get PIO object.
Runtime device structure (in ROM) per driver instance.
Definition device.h:403