public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Watchdog timer reset
@ 2005-05-09 11:05 Daniel Ann
  2005-05-11 22:23 ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Ann @ 2005-05-09 11:05 UTC (permalink / raw)
  To: u-boot

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,


-- 
Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Watchdog timer reset
  2005-05-09 11:05 [U-Boot-Users] Watchdog timer reset Daniel Ann
@ 2005-05-11 22:23 ` Wolfgang Denk
  2005-05-12 12:05   ` Daniel Ann
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2005-05-11 22:23 UTC (permalink / raw)
  To: u-boot

In message <9b7ca657050509040572e02726@mail.gmail.com> you wrote:
> 
> Just wondering, does u-boot support periodical reset of watchdog timer

Yes, of course it does.

> ? 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.

> How does people normally do this ?

Have a look at the code.

> 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

-- 
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 <411akr$3ga@cygnus.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Watchdog timer reset
  2005-05-11 22:23 ` Wolfgang Denk
@ 2005-05-12 12:05   ` Daniel Ann
  2005-05-12 13:35     ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Ann @ 2005-05-12 12:05 UTC (permalink / raw)
  To: u-boot

On 5/12/05, Wolfgang Denk <wd@denx.de> wrote:
> > 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.

> 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.

> > 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) :)

> 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


-- 
Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Watchdog timer reset
  2005-05-12 12:05   ` Daniel Ann
@ 2005-05-12 13:35     ` Wolfgang Denk
  2005-05-13  1:46       ` Daniel Ann
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2005-05-12 13:35 UTC (permalink / raw)
  To: u-boot

In message <9b7ca657050512050554c9e1dd@mail.gmail.com> 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

> :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...

> 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

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

-- 
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_

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Watchdog timer reset
  2005-05-12 13:35     ` Wolfgang Denk
@ 2005-05-13  1:46       ` Daniel Ann
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Ann @ 2005-05-13  1:46 UTC (permalink / raw)
  To: u-boot

On 5/12/05, Wolfgang Denk <wd@denx.de> wrote:
> 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.

> 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,

-- 
Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-05-13  1:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-09 11:05 [U-Boot-Users] Watchdog timer reset Daniel Ann
2005-05-11 22:23 ` Wolfgang Denk
2005-05-12 12:05   ` Daniel Ann
2005-05-12 13:35     ` Wolfgang Denk
2005-05-13  1:46       ` Daniel Ann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox