L4Re - L4 Runtime Environment
L4vbus::Gpio_module Class Reference

A Gpio_module groups multiple GPIO pins together. More...

+ Inheritance diagram for L4vbus::Gpio_module:
+ Collaboration diagram for L4vbus::Gpio_module:

Data Structures

struct  Pin_slice
 A slice of the pins provided by this module. More...
 

Public Member Functions

int setup (Pin_slice const &mask, unsigned mode, unsigned value) const
 Configure function of multiple GPIO pins at once. More...
 
int config_pad (Pin_slice const &mask, unsigned func, unsigned value) const
 Hardware specific configuration function for multiple GPIO pins. More...
 
int get (unsigned offset, unsigned *data) const
 Read values of multiple GPIO pins at once. More...
 
int set (Pin_slice const &mask, unsigned data)
 Set multiple GPIO output pins at once. More...
 
Gpio_pin pin (unsigned pin) const
 Get Gpio_pin for a specific pin of this Gpio_module. More...
 
- Public Member Functions inherited from L4vbus::Device
L4::Cap< Vbusbus_cap () const
 Access the V-BUS capability of the underlying virtual bus. More...
 
l4vbus_device_handle_t dev_handle () const
 Access the device handle of this device. More...
 
int device_by_hid (Device *child, char const *hid, int depth=L4VBUS_MAX_DEPTH, l4vbus_device_t *devinfo=0) const
 Find a device by the HID. More...
 
int next_device (Device *child, int depth=L4VBUS_MAX_DEPTH, l4vbus_device_t *devinfo=0) const
 Find next child following child. More...
 
int device (l4vbus_device_t *devinfo) const
 Obtain detailed information about a vbus device. More...
 
int get_resource (int res_idx, l4vbus_resource_t *res) const
 Obtain the resource description of an individual device resource. More...
 
int is_compatible (char const *cid) const
 Check if the given device has a compatibility ID (CID) or HID that matches cid. More...
 
bool operator== (Device const &o) const
 Test if two devices are the same V-BUS device. More...
 
bool operator!= (Device const &o) const
 Test if two devices are not the same. More...
 
- Public Member Functions inherited from L4vbus::Pm< Device >
int pm_suspend () const
 Suspend the module.
 
int pm_resume () const
 Resume the module.
 

Additional Inherited Members

- Protected Attributes inherited from L4vbus::Device
L4::Cap< Vbus_bus
 
l4vbus_device_handle_t _dev
 The device handle for this device.
 

Detailed Description

A Gpio_module groups multiple GPIO pins together.

Definition at line 129 of file vbus_gpio.

Member Function Documentation

◆ config_pad()

int L4vbus::Gpio_module::config_pad ( Pin_slice const &  mask,
unsigned  func,
unsigned  value 
) const
inline

Hardware specific configuration function for multiple GPIO pins.

Parameters
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

Definition at line 181 of file vbus_gpio.

◆ get()

int L4vbus::Gpio_module::get ( unsigned  offset,
unsigned *  data 
) const
inline

Read values of multiple GPIO pins at once.

Parameters
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

Definition at line 197 of file vbus_gpio.

◆ pin()

Gpio_pin L4vbus::Gpio_module::pin ( unsigned  pin) const
inline

Get Gpio_pin for a specific pin of this Gpio_module.

Parameters
pinGPIO pin number to get Gpio_pin for.
Returns
Gpio_pin

Definition at line 225 of file vbus_gpio.

◆ set()

int L4vbus::Gpio_module::set ( Pin_slice const &  mask,
unsigned  data 
)
inline

Set multiple GPIO output pins at once.

Parameters
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

Definition at line 213 of file vbus_gpio.

◆ setup()

int L4vbus::Gpio_module::setup ( Pin_slice const &  mask,
unsigned  mode,
unsigned  value 
) const
inline

Configure function of multiple GPIO pins at once.

Parameters
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

Definition at line 162 of file vbus_gpio.


The documentation for this class was generated from the following file: