periph_cpu_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Leon George
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef PERIPH_CPU_COMMON_H
20 #define PERIPH_CPU_COMMON_H
21 
22 #include "cpu.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
31 #define CPUID_ADDR (&FCFG->MAC_BLE_0)
32 
35 #define CPUID_LEN (16U)
36 
41 #define PROVIDES_PM_SET_LOWEST_CORTEXM
42 
44 #ifndef DOXYGEN
45 
48 #define HAVE_GPIO_MODE_T
49 typedef enum {
50  GPIO_IN = (IOCFG_INPUT_ENABLE | IOCFG_PULLCTL_OFF),
51  GPIO_IN_PD = (IOCFG_INPUT_ENABLE | IOCFG_PULLCTL_DOWN),
52  GPIO_IN_PU = (IOCFG_INPUT_ENABLE | IOCFG_PULLCTL_UP),
56 } gpio_mode_t;
57 
61 #define HAVE_GPIO_FLANK_T
62 typedef enum {
66 } gpio_flank_t;
67 
68 /*
69  * @brief Invalid UART mode mask
70  *
71  * This mask is also used to force data_bits_t to be uint32_t type
72  * since it may be assigned a uint32_t variable in uart_mode
73  */
74 #define UART_INVALID_MODE (0x8000000)
75 
80 #define HAVE_UART_PARITY_T
81 typedef enum {
82  UART_PARITY_NONE = 0,
83  UART_PARITY_EVEN = (UART_LCRH_PEN | UART_LCRH_EPS),
84  UART_PARITY_ODD = UART_LCRH_PEN,
85  UART_PARITY_MARK = UART_INVALID_MODE | 4,
86  UART_PARITY_SPACE = UART_INVALID_MODE | 5
94 #define HAVE_UART_DATA_BITS_T
95 typedef enum {
96  UART_DATA_BITS_5 = UART_LCRH_WLEN_5,
97  UART_DATA_BITS_6 = UART_LCRH_WLEN_6,
98  UART_DATA_BITS_7 = UART_LCRH_WLEN_7,
99  UART_DATA_BITS_8 = UART_LCRH_WLEN_8
107 #define HAVE_UART_STOP_BITS_T
108 typedef enum {
109  UART_STOP_BITS_1 = 0,
110  UART_STOP_BITS_2 = UART_LCRH_STP2,
118 typedef struct {
119  uart_regs_t *regs;
120  int tx_pin;
121  int rx_pin;
122 #ifdef MODULE_PERIPH_UART_HW_FC
123  int rts_pin;
124  int cts_pin;
125 #endif
126  int intn;
127 } uart_conf_t;
136 typedef struct {
137  uint8_t cfg;
138  uint8_t chn;
139 } timer_conf_t;
140 
141 #define PERIPH_I2C_NEED_READ_REG
142 #define PERIPH_I2C_NEED_READ_REGS
143 #define PERIPH_I2C_NEED_WRITE_REG
144 #define PERIPH_I2C_NEED_WRITE_REGS
145 
146 #endif /* ifndef DOXYGEN */
147 
148 #ifdef __cplusplus
149 }
150 #endif
151 
152 #endif /* PERIPH_CPU_COMMON_H */
153 
UART_PARITY_NONE
@ UART_PARITY_NONE
no parity
Definition: uart.h:127
UART_DATA_BITS_5
@ UART_DATA_BITS_5
5 data bits
Definition: uart.h:140
uart_stop_bits_t
uart_stop_bits_t
Definition of possible stop bits lengths in a UART frame.
Definition: uart.h:151
GPIO_IN_PD
@ GPIO_IN_PD
configure as input with pull-down resistor
Definition: gpio.h:120
UART_STOP_BITS_2
@ UART_STOP_BITS_2
2 stop bits
Definition: uart.h:153
GPIO_OD
@ GPIO_OD
configure as output in open-drain mode without pull resistor
Definition: gpio.h:123
uart_regs_t
UART component registers.
Definition: cc26xx_cc13xx_uart.h:30
UART_DATA_BITS_8
@ UART_DATA_BITS_8
8 data bits
Definition: uart.h:143
IOCFG_EDGEDET_FALLING
#define IOCFG_EDGEDET_FALLING
edge detection on falling edge
Definition: cc26xx_cc13xx_ioc.h:125
GPIO_OUT
@ GPIO_OUT
configure as output in push-pull mode
Definition: gpio.h:122
UART_DATA_BITS_6
@ UART_DATA_BITS_6
6 data bits
Definition: uart.h:141
uart_parity_t
uart_parity_t
Definition of possible parity modes.
Definition: uart.h:126
GPIO_FALLING
@ GPIO_FALLING
emit interrupt on falling flank
Definition: periph_cpu.h:81
IOCFG_PULLCTL_UP
#define IOCFG_PULLCTL_UP
pull up
Definition: cc26xx_cc13xx_ioc.h:122
GPIO_IN_PU
@ GPIO_IN_PU
configure as input with pull-up resistor
Definition: gpio.h:121
GPIO_RISING
@ GPIO_RISING
emit interrupt on rising flank
Definition: periph_cpu.h:82
GPIO_IN
@ GPIO_IN
configure as input without pull resistor
Definition: gpio.h:119
uart_conf_t
UART device configuration.
Definition: periph_cpu.h:166
gpio_flank_t
gpio_flank_t
Definition: periph_cpu.h:80
GPIO_OD_PU
@ GPIO_OD_PU
configure as output in open-drain mode with pull resistor enabled
Definition: gpio.h:125
UART_PARITY_SPACE
@ UART_PARITY_SPACE
space parity
Definition: uart.h:131
IOCFG_EDGEDET_RISING
#define IOCFG_EDGEDET_RISING
edge detection on rising edge
Definition: cc26xx_cc13xx_ioc.h:126
IOCFG_PULLCTL_DOWN
#define IOCFG_PULLCTL_DOWN
pull down
Definition: cc26xx_cc13xx_ioc.h:123
IOCFG_IOMODE_OPEN_DRAIN
#define IOCFG_IOMODE_OPEN_DRAIN
open drain
Definition: cc26xx_cc13xx_ioc.h:132
GPIO_BOTH
@ GPIO_BOTH
emit interrupt on both flanks
Definition: periph_cpu.h:83
UART_PARITY_EVEN
@ UART_PARITY_EVEN
even parity
Definition: uart.h:128
timer_conf_t
Timer configuration.
Definition: periph_cpu.h:288
gpio_mode_t
gpio_mode_t
Available pin modes.
Definition: periph_cpu.h:70
UART_DATA_BITS_7
@ UART_DATA_BITS_7
7 data bits
Definition: uart.h:142
UART_PARITY_MARK
@ UART_PARITY_MARK
mark parity
Definition: uart.h:130
UART_STOP_BITS_1
@ UART_STOP_BITS_1
1 stop bit
Definition: uart.h:152
uart_data_bits_t
uart_data_bits_t
Definition of possible data bits lengths in a UART frame.
Definition: uart.h:139
UART_PARITY_ODD
@ UART_PARITY_ODD
odd parity
Definition: uart.h:129
IOCFG_EDGEDET_BOTH
#define IOCFG_EDGEDET_BOTH
edge detection on both edges
Definition: cc26xx_cc13xx_ioc.h:127
IOCFG_PULLCTL_OFF
#define IOCFG_PULLCTL_OFF
no IO pull
Definition: cc26xx_cc13xx_ioc.h:121