Moxa DA-681-I-SP-LX [26/65] Ioctl swtd_fd ioctl_swatchdog_ack null close swtd_fd

Moxa DA-681-I-SP-LX [26/65] Ioctl swtd_fd ioctl_swatchdog_ack null close swtd_fd
DA-681 Linux Software Configuration
2-15
ioctl(swtd_fd, IOCTL_SWATCHDOG_ACK, NULL);
}
close(swtd_fd);
}
For convenient programming, we re-package these IO control commands in a convenient API in libswtd.c
like this.
int swtd_open(void)
Description
Open the file handle to control the sWatchDog. If you want to do something you must first to this. And
keep the file handle to do other.
Input
None
Output
The return value is file handle. If has some error, it will return < 0 value.
You can get error from errno().
int swtd_enable(int fd, unsigned long time)
Description
Enable application sWatchDog. And you must do ack after this process.
Input
int fd - the file handle, from the swtd_open() return value.
unsigned long time - The time you wish to ack sWatchDog periodically. You must ack the sWatchDog
before timeout. If you do not ack, the system will be reboot automatically. The minimal time is 50 msec, the
maximum time is 60 seconds. The time unit is msec.
Output
OK will be zero. The other has some error, to get the error code from errno().
int swtd_disable(int fd)
Description:
Disable the application to ack sWatchDog. And the kernel will be auto ack it. User does not to do it at
periodic.
Input:
int fd - the file handle from swtd_open() return value.
Output:
OK will be zero. The other has some error, to get error code from errno.
int swtd_get(int fd, int *mode, unsigned long *time)
Description:
Get current setting values.
mode –
1 for user application enable sWatchDog: need to do ack.
0 for user application disable sWatchdog: does not need to do ack.
time The time period to ack sWatchDog.
Input:
int fd - the file handle from swtd_open() return value.
int *mode - the function will be return the status enable or disable user application
need to
do ack.

Содержание

Похожие устройства

Скачать