- Rework the StaticAllocation.c common demo file to reflect the changes to the static allocation object create functions from the previous check-in.

- Correct various typos in comments.
- Add xTimerGetPeriod() function (feature request).
This commit is contained in:
Richard Barry 2016-03-29 11:08:42 +00:00
parent 9dda62372c
commit 26d3770fad
11 changed files with 873 additions and 583 deletions

View file

@ -407,28 +407,53 @@ const uint32_t ulMaxDivisor = 0xff, ulDivisorShift = 0x08;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
used by the Idle task. */
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize ) void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )
{ {
/* configUSE_STATIC_ALLOCATION is set to 1, so the application has the /* If the buffers to be provided to the Idle task are declared inside this
opportunity to supply the buffers that will be used by the Idle task as its function then they must be declared static - otherwise they will be allocated on
stack and to hold its TCB. If these are set to NULL then the buffers will the stack and so not exists after this function exits. */
be allocated dynamically, just as if xTaskCreate() had been called. */ static StaticTask_t xIdleTaskTCB;
*ppxIdleTaskTCBBuffer = NULL; static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
*ppxIdleTaskStackBuffer = NULL;
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE; /* In words. NOT in bytes! */ /* Pass out a pointer to the StaticTask_t structure in which the Idle task's
state will be stored. */
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
/* Pass out the array that will be used as the Idle task's stack. */
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize ) void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )
{ {
/* configUSE_STATIC_ALLOCATION is set to 1, so the application has the /* If the buffers to be provided to the Timer task are declared inside this
opportunity to supply the buffers that will be used by the Timer/RTOS daemon function then they must be declared static - otherwise they will be allocated on
task as its stack and to hold its TCB. If these are set to NULL then the the stack and so not exists after this function exits. */
buffers will be allocated dynamically, just as if xTaskCreate() had been static StaticTask_t xTimerTaskTCB;
called. */ static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
*ppxTimerTaskTCBBuffer = NULL;
*ppxTimerTaskStackBuffer = NULL; /* Pass out a pointer to the StaticTask_t structure in which the Timer
*pusTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; /* In words. NOT in bytes! */ task's state will be stored. */
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
/* Pass out the array that will be used as the Timer task's stack. */
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;
} }

View file

@ -222,28 +222,52 @@ void vApplicationTickHook( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
used by the Idle task. */
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize ) void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )
{ {
/* configUSE_STATIC_ALLOCATION is set to 1, so the application has the /* If the buffers to be provided to the Idle task are declared inside this
opportunity to supply the buffers that will be used by the Idle task as its function then they must be declared static - otherwise they will be allocated on
stack and to hold its TCB. If these are set to NULL then the buffers will the stack and so not exists after this function exits. */
be allocated dynamically, just as if xTaskCreate() had been called. */ static StaticTask_t xIdleTaskTCB;
*ppxIdleTaskTCBBuffer = NULL; static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
*ppxIdleTaskStackBuffer = NULL;
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE; /* In words. NOT in bytes! */ /* Pass out a pointer to the StaticTask_t structure in which the Idle task's
state will be stored. */
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
/* Pass out the array that will be used as the Idle task's stack. */
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize ) void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )
{ {
/* configUSE_STATIC_ALLOCATION is set to 1, so the application has the /* If the buffers to be provided to the Timer task are declared inside this
opportunity to supply the buffers that will be used by the Timer/RTOS daemon function then they must be declared static - otherwise they will be allocated on
task as its stack and to hold its TCB. If these are set to NULL then the the stack and so not exists after this function exits. */
buffers will be allocated dynamically, just as if xTaskCreate() had been static StaticTask_t xTimerTaskTCB;
called. */ static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
*ppxTimerTaskTCBBuffer = NULL;
*ppxTimerTaskStackBuffer = NULL; /* Pass out a pointer to the StaticTask_t structure in which the Timer
*pusTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; /* In words. NOT in bytes! */ task's state will be stored. */
} *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
/*-----------------------------------------------------------*/
/* Pass out the array that will be used as the Timer task's stack. */
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;
}

View file

