public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Periodic task
@ 2015-08-25 20:03 Ran Shalit
  2015-08-26  4:45 ` Heiko Schocher
  0 siblings, 1 reply; 7+ messages in thread
From: Ran Shalit @ 2015-08-25 20:03 UTC (permalink / raw)
  To: u-boot

Hello,

I need to do some periodic very simple task during u-boot prompt
(while u-boot wais for commands). The task is very simple, just
writing into a watchdog refresh register.
But it seems that it's very difficult to "hack" u-boot with such periodic task.
I see that main loop is waiting in loop for characters in a call to
getc, which is a blocking command. If it was non-blocking, it might
have help me. I'm not sure if there is a way to replace the getc with
a non-blocking call.

Does anyone have any idea if there is some simple way to do periodic
task in u-boot  ?

Regards,

Ran

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

* [U-Boot] Periodic task
  2015-08-25 20:03 [U-Boot] Periodic task Ran Shalit
@ 2015-08-26  4:45 ` Heiko Schocher
  2015-08-26  6:09   ` Ran Shalit
  0 siblings, 1 reply; 7+ messages in thread
From: Heiko Schocher @ 2015-08-26  4:45 UTC (permalink / raw)
  To: u-boot

Hello Ran,

Am 25.08.2015 um 22:03 schrieb Ran Shalit:
> Hello,
>
> I need to do some periodic very simple task during u-boot prompt
> (while u-boot wais for commands). The task is very simple, just
> writing into a watchdog refresh register.
> But it seems that it's very difficult to "hack" u-boot with such periodic task.
> I see that main loop is waiting in loop for characters in a call to
> getc, which is a blocking command. If it was non-blocking, it might
> have help me. I'm not sure if there is a way to replace the getc with
> a non-blocking call.
>
> Does anyone have any idea if there is some simple way to do periodic
> task in u-boot  ?

As you want to trigger a watchdog, have a look at
u-boot:/drivers/watchdog
and grep the U-Boot code for
CONFIG_WATCHDOG
CONFIG_HW_WATCHDOG

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

* [U-Boot] Periodic task
  2015-08-26  4:45 ` Heiko Schocher
@ 2015-08-26  6:09   ` Ran Shalit
  2015-08-26  7:05     ` Heiko Schocher
  0 siblings, 1 reply; 7+ messages in thread
From: Ran Shalit @ 2015-08-26  6:09 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 26, 2015 at 7:45 AM, Heiko Schocher <hs@denx.de> wrote:
> Hello Ran,
>
> Am 25.08.2015 um 22:03 schrieb Ran Shalit:
>>
>> Hello,
>>
>> I need to do some periodic very simple task during u-boot prompt
>> (while u-boot wais for commands). The task is very simple, just
>> writing into a watchdog refresh register.
>> But it seems that it's very difficult to "hack" u-boot with such periodic
>> task.
>> I see that main loop is waiting in loop for characters in a call to
>> getc, which is a blocking command. If it was non-blocking, it might
>> have help me. I'm not sure if there is a way to replace the getc with
>> a non-blocking call.
>>
>> Does anyone have any idea if there is some simple way to do periodic
>> task in u-boot  ?
>
>
> As you want to trigger a watchdog, have a look at
> u-boot:/drivers/watchdog
> and grep the U-Boot code for
> CONFIG_WATCHDOG
> CONFIG_HW_WATCHDOG
>
> bye,
> Heiko
> --


Hi Heiko,

That's a great suggestion.
I can understand from this, that there is timer interrupt in the
background for the watchdog refresh activity.

Regards,
Ran

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

* [U-Boot] Periodic task
  2015-08-26  6:09   ` Ran Shalit
@ 2015-08-26  7:05     ` Heiko Schocher
  2015-08-26  8:57       ` Ran Shalit
  0 siblings, 1 reply; 7+ messages in thread
From: Heiko Schocher @ 2015-08-26  7:05 UTC (permalink / raw)
  To: u-boot

Hello Ran,

Am 26.08.2015 um 08:09 schrieb Ran Shalit:
> On Wed, Aug 26, 2015 at 7:45 AM, Heiko Schocher <hs@denx.de> wrote:
>> Hello Ran,
>>
>> Am 25.08.2015 um 22:03 schrieb Ran Shalit:
>>>
>>> Hello,
>>>
>>> I need to do some periodic very simple task during u-boot prompt
>>> (while u-boot wais for commands). The task is very simple, just
>>> writing into a watchdog refresh register.
>>> But it seems that it's very difficult to "hack" u-boot with such periodic
>>> task.
>>> I see that main loop is waiting in loop for characters in a call to
>>> getc, which is a blocking command. If it was non-blocking, it might
>>> have help me. I'm not sure if there is a way to replace the getc with
>>> a non-blocking call.
>>>
>>> Does anyone have any idea if there is some simple way to do periodic
>>> task in u-boot  ?
>>
>>
>> As you want to trigger a watchdog, have a look at
>> u-boot:/drivers/watchdog
>> and grep the U-Boot code for
>> CONFIG_WATCHDOG
>> CONFIG_HW_WATCHDOG
>>
>> bye,
>> Heiko
>> --
>
>
> Hi Heiko,
>
> That's a great suggestion.
> I can understand from this, that there is timer interrupt in the
> background for the watchdog refresh activity.

I do not know anything about your hw ... but timer interrupt is not
necessary.

WATCHDOG_RESET is called from the U-Boot code ..
see definition in include/watchdog.h

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

* [U-Boot] Periodic task
  2015-08-26  7:05     ` Heiko Schocher
