41#define PM_NUM_MODES (3U)
68#ifndef CONFIG_PM_EWUP_USED
69#define CONFIG_PM_EWUP_USED (0U)
109typedef uint32_t gpio_t;
115#define GPIO_UNDEF (0xffffffff)
120#define GPIO_PIN(x, y) ((GPIOA_BASE + (x << 10)) | y)
130#define GPIO_MODE(io, pr, ot) ((io << 0) | (pr << 2) | (ot << 4))
138#define HAVE_GPIO_MODE_T
153#define HAVE_GPIO_FLANK_T
189#define HAVE_GPIO_STATE_T
199#define HAVE_GPIO_PULL_T
207#define HAVE_GPIO_PULL_STRENGTH_T
215#define HAVE_GPIO_DRIVE_STRENGTH_T
223#define HAVE_GPIO_SLEW_T
231#define HAVE_GPIO_CONF_T
295#define DAC_CHANNEL_NUMOF (2)
308#define TIMER_CHANNEL_NUMOF (4U)
313#define TIMER_CHANNEL(tim, chan) *(&dev(tim)->CH0CV + (chan * 2))
341#define UART_ISR_PRIO (2)
349#define SPI_HWCS_MASK (0xffffff00)
357#define SPI_HWCS(x) (SPI_HWCS_MASK | x)
362#define SPI_CS_UNDEF (GPIO_UNDEF)
379#define PERIPH_SPI_NEEDS_TRANSFER_BYTE
381#define PERIPH_SPI_NEEDS_TRANSFER_REG
383#define PERIPH_SPI_NEEDS_TRANSFER_REGS
390#define HAVE_SPI_CLK_T
416#ifdef MODULE_PERIPH_DMA
429#define PERIPH_I2C_NEED_READ_REG
431#define PERIPH_I2C_NEED_WRITE_REG
433#define PERIPH_I2C_NEED_READ_REGS
435#define PERIPH_I2C_NEED_WRITE_REGS
443#define HAVE_I2C_SPEED_T
492#define NWDT_TIME_LOWER_LIMIT (1)
497#define NWDT_TIME_UPPER_LIMIT ((UINT32_MAX >> 15) * MS_PER_SEC + 1)
503#define WDT_INTR_PRIORITY (PLIC_NUM_PRIORITIES)
508#define WDT_HAS_STOP (0)
516#define RTT_IRQ RTC_ALARM_IRQn
517#define RTT_IRQ_PRIORITY (2)
518#define RTT_MAX_VALUE (0xffffffff)
520#define RTT_MIN_FREQUENCY (1U)
527#define USBDEV_SET_ADDR_AFTER_STATUS 0
528#define USBDEV_NUM_ENDPOINTS 4
564void gd32vf103_clock_init(
void);
565void gd32v_enable_irc8(
void);
566void gd32v_disable_irc8(
void);
@ GPIO_OUT
select GPIO MASK as output
@ GPIO_IN
select GPIO MASK as input
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
@ SPI_CLK_10MHZ
drive the SPI bus with 10MHz
@ SPI_CLK_5MHZ
drive the SPI bus with 5MHz
@ SPI_CLK_400KHZ
drive the SPI bus with 400KHz
@ SPI_CLK_1MHZ
drive the SPI bus with 1MHz
@ SPI_CLK_100KHZ
drive the SPI bus with 100KHz
void gpio_init_af(gpio_t pin, uint8_t sel, uint8_t over)
Configure an alternate function for the given pin.
RISCV CLIC interrupt controller definitions.
#define GPIO_MODE(x, y)
Internal macro for combining pin mode (x) and pull-up/down (y).
CPU specific definitions.
gpio_af_t
Override alternative GPIO mode options.
@ GPIO_AF_OUT_OD
alternate function output - open-drain
@ GPIO_AF_OUT_PP
alternate function output - push-pull
uint32_t periph_apb_clk(bus_t bus)
Get the actual bus clock frequency for the APB buses.
@ GD32V_PM_IDLE
IDLE mode.
@ GD32V_PM_STANDBY
STANDBY mode,.
@ GD32V_PM_DEEPSLEEP
DEEPSLEEP mode, corresponds to STOP mode of STM32.
void gpio_init_analog(gpio_t pin)
Configure the given pin to be used as ADC input.
void periph_clk_en(bus_t bus, uint32_t mask)
Enable the given peripheral clock.
void periph_clk_dis(bus_t bus, uint32_t mask)
Disable the given peripheral clock.
@ APB1
Advanced Peripheral Bus 1.
@ AHB
Advanced High-performance Bus.
@ APB2
Advanced Peripheral Bus 2.
enum IRQn IRQn_Type
Interrupt Number Definition.
gpio_mode_t
Available pin modes.
gpio_pull_t
Enumeration of pull resistor configurations.
gpio_pull_strength_t
Enumeration of pull resistor values.
gpio_state_t
Enumeration of GPIO states (direction)
gpio_slew_t
Enumeration of slew rate settings.
gpio_drive_strength_t
Enumeration of drive strength options.
typedef gpio_conf_t
GPIO pin configuration.
@ GPIO_FLOATING
No pull ups nor pull downs enabled.
@ GPIO_PULL_KEEP
Keep the signal at current logic level with pull up/down resistors.
@ GPIO_PULL_DOWN
Pull down resistor enabled.
@ GPIO_PULL_UP
Pull up resistor enabled.
@ GPIO_PULL_WEAKEST
Use the weakest (highest Ohm value) resistor.
@ GPIO_PULL_WEAK
Use a weak pull resistor.
@ GPIO_PULL_STRONG
Use a strong pull resistor.
@ GPIO_PULL_STRONGEST
Use the strongest pull resistor.
@ GPIO_OUTPUT_OPEN_SOURCE
Use pin as output in open emitter configuration.
@ GPIO_USED_BY_PERIPHERAL
The GPIO pin is used by a peripheral.
@ GPIO_OUTPUT_OPEN_DRAIN
Use pin as output in open collector configuration.
@ GPIO_OUTPUT_PUSH_PULL
Use pin as output in push-pull configuration.
@ GPIO_DISCONNECT
Disconnect pin from all peripherals.
@ GPIO_INPUT
Use pin as input.
@ GPIO_SLEW_SLOWEST
let the output voltage level rise/fall as slow as possible
@ GPIO_SLEW_FAST
let the output voltage level rise/fall fast
@ GPIO_SLEW_SLOW
let the output voltage level rise/fall slowly
@ GPIO_SLEW_FASTEST
let the output voltage level rise/fall as fast as possible
@ GPIO_DRIVE_STRONG
Use a strong drive strength.
@ GPIO_DRIVE_WEAK
Use a weak drive strength.
@ GPIO_DRIVE_STRONGEST
Use the strongest drive strength.
@ GPIO_DRIVE_WEAKEST
Use the weakest drive strength.
gpio_t spi_cs_t
Chip select pin type overlaps with gpio_t so it can be casted to this.
Adds include for missing inttype definitions.
Common macros and compiler attributes/pragmas configuration.
unsigned dma_t
DMA channel type.
ADC device configuration.
ADC_TypeDef * dev
ADC device used.
gpio_t pin
pin connected to the channel
uint8_t chan
CPU ADC channel connected to the pin.
DAC line configuration data.
uint8_t chan
DAC device used for this line.
gpio_t pin
pin connected to the line
I2C configuration structure.
uint32_t rcu_mask
bit in clock enable register
i2c_speed_t speed
Configured bus speed, actual speed may be lower but never higher.
TWI_t * dev
Pointer to hardware module registers.
IRQn_Type irqn
I2C event interrupt number.
gpio_t sda_pin
SDA GPIO pin.
gpio_t scl_pin
SCL GPIO pin.
gpio_t pin
GPIO pin mapped to this channel.
uint8_t cc_chan
capture compare channel used
PWM device configuration.
uint32_t rcu_mask
bit in clock enable register
uint32_t remap
AFIO remap mask to route periph to other pins (or zero, if not needed)
gpio_af_t af
alternate function used
mini_timer_t * dev
Timer used.
pwm_chan_t chan[TIMER_CHANNEL_NUMOF]
channel mapping set to {GPIO_UNDEF, 0} if not used
SPI device configuration.
gpio_t miso_pin
pin used for MISO
uint32_t rcumask
bit in the RCC peripheral enable register
gpio_t mosi_pin
pin used for MOSI
SPI_t * dev
pointer to the used SPI device
spi_cs_t cs_pin
pin used for CS
uint8_t apbbus
APBx bus the device is connected to.
Timer device configuration.
uint8_t irqn
global IRQ channel
uint8_t bus
APBx bus the timer is clock from.
TC0_t * dev
Pointer to the used as Timer device.
uint32_t max
maximum value to count to (16/32 bit)
uint32_t rcu_mask
corresponding bit in the RCC register
UART device configuration.
USART_t * dev
pointer to the used UART device
uint32_t rcu_mask
bit in clock enable register
gpio_t tx_pin
pin used for TX
gpio_t rx_pin
pin used for RX
GPIO pin configuration for GD32V MCUs.
gpio_pull_t pull
Pull resistor configuration.
gpio_slew_t slew_rate
Configure the slew rate of outputs.
bool initial_value
Initial value of the output.
gpio_state_t state
State of the pin.
#define MHZ(x)
A macro to return the Hz in x MHz.
#define KHZ(x)
A macro to return the Hz in x kHz.