RTEMS 6.1-rc4
Loading...
Searching...
No Matches
Data Structures | Macros
gpio.h File Reference

RTEMS GPIO API definition. More...

#include <bsp.h>
#include <rtems.h>

Go to the source code of this file.

Data Structures

struct  rtems_gpio_specific_data
 Object containing relevant information for assigning a BSP specific function to a pin. More...
 
struct  rtems_gpio_interrupt_configuration
 Object containing configuration information regarding interrupts. More...
 
struct  rtems_gpio_pin_conf
 Object containing configuration information to request/update a GPIO pin. More...
 
struct  rtems_gpio_multiple_pin_select
 Object containing configuration information to assign GPIO functions to multiple pins at the same time. To be used by BSP code only. More...
 
struct  rtems_gpio_group_definition
 Object containing configuration information to request a GPIO pin group. More...
 

Macros

#define GPIO_LAST_BANK_PINS   BSP_GPIO_PIN_COUNT % BSP_GPIO_PINS_PER_BANK
 
#define GPIO_BANK_COUNT   BSP_GPIO_PIN_COUNT / BSP_GPIO_PINS_PER_BANK
 
#define GPIO_LAST_BANK_PINS   BSP_GPIO_PINS_PER_BANK
 
#define GPIO_SELECT_BANK_COUNT    BSP_GPIO_PINS_PER_BANK / BSP_GPIO_PINS_PER_SELECT_BANK
 
#define INTERRUPT_SERVER_PRIORITY   1
 
#define INTERRUPT_SERVER_STACK_SIZE   2 * RTEMS_MINIMUM_STACK_SIZE
 
#define INTERRUPT_SERVER_MODES   RTEMS_TIMESLICE | RTEMS_PREEMPT
 
#define INTERRUPT_SERVER_ATTRIBUTES   RTEMS_DEFAULT_ATTRIBUTES
 
#define GPIO_INPUT_ERROR   ~0
 

GPIO data structures

enum  rtems_gpio_pull_mode { PULL_UP = 1 , PULL_DOWN , NO_PULL_RESISTOR }
 The set of possible configurations for a GPIO pull-up resistor. More...
 
enum  rtems_gpio_function { DIGITAL_INPUT = 0 , DIGITAL_OUTPUT , BSP_SPECIFIC , NOT_USED }
 The set of possible functions a pin can have. More...
 
enum  rtems_gpio_interrupt {
  FALLING_EDGE = 0 , RISING_EDGE , LOW_LEVEL , HIGH_LEVEL ,
  BOTH_EDGES , BOTH_LEVELS , NONE
}
 The set of possible interrupts a GPIO pin can generate. More...
 
enum  rtems_gpio_irq_state { IRQ_HANDLED , IRQ_NONE }
 The set of possible handled states an user-defined interrupt handler can return. More...
 
enum  rtems_gpio_handler_flag { SHARED_HANDLER , UNIQUE_HANDLER }
 The set of flags to specify an user-defined interrupt handler uniqueness on a GPIO pin. More...
 
typedef struct rtems_gpio_group rtems_gpio_group
 Opaque type for a GPIO pin group.
 

gpio Usage

rtems_status_code rtems_gpio_initialize (void)
 Initializes the GPIO API.
 
rtems_gpio_grouprtems_gpio_create_pin_group (void)
 Instantiates a GPIO pin group. To define the group.
 
rtems_status_code rtems_gpio_define_pin_group (const rtems_gpio_group_definition *group_definition, rtems_gpio_group *group)
 
rtems_status_code rtems_gpio_write_group (uint32_t data, rtems_gpio_group *group)
 Writes a value to the group's digital outputs. The pins order is as defined in the group definition.
 
uint32_t rtems_gpio_read_group (rtems_gpio_group *group)
 Reads the value/level of the group's digital inputs. The pins order is as defined in the group definition.
 
rtems_status_code rtems_gpio_group_bsp_specific_operation (rtems_gpio_group *group, void *arg)
 Performs a BSP specific operation on a group of pins. The pins order is as defined in the group definition.
 
rtems_status_code rtems_gpio_request_configuration (const rtems_gpio_pin_conf *conf)
 Requests a GPIO pin configuration.
 
rtems_status_code rtems_gpio_update_configuration (const rtems_gpio_pin_conf *conf)
 Updates the current configuration of a GPIO pin .
 
