X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=Demo%2FPC%2Fmain.c;h=0250b1267c9bd4c6b55577a559dcfc349e2c1462;hb=921b32a7bf83d65e25cbeecde3b87b43da084dbb;hp=1747f9fe66f5827f9ed06fb3923e496a5b9e3914;hpb=a20e3296fe400e0d1c333ef0df4a34ba8ac4dd16;p=freertos diff --git a/Demo/PC/main.c b/Demo/PC/main.c index 1747f9fe6..0250b1267 100644 --- a/Demo/PC/main.c +++ b/Demo/PC/main.c @@ -1,50 +1,54 @@ /* - FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 Richard Barry. - - This file is part of the FreeRTOS.org distribution. - - FreeRTOS.org is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd. + - FreeRTOS.org is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + *************************************************************************** + * * + * FreeRTOS tutorial books are available in pdf and paperback. * + * Complete, revised, and edited pdf reference manuals are also * + * available. * + * * + * Purchasing FreeRTOS documentation will not only help you, by * + * ensuring you get running as quickly as possible and with an * + * in-depth knowledge of how to use FreeRTOS, it will also help * + * the FreeRTOS project to continue with its mission of providing * + * professional grade, cross platform, de facto standard solutions * + * for microcontrollers - completely free of charge! * + * * + * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * + * * + * Thank you for using FreeRTOS, and thank you for your support! * + * * + *************************************************************************** - You should have received a copy of the GNU General Public License - along with FreeRTOS.org; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - A special exception to the GPL can be applied should you wish to distribute - a combined work that includes FreeRTOS.org, without being obliged to provide - the source code for any proprietary components. See the licensing section - of http://www.FreeRTOS.org for full details of how and when the exception - can be applied. + This file is part of the FreeRTOS distribution. - *************************************************************************** - *************************************************************************** - * * - * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * - * and even write all or part of your application on your behalf. * - * See http://www.OpenRTOS.com for details of the services we provide to * - * expedite your project. * - * * - *************************************************************************** - *************************************************************************** + FreeRTOS is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License (version 2) as published by the + Free Software Foundation AND MODIFIED BY the FreeRTOS exception. + >>>NOTE<<< The modification to the GPL is included to allow you to + distribute a combined work that includes FreeRTOS without being obliged to + provide the source code for proprietary components outside of the FreeRTOS + kernel. FreeRTOS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained + by writing to Richard Barry, contact details for whom are available on the + FreeRTOS WEB site. - Please ensure to read the configuration and relevant port sections of the - online documentation. + 1 tab == 4 spaces! - http://www.FreeRTOS.org - Documentation, latest information, license and - contact details. + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. - http://www.SafeRTOS.com - A version that is certified for use in safety - critical systems. + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. - http://www.OpenRTOS.com - Commercial support, development, porting, - licensing and training services. + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. */ /** @@ -120,8 +124,8 @@ #define mainSEMAPHORE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) #define mainGENERIC_QUEUE_PRIORITY ( tskIDLE_PRIORITY ) -#define mainPRINT_STACK_SIZE ( ( unsigned portSHORT ) 512 ) -#define mainDEBUG_LOG_BUFFER_SIZE ( ( unsigned portSHORT ) 20480 ) +#define mainPRINT_STACK_SIZE ( ( unsigned short ) 512 ) +#define mainDEBUG_LOG_BUFFER_SIZE ( ( unsigned short ) 20480 ) /* The number of flash co-routines to create. */ #define mainNUM_FLASH_CO_ROUTINES ( 8 ) @@ -140,11 +144,11 @@ static void prvCheckForKeyPresses( void ); /* Buffer used by the trace visualisation utility so only needed if the trace being used. */ #if configUSE_TRACE_FACILITY == 1 - static portCHAR pcWriteBuffer[ mainDEBUG_LOG_BUFFER_SIZE ]; + static char pcWriteBuffer[ mainDEBUG_LOG_BUFFER_SIZE ]; #endif /* Constant definition used to turn on/off the pre-emptive scheduler. */ -static const portSHORT sUsingPreemption = configUSE_PREEMPTION; +static const short sUsingPreemption = configUSE_PREEMPTION; /* Start the math tasks appropriate to the build. The Borland port does not yet support floating point so uses the integer equivalent. */ @@ -158,12 +162,12 @@ static portBASE_TYPE prvExampleTaskHook( void * pvParameter ); /* Just used to count the number of times the example task callback function is called, and the number of times a queue send passes. */ -static unsigned portLONG portLONG uxCheckTaskHookCallCount = 0; -static unsigned portLONG portLONG uxQueueSendPassedCount = 0; +static unsigned long long uxCheckTaskHookCallCount = 0; +static unsigned long long uxQueueSendPassedCount = 0; /*-----------------------------------------------------------*/ -portSHORT main( void ) +short main( void ) { /* Initialise hardware and utilities. */ vParTestInitialise(); @@ -237,16 +241,23 @@ static void vErrorChecks( void *pvParameters ) { portTickType xExpectedWakeTime; const portTickType xPrintRate = ( portTickType ) 5000 / portTICK_RATE_MS; -const portLONG lMaxAllowableTimeDifference = ( portLONG ) 0; +const long lMaxAllowableTimeDifference = ( long ) 0; portTickType xWakeTime; -portLONG lTimeDifference; -const portCHAR *pcReceivedMessage; -const portCHAR * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r\n"; +long lTimeDifference; +const char *pcReceivedMessage; +const char * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r\n"; +const char * const pcUnexpectedHookValueMsg = "Task hook has unexpected value!\r\n"; ( void ) pvParameters; /* Register our callback function. */ vTaskSetApplicationTaskTag( NULL, prvExampleTaskHook ); + + /* Just for test purposes. */ + if( xTaskGetApplicationTaskTag( NULL ) != prvExampleTaskHook ) + { + vPrintDisplayMessage( &pcUnexpectedHookValueMsg ); + } /* Loop continuously, blocking, then checking all the other tasks are still running, before blocking once again. This task blocks on the queue of @@ -274,11 +285,11 @@ const portCHAR * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r time we should have unblocked. */ if( xWakeTime > xExpectedWakeTime ) { - lTimeDifference = ( portLONG ) ( xWakeTime - xExpectedWakeTime ); + lTimeDifference = ( long ) ( xWakeTime - xExpectedWakeTime ); } else { - lTimeDifference = ( portLONG ) ( xExpectedWakeTime - xWakeTime ); + lTimeDifference = ( long ) ( xExpectedWakeTime - xWakeTime ); } if( lTimeDifference > lMaxAllowableTimeDifference ) @@ -312,7 +323,7 @@ const portCHAR * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r static void prvCheckForKeyPresses( void ) { -portSHORT sIn; +short sIn; taskENTER_CRITICAL(); #ifdef DEBUG_BUILD @@ -341,7 +352,7 @@ portSHORT sIn; break; case 'e' : { - unsigned portLONG ulBufferLength; + unsigned long ulBufferLength; ulBufferLength = ulTaskEndTrace(); vWriteBufferToDisk( pcWriteBuffer, ulBufferLength ); } @@ -357,8 +368,8 @@ portSHORT sIn; static void prvCheckOtherTasksAreStillRunning( void ) { -static portSHORT sErrorHasOccurred = pdFALSE; -static unsigned portLONG portLONG uxLastHookCallCount = 0, uxLastQueueSendCount = 0; +static short sErrorHasOccurred = pdFALSE; +static unsigned long long uxLastHookCallCount = 0, uxLastQueueSendCount = 0; if( prvCheckMathTasksAreStillRunning() != pdTRUE ) {