@ 2015-08-26  8:57       ` Ran Shalit
  2015-08-26  9:29         ` Heiko Schocher
  0 siblings, 1 reply; 7+ messages in thread
From: Ran Shalit @ 2015-08-26  8:57 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 26, 2015 at 10:05 AM, Heiko Schocher <hs@denx.de> wrote:
> Hello Ran,
>
>
> Am 26.08.2015 um 08:09 schrieb Ran Shalit:
>>
>> On Wed, Aug 26, 2015 at 7:45 AM, Heiko Schocher <hs@denx.de> wrote:
>>>
>>> Hello Ran,
>>>
>>> Am 25.08.2015 um 22:03 schrieb Ran Shalit:
>>>>
>>>>
>>>> Hello,
>>>>
>>>> I need to do some periodic very simple task during u-boot prompt
>>>> (while u-boot wais for commands). The task is very simple, just
>>>> writing into a watchdog refresh register.
>>>> But it seems that it's very difficult to "hack" u-boot with such
>>>> periodic
>>>> task.
>>>> I see that main loop is waiting in loop for characters in a call to
>>>> getc, which is a blocking command. If it was non-blocking, it might
>>>> have help me. I'm not sure if there is a way to replace the getc with
>>>> a non-blocking call.
>>>>
>>>> Does anyone have any idea if there is some simple way to do periodic
>>>> task in u-boot  ?
>>>
>>>
>>>
>>> As you want to trigger a watchdog, have a look at
>>> u-boot:/drivers/watchdog
>>> and grep the U-Boot code for
>>> CONFIG_WATCHDOG
>>> CONFIG_HW_WATCHDOG
>>>
>>> bye,
>>> Heiko
>>> --
>>
>>
>>
>> Hi Heiko,
>>
>> That's a great suggestion.
>> I can understand from this, that there is timer interrupt in the
>> background for the watchdog refresh activity.
>
>
> I do not know anything about your hw ... but timer interrupt is not
> necessary.
>
> WATCHDOG_RESET is called from the U-Boot code ..
> see definition in include/watchdog.h
>
>
> bye,
> Heiko
> --


Hi Heiko,

I am using PPC mpc8349 freescale.
In the arch/powerpc/lib/board.c file it does the following:
....
for (;;) {
WATCHDOG_RESET();
main_loop();
}

There is something in the concept of u-boot flow that I don't uunderstand.
How is it that main_loop will perdiocally return to WATCHDOG_RESET  if
it waits for keyboard activity with getc() blocking function.

Thank you for the time!
Ran

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

* [U-Boot] Periodic task
  2015-08-26  8:57       ` Ran Shalit
@ 2015-08-26  9:29         ` Heiko Schocher
  2015-08-26  9:45           ` Ran Shalit
  0 siblings, 1 reply; 7+ messages in thread
From: Heiko Schocher @ 2015-08-26  9:29 UTC (permalink / raw)
  To: u-boot

Hello Ran,

Am 26.08.2015 um 10:57 schrieb Ran Shalit:
> On Wed, Aug 26, 2015 at 10:05 AM, Heiko Schocher <hs@denx.de> wrote:
>> Hello Ran,
>>
>>
>> Am 26.08.2015 um 08:09 schrieb Ran Shalit:
>>>
>>> On Wed, Aug 26, 2015 at 7:45 AM, Heiko Schocher <hs@denx.de> wrote:
>>>>
>>>> Hello Ran,
>>>>
>>>> Am 25.08.2015 um 22:03 schrieb Ran Shalit:
>>>>>
>>>>>
>>>>> Hello,
>>>>>
>>>>> I need to do some periodic very simple task during u-boot prompt
>>>>> (while u-boot wais for commands). The task is very simple, just
>>>>> writing into a watchdog refresh register.
>>>>> But it seems that it's very difficult to "hack" u-boot with such
>>>>> periodic
>>>>> task.
>>>>> I see that main loop is waiting in loop for characters in a call to
>>>>> getc, which is a blocking command. If it was non-blocking, it might
>>>>> have help me. I'm not sure if there is a way to replace the getc with
>>>>> a non-blocking call.
>>>>>
>>>>> Does anyone have any idea if there is some simple way to do periodic
>>>>> task in u-boot  ?
>>>>
>>>>
>>>>
>>>> As you want to trigger a watchdog, have a look at
>>>> u-boot:/drivers/watchdog
>>>> and grep the U-Boot code for
>>>> CONFIG_WATCHDOG
>>>> CONFIG_HW_WATCHDOG
>>>>
>>>> bye,
>>>> Heiko
>>>> --
>>>
>>>
>>>
>>> Hi Heiko,
>>>
>>> That's a great suggestion.
>>> I can understand from this, that there is timer interrupt in the
>>> background for the watchdog refresh activity.
>>
>>
>> I do not know anything about your hw ... but timer interrupt is not
>> necessary.
>>
>> WATCHDOG_RESET is called from the U-Boot code ..
>> see definition in include/watchdog.h
>>
>>
>> bye,
>> Heiko
>> --
>
>
> Hi Heiko,
>
> I am using PPC mpc8349 freescale.
> In the arch/powerpc/lib/board.c file it does the following:
> ....
> for (;;) {
> WATCHDOG_RESET();
> main_loop();
> }
>
> There is something in the concept of u-boot flow that I don't uunderstand.
> How is it that main_loop will perdiocally return to WATCHDOG_RESET  if
> it waits for keyboard activity with getc() blocking function.

Look into the serial driver: drivers/serial/ns16550.c
NS16550_getc() triggers periodically the watchdog ...

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

* [U-Boot] Periodic task
  2015-08-26  9:29         ` Heiko Schocher
