Hi,

> Maryam Moghaddas wrote:
> Using RTLinux V1, please tell me:

The answer I'll give you is generic ... find the RTL appropriate
function.

> 
> How can we inssure that an interrupt-driven task is running _outside_
> the scoop of the interrupt handler? Meaning that we can get more
> interrupts while executing the first task?
> How can we be sure that the task is interrupt enabled, so get more
> interrupts while its execution?

The solution I consider for your problem is :

- declare a 'volatile int flag_active=0' variable.
- declare a RealTime Semaphore to launch your handling thread.
- then make a real-time thread handling your task like this :
begin your_thread
  init_your_RTsemaphore
  begin while(1)
    flag_active=0
    wait_for_RTsemaphore
    flag_active=1
    ....
    then do what you want to do ...
    ....
  end while
end your_thread

- then make a RealTime interrupt handler which test if flag_active=1, if
so then signal your RTsemaphore else nothing

You should result like that : ( B:begin_thread X:busy_thread
E:end_thread I:Interrupt )

Irq handler :  III    III    III    III   III  ....
Thread      :     BXXX   XXXX   XXE    BXX   XX....

If you want to confirm your result, I suggest you to use Paralell port
to put signals on different pinout
( I use this solution to look all my threads executing and Irq handler
on a SMP machine and it works fine)

This solution loose interrupts while thread running, important note if
interrupt have data to be treated !
if the Irq is not periodic and you are sure that your thread will treat
all data without overflow, you can
make a fifo of data and then increment RTSemaphore each Irq. ( your
thread will try to decrement RTsemaphore
down to 0) but carefull if your thread have not enough time to do all !

> What is an RTTASK priority in comparison to the interrupt handler ?
> 

Normally, the Irq handler has no priority compared to threads ... if
enabled, irq interrupt all, save the context
of the processor, handle the Irq, and then restore the processor context
and return in his previous state.
This explaine that your RTSemaphore is handled by your thread only after
your Irq_handler totally done and if no
higher priority thread is running.

Chris.

-- 
don't forget to remove NOSPAM_ for reply
Kumsta Christophe <[EMAIL PROTECTED]>
Real-Time image processing developper
RT-Linux/RTAI ( Use the Source Luck !)
-- [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