Xref: utzoo comp.unix.internals:2501 comp.unix.wizards:24713 comp.unix.xenix.sco:2139 comp.unix.sysv386:6738 Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!rpi!crdgw1!uunet!mcsun!hp4nl!dri500!slootman From: slootman@dri.nl (Paul Slootman) Newsgroups: comp.unix.internals,comp.unix.wizards,comp.unix.xenix.sco,comp.unix.sysv386 Subject: 5 microsecond delays in device driver - how? Message-ID: <980@dri500.dri.nl> Date: 7 Apr 91 18:35:38 GMT Followup-To: comp.unix.internals Organization: DataCount Register Informatici, Wierden, The Netherlands Lines: 40 Hi, I have a question concerning the use of clock interrupts in device drivers (for now, I'm restricting myself to SCO Xenix and SCO Unix). I have to generate a delay of around 5 to 10 microseconds many times. I will have to do this by busy waiting (right?). A longer delay is not a problem for the device, but because it has to be done thousands (!) of times for each device access, I want to keep the delay as short as possible. As a result, simply looping a number of times that will be sufficient for all CPU speeds etc. is not an option. What I was thinking about doing was using the clock interrupt in some way to measure how many times a loop could be executed between two clock interrupts. This would be done once in the xxinit() function. Knowing how many loops can be done between two clock ticks, I could figure out how often to loop to get a delay of a few microseconds. I understand the system clock is not yet initialized at the moment the xxinit() functions are called. I presume I could thus use the clock myself, to do what I described above. How can I, on the assumption that what I propose would work? If not, what are my other options? One last note: I received a tip that there might be a function in Unix called "tenmicrosec". How many other systems have this? How reliable is it? Please email; I'll summarize to the comp.unix.internals group if anything interesting comes out of this. Paul. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= : slootman@dri.nl : Don't hit the keys so hard, : : ...!hp4nl!dri500!slootman : it hurts : =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=