@ -229,27 +229,51 @@ void vApplicationTickHook( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
used by the Idle task. */
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize ) void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )
{ {
/* configUSE_STATIC_ALLOCATION is set to 1, so the application has the /* If the buffers to be provided to the Idle task are declared inside this
opportunity to supply the buffers that will be used by the Idle task as its function then they must be declared static - otherwise they will be allocated on
stack and to hold its TCB. If these are set to NULL then the buffers will the stack and so not exists after this function exits. */
be allocated dynamically, just as if xTaskCreate() had been called. */ static StaticTask_t xIdleTaskTCB;
*ppxIdleTaskTCBBuffer = NULL; static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
*ppxIdleTaskStackBuffer = NULL;
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE; /* In words. NOT in bytes! */ /* Pass out a pointer to the StaticTask_t structure in which the Idle task's
state will be stored. */
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
/* Pass out the array that will be used as the Idle task's stack. */
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize ) void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )
{ {
/* configUSE_STATIC_ALLOCATION is set to 1, so the application has the /* If the buffers to be provided to the Timer task are declared inside this
opportunity to supply the buffers that will be used by the Timer/RTOS daemon function then they must be declared static - otherwise they will be allocated on
task as its stack and to hold its TCB. If these are set to NULL then the the stack and so not exists after this function exits. */
buffers will be allocated dynamically, just as if xTaskCreate() had been static StaticTask_t xTimerTaskTCB;
called. */ static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
*ppxTimerTaskTCBBuffer = NULL;
*ppxTimerTaskStackBuffer = NULL; /* Pass out a pointer to the StaticTask_t structure in which the Timer
*pusTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; /* In words. NOT in bytes! */ task's state will be stored. */
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
/* Pass out the array that will be used as the Timer task's stack. */
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;
} }
/*-----------------------------------------------------------*/

View file

@ -234,30 +234,54 @@ void vApplicationTickHook( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
used by the Idle task. */
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize ) void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )
{ {
/* configUSE_STATIC_ALLOCATION is set to 1, so the application has the /* If the buffers to be provided to the Idle task are declared inside this
opportunity to supply the buffers that will be used by the Idle task as its function then they must be declared static - otherwise they will be allocated on
stack and to hold its TCB. If these are set to NULL then the buffers will the stack and so not exists after this function exits. */
be allocated dynamically, just as if xTaskCreate() had been called. */ static StaticTask_t xIdleTaskTCB;
*ppxIdleTaskTCBBuffer = NULL; static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
*ppxIdleTaskStackBuffer = NULL;
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE; /* In words. NOT in bytes! */ /* Pass out a pointer to the StaticTask_t structure in which the Idle task's
state will be stored. */
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
/* Pass out the array that will be used as the Idle task's stack. */
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize ) void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )
{ {
/* configUSE_STATIC_ALLOCATION is set to 1, so the application has the /* If the buffers to be provided to the Timer task are declared inside this
opportunity to supply the buffers that will be used by the Timer/RTOS daemon function then they must be declared static - otherwise they will be allocated on
task as its stack and to hold its TCB. If these are set to NULL then the the stack and so not exists after this function exits. */
buffers will be allocated dynamically, just as if xTaskCreate() had been static StaticTask_t xTimerTaskTCB;
called. */ static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
*ppxTimerTaskTCBBuffer = NULL;
*ppxTimerTaskStackBuffer = NULL; /* Pass out a pointer to the StaticTask_t structure in which the Timer
*pusTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; /* In words. NOT in bytes! */ task's state will be stored. */
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
/* Pass out the array that will be used as the Timer task's stack. */
*ppxTimerTaskStackBuffer = uxTimerTaskStack;
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;
} }
/*-----------------------------------------------------------*/

File diff suppressed because it is too large Load diff

View file

@ -241,35 +241,52 @@ volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
used by the Idle task. */
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize ) void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )
{ {
/* The buffers used by the idle task must be static so they are persistent, and /* If the buffers to be provided to the Idle task are declared inside this
so exist after this function returns. */ function then they must be declared static - otherwise they will be allocated on
the stack and so not exists after this function exits. */
static StaticTask_t xIdleTaskTCB; static StaticTask_t xIdleTaskTCB;
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
/* configSUPORT_STATIC_ALLOCATION is set to 1 and /* Pass out a pointer to the StaticTask_t structure in which the Idle task's
configSUPPORT_DYNAMIC_ALLOCATION is 0, so the application must supply the state will be stored. */
buffers that will be used to hold the Idle task data structure and stack. */
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB; *ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
/* Pass out the array that will be used as the Idle task's stack. */
*ppxIdleTaskStackBuffer = uxIdleTaskStack; *ppxIdleTaskStackBuffer = uxIdleTaskStack;
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE; /* In words. NOT in bytes! */
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize ) void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )
{ {
/* The buffers used by the Timer/Daemon task must be static so they are /* If the buffers to be provided to the Timer task are declared inside this
persistent, and so exist after this function returns. */ function then they must be declared static - otherwise they will be allocated on
the stack and so not exists after this function exits. */
static StaticTask_t xTimerTaskTCB; static StaticTask_t xTimerTaskTCB;
static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
/* configSUPPORT_STATIC_ALLOCATION is set to 1, /* Pass out a pointer to the StaticTask_t structure in which the Timer
configSUPPORT_DYNAMIC_ALLOCATION is set to 1, and configUSE_TIMERS is set task's state will be stored. */
to 1, so the application must supply the buffers that will be used to hold
the Timer task data structure and stack. */
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB; *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
/* Pass out the array that will be used as the Timer task's stack. */
*ppxTimerTaskStackBuffer = uxTimerTaskStack; *ppxTimerTaskStackBuffer = uxTimerTaskStack;
*pusTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; /* In words. NOT in bytes! */
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;
} }

