I was showing my engineering friend the wonders of rtlinux,
setting it up on his machine, and monitoring the parallel port
with his scope, when we came across a couple of examples that 
didn't work, namely:

        /usr/rtlinux-3.0/examples/v1api/parallel/rtc_toggle.c
        /usr/rtlinux-3.0/examples/v1api/parallel/rtc_toggle_fifo.c

We found their interrupts only went off once, then stopped.

For fun we debugged them, and found the problem was just 
the interrupt handler; wasn't calling 
I'm guessing these programs were written to use the older
API which automatically re-enabled the irqs, but when ported
to the new API, they forgot to add the necessary irq enable.

To make the examples work, just add the rtl_hard_enable_irq(8)
call above the 'break' statement for 'case 0' in handler(), eg:
_________________________________________________________________________

unsigned int  handler(unsigned int irq_number, struct pt_regs *p) {
        /* Do not rt_task_wait() in a handler */
        switch(shutdown_flag){
                case 0:
                        outb(output, LPT_PORT);
                        /* I'm too lazy to figure out which pin is which
                           so just toggle all of them */
                        output = ~output;
                        (void) CMOS_READ(RTC_REG_C);  /* clear IRQ */
                        rtf_put(0, &samp, sizeof(samp));
                        samp++;
                        rtl_hard_enable_irq(8);                 // <--- ADD THIS LINE
                        break;
_________________________________________________________________________

Once that's added, both examples will work correctly; the scope puts 
out a nice square wave, and the fifo starts generating data you can 
view with 'od -x /dev/rtf0'.

Other examples should likely be checked for this problem.

HTH..

ps. I really dig rtl. I've already got an RTL interrupt driver going
    for a popular 'Kuper Controls' RTMC48 stepper motor card used in the 
    motion picture effects industry. I'm porting my optical printer 
    motion control software from DOS to RTL, and it's been a breeze
    so far.. great work.

-- 

   \___/
   |o,o|
 \/    )
----mm---------------------------------------------------------------------
Greg Ercolano                    UNIX NightOwl / Systems Programmer & Admin
[EMAIL PROTECTED]                              http://3dsite.com/people/erco/
---------------------------------------------------------------------------

----- End of forwarded message from [EMAIL PROTECTED] -----
-- [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/

Reply via email to