rtems_status_code rtems_gpio_multi_set (uint32_t *pin_numbers, uint32_t pin_count)
 Sets multiple output GPIO pins with the logical high.
 
rtems_status_code rtems_gpio_multi_clear (uint32_t *pin_numbers, uint32_t pin_count)
 Sets multiple output GPIO pins with the logical low.
 
uint32_t rtems_gpio_multi_read (uint32_t *pin_numbers, uint32_t pin_count)
 Returns the value (level) of multiple GPIO input pins.
 
rtems_status_code rtems_gpio_set (uint32_t pin_number)
 Sets an output GPIO pin with the logical high.
 
rtems_status_code rtems_gpio_clear (uint32_t pin_number)
 Sets an output GPIO pin with the logical low.
 
int rtems_gpio_get_value (uint32_t pin_number)
 Returns the value (level) of a GPIO input pin.
 
rtems_status_code rtems_gpio_multi_select (const rtems_gpio_pin_conf *pins, uint8_t pin_count)
 
rtems_status_code rtems_gpio_request_pin (uint32_t pin_number, rtems_gpio_function function, bool output_enable, bool logic_invert, void *bsp_specific)
 
rtems_status_code rtems_gpio_resistor_mode (uint32_t pin_number, rtems_gpio_pull_mode mode)
 Configures a single GPIO pin pull resistor.
 
rtems_status_code rtems_gpio_release_pin (uint32_t pin_number)
 Releases a GPIO pin, making it available to be used again.
 
rtems_status_code rtems_gpio_release_configuration (const rtems_gpio_pin_conf *conf)
 Releases a GPIO pin, making it available to be used again.
 
rtems_status_code rtems_gpio_release_multiple_pins (const rtems_gpio_pin_conf *pins, uint32_t pin_count)
 
rtems_status_code rtems_gpio_release_pin_group (rtems_gpio_group *group)
 Releases a GPIO pin group, making the pins used available to be repurposed.
 
rtems_status_code rtems_gpio_debounce_switch (uint32_t pin_number, int ticks)
 Attaches a debouncing function to a given pin/switch. Debouncing is done by requiring a certain number of clock ticks to pass between interrupts. Any interrupt fired too close to the last will be ignored as it is probably the result of an involuntary switch/button bounce after being released.
 
rtems_status_code rtems_gpio_interrupt_handler_install (uint32_t pin_number, rtems_gpio_irq_state(*handler)(void *arg), void *arg)
 Connects a new user-defined interrupt handler to a given pin.
 
rtems_status_code rtems_gpio_enable_interrupt (uint32_t pin_number, rtems_gpio_interrupt interrupt, rtems_gpio_handler_flag flag, bool threaded_handling, rtems_gpio_irq_state(*handler)(void *arg), void *arg)
 
rtems_status_code rtems_gpio_interrupt_handler_remove (uint32_t pin_number, rtems_gpio_irq_state(*handler)(void *arg), void *arg)
 Disconnects an user-defined interrupt handler from the given pin. If in the end there are no more user-defined handlers connected to the pin, interrupts are disabled on the given pin.
 
rtems_status_code rtems_gpio_disable_interrupt (uint32_t pin_number)
 Stops interrupts from being generated on a given GPIO pin and removes the corresponding handler.
 
rtems_status_code rtems_gpio_bsp_multi_set (uint32_t bank, uint32_t bitmask)
 Sets multiple output GPIO pins with the logical high. This must be implemented by each BSP.
 
rtems_status_code rtems_gpio_bsp_multi_clear (uint32_t bank, uint32_t bitmask)
 Sets multiple output GPIO pins with the logical low. This must be implemented by each BSP.
 
uint32_t rtems_gpio_bsp_multi_read (uint32_t bank, uint32_t bitmask)
 Returns the value (level) of multiple GPIO input pins. This must be implemented by each BSP.
 
rtems_status_code rtems_gpio_bsp_specific_group_operation (uint32_t bank, uint32_t *pins, uint32_t pin_count, void *arg)
 
rtems_status_code rtems_gpio_bsp_multi_select (rtems_gpio_multiple_pin_select *pins, uint32_t pin_count, uint32_t select_bank)
 
rtems_status_code rtems_gpio_bsp_set (uint32_t bank, uint32_t pin)
 Sets an output GPIO pin with the logical high. This must be implemented by each BSP.
 
