<br><font size=2 face="sans-serif">hi,</font>
<br>
<br><font size=2 face="sans-serif">Normally you should not share resources
between tasks and ISR's, but if you are "obliged" to do that,
the only way coming to my mind is to disable the interrupts while accessing
the resource from the tasks. This will of course affect to your interrupt
latency and you need to figure out if you can live with that.</font>
<br>
<br><font size=2 face="sans-serif">Regards,</font>
<br>
<br><font size=2 face="sans-serif">Aitor</font>
<br>
<br><tt><font size=2>rtems-users-bounces@rtems.org wrote on 09/03/2008
04:45:12 PM:<br>
<br>
> Hi all, </font></tt>
<br><tt><font size=2>> <br>
> On the project I'm working on we need to protect a ressource from
<br>
> being accessed by multiple tasks. </font></tt>
<br><tt><font size=2>> For this purpose we use a binary semaphore that
is created in the <br>
> following manner : </font></tt>
<br><tt><font size=2>> <br>
> sc = rtems_semaphore_create( rtems_build_name( 'D', 'R', 'V', 's'
), 1, </font></tt>
<br><tt><font size=2>>
<br>
> RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY </font></tt>
<br><tt><font size=2>>
| RTEMS_PRIORITY, <br>
> RTEMS_NO_PRIORITY, &semDriver ); </font></tt>
<br><tt><font size=2>> <br>
> We use a board based on a LEON2 Processor and we use a few ISR as
<br>
> well. These ISRs must often access the same protected ressources <br>
> when triggered. </font></tt>
<br><tt><font size=2>> <br>
> The problem arise when we are in a task that is in the middle of <br>
> accessing the protected ressources and that it obtains the semaphore<br>
> and that directly after an interrupt is triggered. The ISR would ask<br>
> for a semaphore when the last one was not released yet, because it
<br>
> is in the middle of being processed. We then get a deadlock! </font></tt>
<br><tt><font size=2>> <br>
> Could anyone please help me on this ? I guess the best way is to not<br>
> use semaphore in ISR but how can i protect my ressource then ! </font></tt>
<br><tt><font size=2>> <br>
> The version used of RTEMS is 4.6.6</font></tt>
<br><tt><font size=2>> <br>
> Regards, </font></tt>
<br><tt><font size=2>> <br>
> Bise Léonard</font></tt>
<br><tt><font size=2>> _______________________________________________<br>
> rtems-users mailing list<br>
> rtems-users@rtems.com<br>
> http://rtems.rtems.org/mailman/listinfo/rtems-users</font></tt>