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 
24 #include "eagle_soc.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
33 #define CPUID_LEN (4U)
34 
46 #define HAVE_GPIO_T
47 typedef unsigned int gpio_t;
53 #define GPIO_UNDEF ((gpio_t)(UINT_MAX))
54 
58 #define GPIO_PIN(x, y) ((x & 0) | y)
59 
63 #define PORT_GPIO (0)
64 
68 #define GPIO_PIN_NUMOF (17)
69 
70 #ifndef DOXYGEN
71 
75 #define HAVE_GPIO_FLANK_T
76 typedef enum {
77  GPIO_NONE = 0,
78  GPIO_RISING = 1,
79  GPIO_FALLING = 2,
80  GPIO_BOTH = 3,
81  GPIO_LOW = 4,
82  GPIO_HIGH = 5
83 } gpio_flank_t;
85 #endif /* ndef DOXYGEN */
86 
92 #define GPIO0 (GPIO_PIN(PORT_GPIO,0))
93 #define GPIO1 (GPIO_PIN(PORT_GPIO,1))
94 #define GPIO2 (GPIO_PIN(PORT_GPIO,2))
95 #define GPIO3 (GPIO_PIN(PORT_GPIO,3))
96 #define GPIO4 (GPIO_PIN(PORT_GPIO,4))
97 #define GPIO5 (GPIO_PIN(PORT_GPIO,5))
98 #define GPIO6 (GPIO_PIN(PORT_GPIO,6))
99 #define GPIO7 (GPIO_PIN(PORT_GPIO,7))
100 #define GPIO8 (GPIO_PIN(PORT_GPIO,8))
101 #define GPIO9 (GPIO_PIN(PORT_GPIO,9))
102 #define GPIO10 (GPIO_PIN(PORT_GPIO,10))
103 #define GPIO11 (GPIO_PIN(PORT_GPIO,11))
104 #define GPIO12 (GPIO_PIN(PORT_GPIO,12))
105 #define GPIO13 (GPIO_PIN(PORT_GPIO,13))
106 #define GPIO14 (GPIO_PIN(PORT_GPIO,14))
107 #define GPIO15 (GPIO_PIN(PORT_GPIO,15))
108 #define GPIO16 (GPIO_PIN(PORT_GPIO,16))
109 
134 #ifndef DOXYGEN
135 
141 #define HAVE_I2C_SPEED_T
142 typedef enum {
143  I2C_SPEED_LOW = 0,
148 } i2c_speed_t;
150 #endif /* ndef DOXYGEN */
151 
154 typedef struct {
155  i2c_speed_t speed;
156  gpio_t scl;
157  gpio_t sda;
158 } i2c_conf_t;
159 
163 #define I2C_NUMOF_MAX (2)
164 
165 #define PERIPH_I2C_NEED_READ_REG
166 #define PERIPH_I2C_NEED_READ_REGS
167 #define PERIPH_I2C_NEED_WRITE_REG
168 #define PERIPH_I2C_NEED_WRITE_REGS
175 #define PROVIDES_PM_SET_LOWEST
176 #define PROVIDES_PM_RESTART
177 #define PROVIDES_PM_OFF
178 
200 #define PWM_NUMOF_MAX (1)
201 
205 #define PWM_CHANNEL_NUM_MAX (8)
206 
217 #define RNG_DATA_REG_ADDR (0x3ff20e44)
218 
224 #define RTT_FREQUENCY (312500UL)
225 #define RTT_MAX_VALUE (0xFFFFFFFFUL)
226 
256 typedef enum {
257  HSPI = 1,
258 } spi_ctrl_t;
259 
263 typedef struct {
264  spi_ctrl_t ctrl;
265  gpio_t sck;
266  gpio_t mosi;
267  gpio_t miso;
268  gpio_t cs;
269 } spi_conf_t;
270 
274 #define SPI_NUMOF_MAX (1)
275 
276 #define PERIPH_SPI_NEEDS_TRANSFER_BYTE
277 #define PERIPH_SPI_NEEDS_TRANSFER_REG
278 #define PERIPH_SPI_NEEDS_TRANSFER_REGS
284 #define PERIPH_TIMER_PROVIDES_SET
285 
297 typedef struct {
298  gpio_t txd;
299  gpio_t rxd;
300 } uart_conf_t;
301 
305 #define UART_NUMOF_MAX (1)
306 
308 #ifdef __cplusplus
309 }
310 #endif
311 
312 #endif /* PERIPH_CPU_H */
313 
fast mode: ~400 kbit/s
Definition: i2c.h:184
high speed mode: ~3400 kbit/s
Definition: i2c.h:186
I2C configuration options.
Definition: periph_cpu.h:128
emit interrupt on rising flank
Definition: gpio.h:131
i2c_speed_t
Default mapping of I2C bus speed values.
Definition: i2c.h:181
emit interrupt on both flanks
Definition: gpio.h:132
gpio_flank_t
Definition of possible active flanks for external interrupt mode.
Definition: gpio.h:129
HSPI interface controller.
Definition: periph_cpu.h:474
unsigned int gpio_t
GPIO type identifier.
Definition: gpio.h:86
emit interrupt on falling flank
Definition: gpio.h:130
UART device configuration.
Definition: periph_cpu.h:166
spi_ctrl_t
SPI controllers that can be used for peripheral interfaces.
Definition: periph_cpu.h:473
low speed mode: ~10 kbit/s
Definition: i2c.h:182
SPI configuration structure type.
Definition: periph_cpu.h:273
normal mode: ~100 kbit/s
Definition: i2c.h:183
fast plus mode: ~1000 kbit/s
Definition: i2c.h:185