oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Functions
HAL GPIO Interface

Hardware Abstraction Layer interface for GPIO operations. More...

Functions

int ove_hal_gpio_set (unsigned int port, unsigned int pin, int value)
 Set the output level of a GPIO pin at the hardware level.
 
int ove_hal_gpio_get (unsigned int port, unsigned int pin)
 Read the current logical level of a GPIO pin at the hardware level.
 
int ove_hal_gpio_configure (unsigned int port, unsigned int pin, ove_gpio_mode_t mode)
 Configure the direction and drive mode of a GPIO pin at the hardware level.
 
int ove_hal_gpio_irq_hw_enable (unsigned int port, unsigned int pin, ove_gpio_irq_mode_t mode, ove_gpio_irq_cb callback, void *user_data)
 Program and enable a GPIO interrupt in hardware.
 
int ove_hal_gpio_irq_hw_disable (unsigned int port, unsigned int pin)
 Disable a GPIO interrupt in hardware without unregistering the callback.
 

Detailed Description

Hardware Abstraction Layer interface for GPIO operations.

Declares the low-level GPIO functions that every platform HAL must implement. The portable GPIO layer delegates to these functions after performing parameter validation and IRQ bookkeeping.

Note
Platform implementations supply their own definitions of these functions in a board- or SoC-specific source file.

Function Documentation

◆ ove_hal_gpio_set()

int ove_hal_gpio_set ( unsigned int  port,
unsigned int  pin,
int  value 
)

Set the output level of a GPIO pin at the hardware level.

Called by ove_gpio_set() after validation.

Parameters
[in]portGPIO port index.
[in]pinGPIO pin index within the port.
[in]valueNon-zero to drive high, zero to drive low.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_gpio_get()

int ove_hal_gpio_get ( unsigned int  port,
unsigned int  pin 
)

Read the current logical level of a GPIO pin at the hardware level.

Called by ove_gpio_get() after validation.

Parameters
[in]portGPIO port index.
[in]pinGPIO pin index within the port.
Returns
1 if the pin is high, 0 if low, negative error code on failure.

◆ ove_hal_gpio_configure()

int ove_hal_gpio_configure ( unsigned int  port,
unsigned int  pin,
ove_gpio_mode_t  mode 
)

Configure the direction and drive mode of a GPIO pin at the hardware level.

Called by ove_gpio_configure() after validation.

Parameters
[in]portGPIO port index.
[in]pinGPIO pin index within the port.
[in]modeDesired pin mode (ove_gpio_mode_t).
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_gpio_irq_hw_enable()

int ove_hal_gpio_irq_hw_enable ( unsigned int  port,
unsigned int  pin,
ove_gpio_irq_mode_t  mode,
ove_gpio_irq_cb  callback,
void *  user_data 
)

Program and enable a GPIO interrupt in hardware.

Called by ove_gpio_irq_enable() after the callback has been registered via ove_gpio_irq_register(). The HAL must configure the edge detector for mode and arm the interrupt controller.

Parameters
[in]portGPIO port index.
[in]pinGPIO pin index within the port.
[in]modeEdge(s) that should trigger the interrupt.
[in]callbackFunction to invoke when the interrupt fires.
[in]user_dataOpaque pointer forwarded to callback.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_gpio_irq_hw_disable()

int ove_hal_gpio_irq_hw_disable ( unsigned int  port,
unsigned int  pin 
)

Disable a GPIO interrupt in hardware without unregistering the callback.

Called by ove_gpio_irq_disable(). The interrupt controller entry for this pin must be masked so no further callbacks are dispatched.

Parameters
[in]portGPIO port index.
[in]pinGPIO pin index within the port.
Returns
OVE_OK on success, negative error code on failure.