Page 1 of 1

SB-8: Salvo: Interrupt Problems with OSCALL_OSXYZ

PostPosted: Wed Aug 01, 2001 10:25 am
by Salvo Tech Support
Applies To

Salvo v2.2.1 and earlier.

Description of Problem

The configuration parameters OSCALL_OSXYZ are used with certain compilers (e.g. HI-TECH PICC) to handle multiple callgraph issues that arise due to the target processor's software-stackless architecture. These parameters, when set to OSFROM_ANYWHERE, enable certain Salvo user services to be called from both mainline (background) and interrupt (foreground) code.

In v2.2.0 and earlier, interrupt control for multiple callgraph situations is not implemented properly. Salvo services that take only one char-sized parameter, and return only a char-sized parameter (e.g. OSSignalBinSem()) work properly for all values of OSCALL_OSSIGNALEVENT. Others, such as OSSignalMsg() – which has a larger parameter list – do not.

Calling an affected service from both mainline and interrupt code will result in data corruption and unpredictable system behavior. This happens when the interrupt which calls the service occurs after the mainline service's parameters have been initialized and before the mainline service has internally disabled interrupts.

Suggested Workaround

For both library users and source code users, when calling a particular service from both mainline and interrupt code, precede the mainline call with OSDisableInts(). This will protect the service's parameters from corruption.

For example,

code:
void MyTask( void )
{
for ( ; ; ) {
/* body of task */
OSDisableInts();
OSSignalBinSem(BINSEM3_P);
/* continue task, context-switch, etc. */
}
}

There is no need to re-enable interrupts after the mainline service, as this is done internal to the mainline service.

Fixed In

Salvo v3.0.0.

[This message has been edited by Salvo Tech Support (edited January 13, 2002).]