Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 Gunar Schorcht
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include <stdint.h>
19#include <limits.h>
20
21#include "eagle_soc.h"
22#include "cpu_conf.h"
23#include "macros/units.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
32#define CPUID_LEN (4U)
33
37#define CPU_CYCLES_PER_LOOP (5)
38
43
50#define HAVE_GPIO_T
51typedef unsigned int gpio_t;
53
57#define GPIO_UNDEF ((gpio_t)(UINT_MAX))
58
62#define GPIO_PIN(x, y) ((x & 0) | y)
63
67#define PORT_GPIO (0)
68
72#define GPIO_PIN_NUMOF (17)
73
74#ifndef DOXYGEN
79#define HAVE_GPIO_FLANK_T
80typedef enum {
81 GPIO_NONE = 0,
82 GPIO_RISING = 1,
83 GPIO_FALLING = 2,
84 GPIO_BOTH = 3,
85 GPIO_LOW = 4,
86 GPIO_HIGH = 5
89#endif /* ndef DOXYGEN */
90
95#define GPIO0 (GPIO_PIN(PORT_GPIO, 0))
96#define GPIO1 (GPIO_PIN(PORT_GPIO, 1))
97#define GPIO2 (GPIO_PIN(PORT_GPIO, 2))
98#define GPIO3 (GPIO_PIN(PORT_GPIO, 3))
99#define GPIO4 (GPIO_PIN(PORT_GPIO, 4))
100#define GPIO5 (GPIO_PIN(PORT_GPIO, 5))
101#define GPIO6 (GPIO_PIN(PORT_GPIO, 6))
102#define GPIO7 (GPIO_PIN(PORT_GPIO, 7))
103#define GPIO8 (GPIO_PIN(PORT_GPIO, 8))
104#define GPIO9 (GPIO_PIN(PORT_GPIO, 9))
105#define GPIO10 (GPIO_PIN(PORT_GPIO, 10))
106#define GPIO11 (GPIO_PIN(PORT_GPIO, 11))
107#define GPIO12 (GPIO_PIN(PORT_GPIO, 12))
108#define GPIO13 (GPIO_PIN(PORT_GPIO, 13))
109#define GPIO14 (GPIO_PIN(PORT_GPIO, 14))
110#define GPIO15 (GPIO_PIN(PORT_GPIO, 15))
111#define GPIO16 (GPIO_PIN(PORT_GPIO, 16))
113
115
139#ifndef DOXYGEN
146#define HAVE_I2C_SPEED_T
147typedef enum {
148 I2C_SPEED_LOW = 0,
155#endif /* ndef DOXYGEN */
159typedef struct {
160 i2c_speed_t speed;
161 gpio_t scl;
162 gpio_t sda;
163} i2c_conf_t;
164
168#define I2C_NUMOF_MAX (2)
169
170#define PERIPH_I2C_NEED_READ_REG
171#define PERIPH_I2C_NEED_READ_REGS
172#define PERIPH_I2C_NEED_WRITE_REG
173#define PERIPH_I2C_NEED_WRITE_REGS
175
180#define PROVIDES_PM_SET_LOWEST
181#define PROVIDES_PM_RESTART
182#define PROVIDES_PM_OFF
184
201
205#define PWM_NUMOF_MAX (1)
206
210#define PWM_CHANNEL_NUM_MAX (8)
211
213
218
222#define RNG_DATA_REG_ADDR (0x3ff20e44)
224
229#define RTT_FREQUENCY (312500UL)
230#define RTT_MAX_VALUE (0xFFFFFFFFUL)
232
257
261typedef enum {
262 HSPI = 1,
263} spi_ctrl_t;
264
269#define HAVE_SPI_CLK_T
277
281typedef struct {
282 spi_ctrl_t ctrl;
283 gpio_t sck;
284 gpio_t mosi;
285 gpio_t miso;
286 gpio_t cs;
287} spi_conf_t;
288
292#define SPI_NUMOF_MAX (1)
293
294#define PERIPH_SPI_NEEDS_TRANSFER_BYTE
295#define PERIPH_SPI_NEEDS_TRANSFER_REG
296#define PERIPH_SPI_NEEDS_TRANSFER_REGS
298
300
304#define PERIPH_TIMER_PROVIDES_SET
305
313
317typedef struct {
318 gpio_t txd;
319 gpio_t rxd;
321
325#define UART_NUMOF_MAX (2)
327
328#ifdef __cplusplus
329}
330#endif
331
gpio_flank_t
Definition periph_cpu.h:176
i2c_speed_t
Definition periph_cpu.h:272
@ 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
spi_clk_t
Definition periph_cpu.h:348
@ SPI_CLK_10MHZ
drive the SPI bus with 10MHz
Definition periph_cpu.h:353
@ SPI_CLK_5MHZ
drive the SPI bus with 5MHz
Definition periph_cpu.h:352
@ SPI_CLK_400KHZ
drive the SPI bus with 400KHz
Definition periph_cpu.h:350
@ SPI_CLK_1MHZ
drive the SPI bus with 1MHz
Definition periph_cpu.h:351
@ SPI_CLK_100KHZ
drive the SPI bus with 100KHz
Definition periph_cpu.h:349
CPU specific configuration options.
spi_ctrl_t
SPI controllers that can be used for peripheral interfaces.
Definition periph_cpu.h:261
@ HSPI
HSPI interface controller.
Definition periph_cpu.h:262
I2C configuration structure.
Definition periph_cpu.h:295
SPI device configuration.
Definition periph_cpu.h:333
UART device configuration.
Definition periph_cpu.h:214
Unit helper macros.
#define MHZ(x)
A macro to return the Hz in x MHz.
Definition units.h:48
#define KHZ(x)
A macro to return the Hz in x kHz.
Definition units.h:43