On Fri, 5 Nov 1999, Peter Wurmsdobler wrote:
> I have the following code for the isr of the parallel port:
> Starting rt_mcm_spp_isr
> daq_counter = 0
> Starting rt_mcm_measure
> Leaving rt_mcm_measure
> Leaving rt_mcm_spp_isr
> 1. In the above example it seems that rt_task_wakeup( &measure )
> is just a function call. I thought that rt_task_wakeup( &measure )
> will just set the task to READY, then start the scheduler who
> will set some registers such that after the isr the processor
> starts at the task's address. Is this wrong?
You want real time - you got real time - this means the task is woken up
immediately. Apparently it has higher priority than interrupt handler. In
fact you should not worry, but modify you code in a way I show below. Do not
worry, thanks to measure_lock you will not get infinite recursion - isr will
be called maximum 2 times recursively. Please note that it really makes no
difference whether you call some RT task immediately after returning from
ISR, or in the ISR, if you enable interrupts before.
> 2. If measure_lock = 0 at the end of the measure task,
> then the next time ((daq_couter % 2) == 0), it should be
> restarted. I am wrong?
Did you check whether shm->down_sampling is really 2? Sorry for this
question, I have no other idea.
unsigned int rt_mcm_spp_isr( unsigned int irq_number, struct pt_regs *p
)
{
RT_MCM_DPRINTF0( "Starting rt_mcm_spp_isr\n" );
++daq_counter;
RT_MCM_DPRINTF1( "daq_counter = %d\n", daq_counter );
if (( ( daq_counter % (shm->down_sampling) ) == 0 ) &&
( measure_lock == 0 ) )
{
measure_lock = -1;
rtl_hard_enable_irq( RT_MCM_SPP_IRQ ); /*insert this */
rt_task_wakeup( &measure );
}
rtl_hard_enable_irq( RT_MCM_SPP_IRQ );
RT_MCM_DPRINTF0( "Leaving rt_mcm_spp_isr\n" );
return 0;
}
static void rt_mcm_measure(int t)
{
RT_MCM_DPRINTF0( "Starting rt_mcm_measure\n" );
/*
* stuff deleted
*/
RT_MCM_DPRINTF0( "Leaving rt_mcm_measure\n" );
measure_lock = 0;
rt_task_wait();
}
--
Tomek
--- [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/