EasyManua.ls Logo

Sun Microsystems Netra T2000 - Page 109

Sun Microsystems Netra T2000
122 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Appendix A Watchdog Timer Application Mode 93
The data structure used with the LOMIOCALCTL and LOMIOCALSTATE IOCTLs is as
follows:
CODE EXAMPLE A-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);
}

Table of Contents

Other manuals for Sun Microsystems Netra T2000

Related product manuals