View file

@ -329,7 +329,7 @@ volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
( void ) ulLine; ( void ) ulLine;
( void ) pcFileName; ( void ) pcFileName;
printf( "ASSERT! Line %d, file %s\r\n", ulLine, pcFileName ); printf( "ASSERT! Line %d, file %s, GetLastError() %d\r\n", ulLine, pcFileName, GetLastError() );
taskENTER_CRITICAL(); taskENTER_CRITICAL();
{ {
@ -410,38 +410,51 @@ const HeapRegion_t xHeapRegions[] =
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
used by the Idle task. */
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize ) void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )
{ {
/* The buffers used by the idle task must be static so they are persistent, and /* If the buffers to be provided to the Idle task are declared inside this
so exist after this function returns. */ function then they must be declared static - otherwise they will be allocated on
the stack and so not exists after this function exits. */
static StaticTask_t xIdleTaskTCB; static StaticTask_t xIdleTaskTCB;
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
/* configUSE_STATIC_ALLOCATION is set to 1, so the application has the /* Pass out a pointer to the StaticTask_t structure in which the Idle task's
opportunity to supply the buffers that will be used by the Idle task as its state will be stored. */
stack and to hold its TCB. If these are set to NULL then the buffers will
be allocated dynamically, just as if xTaskCreate() had been called. */
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB; *ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
/* Pass out the array that will be used as the Idle task's stack. */
*ppxIdleTaskStackBuffer = uxIdleTaskStack; *ppxIdleTaskStackBuffer = uxIdleTaskStack;
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE; /* In words. NOT in bytes! */
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the
application must provide an implementation of vApplicationGetTimerTaskMemory()
to provide the memory that is used by the Timer service task. */
void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize ) void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )
{ {
/* The buffers used by the Timer/Daemon task must be static so they are /* If the buffers to be provided to the Timer task are declared inside this
persistent, and so exist after this function returns. The stack buffer is function then they must be declared static - otherwise they will be allocated on
not declared here, but globally, as it is checked by a test in a different the stack and so not exists after this function exits. */
file. */
static StaticTask_t xTimerTaskTCB; static StaticTask_t xTimerTaskTCB;
/* configUSE_STATIC_ALLOCATION is set to 1, so the application has the /* Pass out a pointer to the StaticTask_t structure in which the Timer
opportunity to supply the buffers that will be used by the Timer/RTOS daemon task's state will be stored. */
task as its stack and to hold its TCB. If these are set to NULL then the
buffers will be allocated dynamically, just as if xTaskCreate() had been
called. */
*ppxTimerTaskTCBBuffer = &xTimerTaskTCB; *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
/* Pass out the array that will be used as the Timer task's stack. */
*ppxTimerTaskStackBuffer = uxTimerTaskStack; *ppxTimerTaskStackBuffer = uxTimerTaskStack;
*pusTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; /* In words. NOT in bytes! */
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
Note that, as the array is necessarily of type StackType_t,
configMINIMAL_STACK_SIZE is specified in words, not bytes. */
*pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;
} }

View file

@ -1616,7 +1616,7 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION
#endif #endif
/* /*
* The registry is provided as a means for kernel aware debuggers to * The queue registry is provided as a means for kernel aware debuggers to
* locate queues, semaphores and mutexes. Call pcQueueGetQueueName() to look * locate queues, semaphores and mutexes. Call pcQueueGetQueueName() to look
* up and return the name of a queue in the queue registry from the queue's * up and return the name of a queue in the queue registry from the queue's
* handle. * handle.

View file

@ -1152,11 +1152,11 @@ typedef QueueHandle_t SemaphoreHandle_t;
/** /**
* semphr.h * semphr.h
* <pre>TaskHandle_t xSemaphoreGetCount( SemaphoreHandle_t xMutex );</pre> * <pre>UBaseType_t uxSemaphoreGetCount( SemaphoreHandle_t xMutex );</pre>
* *
* If the semaphore is a counting semaphore then xSemaphoreGetCount() returns * If the semaphore is a counting semaphore then uxSemaphoreGetCount() returns
* its current count value. If the semaphore is a binary semaphore then * its current count value. If the semaphore is a binary semaphore then
* xSemaphoreGetCount() returns 1 if the semaphore is available, and 0 if the * uxSemaphoreGetCount() returns 1 if the semaphore is available, and 0 if the
* semaphore is not available. * semaphore is not available.
* *
*/ */