* Timed wait/sleep
@ 2007-07-06 21:57 Alex Roman
2007-07-06 22:04 ` Haudy Kazemi
2007-07-22 13:48 ` Marco Gerards
0 siblings, 2 replies; 8+ messages in thread
From: Alex Roman @ 2007-07-06 21:57 UTC (permalink / raw)
To: The development of GRUB 2
Hello,
Is there any mechanism to wait/sleep for a specified time in GRUB?
The reason I need something like this is that, for the ATA driver I am
working on, I need to be able to wait for a memory mapped register to
change, but I don't want to wait indefinitely. I'd like to be able to
have some sort of loop that will read the register, say, 10 times,
with 10 ms pause in between the reads...
I've searched for this and wasn't able to find anything in the source code...
If there isn't one, what would be the best way to implement something
like this? Perhaps using the RTC, or straight loops? Would there be
any use, besides my driver, in developing an RTC interface?
Thanks!
--
Alex Roman <alex.roman@gmail.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Timed wait/sleep
2007-07-06 21:57 Alex Roman
@ 2007-07-06 22:04 ` Haudy Kazemi
2007-07-06 22:21 ` Alex Roman
2007-07-22 13:48 ` Marco Gerards
1 sibling, 1 reply; 8+ messages in thread
From: Haudy Kazemi @ 2007-07-06 22:04 UTC (permalink / raw)
To: The development of GRUB 2
On Jul 6 2007, Alex Roman wrote:
>Hello,
>
>Is there any mechanism to wait/sleep for a specified time in GRUB?
>
>The reason I need something like this is that, for the ATA driver I am
>working on, I need to be able to wait for a memory mapped register to
>change, but I don't want to wait indefinitely. I'd like to be able to
>have some sort of loop that will read the register, say, 10 times,
>with 10 ms pause in between the reads...
>
> I've searched for this and wasn't able to find anything in the source
> code...
>
>If there isn't one, what would be the best way to implement something
>like this? Perhaps using the RTC, or straight loops? Would there be
>any use, besides my driver, in developing an RTC interface?
I'd avoid straight loops...with those you run into processor speed
issues...runs too fast on new CPUs, runs too slow on old hardware. Of
course I guess you could calibrate some straight loops to the RTC, and then
use the loops rather than polling the RTC periodically, but I don't think
the extra level of complication would provide any real benefit.
>Thanks!
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Timed wait/sleep
2007-07-06 22:04 ` Haudy Kazemi
@ 2007-07-06 22:21 ` Alex Roman
2007-07-07 10:29 ` Jan C. Kleinsorge
0 siblings, 1 reply; 8+ messages in thread
From: Alex Roman @ 2007-07-06 22:21 UTC (permalink / raw)
To: The development of GRUB 2
On 06 Jul 2007 17:04:19 -0500, Haudy Kazemi <kaze0010@umn.edu> wrote:
> On Jul 6 2007, Alex Roman wrote:
> I'd avoid straight loops...with those you run into processor speed
> issues...runs too fast on new CPUs, runs too slow on old hardware. Of
> course I guess you could calibrate some straight loops to the RTC, and then
> use the loops rather than polling the RTC periodically, but I don't think
> the extra level of complication would provide any real benefit.
Yes, I am reluctant to use loops for that reason.
I could definitely do a simple read RTC in a loop until the time
difference from when I started the loop is what I want it to be...
I'll try to get that working, but I am open to other suggestions as well!
Thanks!
--
Alex Roman <alex.roman@gmail.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Timed wait/sleep
@ 2007-07-07 6:47 Amin Azez
0 siblings, 0 replies; 8+ messages in thread
From: Amin Azez @ 2007-07-07 6:47 UTC (permalink / raw)
To: The development of GRUB 2
Donzt beat me for this, but grub2 sounds more like a kernel every day.
I almost want to suggest nicking things from hurd.
Grub2 could even be the init on a minimal hurd setup, surely?
Cough
Sam
-----Original Message-----
From: "Alex Roman" <alex.roman@gmail.com>
To: "The development of GRUB 2" <grub-devel@gnu.org>
Sent: 06/07/07 23:21
Subject: Re: Timed wait/sleep
On 06 Jul 2007 17:04:19 -0500, Haudy Kazemi <kaze0010@umn.edu> wrote:
> On Jul 6 2007, Alex Roman wrote:
> I'd avoid straight loops...with those you run into processor speed
> issues...runs too fast on new CPUs, runs too slow on old hardware. Of
> course I guess you could calibrate some straight loops to the RTC, and then
> use the loops rather than polling the RTC periodically, but I don't think
> the extra level of complication would provide any real benefit.
Yes, I am reluctant to use loops for that reason.
I could definitely do a simple read RTC in a loop until the time
difference from when I started the loop is what I want it to be...
I'll try to get that working, but I am open to other suggestions as well!
Thanks!
--
Alex Roman <alex.roman@gmail.com>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Timed wait/sleep
2007-07-06 22:21 ` Alex Roman
@ 2007-07-07 10:29 ` Jan C. Kleinsorge
0 siblings, 0 replies; 8+ messages in thread
From: Jan C. Kleinsorge @ 2007-07-07 10:29 UTC (permalink / raw)
To: The development of GRUB 2
For i/o delays on x86, Linux uses a sequence of outp(0x80). 0x80 is
usually unsed.
One to three times should be quite sufficient.
Jan
ex Roman wrote:
> On 06 Jul 2007 17:04:19 -0500, Haudy Kazemi <kaze0010@umn.edu> wrote:
>> On Jul 6 2007, Alex Roman wrote:
>> I'd avoid straight loops...with those you run into processor speed
>> issues...runs too fast on new CPUs, runs too slow on old hardware. Of
>> course I guess you could calibrate some straight loops to the RTC,
>> and then
>> use the loops rather than polling the RTC periodically, but I don't
>> think
>> the extra level of complication would provide any real benefit.
>
> Yes, I am reluctant to use loops for that reason.
>
> I could definitely do a simple read RTC in a loop until the time
> difference from when I started the loop is what I want it to be...
>
> I'll try to get that working, but I am open to other suggestions as well!
>
>
> Thanks!
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Timed wait/sleep
2007-07-06 21:57 Alex Roman
2007-07-06 22:04 ` Haudy Kazemi
@ 2007-07-22 13:48 ` Marco Gerards
2007-07-22 21:38 ` Alex Roman
1 sibling, 1 reply; 8+ messages in thread
From: Marco Gerards @ 2007-07-22 13:48 UTC (permalink / raw)
To: The development of GRUB 2
"Alex Roman" <alex.roman@gmail.com> writes:
Hi,
> Is there any mechanism to wait/sleep for a specified time in GRUB?
Not yet. I will also need this for networking. Actually, we can do
still in this idle time. I will get back on this.
You can read the time in milliseconds, IIRC. You can use that to
check in a loop. But please do not use busy waiting. That will give
problems with qemu, etc.
--
Marco
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Timed wait/sleep
2007-07-22 13:48 ` Marco Gerards
@ 2007-07-22 21:38 ` Alex Roman
2007-07-22 22:33 ` Jeroen Dekkers
0 siblings, 1 reply; 8+ messages in thread
From: Alex Roman @ 2007-07-22 21:38 UTC (permalink / raw)
To: The development of GRUB 2
- Original message -
"Alex Roman" <alex.roman@gmail.com> writes: Hi, Not yet...
Sorry, what do you mean by busy waiting?
Thanks
Alex
On 22/07/07, Marco Gerards <mgerards@xs4all.nl> wrote:
> "Alex Roman" <alex.roman@gmail.com> writes:
>
> Hi,
>
> > Is there any mechanism to wait/sleep for a specified time in GRUB?
>
> Not yet. I will also need this for networking. Actually, we can do
> still in this idle time. I will get back on this.
>
> You can read the time in milliseconds, IIRC. You can use that to
> check in a loop. But please do not use busy waiting. That will give
> problems with qemu, etc.
>
> --
> Marco
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Alex Roman <alex.roman@gmail.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Timed wait/sleep
2007-07-22 21:38 ` Alex Roman
@ 2007-07-22 22:33 ` Jeroen Dekkers
0 siblings, 0 replies; 8+ messages in thread
From: Jeroen Dekkers @ 2007-07-22 22:33 UTC (permalink / raw)
To: The development of GRUB 2
At Sun, 22 Jul 2007 17:38:14 -0400,
Alex Roman wrote:
>
> Sorry, what do you mean by busy waiting?
Busy waiting is looping while checking whether a condition
changed. E.g.
while(condition_is_true());
It would be nicer to let the processor sleep for a while. I'm not sure
whether we can actually do that easily in GRUB however...
Jeroen Dekkers
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-07-22 22:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-07 6:47 Timed wait/sleep Amin Azez
-- strict thread matches above, loose matches on Subject: below --
2007-07-06 21:57 Alex Roman
2007-07-06 22:04 ` Haudy Kazemi
2007-07-06 22:21 ` Alex Roman
2007-07-07 10:29 ` Jan C. Kleinsorge
2007-07-22 13:48 ` Marco Gerards
2007-07-22 21:38 ` Alex Roman
2007-07-22 22:33 ` Jeroen Dekkers
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.