Showroom USI example: parallel port

Paolo Mantegazza mantegazza at aero.polimi.it
Mon Oct 11 11:55:10 CEST 2004


Hannes Mayer wrote:
> Hannes Mayer wrote:
> 
>> Paolo Mantegazza wrote:
>>  > man ioperm, man iopl, at your choice.
>>
>> Hi Paolo!
>>
>> I always used #include <asm/io.h>, but #include <sys/io.h> seems to do
>> the trick. Thank you for the reminder to look into "man ioperm" again :-)
>>
>> I managed to detect one interrupt, but after that no further interrupt is
>> detected.
>>
>> Here is the while-loop in the thread of the USI example:
>>
>> [...]
>> while (!end) {
>>     do {
>>         //ovr = rt_wait_intr_timed(intsem, nano2count(TIMEOUT), (void 
>> *)&retval);
>>         ovr = rt_wait_intr(intsem, (void *)&retval);
>>         hard_sti();
>>         if (end) break;
>>         if (ovr > 0) {                    // overrun processing, if 
>> any, goes here
>>             rt_sem_signal(dspsem);
>>         }
>>         /* normal processing goes here */
>>         intcnt++;
>>         rt_sem_signal(dspsem);
>>         rt_ack_irq(PARPORT_IRQ);
>>     } while (ovr > 0);
>>     rt_pend_linux_irq(PARPORT_IRQ);
>> }
>> [...]
>>
>> With some printf's I found that the first interrupt is detected, the 
>> loop proceeds
>> to rt_pend_linux_irq, starts over again, but then it hangs at 
>> rt_wait_intr and no
>> further interrupt is detected.
>> I already added rt_ack_irq, which I use in my kernel modules, but that 
>> doesn't work
>> in this case.
>>
>> What else must be done to detect further parallel port interrupts in 
>> user-space ?
> 
> 
> Forgot to mention that I've tried putting
> rt_startup_irq(PARPORT_IRQ);
> and/or
> rt_enable_irq(PARPORT_IRQ);
> and/or
> rt_ack_irq(PARPORT_IRQ);
> and/or
> rt_unmask_irq(PARPORT_IRQ);
> into the thread loop at various places, the main loop etc., but still no
> luck.
> 
> Well, so far I find kernel modules much easier to make, but since Paolo
> told us to try to concentrate on LXRT, I'm up for the challange :-)
> 

I think your problems are related to the pending to Linux.

In any case you should reread what I told, i.e working with LXRT does 
not mean you cannot do it in kernel space.

So if you want to have your parallel port handler in kernel space work 
as usual but do use the LXRT scheduler always.

To be convinced run any kernel space example in showroom.

In any case do what you want as at a certain release you will be using 
LXRT without even knowing you are doing so.


Paolo.





More information about the Rtai mailing list