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

usleep seems broken



Hi,

I need to use glibc usleep function to time between writes to and from a
device attached to csp0, the reads and writes work but they seem realy slow,
I tried to figure out what was going on so I wrote a test case:

for(;;){
	*control=0x0;
	usleep(1);
	*control=0x1;
	usleep(1);
}

What this code does is just turns on and off a single pin on the device, I
attached a scope to that pin and timed the delay between high and low pulses
and it seems that usleep(1) which should sleep for 1 microsecond actually
delays the process for 25 miliseconds, that's right it's not a typo the
delay is in miliseconds instead of microseconds. When I replaced the
usleep(1) with usleep(25000) than the redout from the scope would show a 39
milisecond delay.


Can anyone at Axis verify this on their systems.

I need a time delay in my app to be more acurate than 25ms, maybe I should
read the time straight from the timer registers on the LX processor, what do
you think?

Thanks.

-- 
Peace can only come as a natural consequence
of universal enlightenment. -Dr. Nikola Tesla