1tsalarm(7D) Devices tsalarm(7D)
2
3
4
6 tsalarm - Alarm device driver
7
9 tsalarm@0:ctl
10
11
13 The tsalarm driver is a Multi-threaded, loadable non-STREAMS pseudo
14 driver that manages ALOM alarms. The tsalarm driver provides an inter‐
15 face through which alarm relays can be controlled on SUNW,Netra-240 and
16 SUNW,Netra-440 platforms.
17
19 The alarm hardware differs depending on platform. The Netra 240 and 440
20 platforms features four dry contact alarm relays which are con‐
21 trolled by ALOM. You can set each alarm to "on" or "off" by using
22 ioctl interfaces provided from the host. The four alarms are labeled as
23 "critical," "major," "minor," and "user." The user alarm is set by a
24 user application depending on system condition. LED's in front of the
25 box provide a visual indication of the four alarms. The number of
26 alarms and their meanings/labels may vary across platforms.
27
29 The interface provided by the tsalarm driver comprises ioctls that
30 enable applications to manipulate the alarm module. The alarm module
31 is accessed via two device nodes: i) /dev/lom and /dev/tsalarm:ctl.
32
33
34 The following ioctls are supported by the /dev/lom and
35 /dev/tsalarm:ctl devices:
36
37 TSIOCALCTL - Turn an alarm on or off.
38
39 The argument is a pointer to the ts_aldata_t/lom_aldata_t struc‐
40 ture. This structure is described below. alarm_no member is an
41 integer which specifies the alarm to which the command is to be
42 applied. The alarm_state/state structure member indicates the state
43 to which the alarm should be set (where 0 == off). An error (EIN‐
44 VAL) is returned if either an invalid alarm_no or invalid
45 alarm_state is provided.
46
47
48 TSIOCALSTATE - Get the state of the alarms.
49
50 The argument is a pointer to the ts_aldata_t/lom_aldata_t struc‐
51 ture. This structure is described below. alarm_no member is an
52 integer which indicates the alarm to which the command will be
53 applied. The alarm_state member holds the alarm's current state
54 and is filled in by the driver. A zero indicates that the alarm is
55 off. An error (EINVAL) is returned if an invalid alarm_no is pro‐
56 vided. The structures and definitions for the values are defined
57 below.
58
59
60
61 Alarm values:
62
63 The following old style values are defined in <lom.io.h>
64
65 #define ALARM_NUM_0 0 /* number of zero'th alarm */
66
67 #define ALARM_NUM_1 1 /* number of first alarm */
68
69 #define ALARM_NUM_2 2 /* number of second alarm */
70
71 #define ALARM_NUM_3 3 /* number of third alarm */
72
73 Alarm values defined in <lom.io.h>
74
75 #define ALARM_OFF 0 /* Turn off alarm */
76
77 #define ALARM_ON 1 /* Turn on alarm */
78
79
80
81 Alarm Data Structure:
82
83 This structure is defined in <lom.io.h>
84
85 typedef struct {
86
87 int alarm_no; /* alarm to apply command to */
88
89 int alarm_state; /* state of alarm (0 == off) */
90
91 } ts_aldata_t;
92
93
94
95 Use the following LOM interfaces to get and set the alarms. These defi‐
96 nitions are included in <lom_io.h>
97
98 #define ALARM_CRITICAL 0 /* number of critical alarm */
99
100 #define ALARM_MAJOR 1 /* number of major alarm */
101
102 #define ALARM_MINOR 2 /* number of minor alarm */
103
104 #define ALARM_USER 3 /* number of user alarm */
105
106
107
108 The following alarm data structure is provided in <lom_io.h>:
109
110 typedef struct {
111
112 int alarm_no;
113
114 int state;
115
116 } lom_aldata_t;
117
118
120 An open() will fail if:
121
122 ENXIO The driver is not installed in the system.
123
124
125
126 An ioctl() will fail if:
127
128 EFAULT There was a hardware failure during the specified operation.
129
130
131 EINVAL The alarm number specified is not valid or an invalid value
132 was supplied.
133
134
135 ENXIO The driver is not installed in the system or the monitor
136 callback routine could not be scheduled.
137
138
140 How to set an alarm:
141
142 #include <sys/unistd.h>
143 #include <fcntl.h>
144 #include <stdio.h>
145 #include <lom_io.h>
146
147 #define LOM_DEVICE "/dev/lom"
148
149 int
150 main()
151 {
152 lom_aldata_t lld;
153 int fd = open(LOM_DEVICE, O_RDWR);
154
155 if (fd == -1) {
156 printf("Error opening device: %s0, LOM_DEVICE);
157 exit (1);
158 }
159
160 lld.alarm_no = ALARM_CRITICAL; /* Set the critical alarm */
161 lld.state = ALARM_ON; /* Set the alarm */
162
163 if (ioctl(fd, LOMIOCALCTL, (char *)&lld) != 0)
164 printf("Setting alarm failed");
165 else
166 printf("Alarm set successfully");
167
168 close(fd);
169
170 }
171
172
174 /dev/lom
175
176 LOM device.
177
178
179 /dev/tsalarm:ctl
180
181 Alarm control device.
182
183
184 /platform/platform/kernel/drv/sparcv9/tsalarm
185
186 Device driver module.
187
188
189 /platform/SUNW,Netra-240/kernel/drv/tsalarm.conf
190
191 Driver configuration file.
192
193
195 See attributes(5) for descriptions of the following attributes:
196
197
198
199
200 ┌─────────────────────────────┬─────────────────────────────┐
201 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
202 ├─────────────────────────────┼─────────────────────────────┤
203 │Availability │SUNWcarx.u │
204 ├─────────────────────────────┼─────────────────────────────┤
205 │Architecture │SPARC │
206 └─────────────────────────────┴─────────────────────────────┘
207
209 attributes(5)
210
211
212 Writing Device Drivers
213
214
215
216SunOS 5.11 16 Mar 2004 tsalarm(7D)