Page 1 of 1

Signalling Semaphore from ISR

PostPosted: Fri Dec 01, 2000 3:49 am
by aek
Your code looks fine.

Are you using the freeware libraries? If so, you can't signal from an ISR because the freeware libraries were compiled with the OSCALL_XYZ configuration options set to OSFROM_MAINLINE_ONLY.

In the full version, this is how you do it: You set OSCALL_OSSIGNALBINSEM to OSFROM_ISR_ONLY, and recompile. This removes the interrupt disabling and enabling from OSSignalBinSem(), which then allows you to call it without it re-enabling interrupts and therefore causing nested interrupts, which you don't want.

We are considering a new set of freeware libraries for v2.2, which will have all the OSSignalXyz() services compiled with OSFROM_ANYWHERE. This will allow you to call them from either mainline code or ISRs. The downside is that this takes more RAM ...


Re: Signalling Semaphore from ISR

PostPosted: Fri Dec 01, 2000 10:59 am
by NoMore
I want to create Binary Semaphore in the main and Signal it from an interrupt. Delays are not involved in my application. How can it be done, what options and settings does it require.


void main (void)
{
PR2 = TMR2_RELOAD;
T2CON = 0x4D;

OSInit();

TMR2IE = 1;
PEIE = 1;
OSEnableInts();

CreateBinSem (0, 0);

for ( ; ; ) OSSched ();
}


#pragma interrupt_level 0
void interrupt IntVector (void)
{
if (TMR2IE && TMR2IF)
{
TMR2IF = 0;

OSSignalBinSem (0);
}
}

[This message has been edited by NoMore (edited December 01, 2000).]

[This message has been edited by NoMore (edited December 01, 2000).]


Re: Signalling Semaphore from ISR

PostPosted: Mon Dec 04, 2000 2:11 am
by NoMore
Obviously i need new v2.2 libraries asap so i can test my application in Salvo environment. And thanks a bunch for comprehensive answer. And keep it up, good work you're doing. Seems I'm gonna love this system.