define portYIELD() __asm( “swi” );
/* ISR routine */ __interrupt VectorNumber_Vtim1ch4 void ML_Timer1Ch4_ISR (void) {portBASE_TYPE pxHigherPriorityTaskWoken;
ML_Timer_ISRHandlerParam p_ISRarameter;
if( TIM1_TIOS_IOS4 == (Bool)0)
{
parameter.timer = TIMER_1;
parameter.channel = CHANNEL_4;
parameter.timer_count = TIM1_TC4;
parameter.overflow= timer1_Overflow[4];
timer1_Overflow[4] = 0;
}
else
{
/* Future use - Code for Output Compare */
}
TIM1_TFLG1|= 0x10;
xQueueSendToBackFromISR (ML_TIMER_CAPTURE_HANDLE, ¶meter, &pxHigherPriorityTaskWoken);
/* Blocked task, waiting for this Queue has priority higher than the interrupted task */
if(pxHigherPriorityTaskWoken == pdTRUE)
{
portYIELD();
}
}
/* ISR hnadler task 3*/
static void ISRHandleQueueFunction (void pvParameters)
{
BaseType_t return_flag;
SL_ISRHandle_Config taskparameter;
/ Accessing task configuration through task parameters /
taskparameter = (SL_ISRHandle_Config *)pvParameters;
for(;;)
{
/ Queue data receive from interrupt service routine */
return_flag = xQueueReceive(taskparameter->handle_name, &taskparameter;portMAX_DELAY);
/* Task calling */
(taskparameter->taskID)(queueBuffdata);
}
}
__interrupt VectorNumberVswi void vPortYield (void)
//void vPortYield (void)
{
portSAVECONTEXT();
vTaskSwitchContext();
portRESTORE_CONTEXT();
}
/* RTI interrupt for Tiemr tick generation */
__interrupt VectorNumber_Vrti void TimerTick_ISR (void)
{#if configUSEPREEMPTION == 1 { /* A context switch might happen so save the context. */ portSAVECONTEXT(); PORTB_PB2=1; /* Increment the tick … */ if( xTaskIncrementTick() != pdFALSE ) { vTaskSwitchContext(); }
CRGFLG_RTIF = (Bool)1;
/* Restore the context of a task - which may be a different task
to that interrupted. */
PORTB_PB2=0;
portRESTORE_CONTEXT();
}
#else
{
xTaskIncrementTick();
CRGFLG_RTIF = (Bool)1;
}
#endif
}
Note:I have not used interrupt nesting in my project. configMAXSYSCALLINTERRUPT_PRIORITY is not avilable in my project.