CrossCore XA
Revision: 1.0
Programmers Guide
Date: Jul 1, 10
5.
Power Device Interface
There is a set of built-in modules, which have their supply power controlled by ioctl() calls or the
write function. Also the device power supply state has a couple of state signals, which can be
accessed through this interface.
5.1.
Configuration of device interface
The device node file for the I/O interface is /dev/cross_pwr_io, which is the entry point to the
PWR driver.
5.2.
Summary of data types
The interface to the PWR IO device does not need to use an explicit data type, simply use an
unsigned integer. ioctl-commands use the parameter a little differently. Here is the definition:
Define
Description
CROSS_PWR_IOC_SET_PWR_STATE
16-bit unsigned integer. Upper 8 – bit is PWR_PIN number.
Lower 8-bit is the state of the pin.
CROSS_PWR_IOC_GET_PWR_STATE 8-bit unsigned integer, stating the number of PWR_PIN to get.
CROSS_PWR_IOC_GET_PWRFAIL_ST
ATUS
Return either true if the pwr fail is active or false if the pwr fail
status is not active
CROSS_PWR_IOC_GET_OVERVOLT
AGE_STATUS
Return either true if the overvoltage is active or false if the
overvoltage is not active
CROSS_PWR_IOC_GET_SIGNAL
Return status of which event caused the signal. Power down is
bit 0 and over voltage is bit 2.
CROSS_PWR_IOC_SET_SIGNAL
Set the signal handler that is called when power signals
change state. Argument is pointer to set_pwr_signal_struct.
typedef struct {
uint32 sig; /* Signal number to be used */
uint32 pid; /* Process ID of the handler */
} set_pwr_signal_struct;
PWR_STATE_PINS enum; the PWR_PIN number used by read/write/ioctl:
PWR_PIN_ETH = 0
Ethernet adapter
PWR_PIN_WLAN = 1
WLAN card
PWR_PIN_ADDON = 2
Addon card
PWR_PIN_CAN = 3
CAN module
PWR_PIN_USB = 4
USB module
PWR_PIN_GPRS = 5
GSM/GPRS modem
5.3.
Interface functions
open
Opens the I/O device
close
Closes the I/O device
read
Reads from the I/O device
write
Writes to the I/O device
ioctl
Used for reading and writing from/to device
www.crosscontrol.com
29