periph_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Gunar Schorcht
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_H
20 #define PERIPH_CPU_H
21 
22 #include <stdint.h>
23 #include <limits.h>
24 
25 #include "eagle_soc.h"
26 #include "cpu_conf.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 #define CPUID_LEN (4U)
36 
48 #define HAVE_GPIO_T
49 typedef unsigned int gpio_t;
55 #define GPIO_UNDEF ((gpio_t)(UINT_MAX))
56 
60 #define GPIO_PIN(x, y) ((x & 0) | y)
61 
65 #define PORT_GPIO (0)
66 
70 #define GPIO_PIN_NUMOF (17)
71 
72 #ifndef DOXYGEN
77 #define HAVE_GPIO_FLANK_T
78 typedef enum {
79  GPIO_NONE = 0,
80  GPIO_RISING = 1,
81  GPIO_FALLING = 2,
82  GPIO_BOTH = 3,
83  GPIO_LOW = 4,
84  GPIO_HIGH = 5
85 } gpio_flank_t;
87 #endif /* ndef DOXYGEN */
94 #define GPIO0 (GPIO_PIN(PORT_GPIO,0))
95 #define GPIO1 (GPIO_PIN(PORT_GPIO,1))
96 #define GPIO2 (GPIO_PIN(PORT_GPIO,2))
97 #define GPIO3 (GPIO_PIN(PORT_GPIO,3))
98 #define GPIO4 (GPIO_PIN(PORT_GPIO,4))
99 #define GPIO5 (GPIO_PIN(PORT_GPIO,5))
100 #define GPIO6 (GPIO_PIN(PORT_GPIO,6))
101 #define GPIO7 (GPIO_PIN(PORT_GPIO,7))
102 #define GPIO8 (GPIO_PIN(PORT_GPIO,8))
103 #define GPIO9 (GPIO_PIN(PORT_GPIO,9))
104 #define GPIO10 (GPIO_PIN(PORT_GPIO,10))
105 #define GPIO11 (GPIO_PIN(PORT_GPIO,11))
106 #define GPIO12 (GPIO_PIN(PORT_GPIO,12))
107 #define GPIO13 (GPIO_PIN(PORT_GPIO,13))
108 #define GPIO14 (GPIO_PIN(PORT_GPIO,14))
109 #define GPIO15 (GPIO_PIN(PORT_GPIO,15))
110 #define GPIO16 (GPIO_PIN(PORT_GPIO,16))
136 #ifndef DOXYGEN
143 #define HAVE_I2C_SPEED_T
144 typedef enum {
145  I2C_SPEED_LOW = 0,
150 } i2c_speed_t;
152 #endif /* ndef DOXYGEN */
156 typedef struct {
157  i2c_speed_t speed;
158  gpio_t scl;
159  gpio_t sda;
160 } i2c_conf_t;
161 
165 #define I2C_NUMOF_MAX (2)
166 
167 #define PERIPH_I2C_NEED_READ_REG
168 #define PERIPH_I2C_NEED_READ_REGS
169 #define PERIPH_I2C_NEED_WRITE_REG
170 #define PERIPH_I2C_NEED_WRITE_REGS
177 #define PROVIDES_PM_SET_LOWEST
178 #define PROVIDES_PM_RESTART
179 #define PROVIDES_PM_OFF
202 #define PWM_NUMOF_MAX (1)
203 
207 #define PWM_CHANNEL_NUM_MAX (8)
208 
219 #define RNG_DATA_REG_ADDR (0x3ff20e44)
226 #define RTT_FREQUENCY (312500UL)
227 #define RTT_MAX_VALUE (0xFFFFFFFFUL)
258 typedef enum {
259  HSPI = 1,
260 } spi_ctrl_t;
261 
265 typedef struct {
266  spi_ctrl_t ctrl;
267  gpio_t sck;
268  gpio_t mosi;
269  gpio_t miso;
270  gpio_t cs;
271 } spi_conf_t;
272 
276 #define SPI_NUMOF_MAX (1)
277 
278 #define PERIPH_SPI_NEEDS_TRANSFER_BYTE
279 #define PERIPH_SPI_NEEDS_TRANSFER_REG
280 #define PERIPH_SPI_NEEDS_TRANSFER_REGS
286 #define PERIPH_TIMER_PROVIDES_SET
287 
299 typedef struct {
300  gpio_t txd;
301  gpio_t rxd;
302 } uart_conf_t;
303 
307 #define UART_NUMOF_MAX (2)
310 #ifdef __cplusplus
311 }
312 #endif
313 
314 #endif /* PERIPH_CPU_H */
gpio_flank_t
Definition: periph_cpu.h:176
i2c_speed_t
Definition: periph_cpu.h:272
spi_ctrl_t
SPI controllers that can be used for peripheral interfaces.
Definition: periph_cpu.h:258
@ HSPI
HSPI interface controller.
Definition: periph_cpu.h:259
unsigned int gpio_t
GPIO type identifier.
Definition: gpio.h:91
@ GPIO_FALLING
emit interrupt on falling flank
Definition: periph_cpu.h:93
@ GPIO_RISING
emit interrupt on rising flank
Definition: periph_cpu.h:94
@ GPIO_BOTH
emit interrupt on both flanks
Definition: periph_cpu.h:95
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: periph_cpu.h:274
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
Definition: periph_cpu.h:276
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
Definition: periph_cpu.h:273
@ I2C_SPEED_HIGH
high speed mode: ~3400 kbit/s
Definition: periph_cpu.h:278
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition: periph_cpu.h:275
Implementation specific CPU configuration options.
I2C configuration structure.
Definition: periph_cpu.h:295
SPI device configuration.
Definition: periph_cpu.h:333
UART device configuration.
Definition: periph_cpu.h:214