@ 2015-08-26  9:45           ` Ran Shalit
  0 siblings, 0 replies; 7+ messages in thread
From: Ran Shalit @ 2015-08-26  9:45 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 26, 2015 at 12:29 PM, Heiko Schocher <hs@denx.de> wrote:
> Hello Ran,
>
>
> Am 26.08.2015 um 10:57 schrieb Ran Shalit:
>>
>> On Wed, Aug 26, 2015 at 10:05 AM, Heiko Schocher <hs@denx.de> wrote:
>>>
>>> Hello Ran,
>>>
>>>
>>> Am 26.08.2015 um 08:09 schrieb Ran Shalit:
>>>>
>>>>
>>>> On Wed, Aug 26, 2015 at 7:45 AM, Heiko Schocher <hs@denx.de> wrote:
>>>>>
>>>>>
>>>>> Hello Ran,
>>>>>
>>>>> Am 25.08.2015 um 22:03 schrieb Ran Shalit:
>>>>>>
>>>>>>
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I need to do some periodic very simple task during u-boot prompt
>>>>>> (while u-boot wais for commands). The task is very simple, just
>>>>>> writing into a watchdog refresh register.
>>>>>> But it seems that it's very difficult to "hack" u-boot with such
>>>>>> periodic
>>>>>> task.
>>>>>> I see that main loop is waiting in loop for characters in a call to
>>>>>> getc, which is a blocking command. If it was non-blocking, it might
>>>>>> have help me. I'm not sure if there is a way to replace the getc with
>>>>>> a non-blocking call.
>>>>>>
>>>>>> Does anyone have any idea if there is some simple way to do periodic
>>>>>> task in u-boot  ?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> As you want to trigger a watchdog, have a look at
>>>>> u-boot:/drivers/watchdog
>>>>> and grep the U-Boot code for
>>>>> CONFIG_WATCHDOG
>>>>> CONFIG_HW_WATCHDOG
>>>>>
>>>>> bye,
>>>>> Heiko
>>>>> --
>>>>
>>>>
>>>>
>>>>
>>>> Hi Heiko,
>>>>
>>>> That's a great suggestion.
>>>> I can understand from this, that there is timer interrupt in the
>>>> background for the watchdog refresh activity.
>>>
>>>
>>>
>>> I do not know anything about your hw ... but timer interrupt is not
>>> necessary.
>>>
>>> WATCHDOG_RESET is called from the U-Boot code ..
>>> see definition in include/watchdog.h
>>>
>>>
>>> bye,
>>> Heiko
>>> --
>>
>>
>>
>> Hi Heiko,
>>
>> I am using PPC mpc8349 freescale.
>> In the arch/powerpc/lib/board.c file it does the following:
>> ....
>> for (;;) {
>> WATCHDOG_RESET();
>> main_loop();
>> }
>>
>> There is something in the concept of u-boot flow that I don't uunderstand.
>> How is it that main_loop will perdiocally return to WATCHDOG_RESET  if
>> it waits for keyboard activity with getc() blocking function.
>
>
> Look into the serial driver: drivers/serial/ns16550.c
> NS16550_getc() triggers periodically the watchdog ...
>
>
> bye,
> Heiko
> --


Hi Heiko,

Thaks for the pointers.
I think I start to understand the general idea.
it seems that WATCHDOG_RESET is triggered wherever possible in the code flow.

Thanks very much,
Ran

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

end of thread, other threads:[~2015-08-26  9:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-25 20:03 [U-Boot] Periodic task Ran Shalit
2015-08-26  4:45 ` Heiko Schocher
2015-08-26  6:09   ` Ran Shalit
2015-08-26  7:05     ` Heiko Schocher
2015-08-26  8:57       ` Ran Shalit
2015-08-26  9:29         ` Heiko Schocher
2015-08-26  9:45           ` Ran Shalit

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