42#define PM_NUM_MODES (3U)
69#ifndef CONFIG_PM_EWUP_USED
70#define CONFIG_PM_EWUP_USED (0U)
110typedef uint32_t gpio_t;
116#define GPIO_UNDEF (0xffffffff)
121#define GPIO_PIN(x, y) ((GPIOA_BASE + (x << 10)) | y)
131#define GPIO_MODE(io, pr, ot) ((io << 0) | (pr << 2) | (ot << 4))
139#define HAVE_GPIO_MODE_T
154#define HAVE_GPIO_FLANK_T
190#define HAVE_GPIO_STATE_T
200#define HAVE_GPIO_PULL_T
208#define HAVE_GPIO_PULL_STRENGTH_T
216#define HAVE_GPIO_DRIVE_STRENGTH_T
224#define HAVE_GPIO_SLEW_T
232#define HAVE_GPIO_CONF_T
296#define DAC_CHANNEL_NUMOF (2)
309#define TIMER_CHANNEL_NUMOF (4U)
314#define TIMER_CHANNEL(tim, chan) *(&dev(tim)->CH0CV + (chan * 2))
342#define UART_ISR_PRIO (2)
350#define SPI_HWCS_MASK (0xffffff00)
358#define SPI_HWCS(x) (SPI_HWCS_MASK | x)
363#define SPI_CS_UNDEF (GPIO_UNDEF)
380#define PERIPH_SPI_NEEDS_TRANSFER_BYTE
382#define PERIPH_SPI_NEEDS_TRANSFER_REG
384#define PERIPH_SPI_NEEDS_TRANSFER_REGS
391#define HAVE_SPI_CLK_T
417#ifdef MODULE_PERIPH_DMA
430#define PERIPH_I2C_NEED_READ_REG
432#define PERIPH_I2C_NEED_WRITE_REG
434#define PERIPH_I2C_NEED_READ_REGS
436#define PERIPH_I2C_NEED_WRITE_REGS
444#define HAVE_I2C_SPEED_T
493#define NWDT_TIME_LOWER_LIMIT (1)
498#define NWDT_TIME_UPPER_LIMIT ((UINT32_MAX >> 15) * MS_PER_SEC + 1)
504#define WDT_INTR_PRIORITY (PLIC_NUM_PRIORITIES)
509#define WDT_HAS_STOP (0)
517#define RTT_IRQ RTC_ALARM_IRQn
518#define RTT_IRQ_PRIORITY (2)
519#define RTT_MAX_VALUE (0xffffffff)
521#define RTT_MIN_FREQUENCY (1U)
528#define USBDEV_SET_ADDR_AFTER_STATUS 0
529#define USBDEV_NUM_ENDPOINTS 4
565void gd32vf103_clock_init(
void);
566void gd32v_enable_irc8(
void);
567void 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.
gpio_t adc_conf_t
ADC configuration wrapper.
RISCV CLIC interrupt controller definitions.
#define GPIO_MODE(x, y)
Internal macro for combining pin mode (x) and pull-up/down (y).
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.
#define TIMER_CHANNEL_NUMOF
GD32V timers have 4 capture-compare channels.
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.
@ GD32V_PM_IDLE
IDLE mode.
@ GD32V_PM_STANDBY
STANDBY mode,
@ GD32V_PM_DEEPSLEEP
DEEPSLEEP mode, corresponds to STOP mode of STM32.
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_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.
gpio_mode_t
Available pin modes.
unsigned dma_t
DMA channel type.
uint8_t dev
ADCx - 1 device used for the channel.
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
IRQn_Type irqn
I2C event interrupt number.
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
TIMER_Type * dev
Timer used.
SPI device configuration.
uint32_t rcumask
bit in the RCC peripheral enable register
uint8_t apbbus
APBx bus the device is connected to.
SPI_Type * dev
SPI device base register address.
Timer device configuration.
uint8_t irqn
global IRQ channel
uint8_t bus
APBx bus the timer is clock from.
TIMER_Type * dev
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_Type * dev
UART device base register address.
uint32_t rcu_mask
bit in clock enable register
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.