rtems_semaphore_obtain

Leon Pollak leonp at plris.com
Mon Mar 19 15:08:40 UTC 2007


Sorry if I am out of sense here.

May it be that because you defined binary semaphore the following occurs:
First timeout occurs and fires semaphore. Exactly at this moment the ISR fires 
and also adds semaphore, but it is lost because of binary definition.


On Monday 19 March 2007, Chris Xenophontos wrote:
> Hello all,
>
> We have a situation, running RTEMS 4.6.0, on a Coldfire 5208.
> One of the threads (tasks) in our application pends with a one-second
> timeout on a semaphore released by an ISR.
>
> The interrupt source that triggers the ISR (for this test case) runs every
> 3 seconds (~3.011).  This re-creates the problem more frequently.
>
> Typically, the task will run, timeout once per second, unless the ISR is
> triggered, in which case it will recognize it and process accordingly.  The
> task processes critical values read from hardware that are latched by the
> ISR.  99.99% of the time, it works as expected.
>
> As the ISR trigger "walks" close to the time of task timeout, we see the
> back-to-back executions, as expected.
>
> However, every 10 hours or so, the task will not respond to the semaphore
> released from the ISR, even though debugging clearly shows the ISR
> responded to the HW interrupt and latched the hardware values.
>
> The effect is a dropped interrupt - the rtems_semaphore_obtain call does
> not return with an RTEMS_SUCCESSFUL status -- it returns a TIMEOUT.  No
> other RTEMS error status are returned either (we check for these well).
>
> The task, ISR, and semaphore_create function that we're using are listed
> below.  Any help appreciated!!
>
> Thanks
> Chris Xenophontos
>
> ///////////// mytask//////////////////
> mytask()
> {
>     while( 1 )
>     {
>     rtems_status = rtems_semaphore_obtain( &myIsrSemId,
>                                             RTEMS_WAIT,
>                                             100 );  // 100 ticks = 1 second
>
>     if(( rtems_status != RTEMS_SUCCESSFUL ) &&
>        ( rtems_ststaus != RTEMS_TIMEOUT   ))
>     {
>        // post error status ( we NEVER see an error here )
>     }
>
>     if( rtems_status == RTEMS_SUCCESSFUL )
>     {
>         // do specific processing based on semaphore released by ISR
>         ( not always seen, even though the ISR ran)
>     }
>     else
>     {
>         // specific processing based on timeout waiting for semaphore
>     }
>     }
> }
> //////////////// end mytask///////////
>
> the ISR is as follows
> ///////////////////myIsr////////////////
> myIsr()
> {
>     ( code to ack the Colfire interrupt )...
>
>     code to read 3 hardware registers....
>
>     rtems_semaphore_release( &myIsrSemId );
> }
> ///////////////myIsr///////////////////
>
> the semaphore is created as follows, and is always created succesfully:
>
> status = rtems_semaphore_create( "MISR",  0,
> ( RTEMS_FIFO | RTEMS_NO_INHERIT_PRIORITY | RTEMS_SIMPLE_BINARY_SEMAPHORE |
> RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL ),
> RTEMS_NO_PRIORITY, &myIsrSemId )
>
>
> mytask is created with the following attributes:
> RTEMS_PREEMPT | RTEMS_NO_ASR | RTEMS_NO_TIMESLICE |
> RTEMS_INTERRUPT_LEVEL(0),
> RTEMS_FLOATING_POINT | RTEMS_LOCAL,
>
> thanks,cx
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users



-- 
Dr.Leon M.Pollak
    Director
PLR Information Systems Ltd.
Tel.:+972-98657670
Fax.:+972-98657621
Mob.:+972-544739246



More information about the users mailing list