Appendix B
Watchdog Timer Application Mode
111
The data structure used with the
LOMIOCALCTL
and
LOMIOCALSTATE
IOCTLs is as
follows:
CODE EXAMPLE B-4
LOMIOCALCTL
and
LOMIOCALSTATE
IOCTL Data Structure
#include <fcntl.h>
#include <lom_io.h>
#define LOM_DEVICE "/dev/lom"
#define ALARM_OFF 0
#define ALARM_ON 1
int main() {
int fd, ret;
lom_aldata_t ald;
ald.alarm_no = ALARM_NUM_3;
ald.state = ALARM_OFF;
fd = open(LOM_DEVICE, O_RDWR);
if (fd == -1) {
printf("Error opening device: %s\n", LOM_DEVICE);
return (1);
}
/* Set Alarm3 to on state */
ald.state = ALARM_ON;
ioctl(fd, LOMIOCALCTL, (void *)&ald);
/* Get Alarm3 state */
ioctl(fd, LOMIOCALSTATE, (char *)&ald);
printf("alarm %d state :%d:\n", ald.alarm_no, ald.state);
/* Set Alarm3 to off state */
ald.state = ALARM_OFF;
ioctl(fd, LOMIOCALCTL, (char *)&ald);
/* Get Alarm3 state */
ioctl(fd, LOMIOCALSTATE, (char *)&ald);
printf("alarm %d state :%d:\n", ald.alarm_no, ald.state);
close (fd);
return (0);
}
Содержание Netra 1290
Страница 12: ...xii Netra 1290 Server System Administration Guide May 2006...
Страница 32: ...14 Netra 1290 Server System Administration Guide May 2006...
Страница 48: ...30 Netra 1290 Server System Administration Guide May 2006...
Страница 80: ...62 Netra 1290 Server System Administration Guide May 2006...
Страница 104: ...86 Netra 1290 Server System Administration Guide May 2006...
Страница 112: ...94 Netra 1290 Server System Administration Guide May 2006...
Страница 142: ...124 Netra 1290 Server System Administration Guide May 2006...