rtems_status_code rtems_gpio_bsp_clear (uint32_t bank, uint32_t pin)
 Sets an output GPIO pin with the logical low. This must be implemented by each BSP.
 
uint32_t rtems_gpio_bsp_get_value (uint32_t bank, uint32_t pin)
 Returns the value (level) of a GPIO input pin. This must be implemented by each BSP.
 
rtems_status_code rtems_gpio_bsp_select_input (uint32_t bank, uint32_t pin, void *bsp_specific)
 Assigns the digital input function to the given pin. This must be implemented by each BSP.
 
rtems_status_code rtems_gpio_bsp_select_output (uint32_t bank, uint32_t pin, void *bsp_specific)
 Assigns the digital output function to the given pin. This must be implemented by each BSP.
 
rtems_status_code rtems_gpio_bsp_select_specific_io (uint32_t bank, uint32_t pin, uint32_t function, void *pin_data)
 Assigns a BSP specific function to the given pin. This must be implemented by each BSP.
 
rtems_status_code rtems_gpio_bsp_set_resistor_mode (uint32_t bank, uint32_t pin, rtems_gpio_pull_mode mode)
 Configures a single GPIO pin pull resistor. This must be implemented by each BSP.
 
uint32_t rtems_gpio_bsp_interrupt_line (rtems_vector_number vector)
 Reads and returns a vector/bank interrupt event line. The bitmask should indicate with a 1 if the corresponding pin as a pending interrupt, or 0 if otherwise. The function should clear the interrupt event line before returning. This must be implemented by each BSP.
 
rtems_vector_number rtems_gpio_bsp_get_vector (uint32_t bank)
 Calculates a vector number for a given GPIO bank. This must be implemented by each BSP.
 
rtems_status_code rtems_gpio_bsp_enable_interrupt (uint32_t bank, uint32_t pin, rtems_gpio_interrupt interrupt)
 Enables interrupts to be generated on a given GPIO pin. This must be implemented by each BSP.
 
rtems_status_code rtems_gpio_bsp_disable_interrupt (uint32_t bank, uint32_t pin, rtems_gpio_interrupt interrupt)
 Stops interrupts from being generated on a given GPIO pin. This must be implemented by each BSP.
 

Detailed Description

RTEMS GPIO API definition.

Enumeration Type Documentation

◆ rtems_gpio_function

The set of possible functions a pin can have.

Enumerated type to define a pin function.

Enumerator
DIGITAL_OUTPUT 

Assigns a certain function to a GPIO pin.

Parameters
[in]pin_numberGPIO pin number.
[in]functionThe new function for the pin.
[in]output_enabledIf TRUE and then the pin is set with the logical high. Otherwise it is set with logical low.
[in]logic_invertReverses the digital I/O logic for DIGITAL_INPUT and DIGITAL_OUTPUT pins.
[in]bsp_specificPointer to a BSP defined structure with BSP-specific data. This field is handled by the BSP.
Return values
RTEMS_SUCCESSFULPin was configured successfully.
RTEMS_INVALID_IDPin number is invalid.
RTEMS_RESOURCE_IN_USEThe received pin is already being used.
RTEMS_UNSATISFIEDCould not assign the GPIO function.
RTEMS_NOT_DEFINEDGPIO function not defined, or NOT_USED.

◆ rtems_gpio_handler_flag

The set of flags to specify an user-defined interrupt handler uniqueness on a GPIO pin.

Enumerated type to define an interrupt handler shared flag.

◆ rtems_gpio_interrupt

The set of possible interrupts a GPIO pin can generate.

Enumerated type to define a GPIO pin interrupt.

◆ rtems_gpio_irq_state

The set of possible handled states an user-defined interrupt handler can return.

Enumerated type to define an interrupt handler handled state.

◆ rtems_gpio_pull_mode

The set of possible configurations for a GPIO pull-up resistor.

Enumerated type to define the possible pull-up resistor configurations for a GPIO pin.

Function Documentation

◆ rtems_gpio_bsp_clear()

rtems_status_code rtems_gpio_bsp_clear ( uint32_t  bank,
uint32_t  pin 
)

Sets an output GPIO pin with the logical low. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]pinGPIO pin number within the given bank.
Return values
RTEMS_SUCCESSFULPin was cleared successfully.
RTEMS_UNSATISFIEDCould not clear the given pin.

◆ rtems_gpio_bsp_disable_interrupt()

