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

BOUNCE rtl@rtlinux.org: Approval required: (fwd)



>From owner-rtl Sun Jul 15 05:54:37 2001
Received: from 3dsite.com (root@3dsite.com [209.55.67.88])
	by localhost.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f6FBsaU05965;
	Sun, 15 Jul 2001 05:54:37 -0600
Received: from 3dsite.com (63-102-154-9.mal-dyn.charterpipeline.com [63.102.154.9])
	by 3dsite.com (8.9.1/8.9.1) with ESMTP id EAA19725;
	Sun, 15 Jul 2001 04:52:28 -0700 (PDT)
Sender: erco@3dsite.com
Message-ID: <3B51844C.F3A22AED@3dsite.com>
Date: Sun, 15 Jul 2001 04:53:48 -0700
From: Greg Ercolano <erco@3dsite.com>
X-Mailer: Mozilla 4.7C-SGI [en] (X11; I; IRIX 6.2 IP22)
X-Accept-Language: en
MIME-Version: 1.0
To: rtl@rtlinux.org
CC: yodaiken@fsmlabs.com
Subject: bug in examples rtc_toggle.c and rtc_toggle_fifo.c
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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
erco@3dsite.com                              http://3dsite.com/people/erco/
---------------------------------------------------------------------------

----- End of forwarded message from owner-rtl@fsmlabs.com -----