RTEMS 6.1-rc2
|
Support for the Raspberry PI GPIO. More...
#include <bsp.h>
#include <bsp/raspberrypi.h>
#include <bsp/irq-generic.h>
#include <bsp/gpio.h>
#include <bsp/rpi-gpio.h>
#include <stdlib.h>
#include "gpio-interfaces-pi1-rev2.c"
Macros | |
#define | SELECT_PIN_FUNCTION(fn, pn) (fn << ((pn % 10) * 3)) |
Functions | |
RTEMS_INTERRUPT_LOCK_DEFINE (static, rtems_gpio_bsp_lock, "rtems_gpio_bsp_lock") | |
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_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. | |
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. | |
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_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. | |
rtems_status_code | rpi_gpio_select_jtag (void) |
Setups a JTAG interface. | |
rtems_status_code | rpi_gpio_select_spi (void) |
Setups a SPI interface. | |
rtems_status_code | rpi_gpio_select_i2c (void) |
Setups a I2C interface. | |
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_specific_group_operation (uint32_t bank, uint32_t *pins, uint32_t pin_count, void *arg) |
Variables | |
rtems_gpio_specific_data | alt_func_def [] |
Support for the Raspberry PI GPIO.
rtems_status_code rpi_gpio_select_i2c | ( | void | ) |
Setups a I2C interface.
RTEMS_SUCCESSFUL | I2C interface successfully configured. |
* | At least one of the required pins is currently occupied, |
rtems_status_code rpi_gpio_select_jtag | ( | void | ) |
Setups a JTAG interface.
RTEMS_SUCCESSFUL | JTAG interface successfully configured. |
* | At least one of the required pins is currently occupied, |
rtems_status_code rpi_gpio_select_spi | ( | void | ) |
Setups a SPI interface.
RTEMS_SUCCESSFUL | SPI interface successfully configured. |
* | At least one of the required pins is currently occupied, |
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.
[in] | bank | GPIO bank number. |
[in] | pin | GPIO pin number within the given bank. |
RTEMS_SUCCESSFUL | Pin was cleared successfully. |
RTEMS_UNSATISFIED | Could not clear the given pin. |
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.
[in] | bank | GPIO bank number. |
[in] | pin | GPIO pin number within the given bank. |
[in] | active_interrupt | Interrupt type currently active on this pin. |
RTEMS_SUCCESSFUL | Interrupt successfully disabled for this pin. |
RTEMS_UNSATISFIED | Could not disable interrupts on this pin. |
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.
[in] | bank | GPIO bank number. |
[in] | pin | GPIO pin number within the given bank. |
[in] | interrupt | Type of interrupt to enable for the pin. |
RTEMS_SUCCESSFUL | Interrupt successfully enabled for this pin. |
RTEMS_UNSATISFIED | Could not enable the interrupt on the pin. |
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.
[in] | bank | GPIO bank number. |
[in] | pin | GPIO pin number within the given bank. |
The | function must return 0 if the pin level is a logical low, or non zero if it has a logical high. |
GPIO_INPUT_ERROR | Could not read the pin level. |
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.
[in] | bank | GPIO bank number. |
The | corresponding rtems_vector_number. |
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.
[in] | vector | GPIO vector/bank. |
Bitmask | (max 32-bit) representing a GPIO bank, where a bit set indicates an active interrupt on that pin. |
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.
[in] | bank | GPIO bank number. |
[in] | bitmask | Bitmask of GPIO pins to clear in the given bank. |
RTEMS_SUCCESSFUL | All pins were cleared successfully. |
RTEMS_UNSATISFIED | Could not clear at least one of the pins. |
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.
[in] | bank | GPIO bank number. |
[in] | bitmask | Bitmask of GPIO pins to read in the given bank. |
The | function must return a bitmask with the values of the corresponding pins. 0 for logical low and 1 for logical high. |
GPIO_INPUT_ERROR | Could not read at least one pin level. |
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.
[in] | bank | GPIO bank number. |
[in] | bitmask | Bitmask of GPIO pins to set in the given bank. |
RTEMS_SUCCESSFUL | All pins were set successfully. |
RTEMS_UNSATISFIED | Could not set at least one of the pins. |
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.
[in] | bank | GPIO bank number. |
[in] | pin | GPIO pin number within the given bank. |
[in] | bsp_specific | Pointer to a BSP defined structure with BSP-specific data. |
RTEMS_SUCCESSFUL | Function was assigned successfully. |
RTEMS_UNSATISFIED | Could not assign the function to the pin. |
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.
[in] | bank | GPIO bank number. |
[in] | pin | GPIO pin number within the given bank. |
[in] | bsp_specific | Pointer to a BSP defined structure with BSP-specific data. |
RTEMS_SUCCESSFUL | Function was assigned successfully. |
RTEMS_UNSATISFIED | Could not assign the function to the pin. |
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.
[in] | bank | GPIO bank number. |
[in] | pin | GPIO pin number within the given bank. |
[in] | function | BSP defined GPIO function. |
[in] | pin_data | Pointer to a BSP defined structure with BSP-specific data. |
RTEMS_SUCCESSFUL | Function was assigned successfully. |
RTEMS_UNSATISFIED | Could not assign the function to the pin. |
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.
[in] | bank | GPIO bank number. |
[in] | pin | GPIO pin number within the given bank. |
RTEMS_SUCCESSFUL | Pin was set successfully. |
RTEMS_UNSATISFIED | Could not set the given pin. |
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.
[in] | bank | GPIO bank number. |
[in] | pin | GPIO pin number within the given bank. |
[in] | mode | The pull resistor mode. |
RTEMS_SUCCESSFUL | Pull resistor successfully configured. |
RTEMS_UNSATISFIED | Could not set the pull mode. |
rtems_gpio_specific_data alt_func_def[] |