Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Ken Rabold
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser General
5 * Public License v2.1. See the file LICENSE in the top level directory for more
6 * details.
7 */
8
9#pragma once
10
20
21#include <inttypes.h>
22
23#include "periph_cpu_common.h"
24#include "cpu.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#ifndef DOXYGEN
34#define HAVE_GPIO_T
35typedef uint8_t gpio_t;
36#endif
37
41#define CPUID_LEN (12U)
42
46#define GPIO_UNDEF (0xff)
47
51#define GPIO_PIN(x, y) (x | y)
52
56#define GPIO_INTR_PRIORITY (3)
57
61typedef struct {
62 uint32_t addr;
63 gpio_t rx;
64 gpio_t tx;
67
71#define UART_ISR_PRIO (2)
72
77#define PERIPH_SPI_NEEDS_TRANSFER_BYTE 1
78#define PERIPH_SPI_NEEDS_TRANSFER_REG 1
79#define PERIPH_SPI_NEEDS_TRANSFER_REGS 1
81
85typedef struct {
86 uint32_t addr;
87 gpio_t mosi;
88 gpio_t miso;
89 gpio_t sclk;
91
95#define PERIPH_TIMER_PROVIDES_SET
96
102#define PERIPH_I2C_NEED_READ_REG
104#define PERIPH_I2C_NEED_WRITE_REG
106#define PERIPH_I2C_NEED_READ_REGS
108#define PERIPH_I2C_NEED_WRITE_REGS
110
111#ifndef DOXYGEN
116#define HAVE_I2C_SPEED_T
117typedef enum {
122#endif /* ndef DOXYGEN */
123
127typedef struct {
128 uint32_t addr;
129 gpio_t scl;
130 gpio_t sda;
132} i2c_conf_t;
133
138#define NWDT_TIME_LOWER_LIMIT (1)
139/* Ensure the internal "count" variable stays within the uint32 bounds.
140 This variable corresponds to max_time * RTC_FREQ / MS_PER_SEC. On fe310,
141 RTC_FREQ is 32768Hz. The 15 right shift is equivalent to a division by RTC_FREQ.
142 */
143#define NWDT_TIME_UPPER_LIMIT ((UINT32_MAX >> 15) * MS_PER_SEC + 1)
145
149#define WDT_INTR_PRIORITY (PLIC_NUM_PRIORITIES)
150
154#define WDT_HAS_STOP (1)
155
161#define RTT_INTR_PRIORITY (2)
162
163#define RTT_MAX_VALUE (0xffffffff)
164#define RTT_CLOCK_FREQUENCY (32768U) /* in Hz */
165#define RTT_MAX_FREQUENCY (RTT_CLOCK_FREQUENCY) /* in Hz */
166#define RTT_MIN_FREQUENCY (1U) /* in Hz */
167
168#ifndef RTT_FREQUENCY
169#define RTT_FREQUENCY (RTT_MAX_FREQUENCY) /* in Hz */
170#endif
171
176
178
179#ifdef __cplusplus
180}
181#endif
182
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:128
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:86
gpio_t sclk
SCLK pin.
Definition periph_cpu.h:89
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:62
gpio_t tx
TX pin.
Definition periph_cpu.h:64
irqn_t isr_num
ISR source number.
Definition periph_cpu.h:65
gpio_t rx
RX pin.
Definition periph_cpu.h:63