Complete the code to declare an interrupt service routine (ISR) in FreeRTOS.
void v[1]Handler(void) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
// ISR code here
}The ISR name typically reflects the hardware interrupt source, such as UARTHandler for UART interrupts.
Complete the code to notify a task from an ISR using FreeRTOS API.
vTaskNotifyGiveFromISR(xTaskHandle, &[1]);The parameter is a pointer to a variable that indicates if a context switch is required.
Fix the error in the ISR to correctly perform deferred interrupt processing.
void vISR_Handler(void) {
BaseType_t [1] = pdFALSE;
// Clear interrupt flag
vTaskNotifyGiveFromISR(xTaskHandle, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}The variable xHigherPriorityTaskWoken must be declared and used to request a context switch.
Fill both blanks to create a deferred interrupt processing task that waits for notification.
void vDeferredTask(void *pvParameters) {
for(;;) {
ulTaskNotifyTake([1], [2]);
// Process interrupt data here
}
}ulTaskNotifyTake uses pdTRUE to clear the notification count and portMAX_DELAY to wait indefinitely.
Fill all three blanks to implement a deferred interrupt processing system with ISR notification and task wait.
void vISR_Handler(void) {
BaseType_t [1] = pdFALSE;
vTaskNotifyGiveFromISR(xTaskHandle, &[2]);
[3]YIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
void vDeferredTask(void *pvParameters) {
for(;;) {
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
// Handle deferred processing
}
}The variable xHigherPriorityTaskWoken is declared and used consistently. The macro portYIELD_FROM_ISR is called with the prefix 'port'.