How to implement 1us delay in Linux?

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
Hello all,

The Linux's timer tick resolution is 1ms, and how to implement 1us delay in Linux, by hardware or by software?

DAVY
 

u can set by software also. but it is risk process.
u can try by software first
 

Hi,

If you are working on an Intel Pentium class workstation, you can use the assembler instruction "rdtsc", which enables you to read a hardware counter running at cpu clock cycle speed.

You can write a assembler routine which reads this counter and loops until it reach a value corresponding to the delay you need.

See this pdf to see how to access this counter :

h**p://www.eecg.toronto.edu/~de/RDTSCPM1.pdf


Replace * by t
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…