On Wed, May 31, 2000 at 02:56:56PM +1000, Andrew Price wrote:
> I ran a very small real time application whose sole purpose was to
> toggle
> a bit of the parallel port every 100us. 
> 
> In the long term I will use this to schedule events etc etc..
> 
> The application I am working on also has need for the joystick.
> 
> When I ran up the current joystick driver for linux, and in particular
> the
> joystick driver for the microsoft (cringe) sidewinder it caused the
> system
> to lock up. If I slowed the rate of the real time process. to one toggle
> every 2ms
> the joystick operates normally.
> 
> 
> I used the example program for latency testing for the parallel port
> along with 
> 'jstest' an example that is packaged with the current joystick driver
> for linux.
> 
> 
> Can anyone explain why the high rate of the real time process affects
> what the joystick,
> a common garden variety process is doing?

A quick look at the sidewinder driver shows this amusing  comment:

/*
 * js_sw_read_packet() is a function which reads either a data packet, or an
 * identification packet from a SideWinder joystick. Better don't try to
 * understand this, since all the ugliness of the Microsoft Digital
 * Overdrive protocol is concentrated in this function. If you really want
 * to know how this works, first go watch a couple horror movies, so that
 * you are well prepared, read US patent #5628686 and then e-mail me,
 * and I'll send you an explanation.
 *                                      Vojtech <[EMAIL PROTECTED]>
 */


and then this cli protected code:
   do {
                bitout--;
                u = v;
                v = inb(io);
        } while (!(~v & u & 0x10) && (bitout > 0));             /* Wait for first 
falling edge on clock */

So it tries to turn off interrupts and do a busy wait for a falling edge. I bet these
last for near millisecond periods -- with a 100us RT thread interrupting the device
is not going to work well at all.

Sorry. One solution is to get a better joystick. Another is to run on a SMP board.




-- 
---------------------------------------------------------
Victor Yodaiken 
FSMLabs:  www.fsmlabs.com  www.rtlinux.com
FSMLabs is a servicemark and a service of 
VJY Associates L.L.C, New Mexico.

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to