Update revision to use TI's mqtt and Freertos.

Dependencies:   mbed client server

Fork of cc3100_Test_mqtt_CM3 by David Fletcher

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers StackMacros.h Source File

StackMacros.h

00001 /*
00002     FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
00003     All rights reserved
00004 
00005     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
00006 
00007     This file is part of the FreeRTOS distribution.
00008 
00009     FreeRTOS is free software; you can redistribute it and/or modify it under
00010     the terms of the GNU General Public License (version 2) as published by the
00011     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
00012 
00013     ***************************************************************************
00014     >>!   NOTE: The modification to the GPL is included to allow you to     !<<
00015     >>!   distribute a combined work that includes FreeRTOS without being   !<<
00016     >>!   obliged to provide the source code for proprietary components     !<<
00017     >>!   outside of the FreeRTOS kernel.                                   !<<
00018     ***************************************************************************
00019 
00020     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
00021     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00022     FOR A PARTICULAR PURPOSE.  Full license text is available on the following
00023     link: http://www.freertos.org/a00114.html
00024 
00025     ***************************************************************************
00026      *                                                                       *
00027      *    FreeRTOS provides completely free yet professionally developed,    *
00028      *    robust, strictly quality controlled, supported, and cross          *
00029      *    platform software that is more than just the market leader, it     *
00030      *    is the industry's de facto standard.                               *
00031      *                                                                       *
00032      *    Help yourself get started quickly while simultaneously helping     *
00033      *    to support the FreeRTOS project by purchasing a FreeRTOS           *
00034      *    tutorial book, reference manual, or both:                          *
00035      *    http://www.FreeRTOS.org/Documentation                              *
00036      *                                                                       *
00037     ***************************************************************************
00038 
00039     http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading
00040     the FAQ page "My application does not run, what could be wrong?".  Have you
00041     defined configASSERT()?
00042 
00043     http://www.FreeRTOS.org/support - In return for receiving this top quality
00044     embedded software for free we request you assist our global community by
00045     participating in the support forum.
00046 
00047     http://www.FreeRTOS.org/training - Investing in training allows your team to
00048     be as productive as possible as early as possible.  Now you can receive
00049     FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
00050     Ltd, and the world's leading authority on the world's leading RTOS.
00051 
00052     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
00053     including FreeRTOS+Trace - an indispensable productivity tool, a DOS
00054     compatible FAT file system, and our tiny thread aware UDP/IP stack.
00055 
00056     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
00057     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
00058 
00059     http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
00060     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS
00061     licenses offer ticketed support, indemnification and commercial middleware.
00062 
00063     http://www.SafeRTOS.com - High Integrity Systems also provide a safety
00064     engineered and independently SIL3 certified version for use in safety and
00065     mission critical applications that require provable dependability.
00066 
00067     1 tab == 4 spaces!
00068 */
00069 
00070 #ifndef STACK_MACROS_H
00071 #define STACK_MACROS_H
00072 
00073 /*
00074  * Call the stack overflow hook function if the stack of the task being swapped
00075  * out is currently overflowed, or looks like it might have overflowed in the
00076  * past.
00077  *
00078  * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
00079  * the current stack state only - comparing the current top of stack value to
00080  * the stack limit.  Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
00081  * will also cause the last few stack bytes to be checked to ensure the value
00082  * to which the bytes were set when the task was created have not been
00083  * overwritten.  Note this second test does not guarantee that an overflowed
00084  * stack will always be recognised.
00085  */
00086 
00087 /*-----------------------------------------------------------*/
00088 
00089 #if( configCHECK_FOR_STACK_OVERFLOW == 0 )
00090 
00091     /* FreeRTOSConfig.h is not set to check for stack overflows. */
00092     #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()
00093     #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()
00094 
00095 #endif /* configCHECK_FOR_STACK_OVERFLOW == 0 */
00096 /*-----------------------------------------------------------*/
00097 
00098 #if( configCHECK_FOR_STACK_OVERFLOW == 1 )
00099 
00100     /* FreeRTOSConfig.h is only set to use the first method of
00101     overflow checking. */
00102     #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()
00103 
00104 #endif
00105 /*-----------------------------------------------------------*/
00106 
00107 #if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH < 0 ) )
00108 
00109     /* Only the current stack state is to be checked. */
00110     #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()                                                        \
00111     {                                                                                                   \
00112         /* Is the currently saved stack pointer within the stack limit? */                              \
00113         if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack )                                       \
00114         {                                                                                               \
00115             vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName );   \
00116         }                                                                                               \
00117     }
00118 
00119 #endif /* configCHECK_FOR_STACK_OVERFLOW > 0 */
00120 /*-----------------------------------------------------------*/
00121 
00122 #if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH > 0 ) )
00123 
00124     /* Only the current stack state is to be checked. */
00125     #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()                                                        \
00126     {                                                                                                   \
00127                                                                                                         \
00128         /* Is the currently saved stack pointer within the stack limit? */                              \
00129         if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack )                                  \
00130         {                                                                                               \
00131             vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName );   \
00132         }                                                                                               \
00133     }
00134 
00135 #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
00136 /*-----------------------------------------------------------*/
00137 
00138 #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
00139 
00140     #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()                                                                                       \
00141     {                                                                                                                                   \
00142     static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,     \
00143                                                     tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,     \
00144                                                     tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,     \
00145                                                     tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,     \
00146                                                     tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE };   \
00147                                                                                                                                         \
00148                                                                                                                                         \
00149         /* Has the extremity of the task stack ever been written over? */                                                               \
00150         if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )          \
00151         {                                                                                                                               \
00152             vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName );                                   \
00153         }                                                                                                                               \
00154     }
00155 
00156 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
00157 /*-----------------------------------------------------------*/
00158 
00159 #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
00160 
00161     #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()                                                                                       \
00162     {                                                                                                                                   \
00163     int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack;                                                                     \
00164     static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,     \
00165                                                     tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,     \
00166                                                     tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,     \
00167                                                     tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,     \
00168                                                     tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE };   \
00169                                                                                                                                         \
00170                                                                                                                                         \
00171         pcEndOfStack -= sizeof( ucExpectedStackBytes );                                                                                 \
00172                                                                                                                                         \
00173         /* Has the extremity of the task stack ever been written over? */                                                               \
00174         if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )                   \
00175         {                                                                                                                               \
00176             vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName );                                   \
00177         }                                                                                                                               \
00178     }
00179 
00180 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
00181 /*-----------------------------------------------------------*/
00182 
00183 #endif /* STACK_MACROS_H */
00184 
00185