Other Parts Discussed in Thread: SYSBIOS
Hi all,
I'm new to the SysBIOS world, and I have a problem related to HWI preemption over SWI. Things seem to be working pretty fine, except for this case where I have the following situation :
An Interrupt occurs, resulting in an HWI being called (Timer_Handler). This HWI posts a SWI (mySwi). This SWI is called after completion of the first HWI.
Then during execution of the SWI, another Interrupt occurs (I2C_Handler). My problem is that this new Interrupt doesn't preempt the SWI, though I need it to.
I am running SysBIOS on a platform similar to Stellaris, with a Cortex-M4F.
Here is the code for setting up the corresponding HWI and SWI dynamically :
Swi_Handle mySwi;
Int main()
{
Hwi_Params hwiParams;
Swi_Params swiParams;
Hwi_Handle myHwi[64];
Swi_Params_init(&swiParams);
swiParams.priority = 0x40;
// create new SWI
mySwi = Swi_create(sensorSwi, &swiParams, NULL);
if(mySwi == NULL) {
send_msg(1,0xBAD00);
}
Hwi_Params_init(&hwiParams);
hwiParams.arg = 0;
hwiParams.enableInt = FALSE;
hwiParams.priority = 0x20; // > 0x0, reserved for zero-latency interrupt
myHwi[33] = Hwi_create(49, I2C_Handler, &hwiParams, NULL);
if(myHwi[39] == NULL){
send_msg(1,0xBAD00+49);
}
myHwi[39] = Hwi_create(55, Timer_Handler, &hwiParams, NULL);
if(myHwi[39] == NULL){
send_msg(1,0xBAD00+39);
}
Hwi_enableInterrupt(49);
Hwi_enableInterrupt(55);
BIOS_start();
return 0;
}
Then the Timer_Handler HWI :
Void Timer_Handler(UArg arg)
{
u32 swiKey;
// we disable SWI so it can be posted upon completion of the HWI
swiKey = Swi_disable();
// [...]
Swi_post(mySwi);
// [...]
clr_pending_irq();
// we restore the SWI and the remaining SWIs can be posted
Swi_restore(swiKey);
}
Does somebody have an idea why the SWI never gets interrupted by the Hardware Interrupt ?
Thanks in advance,
Michael