Hi David,
I do not plan to use a start_routine() function.
My interrupt handler module has the following outline
int init_module(void)

int status;
rtl_irqstate_t f;
   setupserialport();/*function to write some bits to the serial port in
order to set it up properly */
   rtl_no_interrupts(f);

   status = rtl_request_irq(3, intr_handler); /*register intr_handler for
irq 3*/
   rtl_printf("rtl_request_irq: %d\n", status);

   rtl_hard_enable_irq(3);

   rtl_restore_interrupts(f);

   return pthread_create (&thread, 0, 0, 0);
}

intr_handler() is the actual interrupt handler that reads in the data from
the serial port and stores in a buffer.

I insert this module and then I write a user program of the form
{
startRecord(); /*writes some bits to COM2 to trigger recording */
<Wait for some event like a keypress or a timeout>
stopRecord();/*writes some bits to  COM2 to stop recording */
}

After startRecord() the device basically sends data on COM1 and the
intr_handler() should be invoked to read in
the data. The problem is that the intr_handler() gets invoked only once
although the device is generating a lot
of interrupts.

Now if in the interrupt handler main routine I have something like
return pthread_create (&thread, NULL, start_routine, 0);
instead of
return pthread_create (&thread, 0, 0, 0);
and in the start_routine I give a startRecord() command the interrupt
handler
gets invoked as often as interrupts are received.
But in the start_routine() if I give something like
startRecord();
/*delay for fixed time*/
stopRecord();
the intr_handler() again gets called only once.
Am I missing anything?
Thanks for your help.

Best Wishes
Amit


----- Original Message -----
From: David Olofson <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 08, 2001 8:10 AM
Subject: Re: [rtl] serial port interrupt handler


> On Thursday 08 February 2001 05:04, Amit Mookerjee wrote:
>
> > > Hi
> >  I am trying to write a serial port interrupt handler in RTLinux.
> >  The application that I have
> >  in mind needs to trigger a recording device on the COM2 serial port and
> >  read data from the COM1 serial port.
> >  The logic of my main function is as follows:
> >
> >    startRecord();
> >    <Wait for some event like a keypress or a timeout>
> >    stopRecord();
> >
> > So I want to install a interrupt handler module and then trigger of the
> >  recording from an user process.
> >  The device I am attached to (an eyetracker)issues 120 interrupts in a
> >  second. When I run my main function after installing the handler I
notice
> >  that the handler is just invoked once i.e. after the startRecord() the
> >  process just waits for an event but the interrupt handler is not
invoked
> >  even though the device is sending interrupts. The curious fact is that
> >  when I put a startRecord() command in the <void * start_routine(void
> >  *arg)> function of the interrupt handler module the interrupt handler
gets
> > invoked as often as interrupts are received. But when I put a
startRecord()
> > command by a getchar() (a button press) I notice that the handler just
gets
> > invoked once.
> >  Does anyone have ideas about what could be going wrong?
>
> The most common reason for this kind of problems is that the ISR isn't
> telling the hardware that it got the IRQ. If you're using an OS (rather
than
> DOS ;-), the interrupt controller is usually managed automatically, but
your
> driver still has to do any additional handshaking that the hardware device
> may require.
>
> When is this start_routine() function called?
>
>
> file://David
>
> .- M A I A -------------------------------------------------.
> |      Multimedia Application Integration Architecture      |
> | A Free/Open Source Plugin API for Professional Multimedia |
> `----------------------> http://www.linuxaudiodev.com/maia -'
> .- David Olofson -------------------------------------------.
> | Audio Hacker - Open Source Advocate - Singer - Songwriter |
> `--------------------------------------> [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/rtlinux/
>
>
Best Wishes
Amit


----- Original Message -----
From: David Olofson <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 08, 2001 8:10 AM
Subject: Re: [rtl] serial port interrupt handler


> On Thursday 08 February 2001 05:04, Amit Mookerjee wrote:
>
> > > Hi
> >  I am trying to write a serial port interrupt handler in RTLinux.
> >  The application that I have
> >  in mind needs to trigger a recording device on the COM2 serial port and
> >  read data from the COM1 serial port.
> >  The logic of my main function is as follows:
> >
> >    startRecord();
> >    <Wait for some event like a keypress or a timeout>
> >    stopRecord();
> >
> > So I want to install a interrupt handler module and then trigger of the
> >  recording from an user process.
> >  The device I am attached to (an eyetracker)issues 120 interrupts in a
> >  second. When I run my main function after installing the handler I
notice
> >  that the handler is just invoked once i.e. after the startRecord() the
> >  process just waits for an event but the interrupt handler is not
invoked
> >  even though the device is sending interrupts. The curious fact is that
> >  when I put a startRecord() command in the <void * start_routine(void
> >  *arg)> function of the interrupt handler module the interrupt handler
gets
> > invoked as often as interrupts are received. But when I put a
startRecord()
> > command by a getchar() (a button press) I notice that the handler just
gets
> > invoked once.
> >  Does anyone have ideas about what could be going wrong?
>
> The most common reason for this kind of problems is that the ISR isn't
> telling the hardware that it got the IRQ. If you're using an OS (rather
than
> DOS ;-), the interrupt controller is usually managed automatically, but
your
> driver still has to do any additional handshaking that the hardware device
> may require.
>
> When is this start_routine() function called?
>
>
> file://David
>
> .- M A I A -------------------------------------------------.
> |      Multimedia Application Integration Architecture      |
> | A Free/Open Source Plugin API for Professional Multimedia |
> `----------------------> http://www.linuxaudiodev.com/maia -'
> .- David Olofson -------------------------------------------.
> | Audio Hacker - Open Source Advocate - Singer - Songwriter |
> `--------------------------------------> [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/rtlinux/
>
>

-- [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