timer_list for FreeBSD?
M. Warner Losh
imp at bsdimp.com
Wed Nov 23 08:51:43 PST 2005
In message: <20051123092444.D826E164293 at ws1-4.us4.outblaze.com>
"Yong Ma" <mayong at mail.com> writes:
: In my work I send some data to the card and wait for a result in a
: loop.but sometimes it can't get it ,so the driver run and run and
: can't get out of the loop.I need something like timer_list in Linux
: with which I can decide the max time the loop will run.I searched it
: in the source code but found little about that.Anyone can help?
Typically this sort of thing is done in FreeBSD in a more ad-hoc way:
/*
* Wait at most 1ms for the busy bit to flip. Datasheet
* says it will take up to 250us, so add a sane margin of
* error in case they are wrong. Note: GetStatus takes 1us
* to perform the i/o.
*/
limit = 1000;
while ((GetStatus() & BusyBit) && limit-- > 0)
continue;
There's no easy API that will let you limit it to a fixed time. The
above typically is sufficient for 'don't loop forever' so nothing
fancier has been created.
Warner
More information about the freebsd-drivers
mailing list