/* The cooperative scheduler requires a normal IRQ service routine to simply increment the system tick. */ __arm __irq void vPortNonPreemptiveTick( void ) { /* Increment the tick count - which may wake some tasks but as the preemptive scheduler is not being used any woken task is not given processor time no matter what its priority. */ xTaskIncrementTick(); /* Clear the interrupt in the watchdog and EIC. */ WDG->SR = 0x0000; portCLEAR_EIC(); }
/* This function is called from an asm wrapper, so does not require the __irq keyword. */ void vPortPreemptiveTick( void ) { /* Increment the tick counter. */ if( xTaskIncrementTick() != pdFALSE ) { /* Select a new task to execute. */ vTaskSwitchContext(); } /* Clear the interrupt in the watchdog and EIC. */ WDG->SR = 0x0000; portCLEAR_EIC(); }
/* This function is called from an asm wrapper, so does not require the __irq keyword. */ void vPortPreemptiveTick( void ) { /* Increment the tick counter. */ vTaskIncrementTick(); /* The new tick value might unblock a task. Ensure the highest task that is ready to execute is the task that will execute when the tick ISR exits. */ vTaskSwitchContext(); /* Clear the interrupt in the watchdog and EIC. */ WDG->SR = 0x0000; portCLEAR_EIC(); }
/* Serial port ISR. This can cause a context switch so is not defined as a standard ISR using the __irq keyword. Instead a wrapper function is defined within serialISR.s79 which in turn calls this function. See the port documentation on the FreeRTOS.org website for more information. */ __arm void vSerialISR( void ) { unsigned short usStatus; signed char cChar; portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; /* What caused the interrupt? */ usStatus = UART_FlagStatus( UART0 ); if( usStatus & UART_TxHalfEmpty ) { /* The interrupt was caused by the THR becoming empty. Are there any more characters to transmit? */ if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE ) { /* A character was retrieved from the queue so can be sent to the THR now. */ UART0->TxBUFR = cChar; } else { /* Queue empty, nothing to send so turn off the Tx interrupt. */ serINTERRUPT_OFF(); } } if( usStatus & UART_RxBufFull ) { /* The interrupt was caused by a character being received. Grab the character from the RHR and place it in the queue of received characters. */ cChar = UART0->RxBUFR; xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken ); } /* If a task was woken by either a character being received or a character being transmitted then we may need to switch to another task. */ portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); /* End the interrupt in the EIC. */ portCLEAR_EIC(); }