Re: Very Short Delays

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

 



Hi,

On processors that provide a time stamp counter (e.g. Pentium, Alpha), you might use the time stamp counter to delay for a given number of clock ticks (by polling the time
stamp counter until the requested timeout has ellapsed).
In order to cope with different processor speeds you would first need to calculate the number of clock ticks that correspond to the delay of 400ns during initialization of
your driver.

A description of time stamp counters is given in 'Understanding the Linux Kernel', Chapter 5. An example how to use time stamp counter under Alpha (where it is called
processor cycle counter), is given in http://www.mostang.com/~davidm/papers/expo97/paper/doc004.html.

The disadvantage of this approach is that you would need to implement it separatly for each architecture you want to support. You would also have to fall back to other
solutions for processors that don't provide a time stamp counter.

regards
Martin

Christine Ames wrote:

>
>
> Greetings,
>
> I'm looking for a way to "busy wait" <= 400 nanoseconds.
>
> In _Linux_Device_Drivers_ I've found udelay(for micro
> seconds) and mdelay(for milli seconds), but they state (2nd
> edition, page 189) that "Currently, support for delays longer
> than a few microseconds and shorter than a timer tick is very
> inefficient."  I found no further discussion.
>
> "Inefficient" or not, I need a cross-platform/cross-kernel
> way to stall <= 400ns while my hardware gets back to me.  Am
> I stuck, or is there a way?
>
> --Christine

--
Supercomputing System AG          email: maletinsky@scs.ch
Martin Maletinsky                 phone: +41 (0)1 445 16 05
Technoparkstrasse 1               fax:   +41 (0)1 445 16 10
CH-8005 Zurich


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux