Main Main - 2 months ago 35
C Question

Software interrupt in freeRTOS

I am learning freeRTOS. I need to write software interrupt ISR handler in freeRTOS for PIC32 platform (cerebot Mx7ck). I went through the documentation but no help. Please somebody help.

Answer
/* sW timer */
TimerHandle_t xSysMonTimer = NULL;
xSysMonTimer = xTimerCreate("SysMonTimer",( 500 / portTICK_PERIOD_MS),pdFALSE,0,Sys_Mon_Callback);
if( xSysMonTimer == NULL )
{
    /* The timer was not created. */
}
else
{
    /* Start the timer.  No block time is specified, and even if one was
    it would be ignored because the RTOS scheduler has not yet been
    started. */
    if( xTimerStart( xSysMonTimer, 0 ) != pdPASS )
    {
        /* The timer could not be set into the Active state. */
    }
}
void Sys_Mon_Callback( TimerHandle_t pxTimer )
{
    if( xTimerReset( xSysMonTimer, 10 ) != pdPASS )
    {
        /* The reset command was not executed successfully.  Take appropriate
        action here. */
    }
}