rtems_status_code rtems_gpio_bsp_disable_interrupt ( uint32_t  bank,
uint32_t  pin,
rtems_gpio_interrupt  interrupt 
)

Stops interrupts from being generated on a given GPIO pin. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]pinGPIO pin number within the given bank.
[in]active_interruptInterrupt type currently active on this pin.
Return values
RTEMS_SUCCESSFULInterrupt successfully disabled for this pin.
RTEMS_UNSATISFIEDCould not disable interrupts on this pin.

◆ rtems_gpio_bsp_enable_interrupt()

rtems_status_code rtems_gpio_bsp_enable_interrupt ( uint32_t  bank,
uint32_t  pin,
rtems_gpio_interrupt  interrupt 
)

Enables interrupts to be generated on a given GPIO pin. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]pinGPIO pin number within the given bank.
[in]interruptType of interrupt to enable for the pin.
Return values
RTEMS_SUCCESSFULInterrupt successfully enabled for this pin.
RTEMS_UNSATISFIEDCould not enable the interrupt on the pin.

◆ rtems_gpio_bsp_get_value()

uint32_t rtems_gpio_bsp_get_value ( uint32_t  bank,
uint32_t  pin 
)

Returns the value (level) of a GPIO input pin. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]pinGPIO pin number within the given bank.
Return values
Thefunction must return 0 if the pin level is a logical low, or non zero if it has a logical high.
GPIO_INPUT_ERRORCould not read the pin level.

◆ rtems_gpio_bsp_get_vector()

rtems_vector_number rtems_gpio_bsp_get_vector ( uint32_t  bank)

Calculates a vector number for a given GPIO bank. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
Return values
Thecorresponding rtems_vector_number.

◆ rtems_gpio_bsp_interrupt_line()

uint32_t rtems_gpio_bsp_interrupt_line ( rtems_vector_number  vector)

Reads and returns a vector/bank interrupt event line. The bitmask should indicate with a 1 if the corresponding pin as a pending interrupt, or 0 if otherwise. The function should clear the interrupt event line before returning. This must be implemented by each BSP.

Parameters
[in]vectorGPIO vector/bank.
Return values
Bitmask(max 32-bit) representing a GPIO bank, where a bit set indicates an active interrupt on that pin.

◆ rtems_gpio_bsp_multi_clear()

rtems_status_code rtems_gpio_bsp_multi_clear ( uint32_t  bank,
uint32_t  bitmask 
)

Sets multiple output GPIO pins with the logical low. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]bitmaskBitmask of GPIO pins to clear in the given bank.
Return values
RTEMS_SUCCESSFULAll pins were cleared successfully.
RTEMS_UNSATISFIEDCould not clear at least one of the pins.

◆ rtems_gpio_bsp_multi_read()

uint32_t rtems_gpio_bsp_multi_read ( uint32_t  bank,
uint32_t  bitmask 
)

Returns the value (level) of multiple GPIO input pins. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]bitmaskBitmask of GPIO pins to read in the given bank.
Return values
Thefunction must return a bitmask with the values of the corresponding pins. 0 for logical low and 1 for logical high.
GPIO_INPUT_ERRORCould not read at least one pin level.

◆ rtems_gpio_bsp_multi_set()

rtems_status_code rtems_gpio_bsp_multi_set ( uint32_t  bank,
uint32_t  bitmask 
)

Sets multiple output GPIO pins with the logical high. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]bitmaskBitmask of GPIO pins to set in the given bank.
Return values
RTEMS_SUCCESSFULAll pins were set successfully.
RTEMS_UNSATISFIEDCould not set at least one of the pins.

◆ rtems_gpio_bsp_select_input()

rtems_status_code rtems_gpio_bsp_select_input ( uint32_t  bank,
uint32_t  pin,
void *  bsp_specific 
)

Assigns the digital input function to the given pin. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]pinGPIO pin number within the given bank.
[in]bsp_specificPointer to a BSP defined structure with BSP-specific data.
Return values
RTEMS_SUCCESSFULFunction was assigned successfully.
RTEMS_UNSATISFIEDCould not assign the function to the pin.

◆ rtems_gpio_bsp_select_output()

rtems_status_code rtems_gpio_bsp_select_output ( uint32_t  bank,
uint32_t  pin,
void *  bsp_specific 
)

