MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / uxTaskGetStackHighWaterMark2

Function uxTaskGetStackHighWaterMark2

tasks.c:4771–4799  ·  view source on GitHub ↗

uxTaskGetStackHighWaterMark() and uxTaskGetStackHighWaterMark2() are the * same except for their return type. Using configSTACK_DEPTH_TYPE allows the * user to determine the return type. It gets around the problem of the value * overflowing on 8-bit types without breaking backward compatibility for * applications that expect an 8-bit return type. */

Source from the content-addressed store, hash-verified

4769 * overflowing on 8-bit types without breaking backward compatibility for
4770 * applications that expect an 8-bit return type. */
4771 configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask )
4772 {
4773 TCB_t * pxTCB;
4774 uint8_t * pucEndOfStack;
4775 configSTACK_DEPTH_TYPE uxReturn;
4776
4777 /* uxTaskGetStackHighWaterMark() and uxTaskGetStackHighWaterMark2() are
4778 * the same except for their return type. Using configSTACK_DEPTH_TYPE
4779 * allows the user to determine the return type. It gets around the
4780 * problem of the value overflowing on 8-bit types without breaking
4781 * backward compatibility for applications that expect an 8-bit return
4782 * type. */
4783
4784 pxTCB = prvGetTCBFromHandle( xTask );
4785
4786 #if portSTACK_GROWTH < 0
4787 {
4788 pucEndOfStack = ( uint8_t * ) pxTCB->pxStack;
4789 }
4790 #else
4791 {
4792 pucEndOfStack = ( uint8_t * ) pxTCB->pxEndOfStack;
4793 }
4794 #endif
4795
4796 uxReturn = prvTaskCheckFreeStackSpace( pucEndOfStack );
4797
4798 return uxReturn;
4799 }
4800
4801#endif /* INCLUDE_uxTaskGetStackHighWaterMark2 */
4802/*-----------------------------------------------------------*/

Callers 1

Calls 1

Tested by

no test coverage detected