L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4vbus::Gpio_pin Class Reference

A GPIO pin. More...

#include <vbus_gpio>

+ Inheritance diagram for L4vbus::Gpio_pin:
+ Collaboration diagram for L4vbus::Gpio_pin:

Public Member Functions

int get () const
 Read value of GPIO input pin.
 
int set (int value) const
 Set GPIO output pin.
 
int setup (unsigned mode, unsigned value) const
 Configure the function of a GPIO pin.
 
int config_pull (unsigned mode) const
 Generic function to set pull up/down mode.
 
int config_pad (unsigned func, unsigned value) const
 Hardware specific configuration function.
 
int config_get (unsigned func, unsigned *value) const
 Read hardware specific configuration.
 
int to_irq () const
 Create IRQ for GPIO pin.
 
unsigned pin () const
 Get pin number.
 
- Public Member Functions inherited from L4vbus::Device
 Device ()
 Construct a new vbus device using the NULL device L4VBUS_NULL.
 
 Device (L4::Cap< Vbus > bus, l4vbus_device_handle_t dev)
 Construct a new vbus device using a device handle.
 
L4::Cap< Vbusbus_cap () const
 Access the Vbus capability of the underlying virtual bus.
 
l4vbus_device_handle_t dev_handle () const
 Access the device handle of this device.
 
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 hardware interface identifier (HID).
 
int next_device (Device *child, int depth=L4VBUS_MAX_DEPTH, l4vbus_device_t *devinfo=0) const
 Find next child following child.
 
int device (l4vbus_device_t *devinfo) const
 Obtain detailed information about a Vbus device.
 
int get_resource (unsigned res_idx, l4vbus_resource_t *res) const
 Obtain the resource description of an individual device resource.
 
int is_compatible (char const *cid) const
 Check if the given device has a compatibility ID (CID) or HID that matches cid.
 
bool operator== (Device const &o) const
 Test if two devices are the same Vbus device.
 
bool operator!= (Device const &o) const
 Test if two Vbus devices are not the same.
 
- Public Member Functions inherited from L4vbus::Pm< Device >
int pm_suspend () const
 Suspend the device.
 
int pm_resume () const
 Resume the device.
 

Additional Inherited Members

- Protected Attributes inherited from L4vbus::Device
L4::Cap< Vbus_bus
 The Vbus capability where this device is located on.
 
l4vbus_device_handle_t _dev
 The device handle for this device.
 

Detailed Description

A GPIO pin.

Definition at line 28 of file vbus_gpio.

Member Function Documentation

◆ config_get()

int L4vbus::Gpio_pin::config_get ( unsigned  func,
unsigned *  value 
) const
inline

Read hardware specific configuration.

Parameters
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

Definition at line 104 of file vbus_gpio.

References L4vbus::Device::_bus, L4vbus::Device::_dev, and l4vbus_gpio_config_get().

+ Here is the call graph for this function:

◆ config_pad()

int L4vbus::Gpio_pin::config_pad ( unsigned  func,
unsigned  value 
) const
inline

Hardware specific configuration function.

Parameters
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

Definition at line 91 of file vbus_gpio.

References L4vbus::Device::_bus, L4vbus::Device::_dev, and l4vbus_gpio_config_pad().

+ Here is the call graph for this function:

◆ config_pull()

int L4vbus::Gpio_pin::config_pull ( unsigned  mode) const
inline

Generic function to set pull up/down mode.

Parameters
modemode for pull up/down resistors, see L4vbus_gpio_pull_modes
Returns
0 if OK, error code otherwise

Definition at line 77 of file vbus_gpio.

References L4vbus::Device::_bus, L4vbus::Device::_dev, and l4vbus_gpio_config_pull().

+ Here is the call graph for this function:

◆ get()

int L4vbus::Gpio_pin::get ( ) const
inline

Read value of GPIO input pin.

Returns
Value of GPIO pin (usually 0 or 1), negative error code otherwise.

Definition at line 40 of file vbus_gpio.

References L4vbus::Device::_bus, L4vbus::Device::_dev, and l4vbus_gpio_get().

+ Here is the call graph for this function:

◆ pin()

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

Get pin number.

Returns
GPIO pin number

Definition at line 124 of file vbus_gpio.

◆ set()

int L4vbus::Gpio_pin::set ( int  value) const
inline

Set GPIO output pin.

Parameters
valueValue to write to the GPIO pin (usually 0 or 1)
Returns
0 if OK, error code otherwise

Definition at line 51 of file vbus_gpio.

References L4vbus::Device::_bus, L4vbus::Device::_dev, and l4vbus_gpio_set().

+ Here is the call graph for this function:

◆ setup()

int L4vbus::Gpio_pin::setup ( unsigned  mode,
unsigned  value 
) const
inline

Configure the function of a GPIO pin.

Parameters
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

Definition at line 66 of file vbus_gpio.

References L4vbus::Device::_bus, L4vbus::Device::_dev, and l4vbus_gpio_setup().

+ Here is the call graph for this function:

◆ to_irq()

int L4vbus::Gpio_pin::to_irq ( ) const
inline

Create IRQ for GPIO pin.

Returns
IRQ number if OK, negative error code otherwise

Definition at line 114 of file vbus_gpio.

References L4vbus::Device::_bus, L4vbus::Device::_dev, and l4vbus_gpio_to_irq().

+ Here is the call graph for this function:

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