how to call ioctl function for watchdog..
Chan Kim
ckim at etri.re.kr
Tue Nov 24 12:42:55 UTC 2015
Hello, rtems users and experts,
I am trying to use a timer with watchdog capability as a watchdog in rtems.
I saw in rtems-4.10.99-src/cpukit/libcsupport/include/rtems/watchdogdrv.h below definition.
#define WATCHDOG_DRIVER_TABLE_ENTRY \
{ Watchdog_initialize, NULL, NULL, NULL, NULL, Watchdog_control }
so I added my .c and .h to the build tree and added this Watchdog_initialize and Watchdog_control function.
When I add CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER, the driver entry is added to the driver table.
during the drivers init stage, I see Watchdog_initialize is called. In the initialize function, I used
rtems_io_register_name("/dev/wdt", major, 0);
which was successful.
Then in the application, I did fd = open("/dev/wdt", O_RDWR); but it's not successful.
of course when I do ioctl(fd, MYCMD, myvar); in the application, it is not connected to my Watchdog_control function.
It maybe because the open function is not defined. But in the original watchdogdrv.h (libcsupport), why isn't there open function?
(I understand this file is not supposed to be altered by user)
Can I just add an open function in the watchdogdrv.h and my implementation code for watchdog, and expect the open("/dev/wdt"..) to work?
Thanks!
Chan
More information about the users
mailing list