Nexus Embedded Platform 0.1.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
gpio.h File Reference

Fixed GPIO authorization masks and bounded port operations. More...

Go to the source code of this file.

Data Structures

struct  nx_gpio_ops_t
 Shared read-only methods using one provider state. More...
struct  nx_gpio_port
 Immutable interface pointing to caller-owned state. More...

Typedefs

typedef struct nx_gpio_port nx_gpio_port_t

Functions

nx_result_t nx_gpio_port_write (const nx_gpio_port_t *port, uint32_t set_mask, uint32_t reset_mask)
 Atomically set/reset one port's authorized output mask.
nx_result_t nx_gpio_port_read (const nx_gpio_port_t *port, uint32_t *value)
 Read one input snapshot restricted to the binding mask.
nx_result_t nx_gpio_port_toggle (const nx_gpio_port_t *port, uint32_t mask)
 Toggle authorized outputs under the single-writer contract.

Detailed Description

Fixed GPIO authorization masks and bounded port operations.

Author
Nexus Team

Definition in file gpio.h.

Typedef Documentation

◆ nx_gpio_port_t

typedef struct nx_gpio_port nx_gpio_port_t

Definition at line 15 of file gpio.h.

Function Documentation

◆ nx_gpio_port_read()

nx_result_t nx_gpio_port_read ( const nx_gpio_port_t * port,
uint32_t * value )

Read one input snapshot restricted to the binding mask.

Parameters
[in]portFixed initialized binding.
[out]valueMasked input snapshot; unchanged on error.
Returns
NX_SUCCESS or NX_ERROR_INVALID. No cross-port simultaneity.

◆ nx_gpio_port_toggle()

nx_result_t nx_gpio_port_toggle ( const nx_gpio_port_t * port,
uint32_t mask )

Toggle authorized outputs under the single-writer contract.

Parameters
[in]portFixed output binding with a serialized writer.
[in]maskAuthorized subset to toggle.
Returns
NX_SUCCESS or INVALID/PERMISSION before register writes.
Note
Read-modify-write is not atomic against unrelated writes.

◆ nx_gpio_port_write()

nx_result_t nx_gpio_port_write ( const nx_gpio_port_t * port,
uint32_t set_mask,
uint32_t reset_mask )

Atomically set/reset one port's authorized output mask.

Parameters
[in]portFixed initialized binding, no registry or OS lock.
[in]set_maskAuthorized bits to set.
[in]reset_maskAuthorized bits to reset; disjoint from set_mask.
Returns
NX_SUCCESS or INVALID/PERMISSION before any register write.
Note
Task/IRQ bounded, no wait. One serialized writer owns the binding. Stop/mode changes require writers and IRQ quiescence.