Devices tsalarm(7D)
NAME
tsalarm - Alarm device driver
SYNOPSIS
tsalarm@0:ctl
DESCRIPTION
The tsalarm driver is a Multi-threaded, loadable non-STREAMS
pseudo driver that manages ALOM alarms. The tsalarm driver
provides an interface through which alarm relays can be con-
trolled on SUNW,Netra-240 and SUNW,Netra-440 platforms.
HARDWARE INTERFACE
The alarm hardware differs depending on platform. The Netra
240 and 440 platforms features four dry contact alarm relays
which are controlled by ALOM. You can set each alarm to "on"
or "off" by using ioctl interfaces provided from the host.
The four alarms are labeled as "critical," "major," "minor,"
and "user." The user alarm is set by a user application
depending on system condition. LED's in front of the box
provide a visual indication of the four alarms. The number
of alarms and their meanings/labels may vary across plat-
forms.
IOCTLS
The interface provided by the tsalarm driver comprises
ioctls that enable applications to manipulate the alarm
module. The alarm module is accessed via two device nodes:
i) /dev/lom and /dev/tsalarm:ctl.
The following ioctls are supported by the /dev/lom and
/dev/tsalarm:ctl devices:
TSIOCALCTL - Turn an alarm on or off.
The argument is a pointer to the
tsaldatat/lomaldatat structure. This structure is
described below. alarmno member is an integer which
specifies the alarm to which the command is to be
applied. The alarmstate/state structure member indi-
cates the state to which the alarm should be set (where
0 == off). An error (EINVAL) is returned if either an
invalid alarmno or invalid alarmstate is provided.
TSIOCALSTATE - Get the state of the alarms.
The argument is a pointer to the
tsaldatat/lomaldatat structure. This structure is
described below. alarmno member is an integer which
SunOS 5.11 Last change: 16 Mar 2004 1
Devices tsalarm(7D)
indicates the alarm to which the command will be
applied. The alarmstate member holds the alarm's
current state and is filled in by the driver. A zero
indicates that the alarm is off. An error (EINVAL) is
returned if an invalid alarmno is provided. The struc-
tures and definitions for the values are defined
below.
Alarm values:
The following old style values are defined in
#define ALARMNUM0 0 /* number of zero'th alarm */
#define ALARMNUM1 1 /* number of first alarm */
#define ALARMNUM2 2 /* number of second alarm */
#define ALARMNUM3 3 /* number of third alarm */
Alarm values defined in
#define ALARMOF 0 /* Turn off alarm */
#define ALARMON 1 /* Turn on alarm */
Alarm Data Structure:
This structure is defined in
typedef struct {
int alarmno; /* alarm to apply command to */
int alarmstate; /* state of alarm (0 == off) */
} tsaldatat;
Use the following LOM interfaces to get and set the alarms.
These definitions are included in
#define ALARMCRITICAL 0 /* number of critical alarm */
#define ALARMAJOR 1 /* number of major alarm */
#define ALARMINOR 2 /* number of minor alarm */
SunOS 5.11 Last change: 16 Mar 2004 2
Devices tsalarm(7D)
#define ALARMUSER 3 /* number of user alarm */
The following alarm data structure is provided in
:
typedef struct {
int alarmno;
int state;
} lomaldatat;
ERORS
An open() will fail if:
ENXIO The driver is not installed in the system.
An ioctl() will fail if:
EFAULT There was a hardware failure during the specified
operation.
EINVAL The alarm number specified is not valid or an
invalid value was supplied.
ENXIO The driver is not installed in the system or the
monitor callback routine could not be scheduled.
EXAMPLES
How to set an alarm:
#include
#include
#include
#include
#define LOMDEVICE "/dev/lom"
int
main()
{
lomaldatat lld;
int fd = open(LOMDEVICE, ORDWR);
SunOS 5.11 Last change: 16 Mar 2004 3
Devices tsalarm(7D)
if (fd == -1) {
printf("Error opening device: %s0, LOMDEVICE);
exit (1);
}
lld.alarmno = ALARMCRITICAL; /* Set the critical alarm */
lld.state = ALARMON; /* Set the alarm */
if (ioctl(fd, LOMIOCALCTL, (char *)&lld) != 0)
printf("Setting alarm failed");
else
printf("Alarm set successfully");
close(fd);
}
FILES
/dev/lom
LOM device.
/dev/tsalarm:ctl
Alarm control device.
/platform/platform/kernel/drv/sparcv9/tsalarm
Device driver module.
/platform/SUNW,Netra-240/kernel/drv/tsalarm.conf
Driver configuration file.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 16 Mar 2004 4
Devices tsalarm(7D)
ATRIBUTE TYPE ATRIBUTE VALUE
Availability SUNWcarx.u
Architecture SPARC
SEE ALSO
attributes(5)
Writing Device Drivers
SunOS 5.11 Last change: 16 Mar 2004 5
|