Loading...
Searching...
No Matches
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#include "macros/units.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
36#define CPUID_LEN (4U)
37
41#define CPU_CYCLES_PER_LOOP (5)
42
54#define HAVE_GPIO_T
55typedef unsigned int gpio_t;
61#define GPIO_UNDEF ((gpio_t)(UINT_MAX))
62
66#define GPIO_PIN(x, y) ((x & 0) | y)
67
71#define PORT_GPIO (0)
72
76#define GPIO_PIN_NUMOF (17)
77
78#ifndef DOXYGEN
83#define HAVE_GPIO_FLANK_T
84typedef enum {
85 GPIO_NONE = 0,
86 GPIO_RISING = 1,
87 GPIO_FALLING = 2,
88 GPIO_BOTH = 3,
89 GPIO_LOW = 4,
90 GPIO_HIGH = 5
93#endif /* ndef DOXYGEN */
94
99#define GPIO0 (GPIO_PIN(PORT_GPIO, 0))
100#define GPIO1 (GPIO_PIN(PORT_GPIO, 1))
101#define GPIO2 (GPIO_PIN(PORT_GPIO, 2))
102#define GPIO3 (GPIO_PIN(PORT_GPIO, 3))
103#define GPIO4 (GPIO_PIN(PORT_GPIO, 4))
104#define GPIO5 (GPIO_PIN(PORT_GPIO, 5))
105#define GPIO6 (GPIO_PIN(PORT_GPIO, 6))
106#define GPIO7 (GPIO_PIN(PORT_GPIO, 7))
107#define GPIO8 (GPIO_PIN(PORT_GPIO, 8))
108#define GPIO9 (GPIO_PIN(PORT_GPIO, 9))
109#define GPIO10 (GPIO_PIN(PORT_GPIO, 10))
110#define GPIO11 (GPIO_PIN(PORT_GPIO, 11))
111#define GPIO12 (GPIO_PIN(PORT_GPIO, 12))
112#define GPIO13 (GPIO_PIN(PORT_GPIO, 13))
113#define GPIO14 (GPIO_PIN(PORT_GPIO, 14))
114#define GPIO15 (GPIO_PIN(PORT_GPIO, 15))
115#define GPIO16 (GPIO_PIN(PORT_GPIO, 16))
143#ifndef DOXYGEN
150#define HAVE_I2C_SPEED_T
151typedef enum {
152 I2C_SPEED_LOW = 0,
159#endif /* ndef DOXYGEN */
163typedef struct {
164 i2c_speed_t speed;
165 gpio_t scl;
166 gpio_t sda;
167} i2c_conf_t;
168
172#define I2C_NUMOF_MAX (2)
173
174#define PERIPH_I2C_NEED_READ_REG
175#define PERIPH_I2C_NEED_READ_REGS
176#define PERIPH_I2C_NEED_WRITE_REG
177#define PERIPH_I2C_NEED_WRITE_REGS
184#define PROVIDES_PM_SET_LOWEST
185#define PROVIDES_PM_RESTART
186#define PROVIDES_PM_OFF
209#define PWM_NUMOF_MAX (1)
210
214#define PWM_CHANNEL_NUM_MAX (8)
215
226#define RNG_DATA_REG_ADDR (0x3ff20e44)
233#define RTT_FREQUENCY (312500UL)
234#define RTT_MAX_VALUE (0xFFFFFFFFUL)
265typedef enum {
266 HSPI = 1,
267} spi_ctrl_t;
268
273#define HAVE_SPI_CLK_T
281
285typedef struct {
286 spi_ctrl_t ctrl;
287 gpio_t sck;
288 gpio_t mosi;
289 gpio_t miso;
290 gpio_t cs;
291} spi_conf_t;
292
296#define SPI_NUMOF_MAX (1)
297
298#define PERIPH_SPI_NEEDS_TRANSFER_BYTE
299#define PERIPH_SPI_NEEDS_TRANSFER_REG
300#define PERIPH_SPI_NEEDS_TRANSFER_REGS
308#define PERIPH_TIMER_PROVIDES_SET
309
321typedef struct {
322 gpio_t txd;
323 gpio_t rxd;
325
329#define UART_NUMOF_MAX (2)
332#ifdef __cplusplus
333}
334#endif
335
336#endif /* PERIPH_CPU_H */
gpio_flank_t
Definition periph_cpu.h:180
i2c_speed_t
Definition periph_cpu.h:276
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:278
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
Definition periph_cpu.h:280
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
Definition periph_cpu.h:277
@ I2C_SPEED_HIGH
high speed mode: ~3400 kbit/s
Definition periph_cpu.h:282
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition periph_cpu.h:279
spi_clk_t
Definition periph_cpu.h:352
@ SPI_CLK_10MHZ
drive the SPI bus with 10MHz
Definition periph_cpu.h:357
@ SPI_CLK_5MHZ
drive the SPI bus with 5MHz
Definition periph_cpu.h:356
@ SPI_CLK_400KHZ
drive the SPI bus with 400KHz
Definition periph_cpu.h:354
@ SPI_CLK_1MHZ
drive the SPI bus with 1MHz
Definition periph_cpu.h:355
@ SPI_CLK_100KHZ
drive the SPI bus with 100KHz
Definition periph_cpu.h:353
spi_host_device_t spi_ctrl_t
Mapping of SPI controller type for source code compatibility.
Definition periph_cpu.h:842
spi_ctrl_t
SPI controllers that can be used for peripheral interfaces.
Definition periph_cpu.h:265
@ HSPI
HSPI interface controller.
Definition periph_cpu.h:266
Implementation specific CPU configuration options.
I2C configuration structure.
Definition periph_cpu.h:299
SPI device configuration.
Definition periph_cpu.h:337
UART device configuration.
Definition periph_cpu.h:218
Unit helper macros.
#define MHZ(x)
A macro to return the Hz in x MHz.
Definition units.h:49
#define KHZ(x)
A macro to return the Hz in x kHz.
Definition units.h:44