Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Nov 2005 09:50:44 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        mayong@mail.com
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: timer_list for FreeBSD?
Message-ID:  <20051123.095044.88000142.imp@bsdimp.com>
In-Reply-To: <20051123092444.D826E164293@ws1-4.us4.outblaze.com>
References:  <20051123092444.D826E164293@ws1-4.us4.outblaze.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20051123092444.D826E164293@ws1-4.us4.outblaze.com>
            "Yong Ma" <mayong@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051123.095044.88000142.imp>