Loading...
Searching...
No Matches
periph_cpu_common.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Leon George
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include "cpu.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
27#define CPUID_ADDR (&FCFG->MAC_BLE_0)
31#define CPUID_LEN (16U)
32
37#define PROVIDES_PM_SET_LOWEST_CORTEXM
39
40#ifndef DOXYGEN
44#define HAVE_GPIO_MODE_T
45typedef enum {
46 GPIO_IN = (IOCFG_INPUT_ENABLE | IOCFG_PULLCTL_OFF),
47 GPIO_IN_PD = (IOCFG_INPUT_ENABLE | IOCFG_PULLCTL_DOWN),
48 GPIO_IN_PU = (IOCFG_INPUT_ENABLE | IOCFG_PULLCTL_UP),
53
57#define HAVE_GPIO_FLANK_T
58typedef enum {
59 GPIO_FALLING = IOCFG_EDGEDET_FALLING,
60 GPIO_RISING = IOCFG_EDGEDET_RISING,
61 GPIO_BOTH = IOCFG_EDGEDET_BOTH
63
67#define GPIO_PIN(x, y) (((x) & 0) | (y))
68
69/*
70 * @brief Invalid UART mode mask
71 *
72 * This mask is also used to force data_bits_t to be uint32_t type
73 * since it may be assigned a uint32_t variable in uart_mode
74 */
75#define UART_INVALID_MODE (0x8000000)
76
81#define HAVE_UART_PARITY_T
82typedef enum {
84 UART_PARITY_EVEN = (UART_LCRH_PEN | UART_LCRH_EPS),
85 UART_PARITY_ODD = UART_LCRH_PEN,
90
95#define HAVE_UART_DATA_BITS_T
96typedef enum {
97 UART_DATA_BITS_5 = UART_LCRH_WLEN_5,
98 UART_DATA_BITS_6 = UART_LCRH_WLEN_6,
99 UART_DATA_BITS_7 = UART_LCRH_WLEN_7,
100 UART_DATA_BITS_8 = UART_LCRH_WLEN_8
103
108#define HAVE_UART_STOP_BITS_T
109typedef enum {
111 UART_STOP_BITS_2 = UART_LCRH_STP2,
114
119typedef struct {
120 uart_regs_t *regs;
121 int tx_pin;
122 int rx_pin;
123#ifdef MODULE_PERIPH_UART_HW_FC
124 int rts_pin;
125 int cts_pin;
126#endif
127 int intn;
130
137typedef struct {
138 uint8_t cfg;
139 uint8_t chn;
141
152#define TIMER_CHANNEL_NUMOF 2
153
154#define PERIPH_I2C_NEED_READ_REG
155#define PERIPH_I2C_NEED_READ_REGS
156#define PERIPH_I2C_NEED_WRITE_REG
157#define PERIPH_I2C_NEED_WRITE_REGS
158
159#endif /* ifndef DOXYGEN */
160
161#ifdef __cplusplus
162}
163#endif
164
gpio_flank_t
Definition periph_cpu.h:176
@ GPIO_OUT
select GPIO MASK as output
Definition periph_cpu.h:161
@ GPIO_IN
select GPIO MASK as input
Definition periph_cpu.h:160
#define IOCFG_EDGEDET_BOTH
edge detection on both edges
#define IOCFG_IOMODE_OPEN_DRAIN
open drain
#define IOCFG_PULLCTL_DOWN
pull down
#define IOCFG_EDGEDET_RISING
edge detection on rising edge
#define IOCFG_PULLCTL_UP
pull up
#define IOCFG_PULLCTL_OFF
no IO pull
#define IOCFG_EDGEDET_FALLING
edge detection on falling edge
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:91
uart_parity_t
Definition of possible parity modes.
Definition periph_cpu.h:501
@ UART_PARITY_SPACE
space parity
Definition periph_cpu.h:506
@ UART_PARITY_NONE
no parity
Definition periph_cpu.h:502
@ UART_PARITY_EVEN
even parity
Definition periph_cpu.h:503
@ UART_PARITY_ODD
odd parity
Definition periph_cpu.h:504
@ UART_PARITY_MARK
mark parity
Definition periph_cpu.h:505
uart_stop_bits_t
Definition of possible stop bits lengths.
Definition periph_cpu.h:533
@ UART_STOP_BITS_2
2 stop bits
Definition periph_cpu.h:535
@ UART_STOP_BITS_1
1 stop bit
Definition periph_cpu.h:534
#define UART_INVALID_MODE
Invalid UART mode mask.
Definition periph_cpu.h:492
uart_data_bits_t
Definition of possible data bits lengths in a UART frame.
Definition periph_cpu.h:517
@ UART_DATA_BITS_6
6 data bits
Definition periph_cpu.h:519
@ UART_DATA_BITS_5
5 data bits
Definition periph_cpu.h:518
@ UART_DATA_BITS_7
7 data bits
Definition periph_cpu.h:520
@ UART_DATA_BITS_8
8 data bits
Definition periph_cpu.h:521
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214
UART component registers.