NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
neorv32_gpio.c File Reference

General purpose input/output port unit (GPIO) HW driver source file. More...

#include "neorv32.h"
#include "neorv32_gpio.h"

Functions

int neorv32_gpio_available (void)
 
void neorv32_gpio_pin_set (int pin, int value)
 
void neorv32_gpio_pin_toggle (int pin)
 
uint32_t neorv32_gpio_pin_get (int pin)
 
void neorv32_gpio_port_set (uint64_t port_data)
 
void neorv32_gpio_port_toggle (uint64_t toggle)
 
uint64_t neorv32_gpio_port_get (void)
 

Detailed Description

General purpose input/output port unit (GPIO) HW driver source file.

Note
These functions should only be used if the GPIO unit was synthesized (IO_GPIO_EN = true).
See also
https://stnolting.github.io/neorv32/sw/files.html

Function Documentation

◆ neorv32_gpio_available()

int neorv32_gpio_available ( void )

Check if GPIO unit was synthesized.

Returns
0 if GPIO was not synthesized, 1 if GPIO is available.

◆ neorv32_gpio_pin_get()

uint32_t neorv32_gpio_pin_get ( int pin)

Get single pin of GPIO's input port.

Parameters
[in]pinInput pin to be read (0..63).
Returns
=0 if pin is low, !=0 if pin is high.

◆ neorv32_gpio_pin_set()

void neorv32_gpio_pin_set ( int pin,
int value )

Set single pin of GPIO's output port.

Parameters
[in]pinOutput pin number to be set (0..63).
[in]valueSet pint high (1) or low (0).

◆ neorv32_gpio_pin_toggle()

void neorv32_gpio_pin_toggle ( int pin)

Toggle single pin of GPIO's output port.

Parameters
[in]pinOutput pin number to be toggled (0..63).

◆ neorv32_gpio_port_get()

uint64_t neorv32_gpio_port_get ( void )

Get complete GPIO input port.

Returns
Current input port state (64-bit).

◆ neorv32_gpio_port_set()

void neorv32_gpio_port_set ( uint64_t port_data)

Set complete GPIO output port.

Parameters
[in]port_dataNew output port value (64-bit).

◆ neorv32_gpio_port_toggle()

void neorv32_gpio_port_toggle ( uint64_t toggle)

Toggle bit in entire GPIO output port.

Parameters
[in]toggleBit mask; set bits will toggle the according output port (64-bit).