summaryrefslogtreecommitdiff
path: root/usr/src/man/man7d/tsalarm.7d
blob: c2ee9ae4219da3374967c3fbaffd30ee4a96c5cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
'\" 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 "Sep 10, 2013"
.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
.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
.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 <lom.io.h>

     #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 <lom.io.h>

     #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 <lom.io.h>

     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 <lom_io.h>
.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 <lom_io.h>:
.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
.na
\fBENXIO\fR
.ad
.RS 9n
The driver is not installed in the system.
.RE

.sp
.LP
An \fBioctl()\fR will fail if:
.sp
.ne 2
.na
\fBEFAULT\fR
.ad
.RS 10n
There was a hardware failure during the specified operation.
.RE

.sp
.ne 2
.na
\fBEINVAL\fR
.ad
.RS 10n
The alarm number specified is not valid or an invalid value was supplied.
.RE

.sp
.ne 2
.na
\fBENXIO\fR
.ad
.RS 10n
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 <sys/unistd.h>
     #include <fcntl.h>
     #include <stdio.h>
     #include <lom_io.h>

     #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\en", 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
.na
\fB\fB/dev/lom\fR\fR
.ad
.sp .6
.RS 4n
LOM device.
.RE

.sp
.ne 2
.na
\fB\fB/dev/tsalarm:ctl\fR\fR
.ad
.sp .6
.RS 4n
Alarm control device.
.RE

.sp
.ne 2
.na
\fB\fB/platform/platform/kernel/drv/sparcv9/tsalarm\fR\fR
.ad
.sp .6
.RS 4n
Device driver module.
.RE

.sp
.ne 2
.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
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Architecture	SPARC
.TE

.SH SEE ALSO
.sp
.LP
\fBattributes\fR(5)
.sp
.LP
\fIWriting Device Drivers\fR