Document number
204911
Version
Rev. K
Issue date
2016-10-11
Sirius Breadboard User Manual
www.aacmicrotec.com
Page
19
of
106
5.2.2.3.
size_t write(…)
Any data is accepted as a watchdog kick.
Argument name
Type
Direction
Description
fd
Int
in
File descriptor received at open
buf
void *
in
Character buffer to read data from
nbytes
size_t
in
Number of bytes to write
Return value
Description
*
nNumber of bytes that were
written.
- 1
see errno values
errno values
EPERM
Device was not opened
EBUSY
Device is busy
5.2.2.4.
int ioctl(…)
Ioctl allows for disabling/enabling of the watchdog and setting of the timeout.
Argument name
Type
Direction
Description
fd
int
in
File descriptor received at open
cmd
int
in
Command to send
val
int
in
Data to write
Command table
Val interpretation
WATCHDOG_ENABLE_IOCTL
1 = Enables the watchdog
0 = Disables the watchdog
WATCHDOG_SET_TIMEOUT_IOCTL
0
– 255 = Number of seconds until the watchdog barks
Return value
Description
0
Command executed successfully
-1
see errno values
errno values
EINVAL
Invalid data sent
RTEMS_NOT_DEFINED
Invalid I/O command
5.2.3. Usage
To enable the watchdog use the wdt_enable() function.
To disable the watchdog use the wdt_disable() function.
The watchdog must be kicked using wdt_kick() before the timeout occurs or else the
watchdog will bark. Notice that the value shall be set between 1 and 255 seconds. Set to
zero is a false value.