Assigns the digital output function to the given pin. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]pinGPIO pin number within the given bank.
[in]bsp_specificPointer to a BSP defined structure with BSP-specific data.
Return values
RTEMS_SUCCESSFULFunction was assigned successfully.
RTEMS_UNSATISFIEDCould not assign the function to the pin.

◆ rtems_gpio_bsp_select_specific_io()

rtems_status_code rtems_gpio_bsp_select_specific_io ( uint32_t  bank,
uint32_t  pin,
uint32_t  function,
void *  pin_data 
)

Assigns a BSP specific function to the given pin. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]pinGPIO pin number within the given bank.
[in]functionBSP defined GPIO function.
[in]pin_dataPointer to a BSP defined structure with BSP-specific data.
Return values
RTEMS_SUCCESSFULFunction was assigned successfully.
RTEMS_UNSATISFIEDCould not assign the function to the pin.

◆ rtems_gpio_bsp_set()

rtems_status_code rtems_gpio_bsp_set ( uint32_t  bank,
uint32_t  pin 
)

Sets an output GPIO pin with the logical high. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]pinGPIO pin number within the given bank.
Return values
RTEMS_SUCCESSFULPin was set successfully.
RTEMS_UNSATISFIEDCould not set the given pin.

◆ rtems_gpio_bsp_set_resistor_mode()

rtems_status_code rtems_gpio_bsp_set_resistor_mode ( uint32_t  bank,
uint32_t  pin,
rtems_gpio_pull_mode  mode 
)

Configures a single GPIO pin pull resistor. This must be implemented by each BSP.

Parameters
[in]bankGPIO bank number.
[in]pinGPIO pin number within the given bank.
[in]modeThe pull resistor mode.
Return values
RTEMS_SUCCESSFULPull resistor successfully configured.
RTEMS_UNSATISFIEDCould not set the pull mode.

◆ rtems_gpio_clear()

rtems_status_code rtems_gpio_clear ( uint32_t  pin_number)

Sets an output GPIO pin with the logical low.

Parameters
[in]pin_numberGPIO pin number.
Return values
RTEMS_SUCCESSFULPin was cleared successfully.
RTEMS_INVALID_IDPin number is invalid.
RTEMS_NOT_CONFIGUREDThe received pin is not configured as a digital output.
RTEMS_UNSATISFIEDCould not clear the GPIO pin.

◆ rtems_gpio_create_pin_group()

rtems_gpio_group * rtems_gpio_create_pin_group ( void  )

Instantiates a GPIO pin group. To define the group.

See also
rtems_gpio_define_pin_group().
Return values
rtems_gpio_grouppointer.

◆ rtems_gpio_debounce_switch()

rtems_status_code rtems_gpio_debounce_switch ( uint32_t  pin_number,
int  ticks 
)

Attaches a debouncing function to a given pin/switch. Debouncing is done by requiring a certain number of clock ticks to pass between interrupts. Any interrupt fired too close to the last will be ignored as it is probably the result of an involuntary switch/button bounce after being released.

Parameters
[in]pin_numberGPIO pin number.
[in]ticksMinimum number of clock ticks that must pass between interrupts so it can be considered a legitimate interrupt.
Return values
RTEMS_SUCCESSFULDebounce function successfully attached to the pin.
RTEMS_INVALID_IDPin number is invalid.
RTEMS_NOT_CONFIGUREDThe current pin is not configured as a digital input, hence it can not be connected to a switch, or interrupts are not enabled for this pin.

◆ rtems_gpio_disable_interrupt()

rtems_status_code rtems_gpio_disable_interrupt ( uint32_t  pin_number)

Stops interrupts from being generated on a given GPIO pin and removes the corresponding handler.

Parameters
[in]pin_numberGPIO pin number.
Return values
RTEMS_SUCCESSFULInterrupt successfully disabled for this pin.
RTEMS_INVALID_IDPin number is invalid.
RTEMS_NOT_CONFIGUREDPin has no active interrupts.
RTEMS_UNSATISFIEDCould not remove the current interrupt handler, could not recognize the current active interrupt on this pin or could not disable interrupts on this pin.

◆ rtems_gpio_get_value()

int rtems_gpio_get_value ( uint32_t  pin_number)

Returns the value (level) of a GPIO input pin.

Parameters
[in]pin_numberGPIO pin number.
Return values
Thefunction returns 0 or 1 depending on the pin current logical value.
-1Pin number is invalid, or not a digital input pin.

◆ rtems_gpio_group_bsp_specific_operation()

