hwiattr_get(), hwiattr_get_*()

Get attributes of a bus or device

Synopsis:

#include <drvr/hwinfo.h>

/* General-purpose function */
int hwiattr_get( unsigned hwi_off, hwiattr_t *hwiattr );

/* Bus attribute functions */
int hwiattr_get_spi( unsigned hwi_off, hwiattr_spi_t *hwiattr );
int hwiattr_get_i2c( unsigned hwi_off, hwiattr_i2c_t *hwiattr );
int hwiattr_get_pci( unsigned hwi_off, hwiattr_pci_t *hwiattr );
int hwiattr_get_usb( unsigned hwi_off, hwiattr_usb_t *hwiattr );
int hwiattr_get_can( unsigned hwi_off, hwiattr_can_t *hwiattr );

/* Device attribute functions */
int hwiattr_get_uart( unsigned hwi_off, hwiattr_uart_t *hwiattr );
int hwiattr_get_rtc( unsigned hwi_off, hwiattr_rtc_t *hwiattr );
int hwiattr_get_timer( unsigned hwi_off, hwiattr_timer_t *hwiattr );

Arguments:

hwi_off
The offset into the hwinfo section of the system page for the device, which you can get by calling hwi_find_device().
hwiattr
A pointer to a location where the function can store the requested attribute. The type of the pointer depends on which function you call.

Library:

libdrvr

Use the -l drvr option to qcc to link against this library.

Description:

These functions retrieve the attributes for the bus or device identified by hwi_off and fill in the hwiattr structure.

The hwiattr_get() function is the generic function, so it must determine the type of the bus or device from hwi_off. It's always faster to call the specific hwiattr_get_*() function directly, as all the generic routine does is try to figure out which specific one to call:

For attributes of: Use:
CAN buses hwiattr_get_can()
I2C buses hwiattr_get_i2c()
PCI buses hwiattr_get_pci()
RTC devices hwiattr_get_rtc()
SPI buses hwiattr_get_spi()
Timer buses hwiattr_get_timer()
UART devices hwiattr_get_uart()
USBs hwiattr_get_usb()

Returns:

The result from the specific hwiattr_get_*() routine or EINVAL. The specific routines return EOK, or an errno error if an error occurs.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes