* queue was created, so this many bytes will be copied from pvItemToQueue\r
* into the queue storage area.\r
*\r
- * @param cTaskPreviouslyWoken This is included so an ISR can post onto\r
- * the same queue multiple times from a single interrupt. The first call\r
- * should always pass in pdFALSE. Subsequent calls should pass in\r
- * the value returned from the previous call. See the file serial .c in the\r
- * PC port for a good example of this mechanism.\r
+ * @param pxHigherPriorityTaskWoken xQueueSendToFrontFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task. If xQueueSendToFromFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
*\r
- * @return pdTRUE if a task was woken by posting onto the queue. This is\r
- * used by the ISR to determine if a context switch may be required following\r
- * the ISR.\r
+ * @return pdTRUE if the data was successfully sent to the queue, otherwise\r
+ * errQUEUE_FULL.\r
*\r
* Example usage for buffered IO (where the ISR can obtain more than one value\r
* per call):\r
void vBufferISR( void )\r
{\r
portCHAR cIn;\r
- portBASE_TYPE xTaskWokenByPost;\r
+ portBASE_TYPE xHigherPrioritTaskWoken;\r
\r
// We have not woken a task at the start of the ISR.\r
- cTaskWokenByPost = pdFALSE;\r
+ xHigherPriorityTaskWoken = pdFALSE;\r
\r
// Loop until the buffer is empty.\r
do\r
// Obtain a byte from the buffer.\r
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); \r
\r
- // Post the byte. The first time round the loop cTaskWokenByPost\r
- // will be pdFALSE. If the queue send causes a task to wake we do\r
- // not want the task to run until we have finished the ISR, so\r
- // xQueueSendFromISR does not cause a context switch. Also we\r
- // don't want subsequent posts to wake any other tasks, so we store\r
- // the return value back into cTaskWokenByPost so xQueueSendFromISR\r
- // knows not to wake any task the next iteration of the loop.\r
- xTaskWokenByPost = xQueueSendToFrontFromISR( xRxQueue, &cIn, cTaskWokenByPost );\r
+ // Post the byte. \r
+ xQueueSendToFrontFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );\r
\r
} while( portINPUT_BYTE( BUFFER_COUNT ) );\r
\r
// Now the buffer is empty we can switch context if necessary.\r
- if( cTaskWokenByPost )\r
+ if( xHigherPriorityTaskWoken )\r
{\r
taskYIELD ();\r
}\r
* \defgroup xQueueSendFromISR xQueueSendFromISR\r
* \ingroup QueueManagement\r
*/\r
-#define xQueueSendToFrontFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken, queueSEND_TO_FRONT )\r
+#define xQueueSendToFrontFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken, queueSEND_TO_FRONT )\r
\r
\r
/**\r
* queue was created, so this many bytes will be copied from pvItemToQueue\r
* into the queue storage area.\r
*\r
- * @param cTaskPreviouslyWoken This is included so an ISR can post onto\r
- * the same queue multiple times from a single interrupt. The first call\r
- * should always pass in pdFALSE. Subsequent calls should pass in\r
- * the value returned from the previous call. See the file serial .c in the\r
- * PC port for a good example of this mechanism.\r
+ * @param pxHigherPriorityTaskWoken xQueueSendToBackFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task. If xQueueSendToBackFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
*\r
- * @return pdTRUE if a task was woken by posting onto the queue. This is\r
- * used by the ISR to determine if a context switch may be required following\r
- * the ISR.\r
+ * @return pdTRUE if the data was successfully sent to the queue, otherwise\r
+ * errQUEUE_FULL.\r
*\r
* Example usage for buffered IO (where the ISR can obtain more than one value\r
* per call):\r
void vBufferISR( void )\r
{\r
portCHAR cIn;\r
- portBASE_TYPE xTaskWokenByPost;\r
+ portBASE_TYPE xHigherPriorityTaskWoken;\r
\r
// We have not woken a task at the start of the ISR.\r
- cTaskWokenByPost = pdFALSE;\r
+ xHigherPriorityTaskWoken = pdFALSE;\r
\r
// Loop until the buffer is empty.\r
do\r
// Obtain a byte from the buffer.\r
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); \r
\r
- // Post the byte. The first time round the loop cTaskWokenByPost\r
- // will be pdFALSE. If the queue send causes a task to wake we do\r
- // not want the task to run until we have finished the ISR, so\r
- // xQueueSendFromISR does not cause a context switch. Also we\r
- // don't want subsequent posts to wake any other tasks, so we store\r
- // the return value back into cTaskWokenByPost so xQueueSendFromISR\r
- // knows not to wake any task the next iteration of the loop.\r
- xTaskWokenByPost = xQueueSendToBackFromISR( xRxQueue, &cIn, cTaskWokenByPost );\r
+ // Post the byte.\r
+ xQueueSendToBackFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );\r
\r
} while( portINPUT_BYTE( BUFFER_COUNT ) );\r
\r
// Now the buffer is empty we can switch context if necessary.\r
- if( cTaskWokenByPost )\r
+ if( xHigherPriorityTaskWoken )\r
{\r
taskYIELD ();\r
}\r
* \defgroup xQueueSendFromISR xQueueSendFromISR\r
* \ingroup QueueManagement\r
*/\r
-#define xQueueSendToBackFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken, queueSEND_TO_BACK )\r
+#define xQueueSendToBackFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken, queueSEND_TO_BACK )\r
\r
/**\r
* queue. h\r
* queue was created, so this many bytes will be copied from pvItemToQueue\r
* into the queue storage area.\r
*\r
- * @param cTaskPreviouslyWoken This is included so an ISR can post onto\r
- * the same queue multiple times from a single interrupt. The first call\r
- * should always pass in pdFALSE. Subsequent calls should pass in\r
- * the value returned from the previous call. See the file serial .c in the\r
- * PC port for a good example of this mechanism.\r
+ * @param pxHigherPriorityTaskWoken xQueueSendFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task. If xQueueSendFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
*\r
- * @return pdTRUE if a task was woken by posting onto the queue. This is\r
- * used by the ISR to determine if a context switch may be required following\r
- * the ISR.\r
+ * @return pdTRUE if the data was successfully sent to the queue, otherwise\r
+ * errQUEUE_FULL.\r
*\r
* Example usage for buffered IO (where the ISR can obtain more than one value\r
* per call):\r
void vBufferISR( void )\r
{\r
portCHAR cIn;\r
- portBASE_TYPE xTaskWokenByPost;\r
+ portBASE_TYPE xHigherPriorityTaskWoken;\r
\r
// We have not woken a task at the start of the ISR.\r
- cTaskWokenByPost = pdFALSE;\r
+ xHigherPriorityTaskWoken = pdFALSE;\r
\r
// Loop until the buffer is empty.\r
do\r
// Obtain a byte from the buffer.\r
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); \r
\r
- // Post the byte. The first time round the loop cTaskWokenByPost\r
- // will be pdFALSE. If the queue send causes a task to wake we do\r
- // not want the task to run until we have finished the ISR, so\r
- // xQueueSendFromISR does not cause a context switch. Also we\r
- // don't want subsequent posts to wake any other tasks, so we store\r
- // the return value back into cTaskWokenByPost so xQueueSendFromISR\r
- // knows not to wake any task the next iteration of the loop.\r
- xTaskWokenByPost = xQueueSendFromISR( xRxQueue, &cIn, cTaskWokenByPost );\r
+ // Post the byte. \r
+ xTaskWokenByPost = xQueueSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );\r
\r
} while( portINPUT_BYTE( BUFFER_COUNT ) );\r
\r
// Now the buffer is empty we can switch context if necessary.\r
- if( cTaskWokenByPost )\r
+ if( xHigherPriorityTaskWoken )\r
{\r
taskYIELD ();\r
}\r
* \defgroup xQueueSendFromISR xQueueSendFromISR\r
* \ingroup QueueManagement\r
*/\r
-#define xQueueSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken, queueSEND_TO_BACK )\r
+#define xQueueSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken, queueSEND_TO_BACK )\r
\r
/**\r
* queue. h\r
portBASE_TYPE xQueueGenericSendFromISR(\r
xQueueHandle pxQueue,\r
const void *pvItemToQueue,\r
- portBASE_TYPE xTaskPreviouslyWoken\r
+ portBASE_TYPE *pxHigherPriorityTaskWoken,\r
portBASE_TYPE xCopyPosition\r
);\r
</pre>\r
* queue was created, so this many bytes will be copied from pvItemToQueue\r
* into the queue storage area.\r
*\r
- * @param cTaskPreviouslyWoken This is included so an ISR can post onto\r
- * the same queue multiple times from a single interrupt. The first call\r
- * should always pass in pdFALSE. Subsequent calls should pass in\r
- * the value returned from the previous call. See the file serial .c in the\r
- * PC port for a good example of this mechanism.\r
+ * @param pxHigherPriorityTaskWoken xQueueGenericSendFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task. If xQueueGenericSendFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
*\r
* @param xCopyPosition Can take the value queueSEND_TO_BACK to place the\r
* item at the back of the queue, or queueSEND_TO_FRONT to place the item\r
* at the front of the queue (for high priority messages).\r
*\r
- * @return pdTRUE if a task was woken by posting onto the queue. This is\r
- * used by the ISR to determine if a context switch may be required following\r
- * the ISR.\r
+ * @return pdTRUE if the data was successfully sent to the queue, otherwise\r
+ * errQUEUE_FULL.\r
*\r
* Example usage for buffered IO (where the ISR can obtain more than one value\r
* per call):\r
void vBufferISR( void )\r
{\r
portCHAR cIn;\r
- portBASE_TYPE xTaskWokenByPost;\r
+ portBASE_TYPE xHigherPriorityTaskWokenByPost;\r
\r
// We have not woken a task at the start of the ISR.\r
- cTaskWokenByPost = pdFALSE;\r
+ xHigherPriorityTaskWokenByPost = pdFALSE;\r
\r
// Loop until the buffer is empty.\r
do\r
// Obtain a byte from the buffer.\r
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); \r
\r
- // Post the byte. The first time round the loop cTaskWokenByPost\r
- // will be pdFALSE. If the queue send causes a task to wake we do\r
- // not want the task to run until we have finished the ISR, so\r
- // xQueueSendFromISR does not cause a context switch. Also we\r
- // don't want subsequent posts to wake any other tasks, so we store\r
- // the return value back into cTaskWokenByPost so xQueueSendFromISR\r
- // knows not to wake any task the next iteration of the loop.\r
- xTaskWokenByPost = xQueueGenericSendFromISR( xRxQueue, &cIn, cTaskWokenByPost, queueSEND_TO_BACK );\r
+ // Post each byte.\r
+ xQueueGenericSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWokenByPost, queueSEND_TO_BACK );\r
\r
} while( portINPUT_BYTE( BUFFER_COUNT ) );\r
\r
- // Now the buffer is empty we can switch context if necessary.\r
- if( cTaskWokenByPost )\r
+ // Now the buffer is empty we can switch context if necessary. Note that the\r
+ // name of the yield function required is port specific.\r
+ if( xHigherPriorityTaskWokenByPost )\r
{\r
- taskYIELD ();\r
+ taskYIELD_YIELD_FROM_ISR();\r
}\r
}\r
</pre>\r
* \defgroup xQueueSendFromISR xQueueSendFromISR\r
* \ingroup QueueManagement\r
*/\r
-signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE xTaskPreviouslyWoken, portBASE_TYPE xCopyPosition );\r
+signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition );\r
\r
/**\r
* queue. h\r
* @param xSemaphore A handle to the semaphore being released. This is the\r
* handle returned when the semaphore was created.\r
*\r
- * @param sTaskPreviouslyWoken This is included so an ISR can make multiple calls\r
- * to xSemaphoreGiveFromISR () from a single interrupt. The first call\r
- * should always pass in pdFALSE. Subsequent calls should pass in\r
- * the value returned from the previous call. See the file serial .c in the\r
- * PC port for a good example of using xSemaphoreGiveFromISR ().\r
+ * @param pxHigherPriorityTaskWoken xSemaphoreGiveFromISR() will set\r
+ * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task\r
+ * to unblock, and the unblocked task has a priority higher than the currently\r
+ * running task. If xSemaphoreGiveFromISR() sets this value to pdTRUE then\r
+ * a context switch should be requested before the interrupt is exited.\r
*\r
- * @return pdTRUE if a task was woken by releasing the semaphore. This is \r
- * used by the ISR to determine if a context switch may be required following\r
- * the ISR.\r
+ * @return pdTRUE if the semaphore was successfully given, otherwise errQUEUE_FULL.\r
*\r
* Example usage:\r
<pre>\r
void vTimerISR( void * pvParameters )\r
{\r
static unsigned portCHAR ucLocalTickCount = 0;\r
- static portBASE_TYPE xTaskWoken;\r
+ static portBASE_TYPE xHigherPriorityTaskWoken;\r
\r
// A timer tick has occurred.\r
\r
// ... Do other time functions.\r
\r
// Is it time for vATask () to run?\r
- xTaskWoken = pdFALSE;\r
+ xHigherPriorityTaskWoken = pdFALSE;\r
ucLocalTickCount++;\r
if( ucLocalTickCount >= TICKS_TO_WAIT )\r
{\r
// Unblock the task by releasing the semaphore.\r
- xTaskWoken = xSemaphoreGiveFromISR( xSemaphore, xTaskWoken );\r
+ xSemaphoreGiveFromISR( xSemaphore, &xHigherPriorityTaskWoken );\r
\r
// Reset the count so we release the semaphore again in 10 ticks time.\r
ucLocalTickCount = 0;\r
}\r
\r
- if( xTaskWoken != pdFALSE )\r
+ if( xHigherPriorityTaskWoken != pdFALSE )\r
{\r
// We can force a context switch here. Context switching from an\r
// ISR uses port specific syntax. Check the demo task for your port\r
* \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR\r
* \ingroup Semaphores\r
*/\r
-#define xSemaphoreGiveFromISR( xSemaphore, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( ( xQueueHandle ) xSemaphore, NULL, xTaskPreviouslyWoken, queueSEND_TO_BACK )\r
+#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( xQueueHandle ) xSemaphore, NULL, pxHigherPriorityTaskWoken, queueSEND_TO_BACK )\r
\r
/**\r
* semphr. h\r