Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Ken Rabold
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include <inttypes.h>
19
20#include "periph_cpu_common.h"
21#include "cpu.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#ifndef DOXYGEN
31#define HAVE_GPIO_T
32typedef uint8_t gpio_t;
33#endif
34
38#define CPUID_LEN (12U)
39
43#define GPIO_UNDEF (0xff)
44
48#define GPIO_PIN(x, y) (x | y)
49
53#define GPIO_INTR_PRIORITY (3)
54
58typedef struct {
59 uint32_t addr;
60 gpio_t rx;
61 gpio_t tx;
64
68#define UART_ISR_PRIO (2)
69
74#define PERIPH_SPI_NEEDS_TRANSFER_BYTE 1
75#define PERIPH_SPI_NEEDS_TRANSFER_REG 1
76#define PERIPH_SPI_NEEDS_TRANSFER_REGS 1
78
82typedef struct {
83 uint32_t addr;
84 gpio_t mosi;
85 gpio_t miso;
86 gpio_t sclk;
88
92#define PERIPH_TIMER_PROVIDES_SET
93
99#define PERIPH_I2C_NEED_READ_REG
101#define PERIPH_I2C_NEED_WRITE_REG
103#define PERIPH_I2C_NEED_READ_REGS
105#define PERIPH_I2C_NEED_WRITE_REGS
107
108#ifndef DOXYGEN
113#define HAVE_I2C_SPEED_T
114typedef enum {
119#endif /* ndef DOXYGEN */
120
124typedef struct {
125 uint32_t addr;
126 gpio_t scl;
127 gpio_t sda;
129} i2c_conf_t;
130
135#define NWDT_TIME_LOWER_LIMIT (1)
136/* Ensure the internal "count" variable stays within the uint32 bounds.
137 This variable corresponds to max_time * RTC_FREQ / MS_PER_SEC. On fe310,
138 RTC_FREQ is 32768Hz. The 15 right shift is equivalent to a division by RTC_FREQ.
139 */
140#define NWDT_TIME_UPPER_LIMIT ((UINT32_MAX >> 15) * MS_PER_SEC + 1)
142
146#define WDT_INTR_PRIORITY (PLIC_NUM_PRIORITIES)
147
151#define WDT_HAS_STOP (1)
152
158#define RTT_INTR_PRIORITY (2)
159
160#define RTT_MAX_VALUE (0xffffffff)
161#define RTT_CLOCK_FREQUENCY (32768U) /* in Hz */
162#define RTT_MAX_FREQUENCY (RTT_CLOCK_FREQUENCY) /* in Hz */
163#define RTT_MIN_FREQUENCY (1U) /* in Hz */
164
165#ifndef RTT_FREQUENCY
166#define RTT_FREQUENCY (RTT_MAX_FREQUENCY) /* in Hz */
167#endif
168
173
175
176#ifdef __cplusplus
177}
178#endif
179
i2c_speed_t
Definition periph_cpu.h:272
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:274
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
Definition periph_cpu.h:275
CPU specific definitions.
void fe310_clock_init(void)
Initialization of the clock.
Adds include for missing inttype definitions.
unsigned irqn_t
Convenience typedef for interrupt lines.
I2C configuration structure.
Definition periph_cpu.h:295
i2c_speed_t speed
Configured bus speed, actual speed may be lower but never higher.
Definition periph_cpu.h:300
uint32_t addr
device base address
Definition periph_cpu.h:125
gpio_t sda
GPIO used as SDA pin.
Definition periph_cpu.h:468
gpio_t scl
GPIO used as SCL pin.
Definition periph_cpu.h:467
SPI device configuration.
Definition periph_cpu.h:333
gpio_t mosi
GPIO used as MOSI pin.
Definition periph_cpu.h:863
uint32_t addr
SPI control register address.
Definition periph_cpu.h:83
gpio_t sclk
SCLK pin.
Definition periph_cpu.h:86
gpio_t miso
GPIO used as MISO pin.
Definition periph_cpu.h:864
UART device configuration.
Definition periph_cpu.h:214
uint32_t addr
UART control register address.
Definition periph_cpu.h:59
gpio_t tx
TX pin.
Definition periph_cpu.h:61
irqn_t isr_num
ISR source number.
Definition periph_cpu.h:62
gpio_t rx
RX pin.
Definition periph_cpu.h:60