mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Update prototypes and macros for the new xQueueSendFromISR() function and the task hook feature.
This commit is contained in:
parent
da6d27b627
commit
a9ed428422
|
@ -66,6 +66,9 @@
|
||||||
#include "portable.h"
|
#include "portable.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Defines the prototype to which the application task hook function must
|
||||||
|
conform. */
|
||||||
|
typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,6 +128,10 @@
|
||||||
#error Missing definition: configUSE_16_BIT_TICKS should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
#error Missing definition: configUSE_16_BIT_TICKS should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_APPLICATION_TASK_HOOK
|
||||||
|
#define configUSE_APPLICATION_TASK_HOOK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef INCLUDE_uxTaskGetStackHighWaterMark
|
#ifndef INCLUDE_uxTaskGetStackHighWaterMark
|
||||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -149,6 +156,27 @@
|
||||||
#define portCRITICAL_NESTING_IN_TCB 0
|
#define portCRITICAL_NESTING_IN_TCB 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configMAX_TASK_NAME_LEN
|
||||||
|
#define configMAX_TASK_NAME_LEN 16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configIDLE_SHOULD_YIELD
|
||||||
|
#define configIDLE_SHOULD_YIELD 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if configMAX_TASK_NAME_LEN < 1
|
||||||
|
#undef configMAX_TASK_NAME_LEN
|
||||||
|
#define configMAX_TASK_NAME_LEN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskResumeFromISR
|
||||||
|
#define INCLUDE_xTaskResumeFromISR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskGetSchedulerState
|
||||||
|
#define INCLUDE_xTaskGetSchedulerState 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ( configUSE_MUTEXES == 1 )
|
#if ( configUSE_MUTEXES == 1 )
|
||||||
/* xTaskGetCurrentTaskHandle is used by the priority inheritance mechanism
|
/* xTaskGetCurrentTaskHandle is used by the priority inheritance mechanism
|
||||||
within the mutex implementation so must be available if mutexes are used. */
|
within the mutex implementation so must be available if mutexes are used. */
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
#ifndef PROJDEFS_H
|
#ifndef PROJDEFS_H
|
||||||
#define PROJDEFS_H
|
#define PROJDEFS_H
|
||||||
|
|
||||||
/* Defines to prototype to which task functions must conform. */
|
/* Defines the prototype to which task functions must conform. */
|
||||||
typedef void (*pdTASK_CODE)( void * );
|
typedef void (*pdTASK_CODE)( void * );
|
||||||
|
|
||||||
#define pdTRUE ( 1 )
|
#define pdTRUE ( 1 )
|
||||||
|
|
|
@ -789,15 +789,14 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
* queue was created, so this many bytes will be copied from pvItemToQueue
|
* queue was created, so this many bytes will be copied from pvItemToQueue
|
||||||
* into the queue storage area.
|
* into the queue storage area.
|
||||||
*
|
*
|
||||||
* @param cTaskPreviouslyWoken This is included so an ISR can post onto
|
* @param pxHigherPriorityTaskWoken xQueueSendToFrontFromISR() will set
|
||||||
* the same queue multiple times from a single interrupt. The first call
|
* *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
|
||||||
* should always pass in pdFALSE. Subsequent calls should pass in
|
* to unblock, and the unblocked task has a priority higher than the currently
|
||||||
* the value returned from the previous call. See the file serial .c in the
|
* running task. If xQueueSendToFromFromISR() sets this value to pdTRUE then
|
||||||
* PC port for a good example of this mechanism.
|
* a context switch should be requested before the interrupt is exited.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if a task was woken by posting onto the queue. This is
|
* @return pdTRUE if the data was successfully sent to the queue, otherwise
|
||||||
* used by the ISR to determine if a context switch may be required following
|
* errQUEUE_FULL.
|
||||||
* the ISR.
|
|
||||||
*
|
*
|
||||||
* Example usage for buffered IO (where the ISR can obtain more than one value
|
* Example usage for buffered IO (where the ISR can obtain more than one value
|
||||||
* per call):
|
* per call):
|
||||||
|
@ -805,10 +804,10 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
void vBufferISR( void )
|
void vBufferISR( void )
|
||||||
{
|
{
|
||||||
portCHAR cIn;
|
portCHAR cIn;
|
||||||
portBASE_TYPE xTaskWokenByPost;
|
portBASE_TYPE xHigherPrioritTaskWoken;
|
||||||
|
|
||||||
// We have not woken a task at the start of the ISR.
|
// We have not woken a task at the start of the ISR.
|
||||||
cTaskWokenByPost = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
// Loop until the buffer is empty.
|
// Loop until the buffer is empty.
|
||||||
do
|
do
|
||||||
|
@ -816,19 +815,13 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
// Obtain a byte from the buffer.
|
// Obtain a byte from the buffer.
|
||||||
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
|
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
|
||||||
|
|
||||||
// Post the byte. The first time round the loop cTaskWokenByPost
|
// Post the byte.
|
||||||
// will be pdFALSE. If the queue send causes a task to wake we do
|
xQueueSendToFrontFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );
|
||||||
// not want the task to run until we have finished the ISR, so
|
|
||||||
// xQueueSendFromISR does not cause a context switch. Also we
|
|
||||||
// don't want subsequent posts to wake any other tasks, so we store
|
|
||||||
// the return value back into cTaskWokenByPost so xQueueSendFromISR
|
|
||||||
// knows not to wake any task the next iteration of the loop.
|
|
||||||
xTaskWokenByPost = xQueueSendToFrontFromISR( xRxQueue, &cIn, cTaskWokenByPost );
|
|
||||||
|
|
||||||
} while( portINPUT_BYTE( BUFFER_COUNT ) );
|
} while( portINPUT_BYTE( BUFFER_COUNT ) );
|
||||||
|
|
||||||
// Now the buffer is empty we can switch context if necessary.
|
// Now the buffer is empty we can switch context if necessary.
|
||||||
if( cTaskWokenByPost )
|
if( xHigherPriorityTaskWoken )
|
||||||
{
|
{
|
||||||
taskYIELD ();
|
taskYIELD ();
|
||||||
}
|
}
|
||||||
|
@ -838,7 +831,7 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
#define xQueueSendToFrontFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken, queueSEND_TO_FRONT )
|
#define xQueueSendToFrontFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken, queueSEND_TO_FRONT )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -867,15 +860,14 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
* queue was created, so this many bytes will be copied from pvItemToQueue
|
* queue was created, so this many bytes will be copied from pvItemToQueue
|
||||||
* into the queue storage area.
|
* into the queue storage area.
|
||||||
*
|
*
|
||||||
* @param cTaskPreviouslyWoken This is included so an ISR can post onto
|
* @param pxHigherPriorityTaskWoken xQueueSendToBackFromISR() will set
|
||||||
* the same queue multiple times from a single interrupt. The first call
|
* *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
|
||||||
* should always pass in pdFALSE. Subsequent calls should pass in
|
* to unblock, and the unblocked task has a priority higher than the currently
|
||||||
* the value returned from the previous call. See the file serial .c in the
|
* running task. If xQueueSendToBackFromISR() sets this value to pdTRUE then
|
||||||
* PC port for a good example of this mechanism.
|
* a context switch should be requested before the interrupt is exited.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if a task was woken by posting onto the queue. This is
|
* @return pdTRUE if the data was successfully sent to the queue, otherwise
|
||||||
* used by the ISR to determine if a context switch may be required following
|
* errQUEUE_FULL.
|
||||||
* the ISR.
|
|
||||||
*
|
*
|
||||||
* Example usage for buffered IO (where the ISR can obtain more than one value
|
* Example usage for buffered IO (where the ISR can obtain more than one value
|
||||||
* per call):
|
* per call):
|
||||||
|
@ -883,10 +875,10 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
void vBufferISR( void )
|
void vBufferISR( void )
|
||||||
{
|
{
|
||||||
portCHAR cIn;
|
portCHAR cIn;
|
||||||
portBASE_TYPE xTaskWokenByPost;
|
portBASE_TYPE xHigherPriorityTaskWoken;
|
||||||
|
|
||||||
// We have not woken a task at the start of the ISR.
|
// We have not woken a task at the start of the ISR.
|
||||||
cTaskWokenByPost = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
// Loop until the buffer is empty.
|
// Loop until the buffer is empty.
|
||||||
do
|
do
|
||||||
|
@ -894,19 +886,13 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
// Obtain a byte from the buffer.
|
// Obtain a byte from the buffer.
|
||||||
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
|
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
|
||||||
|
|
||||||
// Post the byte. The first time round the loop cTaskWokenByPost
|
// Post the byte.
|
||||||
// will be pdFALSE. If the queue send causes a task to wake we do
|
xQueueSendToBackFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );
|
||||||
// not want the task to run until we have finished the ISR, so
|
|
||||||
// xQueueSendFromISR does not cause a context switch. Also we
|
|
||||||
// don't want subsequent posts to wake any other tasks, so we store
|
|
||||||
// the return value back into cTaskWokenByPost so xQueueSendFromISR
|
|
||||||
// knows not to wake any task the next iteration of the loop.
|
|
||||||
xTaskWokenByPost = xQueueSendToBackFromISR( xRxQueue, &cIn, cTaskWokenByPost );
|
|
||||||
|
|
||||||
} while( portINPUT_BYTE( BUFFER_COUNT ) );
|
} while( portINPUT_BYTE( BUFFER_COUNT ) );
|
||||||
|
|
||||||
// Now the buffer is empty we can switch context if necessary.
|
// Now the buffer is empty we can switch context if necessary.
|
||||||
if( cTaskWokenByPost )
|
if( xHigherPriorityTaskWoken )
|
||||||
{
|
{
|
||||||
taskYIELD ();
|
taskYIELD ();
|
||||||
}
|
}
|
||||||
|
@ -916,7 +902,7 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
#define xQueueSendToBackFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken, queueSEND_TO_BACK )
|
#define xQueueSendToBackFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken, queueSEND_TO_BACK )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -947,15 +933,14 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
* queue was created, so this many bytes will be copied from pvItemToQueue
|
* queue was created, so this many bytes will be copied from pvItemToQueue
|
||||||
* into the queue storage area.
|
* into the queue storage area.
|
||||||
*
|
*
|
||||||
* @param cTaskPreviouslyWoken This is included so an ISR can post onto
|
* @param pxHigherPriorityTaskWoken xQueueSendFromISR() will set
|
||||||
* the same queue multiple times from a single interrupt. The first call
|
* *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
|
||||||
* should always pass in pdFALSE. Subsequent calls should pass in
|
* to unblock, and the unblocked task has a priority higher than the currently
|
||||||
* the value returned from the previous call. See the file serial .c in the
|
* running task. If xQueueSendFromISR() sets this value to pdTRUE then
|
||||||
* PC port for a good example of this mechanism.
|
* a context switch should be requested before the interrupt is exited.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if a task was woken by posting onto the queue. This is
|
* @return pdTRUE if the data was successfully sent to the queue, otherwise
|
||||||
* used by the ISR to determine if a context switch may be required following
|
* errQUEUE_FULL.
|
||||||
* the ISR.
|
|
||||||
*
|
*
|
||||||
* Example usage for buffered IO (where the ISR can obtain more than one value
|
* Example usage for buffered IO (where the ISR can obtain more than one value
|
||||||
* per call):
|
* per call):
|
||||||
|
@ -963,10 +948,10 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
void vBufferISR( void )
|
void vBufferISR( void )
|
||||||
{
|
{
|
||||||
portCHAR cIn;
|
portCHAR cIn;
|
||||||
portBASE_TYPE xTaskWokenByPost;
|
portBASE_TYPE xHigherPriorityTaskWoken;
|
||||||
|
|
||||||
// We have not woken a task at the start of the ISR.
|
// We have not woken a task at the start of the ISR.
|
||||||
cTaskWokenByPost = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
// Loop until the buffer is empty.
|
// Loop until the buffer is empty.
|
||||||
do
|
do
|
||||||
|
@ -974,19 +959,13 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
// Obtain a byte from the buffer.
|
// Obtain a byte from the buffer.
|
||||||
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
|
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
|
||||||
|
|
||||||
// Post the byte. The first time round the loop cTaskWokenByPost
|
// Post the byte.
|
||||||
// will be pdFALSE. If the queue send causes a task to wake we do
|
xTaskWokenByPost = xQueueSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );
|
||||||
// not want the task to run until we have finished the ISR, so
|
|
||||||
// xQueueSendFromISR does not cause a context switch. Also we
|
|
||||||
// don't want subsequent posts to wake any other tasks, so we store
|
|
||||||
// the return value back into cTaskWokenByPost so xQueueSendFromISR
|
|
||||||
// knows not to wake any task the next iteration of the loop.
|
|
||||||
xTaskWokenByPost = xQueueSendFromISR( xRxQueue, &cIn, cTaskWokenByPost );
|
|
||||||
|
|
||||||
} while( portINPUT_BYTE( BUFFER_COUNT ) );
|
} while( portINPUT_BYTE( BUFFER_COUNT ) );
|
||||||
|
|
||||||
// Now the buffer is empty we can switch context if necessary.
|
// Now the buffer is empty we can switch context if necessary.
|
||||||
if( cTaskWokenByPost )
|
if( xHigherPriorityTaskWoken )
|
||||||
{
|
{
|
||||||
taskYIELD ();
|
taskYIELD ();
|
||||||
}
|
}
|
||||||
|
@ -996,7 +975,7 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
#define xQueueSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken, queueSEND_TO_BACK )
|
#define xQueueSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken, queueSEND_TO_BACK )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
@ -1004,7 +983,7 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
portBASE_TYPE xQueueGenericSendFromISR(
|
portBASE_TYPE xQueueGenericSendFromISR(
|
||||||
xQueueHandle pxQueue,
|
xQueueHandle pxQueue,
|
||||||
const void *pvItemToQueue,
|
const void *pvItemToQueue,
|
||||||
portBASE_TYPE xTaskPreviouslyWoken
|
portBASE_TYPE *pxHigherPriorityTaskWoken,
|
||||||
portBASE_TYPE xCopyPosition
|
portBASE_TYPE xCopyPosition
|
||||||
);
|
);
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -1027,19 +1006,18 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
* queue was created, so this many bytes will be copied from pvItemToQueue
|
* queue was created, so this many bytes will be copied from pvItemToQueue
|
||||||
* into the queue storage area.
|
* into the queue storage area.
|
||||||
*
|
*
|
||||||
* @param cTaskPreviouslyWoken This is included so an ISR can post onto
|
* @param pxHigherPriorityTaskWoken xQueueGenericSendFromISR() will set
|
||||||
* the same queue multiple times from a single interrupt. The first call
|
* *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
|
||||||
* should always pass in pdFALSE. Subsequent calls should pass in
|
* to unblock, and the unblocked task has a priority higher than the currently
|
||||||
* the value returned from the previous call. See the file serial .c in the
|
* running task. If xQueueGenericSendFromISR() sets this value to pdTRUE then
|
||||||
* PC port for a good example of this mechanism.
|
* a context switch should be requested before the interrupt is exited.
|
||||||
*
|
*
|
||||||
* @param xCopyPosition Can take the value queueSEND_TO_BACK to place the
|
* @param xCopyPosition Can take the value queueSEND_TO_BACK to place the
|
||||||
* item at the back of the queue, or queueSEND_TO_FRONT to place the item
|
* item at the back of the queue, or queueSEND_TO_FRONT to place the item
|
||||||
* at the front of the queue (for high priority messages).
|
* at the front of the queue (for high priority messages).
|
||||||
*
|
*
|
||||||
* @return pdTRUE if a task was woken by posting onto the queue. This is
|
* @return pdTRUE if the data was successfully sent to the queue, otherwise
|
||||||
* used by the ISR to determine if a context switch may be required following
|
* errQUEUE_FULL.
|
||||||
* the ISR.
|
|
||||||
*
|
*
|
||||||
* Example usage for buffered IO (where the ISR can obtain more than one value
|
* Example usage for buffered IO (where the ISR can obtain more than one value
|
||||||
* per call):
|
* per call):
|
||||||
|
@ -1047,10 +1025,10 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
void vBufferISR( void )
|
void vBufferISR( void )
|
||||||
{
|
{
|
||||||
portCHAR cIn;
|
portCHAR cIn;
|
||||||
portBASE_TYPE xTaskWokenByPost;
|
portBASE_TYPE xHigherPriorityTaskWokenByPost;
|
||||||
|
|
||||||
// We have not woken a task at the start of the ISR.
|
// We have not woken a task at the start of the ISR.
|
||||||
cTaskWokenByPost = pdFALSE;
|
xHigherPriorityTaskWokenByPost = pdFALSE;
|
||||||
|
|
||||||
// Loop until the buffer is empty.
|
// Loop until the buffer is empty.
|
||||||
do
|
do
|
||||||
|
@ -1058,21 +1036,16 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
// Obtain a byte from the buffer.
|
// Obtain a byte from the buffer.
|
||||||
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
|
cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
|
||||||
|
|
||||||
// Post the byte. The first time round the loop cTaskWokenByPost
|
// Post each byte.
|
||||||
// will be pdFALSE. If the queue send causes a task to wake we do
|
xQueueGenericSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWokenByPost, queueSEND_TO_BACK );
|
||||||
// not want the task to run until we have finished the ISR, so
|
|
||||||
// xQueueSendFromISR does not cause a context switch. Also we
|
|
||||||
// don't want subsequent posts to wake any other tasks, so we store
|
|
||||||
// the return value back into cTaskWokenByPost so xQueueSendFromISR
|
|
||||||
// knows not to wake any task the next iteration of the loop.
|
|
||||||
xTaskWokenByPost = xQueueGenericSendFromISR( xRxQueue, &cIn, cTaskWokenByPost, queueSEND_TO_BACK );
|
|
||||||
|
|
||||||
} while( portINPUT_BYTE( BUFFER_COUNT ) );
|
} while( portINPUT_BYTE( BUFFER_COUNT ) );
|
||||||
|
|
||||||
// Now the buffer is empty we can switch context if necessary.
|
// Now the buffer is empty we can switch context if necessary. Note that the
|
||||||
if( cTaskWokenByPost )
|
// name of the yield function required is port specific.
|
||||||
|
if( xHigherPriorityTaskWokenByPost )
|
||||||
{
|
{
|
||||||
taskYIELD ();
|
taskYIELD_YIELD_FROM_ISR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -1080,7 +1053,7 @@ void vQueueDelete( xQueueHandle xQueue );
|
||||||
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
* \defgroup xQueueSendFromISR xQueueSendFromISR
|
||||||
* \ingroup QueueManagement
|
* \ingroup QueueManagement
|
||||||
*/
|
*/
|
||||||
signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE xTaskPreviouslyWoken, portBASE_TYPE xCopyPosition );
|
signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
|
|
|
@ -460,15 +460,13 @@ typedef xQueueHandle xSemaphoreHandle;
|
||||||
* @param xSemaphore A handle to the semaphore being released. This is the
|
* @param xSemaphore A handle to the semaphore being released. This is the
|
||||||
* handle returned when the semaphore was created.
|
* handle returned when the semaphore was created.
|
||||||
*
|
*
|
||||||
* @param sTaskPreviouslyWoken This is included so an ISR can make multiple calls
|
* @param pxHigherPriorityTaskWoken xSemaphoreGiveFromISR() will set
|
||||||
* to xSemaphoreGiveFromISR () from a single interrupt. The first call
|
* *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
|
||||||
* should always pass in pdFALSE. Subsequent calls should pass in
|
* to unblock, and the unblocked task has a priority higher than the currently
|
||||||
* the value returned from the previous call. See the file serial .c in the
|
* running task. If xSemaphoreGiveFromISR() sets this value to pdTRUE then
|
||||||
* PC port for a good example of using xSemaphoreGiveFromISR ().
|
* a context switch should be requested before the interrupt is exited.
|
||||||
*
|
*
|
||||||
* @return pdTRUE if a task was woken by releasing the semaphore. This is
|
* @return pdTRUE if the semaphore was successfully given, otherwise errQUEUE_FULL.
|
||||||
* used by the ISR to determine if a context switch may be required following
|
|
||||||
* the ISR.
|
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
<pre>
|
<pre>
|
||||||
|
@ -503,25 +501,25 @@ typedef xQueueHandle xSemaphoreHandle;
|
||||||
void vTimerISR( void * pvParameters )
|
void vTimerISR( void * pvParameters )
|
||||||
{
|
{
|
||||||
static unsigned portCHAR ucLocalTickCount = 0;
|
static unsigned portCHAR ucLocalTickCount = 0;
|
||||||
static portBASE_TYPE xTaskWoken;
|
static portBASE_TYPE xHigherPriorityTaskWoken;
|
||||||
|
|
||||||
// A timer tick has occurred.
|
// A timer tick has occurred.
|
||||||
|
|
||||||
// ... Do other time functions.
|
// ... Do other time functions.
|
||||||
|
|
||||||
// Is it time for vATask () to run?
|
// Is it time for vATask () to run?
|
||||||
xTaskWoken = pdFALSE;
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
ucLocalTickCount++;
|
ucLocalTickCount++;
|
||||||
if( ucLocalTickCount >= TICKS_TO_WAIT )
|
if( ucLocalTickCount >= TICKS_TO_WAIT )
|
||||||
{
|
{
|
||||||
// Unblock the task by releasing the semaphore.
|
// Unblock the task by releasing the semaphore.
|
||||||
xTaskWoken = xSemaphoreGiveFromISR( xSemaphore, xTaskWoken );
|
xSemaphoreGiveFromISR( xSemaphore, &xHigherPriorityTaskWoken );
|
||||||
|
|
||||||
// Reset the count so we release the semaphore again in 10 ticks time.
|
// Reset the count so we release the semaphore again in 10 ticks time.
|
||||||
ucLocalTickCount = 0;
|
ucLocalTickCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xTaskWoken != pdFALSE )
|
if( xHigherPriorityTaskWoken != pdFALSE )
|
||||||
{
|
{
|
||||||
// We can force a context switch here. Context switching from an
|
// We can force a context switch here. Context switching from an
|
||||||
// ISR uses port specific syntax. Check the demo task for your port
|
// ISR uses port specific syntax. Check the demo task for your port
|
||||||
|
@ -532,7 +530,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
||||||
* \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR
|
* \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR
|
||||||
* \ingroup Semaphores
|
* \ingroup Semaphores
|
||||||
*/
|
*/
|
||||||
#define xSemaphoreGiveFromISR( xSemaphore, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( ( xQueueHandle ) xSemaphore, NULL, xTaskPreviouslyWoken, queueSEND_TO_BACK )
|
#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( xQueueHandle ) xSemaphore, NULL, pxHigherPriorityTaskWoken, queueSEND_TO_BACK )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* semphr. h
|
* semphr. h
|
||||||
|
|
|
@ -66,7 +66,7 @@ extern "C" {
|
||||||
* MACROS AND DEFINITIONS
|
* MACROS AND DEFINITIONS
|
||||||
*----------------------------------------------------------*/
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
#define tskKERNEL_VERSION_NUMBER "V4.7.2"
|
#define tskKERNEL_VERSION_NUMBER "V5.0.0"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* task. h
|
* task. h
|
||||||
|
@ -893,6 +893,29 @@ unsigned portLONG ulTaskEndTrace( void );
|
||||||
*/
|
*/
|
||||||
unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask );
|
unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* task.h
|
||||||
|
* <pre>void vTaskSetApplicationTaskHook( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>
|
||||||
|
*
|
||||||
|
* Sets pxHookFunction to be the task hook function used by the task xTask.
|
||||||
|
* Passing xTask as NULL has the effect of setting the calling tasks hook
|
||||||
|
* function.
|
||||||
|
*/
|
||||||
|
void vTaskSetApplicationTaskHook( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* task.h
|
||||||
|
* <pre>portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>
|
||||||
|
*
|
||||||
|
* Calls the hook function associated with xTask. Passing xTask as NULL has
|
||||||
|
* the effect of calling the Running tasks (the calling task) hook function.
|
||||||
|
*
|
||||||
|
* pvParameter is passed to the hook function for the task to interpret as it
|
||||||
|
* wants.
|
||||||
|
*/
|
||||||
|
portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter );
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
* SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
|
* SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
|
||||||
*----------------------------------------------------------*/
|
*----------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue