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
9#pragma once
10
20
21#include <stdint.h>
22#include <limits.h>
23
24#include "eagle_soc.h"
25#include "cpu_conf.h"
26#include "macros/units.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
35#define CPUID_LEN (4U)
36
40#define CPU_CYCLES_PER_LOOP (5)
41
46
53#define HAVE_GPIO_T
54typedef unsigned int gpio_t;
56
60#define GPIO_UNDEF ((gpio_t)(UINT_MAX))
61
65#define GPIO_PIN(x, y) ((x & 0) | y)
66
70#define PORT_GPIO (0)
71
75#define GPIO_PIN_NUMOF (17)
76
77#ifndef DOXYGEN
82#define HAVE_GPIO_FLANK_T
83typedef enum {
84 GPIO_NONE = 0,
85 GPIO_RISING = 1,
86 GPIO_FALLING = 2,
87 GPIO_BOTH = 3,
88 GPIO_LOW = 4,
89 GPIO_HIGH = 5
92#endif /* ndef DOXYGEN */
93
98#define GPIO0 (GPIO_PIN(PORT_GPIO, 0))
99#define GPIO1 (GPIO_PIN(PORT_GPIO, 1))
100#define GPIO2 (GPIO_PIN(PORT_GPIO, 2))
101#define GPIO3 (GPIO_PIN(PORT_GPIO, 3))
102#define GPIO4 (GPIO_PIN(PORT_GPIO, 4))
103#define GPIO5 (GPIO_PIN(PORT_GPIO, 5))
104#define GPIO6 (GPIO_PIN(PORT_GPIO, 6))
105#define GPIO7 (GPIO_PIN(PORT_GPIO, 7))
106#define GPIO8 (GPIO_PIN(PORT_GPIO, 8))
107#define GPIO9 (GPIO_PIN(PORT_GPIO, 9))
108#define GPIO10 (GPIO_PIN(PORT_GPIO, 10))
109#define GPIO11 (GPIO_PIN(PORT_GPIO, 11))
110#define GPIO12 (GPIO_PIN(PORT_GPIO, 12))
111#define GPIO13 (GPIO_PIN(PORT_GPIO, 13))
112#define GPIO14 (GPIO_PIN(PORT_GPIO, 14))
113#define GPIO15 (GPIO_PIN(PORT_GPIO, 15))
114#define GPIO16 (GPIO_PIN(PORT_GPIO, 16))
116
118
142#ifndef DOXYGEN
149#define HAVE_I2C_SPEED_T
150typedef enum {
151 I2C_SPEED_LOW = 0,
158#endif /* ndef DOXYGEN */
162typedef struct {
163 i2c_speed_t speed;
164 gpio_t scl;
165 gpio_t sda;
166} i2c_conf_t;
167
171#define I2C_NUMOF_MAX (2)
172
173#define PERIPH_I2C_NEED_READ_REG
174#define PERIPH_I2C_NEED_READ_REGS
175#define PERIPH_I2C_NEED_WRITE_REG
176#define PERIPH_I2C_NEED_WRITE_REGS
178
183#define PROVIDES_PM_SET_LOWEST
184#define PROVIDES_PM_RESTART
185#define PROVIDES_PM_OFF
187
204
208#define PWM_NUMOF_MAX (1)
209
213#define PWM_CHANNEL_NUM_MAX (8)
214
216
221
225#define RNG_DATA_REG_ADDR (0x3ff20e44)
227
232#define RTT_FREQUENCY (312500UL)
233#define RTT_MAX_VALUE (0xFFFFFFFFUL)
235
260
264typedef enum {
265 HSPI = 1,
266} spi_ctrl_t;
267
272#define HAVE_SPI_CLK_T
280
284typedef struct {
285 spi_ctrl_t ctrl;
286 gpio_t sck;
287 gpio_t mosi;
288 gpio_t miso;
289 gpio_t cs;
290} spi_conf_t;
291
295#define SPI_NUMOF_MAX (1)
296
297#define PERIPH_SPI_NEEDS_TRANSFER_BYTE
298#define PERIPH_SPI_NEEDS_TRANSFER_REG
299#define PERIPH_SPI_NEEDS_TRANSFER_REGS
301
303
307#define PERIPH_TIMER_PROVIDES_SET
308
316
320typedef struct {
321 gpio_t txd;
322 gpio_t rxd;
324
328#define UART_NUMOF_MAX (2)
330
331#ifdef __cplusplus
332}
333#endif
334
gpio_flank_t
Definition periph_cpu.h:179
i2c_speed_t
Definition periph_cpu.h:275
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:277
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
Definition periph_cpu.h:279
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
Definition periph_cpu.h:276
@ I2C_SPEED_HIGH
high speed mode: ~3400 kbit/s
Definition periph_cpu.h:281
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition periph_cpu.h:278
spi_clk_t
Definition periph_cpu.h:351
@ SPI_CLK_10MHZ
drive the SPI bus with 10MHz
Definition periph_cpu.h:356
@ SPI_CLK_5MHZ
drive the SPI bus with 5MHz
Definition periph_cpu.h:355
@ SPI_CLK_400KHZ
drive the SPI bus with 400KHz
Definition periph_cpu.h:353
@ SPI_CLK_1MHZ
drive the SPI bus with 1MHz
Definition periph_cpu.h:354
@ SPI_CLK_100KHZ
drive the SPI bus with 100KHz
Definition periph_cpu.h:352
CPU specific configuration options.
spi_ctrl_t
SPI controllers that can be used for peripheral interfaces.
Definition periph_cpu.h:264
@ HSPI
HSPI interface controller.
Definition periph_cpu.h:265
I2C configuration structure.
Definition periph_cpu.h:298
SPI device configuration.
Definition periph_cpu.h:336
UART device configuration.
Definition periph_cpu.h:217
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