L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4vbus GPIO functions
+ Collaboration diagram for L4vbus GPIO functions:

Enumerations

enum  L4vbus_gpio_generic_func { L4VBUS_GPIO_SETUP_INPUT = 0x100 , L4VBUS_GPIO_SETUP_OUTPUT = 0x200 , L4VBUS_GPIO_SETUP_IRQ = 0x300 }
 Constants for generic GPIO functions. More...
 
enum  L4vbus_gpio_pull_modes { L4VBUS_GPIO_PIN_PULL_NONE = 0x100 , L4VBUS_GPIO_PIN_PULL_UP = 0x200 , L4VBUS_GPIO_PIN_PULL_DOWN = 0x300 }
 Constants for generic GPIO pull up/down resistor configuration. More...
 

Functions

int l4vbus_gpio_setup (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned pin, unsigned mode, int value)
 Configure the function of a GPIO pin.
 
int l4vbus_gpio_config_pull (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned pin, unsigned mode)
 Generic function to set pull up/down mode.
 
int l4vbus_gpio_config_pad (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned pin, unsigned func, unsigned value)
 Hardware specific configuration function.
 
int l4vbus_gpio_config_get (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned pin, unsigned func, unsigned *value)
 Read hardware specific configuration.
 
int l4vbus_gpio_get (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned pin)
 Read value of GPIO input pin.
 
int l4vbus_gpio_set (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned pin, int value)
 Set GPIO output pin.
 
int l4vbus_gpio_multi_setup (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned offset, unsigned mask, unsigned mode, unsigned value)
 Configure function of multiple GPIO pins at once.
 
int l4vbus_gpio_multi_config_pad (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned offset, unsigned mask, unsigned func, unsigned value)
 Hardware specific configuration function for multiple GPIO pins.
 
int l4vbus_gpio_multi_get (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned offset, unsigned *data)
 Read values of multiple GPIO pins at once.
 
int l4vbus_gpio_multi_set (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned offset, unsigned mask, unsigned data)
 Set multiple GPIO output pins at once.
 
int l4vbus_gpio_to_irq (l4_cap_idx_t vbus, l4vbus_device_handle_t handle, unsigned pin)
 Create IRQ for GPIO pin.
 

Detailed Description

Enumeration Type Documentation

◆ L4vbus_gpio_generic_func

Constants for generic GPIO functions.

Enumerator
L4VBUS_GPIO_SETUP_INPUT 

Set GPIO pin to input.

L4VBUS_GPIO_SETUP_OUTPUT 

Set GPIO pin to output.

L4VBUS_GPIO_SETUP_IRQ 

Set GPIO pin to IRQ.

Definition at line 26 of file vbus_gpio.h.

◆ L4vbus_gpio_pull_modes

Constants for generic GPIO pull up/down resistor configuration.

Enumerator
L4VBUS_GPIO_PIN_PULL_NONE 

No pull up or pull down resistors.

L4VBUS_GPIO_PIN_PULL_UP 

enable pull up resistor

L4VBUS_GPIO_PIN_PULL_DOWN 

enable pull down resistor

Definition at line 36 of file vbus_gpio.h.

Function Documentation

◆ l4vbus_gpio_config_get()

int l4vbus_gpio_config_get ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  pin,
unsigned  func,
unsigned *  value 
)

Read hardware specific configuration.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
pinGPIO pin number
funcHardware specific configuration register to read from. Usually this is an offset to the GPIO chip's base address.
[out]valueThe configuration value.
Returns
0 if OK, error code otherwise

Referenced by L4vbus::Gpio_pin::config_get().

+ Here is the caller graph for this function:

◆ l4vbus_gpio_config_pad()

int l4vbus_gpio_config_pad ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  pin,
unsigned  func,
unsigned  value 
)

Hardware specific configuration function.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
pinGPIO pin number
funcHardware specific configuration register, usually offset to the GPIO chip's base address
valueValue which is written into the hardware specific configuration register for the specified pin
Returns
0 if OK, error code otherwise

Referenced by L4vbus::Gpio_pin::config_pad().

+ Here is the caller graph for this function:

◆ l4vbus_gpio_config_pull()

int l4vbus_gpio_config_pull ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  pin,
unsigned  mode 
)

Generic function to set pull up/down mode.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
pinGPIO pin number
modemode for pull up/down resistors, see L4vbus_gpio_pull_modes
Returns
0 if OK, error code otherwise

Referenced by L4vbus::Gpio_pin::config_pull().

+ Here is the caller graph for this function:

