Watchdog timer reset
Hey folks,
Just wondering, does u-boot support periodical reset of watchdog timer ? If not, I suppose I have to disable the watchdog when I enter uboot in interactive mode, and probably enable it when I exit u-boot.
How does people normally do this ?
Just out of curiosity, (assuming u-boot does not do something like above), can we do something similar to below code?
-=-=-=-=-=-=-=-=-=-=-=-=-=-=signal(SIGALRM, runme);
function runme(void) {
printf("hi\n");
alarm(10);
}
-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Cheers,
Signature · 1 line
Daniel
Quoted 2 lines · In message <[email protected]> you wrote:
Just wondering, does u-boot support periodical reset of watchdog timer
Yes, of course it does.
Quoted 2 lines
? If not, I suppose I have to disable the watchdog when I enter uboot in interactive mode, and probably enable it when I exit u-boot.
If your watchdog i worth it's money it comes up enabled after reset, and you can just disable it once and forever. A watchdog that can be switched of is not worth to be called by that name.
Quoted 1 line
How does people normally do this ?
Have a look at the code.
Quoted 5 lines
Just out of curiosity, (assuming u-boot does not do something like above), can we do something similar to below code?
-=-=-=-=-=-=-=-=-=-=-=-=-=-=
signal(SIGALRM, runme);
No, we cannot. U-boot is strictly single-tasking and has no notion of signals and the like. Also, your code makes no sense to me.
Best regards,
Wolfgang Denk
Signature · 5 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I will also, for an appropriate fee, certify that your keyboard is object-oriented, and that the bits on your hard disk are template- compatible. - Jeffrey S. Haemer in <[email protected]>
Quoted 3 lines · Wolfgang Denk
Quoted 1 line
Just wondering, does u-boot support periodical reset of watchdog timer
Yes, of course it does.
I'd really appreciate it if you could point me to a file or a function to take a look.
Quoted 3 lines
If your watchdog i worth it's money it comes up enabled after reset, and you can just disable it once and forever. A watchdog that can be switched of is not worth to be called by that name.
Actually this is really software driven timer we developed on an 8bit micom. So, disable/enable isnt much of bother, but like you said about watchdog, I'm trying to avoid disabling watchdog altogether.
Quoted 3 lines
Quoted 1 line
How does people normally do this ?
Have a look at the code.
:P sorry for trying an easy way out, but if you happen to know good place to start, dont hesitate (please) :)
Quoted 2 lines
No, we cannot. U-boot is strictly single-tasking and has no notion of signals and the like. Also, your code makes no sense to me.
Okay, its basically using alarm() to produce SIGALRM every 10 seconds. (assuming alarm() takes second as an argument) And using signal() we are calling runme() function everytime it is woken up by SIGALRM. Natually, runme() will do whatever it needs to do, and sets another alarm before it ends. Not shown in the code, is probably a block read so it keeps the program running.
Hopefully this makes more sense than a code :P
Signature · 1 line
Daniel
Quoted 3 lines · In message <[email protected]> you wrote:
I'd really appreciate it if you could point me to a file or a function to take a look.
watchdog_reset() for example?
Try running something like
$ cd u-boot $ find * -type f | xargs egrep watchdog or $ find * -type f | xargs egrep watchdog_reset
Quoted 2 lines
:P sorry for trying an easy way out, but if you happen to know good place to start, dont hesitate (please) :)
See above - this is obviosly hardware dependent, but looking for watchdog_reset() in cpu/*/cpu.c might be helpful...
Quoted 7 lines
Okay, its basically using
alarm()to produce SIGALRM every 10 seconds. (assumingalarm()takes second as an argument) And usingsignal()we are callingrunme()function everytime it is woken up by SIGALRM. Natually,runme()will do whatever it needs to do, and sets another alarm before it ends. Not shown in the code, is probably a block read so it keeps the program running.
Hopefully this makes more sense than a code :P
No, it does not. As mentioned before, there are no signals or tasks or similar in U-Boot. Everything is strictly single-tasking. I'm not sure waht you want, but you can problaby do something like
for (;;) {
/* do something */
usleep (10 * CFG_HZ);
}in C, but I don't understand what that would give you.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Gods don't like people not doing much work. People who aren't busy all the time might start to _think_. - Terry Pratchett, _Small Gods_
Quoted 1 line · Wolfgang Denk
watchdog_reset()for example?
Thanks. I can see what's going on now. I wasnt really interested about how to reset watchdog itself, but rather continuously calling particular function in set interval. Having looked at how WATCHDOG_RESET() is called, I sort of see it now.
Quoted 10 lines
No, it does not. As mentioned before, there are no signals or tasks or similar in U-Boot. Everything is strictly single-tasking. I'm not sure waht you want, but you can problaby do something like
for (;;) { /* do something */ usleep (10 * CFG_HZ); }in C, but I don't understand what that would give you.
Okay, I got you on U-Boot being single tasking process. And like you said, I wouldnt want to do something like above also :P
Thanks again for putting me on the right track.
Cheers,
Signature · 1 line
Daniel