rtems_status_code rtems_gpio_group_bsp_specific_operation ( rtems_gpio_group group,
void *  arg 
)

Performs a BSP specific operation on a group of pins. The pins order is as defined in the group definition.

Parameters
[in]groupReference to the group.
[in]argPointer to a BSP defined structure with BSP-specific data. This field is handled by the BSP.
Return values
RTEMS_SUCCESSFULOperation completed with success.
RTEMS_NOT_DEFINEDGroup has no BSP specific pins, or the BSP does not support BSP specific operations for groups.
RTEMS_UNSATISFIEDCould not operate on at least one of the pins.

◆ rtems_gpio_initialize()

rtems_status_code rtems_gpio_initialize ( void  )

Initializes the GPIO API.

Return values
RTEMS_SUCCESSFULAPI successfully initialized.
*
See also
rtems_semaphore_create().

◆ rtems_gpio_interrupt_handler_install()

rtems_status_code rtems_gpio_interrupt_handler_install ( uint32_t  pin_number,
rtems_gpio_irq_state(*)(void *arg)  handler,
void *  arg 
)

Connects a new user-defined interrupt handler to a given pin.

Parameters
[in]pin_numberGPIO pin number.
[in]handlerPointer to a function that will be called every time the enabled interrupt for the given pin is generated. This function must return information about its handled/unhandled state.
[in]argVoid pointer to the arguments of the user-defined handler.
Return values
RTEMS_SUCCESSFULHandler successfully connected to this pin.
RTEMS_NO_MEMORYCould not connect more user-defined handlers to the given pin.
RTEMS_NOT_CONFIGUREDThe given pin has no interrupt configured.
RTEMS_INVALID_IDPin number is invalid.
RTEMS_TOO_MANYThe pin's current handler is set as unique.
RTEMS_RESOURCE_IN_USEThe current user-defined handler for this pin is unique.

◆ rtems_gpio_interrupt_handler_remove()

rtems_status_code rtems_gpio_interrupt_handler_remove ( uint32_t  pin_number,
rtems_gpio_irq_state(*)(void *arg)  handler,
void *  arg 
)

Disconnects an user-defined interrupt handler from the given pin. If in the end there are no more user-defined handlers connected to the pin, interrupts are disabled on the given pin.

Parameters
[in]pin_numberGPIO pin number.
[in]handlerPointer to the user-defined handler
[in]argVoid pointer to the arguments of the user-defined handler.
Return values
RTEMS_SUCCESSFULHandler successfully disconnected from this pin.
RTEMS_INVALID_IDPin number is invalid.
RTEMS_NOT_CONFIGUREDPin has no active interrupts.
*
See also
rtems_gpio_disable_interrupt()

◆ rtems_gpio_multi_clear()

rtems_status_code rtems_gpio_multi_clear ( uint32_t *  pin_numbers,
uint32_t  pin_count 
)

Sets multiple output GPIO pins with the logical low.

Parameters
[in]pin_numbersArray with the GPIO pin numbers to clear.
[in]countNumber of GPIO pins to clear.
Return values
RTEMS_SUCCESSFULAll pins were cleared successfully.
RTEMS_INVALID_IDAt least one pin number is invalid.
RTEMS_NOT_CONFIGUREDAt least one of the received pins is not configured as a digital output.
RTEMS_UNSATISFIEDCould not clear the GPIO pins.

◆ rtems_gpio_multi_read()

uint32_t rtems_gpio_multi_read ( uint32_t *  pin_numbers,
uint32_t  pin_count 
)

Returns the value (level) of multiple GPIO input pins.

Parameters
[in]pin_numbersArray with the GPIO pin numbers to read.
[in]countNumber of GPIO pins to read.
Return values
Bitmaskwith the values of the corresponding pins. 0 for logical low and 1 for logical high.
GPIO_INPUT_ERRORCould not read at least one pin level.

◆ rtems_gpio_multi_set()

rtems_status_code rtems_gpio_multi_set ( uint32_t *  pin_numbers,
uint32_t  pin_count 
)

Sets multiple output GPIO pins with the logical high.

Parameters
[in]pin_numbersArray with the GPIO pin numbers to set.
[in]countNumber of GPIO pins to set.
Return values
RTEMS_SUCCESSFULAll pins were set successfully.
RTEMS_INVALID_IDAt least one pin number is invalid.
RTEMS_NOT_CONFIGUREDAt least one of the received pins is not configured as a digital output.
RTEMS_UNSATISFIEDCould not set the GPIO pins.