◆ l4vbus_gpio_get()

int l4vbus_gpio_get ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  pin 
)

Read value of GPIO input pin.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
pinGPIO pin number to read from
Returns
Value of GPIO pin (usually 0 or 1), negative error code otherwise.

Referenced by L4vbus::Gpio_pin::get().

+ Here is the caller graph for this function:

◆ l4vbus_gpio_multi_config_pad()

int l4vbus_gpio_multi_config_pad ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  offset,
unsigned  mask,
unsigned  func,
unsigned  value 
)

Hardware specific configuration function for multiple GPIO pins.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
offsetPin corresponding to the LSB in mask. Note: allowed may be hardware specific.
maskMask of GPIO pins to configure. A bit set to 1 configures this pin. A maximum of 32 pins can be configured at once. The real number depends on the hardware and the driver implementation.
funcHardware specific configuration register, usually offset to the GPIO chip's base address.
valueValue which is written into the hardware specific configuration register for the specified pins
Returns
0 if OK, error code otherwise

Referenced by L4vbus::Gpio_module::config_pad().

+ Here is the caller graph for this function:

◆ l4vbus_gpio_multi_get()

int l4vbus_gpio_multi_get ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  offset,
unsigned *  data 
)

Read values of multiple GPIO pins at once.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
offsetPin corresponding to the LSB in data. Note: allowed may be hardware specific.
[out]dataEach bit returns the value (0 or 1) for the corresponding GPIO pin. The value of pins that are not accessible is undefined.
Returns
0 if OK, error code otherwise

Referenced by L4vbus::Gpio_module::get().

+ Here is the caller graph for this function:

◆ l4vbus_gpio_multi_set()

int l4vbus_gpio_multi_set ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  offset,
unsigned  mask,
unsigned  data 
)

Set multiple GPIO output pins at once.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
offsetPin corresponding to the LSB in data. Note: allowed may be hardware specific.
maskMask of GPIO pins to set. A bit set to 1 selects this pin. A maximum of 32 pins can be set at once. The real number depends on the hardware and the driver implementation.
dataEach bit corresponds to the GPIO pin in mask. The value of each bit is written to the GPIO pin if its bit in mask is set.
Returns
0 if OK, error code otherwise

Referenced by L4vbus::Gpio_module::set().

+ Here is the caller graph for this function:

◆ l4vbus_gpio_multi_setup()

int l4vbus_gpio_multi_setup ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  offset,
unsigned  mask,
unsigned  mode,
unsigned  value 
)

Configure function of multiple GPIO pins at once.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
offsetPin corresponding to the LSB in mask. Note: allowed may be hardware specific.
maskMask of GPIO pins to configure. A bit set to 1 configures this pin. A maximum of 32 pins can be configured at once. The real number depends on the hardware and the driver implementation.
modeGPIO function, see L4vbus_gpio_generic_func for generic functions. Hardware specific functions must be provided in the lower 8 bits.
valueOptional value to set the GPIO pins to if they are configured as output pins
Returns
0 if OK, error code otherwise

Referenced by L4vbus::Gpio_module::setup().

+ Here is the caller graph for this function:

◆ l4vbus_gpio_set()

int l4vbus_gpio_set ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  pin,
int  value 
)

Set GPIO output pin.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
pinGPIO pin number to write to
valueValue to write to the GPIO pin (usually 0 or 1)
Returns
0 if OK, error code otherwise

Referenced by L4vbus::Gpio_pin::set().

+ Here is the caller graph for this function:

◆ l4vbus_gpio_setup()

int l4vbus_gpio_setup ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  pin,
unsigned  mode,
int  value 
)

Configure the function of a GPIO pin.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
pinGPIO pin number
modeGPIO function, see L4vbus_gpio_generic_func for generic functions. Hardware specific functions must be provided in the lower 8 bits.
valueOptional value to set the GPIO pin to if it is configured as an output pin
Returns
0 if OK, error code otherwise

Referenced by L4vbus::Gpio_pin::setup().

+ Here is the caller graph for this function:

◆ l4vbus_gpio_to_irq()

int l4vbus_gpio_to_irq ( l4_cap_idx_t  vbus,
l4vbus_device_handle_t  handle,
unsigned  pin 
)

Create IRQ for GPIO pin.

Parameters
vbusV-BUS capability
handleDevice handle for the GPIO chip
pinGPIO pin to create an IRQ for.
Returns
IRQ number if OK, negative error code otherwise

Referenced by L4vbus::Gpio_pin::to_irq().

+ Here is the caller graph for this function: