rtems_interrupt_is_in_progress() not working.

Joel Sherrill joel.sherrill at OARcorp.com
Sun Jan 10 15:43:46 UTC 2010


On 01/10/2010 07:46 AM, Nick Thomas wrote:
>    
>> -----Original Message-----
>> From: Joel Sherrill [mailto:joel.sherrill at oarcorp.com]
>> Sent: 09 January 2010 15:38
>> To: Nick Thomas
>> Cc: rtems-users at rtems.com
>> Subject: Re: rtems_interrupt_is_in_progress() not working.
>>
>> On 01/09/2010 03:58 AM, Nick Thomas wrote:
>>      
>>> Hi, I have the following function, which tries to obtain a semaphore,
>>> but first checking that we are not inside an ISR.
>>>
>>> But, it doesn't work.
>>>
>>>
>>>        
>> Which architecture?
>>      
> PowerPC 405.
>    
>> Can you set up a simple test like the one I have attached and try it?
>> The attached test sends a signal from an ISR.  It is pretty small.
>>
>> Then it either works or doesn't and I can look at it. :)
>>      
> OK, I ran the test you sent to me, and I got this output:
>
> *** SIGNAL FROM TST TEST ***
> rtems_signal_catch - handler installed
> Signal sent from ISR has been processed
> *** END OF SIGNAL FROM TSR TEST ***
>
>
> Not sure how that helps though as the test doesn't use
> rtems_interrupt_is_in_progress() !
>
>    
I meant to change the test so instead of sending a signal
from the ISR, you check that rtems_interrupt_is_in_progress()
is tested.  Fix the example so it checks it is false from the task
and true from the ISR.  If it doesn't work, then I can verify the
correctness of the test on another architecture.

I suspect this is because the PowerPC keeps interrupt nest
level in a register (if I remember that correctly) and that
information is not propagated to the API.

So we need a test. :)
> Regards
>
> Nick
>
>    
>>> It crashes in rtems_semaphore_obtain call, and the debugger shows
>>>        
>> that
>>      
>>> there is an RTEMS error 18, which corresponds to doing the wrong
>>>        
>> thing
>>      
>>> inside an ISR ( I think ).
>>>
>>> So, why doesn't rtems_interrupt_is_in_progress() detect that the call
>>> is inside an ISR?
>>>
>>> --- SNIP ---
>>> Void Lock(void)
>>> {
>>> 	rtems_status_code stat;
>>>
>>> 	if (rtems_interrupt_is_in_progress() == FALSE)
>>> 	{
>>> 		stat = rtems_semaphore_obtain(M_The_mutex, RTEMS_WAIT, 0);
>>> 		if (stat != RTEMS_SUCCESSFUL)
>>> 		{
>>> 			printf("Lock: rtems_semaphore_obtain returned %d\n",
>>>        
>> stat);
>>      
>>> 		}
>>> 	}
>>> }
>>> --- END ---
>>>
>>> -----------------------------
>>> Nick Thomas
>>> Email: nick.thomas at pixsan.com
>>>
>>> _______________________________________________
>>> rtems-users mailing list
>>> rtems-users at rtems.org
>>> http://www.rtems.org/mailman/listinfo/rtems-users
>>>
>>>        
>
>    




More information about the users mailing list