3 ioctl, Ioctl – ADLINK CSA-5100 User Manual

Page 37

Advertising
background image

37

CSA-5100

PROTOTYPE
static ssize_t write(struct file *file, const char __user *data,size_t len, loff_t *ppos)

DESCRIPTION
This function is used to write information to be given to watchdog device.
int write(int handle, void *buf, int nbyte) may be used in client to call this feature.

PARAMETERS
handle

[IN] File handle to the watchdog;

buf

[IN] Buffer to write;

nbyte

[IN] Count of bytes;


RETURN
Number of bytes actually written: success
-1: error

6.2.3 ioctl

The Watchdog Driver provides several ioctl options:

WDIOS_DISABLECARD

, used to turn off the watchdog timer. The Watchdog Driver support

module parameter WATCHDOG_NOWAYOUT. If it is set, there is no way of disabling the
watchdog once it has been started. So, if the watchdog daemon crashes, the system will
reboot after the timeout has passed.

WDIOS_ENABLECARD

, used to turn on the watchdog timer.

WDIOC_SETOPTIONS

, used to set the watchdog status.

WDIOC_GETSTATUS

, used to determines the status supported by watchdog ioctl. The

status bit of the device does not allow distinguishing between a regular system reset and a
watchdog forced reset. But, in test mode it is useful, so it is supported through
WDIOC_GETSTATUS watchdog ioctl. Additionally the driver reports the keepalive signal and
the acception of the magic.

WDIOC_SETTIMEOUT

, used to change the watchdog timeout parameter (1s-255s). The

Watchdog Driver support module parameter DEFAULT_TIMEOUT. If it set then the
Watchdog Driver will use it as the watchdog timeout parameter. If it is not set, the default
watchdog timeout parameter is 5s.

WDIOC_GETTIMEOUT

, used to query the watchdog timeout parameter.

WDIOC_KEEPALIVE

, used to feed the watchdog, just like the write () interface.

WDIOC_ENABLEBYPS

, which is a custom command, used to enable the LAN bypass.

Defined as below:
#define WDIOC_ENABLEBYPS _IOR(WATCHDOG_IOCTL_BASE, 101, int)

WDIOC_DISABLEBYPS

, which is a custom command, used to disable the LAN bypass.

Defined as below:
#define WDIOC_DISABLEBYPS _IOR(WATCHDOG_IOCTL_BASE, 102, int)

PROTOTYPE
static long ioctl(struct file *file, unsigned int cmd, unsigned long arg)

Advertising