◆ rtems_gpio_read_group()

uint32_t rtems_gpio_read_group ( rtems_gpio_group group)

Reads the value/level of the group's digital inputs. The pins order is as defined in the group definition.

Parameters
[in]groupReference to the group.
Return values
Thefunction returns a 32-bit bitmask with the group's input pins current logical values.
GPIO_INPUT_ERRORGroup has no input pins.

◆ rtems_gpio_release_configuration()

rtems_status_code rtems_gpio_release_configuration ( const rtems_gpio_pin_conf conf)

Releases a GPIO pin, making it available to be used again.

Parameters
[in]confGPIO pin configuration to be released.
Return values
RTEMS_SUCCESSFULPin successfully disabled.
RTEMS_UNSATISFIEDPin configuration is NULL.
*
See also
rtems_gpio_release_pin().

◆ rtems_gpio_release_pin()

rtems_status_code rtems_gpio_release_pin ( uint32_t  pin_number)

Releases a GPIO pin, making it available to be used again.

Parameters
[in]pin_numberGPIO pin number.
Return values
RTEMS_SUCCESSFULPin successfully disabled.
RTEMS_INVALID_IDPin number is invalid.
*Could not disable an active interrupt on this pin,
See also
rtems_gpio_disable_interrupt().

◆ rtems_gpio_release_pin_group()

rtems_status_code rtems_gpio_release_pin_group ( rtems_gpio_group group)

Releases a GPIO pin group, making the pins used available to be repurposed.

Parameters
[in]confGPIO pin configuration to be released.
Return values
RTEMS_SUCCESSFULPins successfully disabled.
*
See also
rtems_gpio_release_pin(),
rtems_semaphore_delete() or
rtems_semaphore_flush().

◆ rtems_gpio_request_configuration()

rtems_status_code rtems_gpio_request_configuration ( const rtems_gpio_pin_conf conf)

Requests a GPIO pin configuration.

Parameters
[in]confrtems_gpio_pin_conf structure filled with the pin information and desired configurations.
Return values
RTEMS_SUCCESSFULPin was configured successfully.
RTEMS_UNSATISFIEDCould not satisfy the given configuration.

◆ rtems_gpio_resistor_mode()

rtems_status_code rtems_gpio_resistor_mode ( uint32_t  pin_number,
rtems_gpio_pull_mode  mode 
)

Configures a single GPIO pin pull resistor.

Parameters
[in]pin_numberGPIO pin number.
[in]modeThe pull resistor mode.
Return values
RTEMS_SUCCESSFULPull resistor successfully configured.
RTEMS_INVALID_IDPin number is invalid.
RTEMS_UNSATISFIEDCould not set the pull mode.

◆ rtems_gpio_set()

rtems_status_code rtems_gpio_set ( uint32_t  pin_number)

Sets an output GPIO pin with the logical high.

Parameters
[in]pin_numberGPIO pin number.
Return values
RTEMS_SUCCESSFULPin was set successfully.
RTEMS_INVALID_IDPin number is invalid.
RTEMS_NOT_CONFIGUREDThe received pin is not configured as a digital output.
RTEMS_UNSATISFIEDCould not set the GPIO pin.

◆ rtems_gpio_update_configuration()

rtems_status_code rtems_gpio_update_configuration ( const rtems_gpio_pin_conf conf)

Updates the current configuration of a GPIO pin .

Parameters
[in]confrtems_gpio_pin_conf structure filled with the pin information and desired configurations.
Return values
RTEMS_SUCCESSFULPin configuration was updated successfully.
RTEMS_INVALID_IDPin number is invalid.
RTEMS_NOT_CONFIGUREDThe pin is not being used.
RTEMS_UNSATISFIEDCould not update the pin's configuration.

◆ rtems_gpio_write_group()

rtems_status_code rtems_gpio_write_group ( uint32_t  data,
rtems_gpio_group group 
)

Writes a value to the group's digital outputs. The pins order is as defined in the group definition.

Parameters
[in]dataData to write/send.
[in]groupReference to the group.
Return values
RTEMS_SUCCESSFULData successfully written.
RTEMS_NOT_DEFINEDGroup has no output pins.
RTEMS_UNSATISFIEDCould not operate on at least one of the pins.