usleep() in ioctl

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

 



Hello,

I've been deferring a problem I ran into a few months back and I figure a new year is a good time to readdress it.

I have a loadable module that controls some hardware. Within this hardware are various bits that need to be strobed (i.e set for a minimum specified time and then reset). I have several ioctl() functions set to do this, but when I tried using a usleep() to force a minimum delay, the system hanged. I did a work around by using the CPU internal register timer rdtscl(), but this has the side effect of tying up the CPU instead of allowing a reschedule as (hopefully) a usleep() would do.

An example of what I'd like to do is:

...

case STROBE_RESET:
	{
	 	hwRegister |= RESET_MASK;
		usleep (10000L);   // hold bit high for at least 10ms
		hwRegister &= ~RESET_MASK;
		break;
	}
...


Some delays are shorter (i.e. 20us).

What (if any) taboos exist for using sleep() in a kernel ioctl call and what alternatives exist?

Kernel is 2.6.13 w/preemption, soon to be moving to a later version,

Thanks,
-Bruce



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[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