Watchdog device driver

Joel Sherrill joel.sherrill at OARcorp.com
Thu May 22 14:41:07 UTC 2008


Chris Johns wrote:
> Andrei Chichak wrote:
>   
>> At 05:12 PM 5/21/2008, you wrote:
>>     
>>> This is a good idea. I see the driver as something like:
>>>
>>>   int wd = open ("/dev/wd0", O_WRONLY, 0);
>>>
>>>   ioctl (wd, RTEMS_WDOG_RESET);        /* reset the watchdog */
>>>   ioctl (wd, RTEMS_WDOG_CONFIG, 250);  /* set the timeout to be 250msec */
>>>   ioctl (wd, RTEMS_WDOG_TRIGGER);      /* trigger a watchdog reset */
>>>
>>>   close (wd);
>>>
>>> Regards
>>>       
>> I like the interface, in all of the systems that I have written there
>> was a two phase strobbing, I suspect that would be the RESET and TRIGGER, yes?
>>
>>     
>
> The trigger would allow you the ability to reset a board by asking the driver
> to trigger the watchdog. This maybe done by lowering the time out to very
> short value or it could be disabling interrupts and looping.
>
> I think a single call to RESET or SERVICE the watchdog is all that is needed.
> You also need enable and disable. If a watchdog cannot be disabled the driver
> should return an error code.
>
>   
One issue is the default state.  Many watchdog's need to start
disabled and be enabled once the application is initialized.  I
have seen multiple cases where the BSP + application initialization
was longer than the reset period.
>> Where in the BSP would this sort of stuff go? (Being a moderate
>> newbie I have to ask. I didn't know there was support for SPI, I'll
>> have to look that up)
>>     
>
> We need to create a header file that would live in the cpukit and be installed
> when RTEMS is build and installed. This would provide the API which is the
> RTEMS_WDOG_RESET declarations. Maybe these could go in an existing header. I
> will let Joel decide this.
>
>   
This is the right approach. 

> In the BSP the driver can go where it suits the BSP. You have to register the
> driver and this could be via confdefs.h (Joel?) or by a call in the BSP. If
> the BSP does not provide a watchdog driver the open fails because no device
> node exists.
>
>   

I have committed a baseline watchdogdrv.h in
cpukit/libcsupport/include/rtems along with changes
to confdefs.h  Doesn't define the ioctl's -- just
enough to be able to configure the driver.

There should be a driver template similar to the Clock
Driver template which does a lot of the boiler plate
for you.  The BSP should not have to do not anything
but define a few macros to support initialization, etc.
I didn't add one of these.

There should also be a chapter in the BSP and Device
Driver Guide about the interface once it is settled.
> Regards
> Chris
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>   


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985





More information about the users mailing list