'\" te .\" Copyright (c) 2004, Sun Microsystems, Inc. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH tsalarm 7D "16 Mar 2004" "SunOS 5.11" "Devices" .SH NAME tsalarm \- Alarm device driver .SH SYNOPSIS .LP .nf tsalarm@0:ctl .fi .SH DESCRIPTION .sp .LP The \fBtsalarm\fR driver is a Multi-threaded, loadable non-STREAMS pseudo driver that manages ALOM alarms. The \fBtsalarm\fR driver provides an interface through which alarm relays can be controlled on SUNW,Netra-240 and SUNW,Netra-440 platforms. .SH HARDWARE INTERFACE .sp .LP 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 platforms. .SH IOCTLS .sp .LP The interface provided by the \fBtsalarm\fR driver comprises ioctls that enable applications to manipulate the alarm module. The alarm module is accessed via two device nodes: i) \fB/dev/lom\fR and \fB/dev/tsalarm:ctl\fR. .sp .LP The following ioctls are supported by the \fB/dev/lom\fR and \fB/dev/tsalarm:ctl\fR devices: .sp .ne 2 .mk .na \fB\fBTSIOCALCTL - Turn an alarm on or off.\fR\fR .ad .sp .6 .RS 4n The argument is a pointer to the \fBts_aldata_t/lom_aldata_t\fR structure. This structure is described below. \fBalarm_no member\fR is an integer which specifies the alarm to which the command is to be applied. The \fBalarm_state/state\fR structure member indicates the state to which the alarm should be set (where 0 == off). An error (\fBEINVAL\fR) is returned if either an invalid alarm_no or invalid alarm_state is provided. .RE .sp .ne 2 .mk .na \fB\fBTSIOCALSTATE - Get the state of the alarms.\fR\fR .ad .sp .6 .RS 4n The argument is a pointer to the \fBts_aldata_t/lom_aldata_t\fR structure. This structure is described below. \fBalarm_no member\fR is an integer which indicates the alarm to which the command will be applied. The \fBalarm_state\fR member holds the alarm's current state and is filled in by the driver. A zero indicates that the alarm is off. An error (\fBEINVAL\fR) is returned if an invalid alarm_no is provided. The structures and definitions for the values are defined below. .RE .sp .LP Alarm values: .sp .in +2 .nf The following old style values are defined in #define ALARM_NUM_0 0 /* number of zero'th alarm */ #define ALARM_NUM_1 1 /* number of first alarm */ #define ALARM_NUM_2 2 /* number of second alarm */ #define ALARM_NUM_3 3 /* number of third alarm */ Alarm values defined in #define ALARM_OFF 0 /* Turn off alarm */ #define ALARM_ON 1 /* Turn on alarm */ .fi .in -2 .sp .LP Alarm Data Structure: .sp .in +2 .nf This structure is defined in typedef struct { int alarm_no; /* alarm to apply command to */ int alarm_state; /* state of alarm (0 == off) */ } ts_aldata_t; .fi .in -2 .sp .LP Use the following LOM interfaces to get and set the alarms. These definitions are included in .sp .in +2 .nf #define ALARM_CRITICAL 0 /* number of critical alarm */ #define ALARM_MAJOR 1 /* number of major alarm */ #define ALARM_MINOR 2 /* number of minor alarm */ #define ALARM_USER 3 /* number of user alarm */ .fi .in -2 .sp .LP The following alarm data structure is provided in : .sp .in +2 .nf typedef struct { int alarm_no; int state; } lom_aldata_t; .fi .in -2 .SH ERRORS .sp .LP An \fBopen()\fR will fail if: .sp .ne 2 .mk .na \fBENXIO\fR .ad .RS 9n .rt The driver is not installed in the system. .RE .sp .LP An \fBioctl()\fR will fail if: .sp .ne 2 .mk .na \fBEFAULT\fR .ad .RS 10n .rt There was a hardware failure during the specified operation. .RE .sp .ne 2 .mk .na \fBEINVAL\fR .ad .RS 10n .rt The alarm number specified is not valid or an invalid value was supplied. .RE .sp .ne 2 .mk .na \fBENXIO\fR .ad .RS 10n .rt The driver is not installed in the system or the monitor callback routine could not be scheduled. .RE .SH EXAMPLES .sp .in +2 .nf How to set an alarm: #include #include #include #include #define LOM_DEVICE "/dev/lom" int main() { lom_aldata_t lld; int fd = open(LOM_DEVICE, O_RDWR); if (fd == -1) { printf("Error opening device: %s\n", LOM_DEVICE); exit (1); } lld.alarm_no = ALARM_CRITICAL; /* Set the critical alarm */ lld.state = ALARM_ON; /* Set the alarm */ if (ioctl(fd, LOMIOCALCTL, (char *)&lld) != 0) printf("Setting alarm failed"); else printf("Alarm set successfully"); close(fd); } .fi .in -2 .SH FILES .sp .ne 2 .mk .na \fB\fB/dev/lom\fR\fR .ad .sp .6 .RS 4n LOM device. .RE .sp .ne 2 .mk .na \fB\fB/dev/tsalarm:ctl\fR\fR .ad .sp .6 .RS 4n Alarm control device. .RE .sp .ne 2 .mk .na \fB\fB/platform/platform/kernel/drv/sparcv9/tsalarm\fR\fR .ad .sp .6 .RS 4n Device driver module. .RE .sp .ne 2 .mk .na \fB\fB/platform/SUNW,Netra-240/kernel/drv/tsalarm.conf\fR\fR .ad .sp .6 .RS 4n Driver configuration file. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ ArchitectureSPARC .TE .SH SEE ALSO .sp .LP \fBattributes\fR(5) .sp .LP \fIWriting Device Drivers\fR