tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Waiting for a bit in a register to be cleared: which strategy?

On lug 03 20:15, Mouse wrote:

> Then, yes, just loop.  First make it work, then make it better.

Ok! I did exactly this way.

> Well, be aware that DELAY() on many machines, especially for small
> arguments, _is_ just a cycle-burning loop - it just multiplies the
> argument by a constant calculated based on CPU speed.

Yes, IIUC from the manpages, DELAY(n) uses the argument n in a similar
way mstohz(9) would.

> > Yes, of coure.
> If that's "of course" to you, you're not a _complete_ newbie. :-)

:) I tried to follow the logic reasoning behind your text. I have some
theory background, but reading code (and even more, writing it) is still
a big challenge.

> I'd say, just use the simple loop.  Once you have that much working,
> *then* worry about things like handling (pseudo-)hardware failures or
> interrupts, or sleeping instead of busy-waiting.

Ok, I'm relieved, because just did as you suggested. The loop works; I
honestly think that the bit is cleared in a negligible amount of time,
but it's right and proper to handle a failure. As a next improvement,
I'll try with waiting and then with an interrupt, if I manage to.


Home | Main Index | Thread Index | Old Index