X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FDemo%2FColdFire_MCF51CN128_CodeWarrior%2FSources%2Fmain.c;h=4e13c79e83385256cfa0d6b3528e876f9360a254;hb=refs%2Ftags%2FV8.1.2;hp=a5f78d12396391504052dc1dc0b7a83215e3a7fe;hpb=a97a430d525b824853f6528cb60d160468690963;p=freertos diff --git a/FreeRTOS/Demo/ColdFire_MCF51CN128_CodeWarrior/Sources/main.c b/FreeRTOS/Demo/ColdFire_MCF51CN128_CodeWarrior/Sources/main.c index a5f78d123..4e13c79e8 100644 --- a/FreeRTOS/Demo/ColdFire_MCF51CN128_CodeWarrior/Sources/main.c +++ b/FreeRTOS/Demo/ColdFire_MCF51CN128_CodeWarrior/Sources/main.c @@ -1,48 +1,38 @@ /* - FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd. + All rights reserved - FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT - http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. + VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. *************************************************************************** * * - * FreeRTOS tutorial books are available in pdf and paperback. * - * Complete, revised, and edited pdf reference manuals are also * - * available. * + * FreeRTOS provides completely free yet professionally developed, * + * robust, strictly quality controlled, supported, and cross * + * platform software that has become a de facto standard. * * * - * 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! * + * Help yourself get started quickly and support the FreeRTOS * + * project by purchasing a FreeRTOS tutorial book, reference * + * manual, or both from: http://www.FreeRTOS.org/Documentation * * * - * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * - * * - * Thank you for using FreeRTOS, and thank you for your support! * + * Thank you! * * * *************************************************************************** - This file is part of the FreeRTOS distribution. 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. + 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. + >>! 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 Real Time Engineers Ltd., contact details for whom are available - on the FreeRTOS WEB site. + FOR A PARTICULAR PURPOSE. Full license text is available from the following + link: http://www.freertos.org/a00114.html 1 tab == 4 spaces! @@ -55,21 +45,22 @@ * * *************************************************************************** - - http://www.FreeRTOS.org - Documentation, books, training, latest versions, + http://www.FreeRTOS.org - Documentation, books, training, latest versions, license and Real Time Engineers Ltd. contact details. http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, - including FreeRTOS+Trace - an indispensable productivity tool, and our new - fully thread aware and reentrant UDP/IP stack. - - http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High - Integrity Systems, who sell the code with commercial support, - indemnification and middleware, under the OpenRTOS brand. - - http://www.SafeRTOS.com - High Integrity Systems also provide a safety - engineered and independently SIL3 certified version for use in safety and + including FreeRTOS+Trace - an indispensable productivity tool, a DOS + compatible FAT file system, and our tiny thread aware UDP/IP stack. + + http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High + Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS + licenses offer ticketed support, indemnification and middleware. + + http://www.SafeRTOS.com - High Integrity Systems also provide a safety + engineered and independently SIL3 certified version for use in safety and mission critical applications that require provable dependability. + + 1 tab == 4 spaces! */ @@ -88,11 +79,11 @@ * pages display some TCP/IP status information and permit LED3 to be turned on * and off using a check box. * - * Tick hook function that implements a "Check" function - This is executed - * every 5 seconds from the tick hook function. It checks to ensure that all - * the standard demo tasks are still operational and running without error. - * The system status (pass/fail) is then displayed underneith the task table on - * the served WEB pages. + * Tick hook function that implements a "Check" function - This is executed + * every 5 seconds from the tick hook function. It checks to ensure that all + * the standard demo tasks are still operational and running without error. + * The system status (pass/fail) is then displayed underneith the task table on + * the served WEB pages. * * "Reg test" tasks - These fill the registers with known values, then check * that each register still contains its expected value. Each task uses @@ -177,8 +168,8 @@ extern void vBasicWEBServer( void *pv ); /* Setup the hardware ready for this demo. */ prvSetupHardware(); - - xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL ); + + xTaskCreate( vuIP_Task, "uIP", mainBASIC_WEB_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL ); /* Start the standard demo tasks. */ vStartLEDFlashTasks( tskIDLE_PRIORITY ); @@ -188,8 +179,8 @@ extern void vBasicWEBServer( void *pv ); vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); /* Start the reg test tasks - defined in this file. */ - xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, ( void * ) &ulRegTest1Counter, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, ( void * ) &ulRegTest2Counter, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) &ulRegTest1Counter, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) &ulRegTest2Counter, tskIDLE_PRIORITY, NULL ); /* Start the scheduler. */ vTaskStartScheduler(); @@ -205,18 +196,18 @@ extern void vBasicWEBServer( void *pv ); void vApplicationTickHook( void ) { static unsigned long ulExecutionCount = 0, ulLastRegTest1Count = 0, ulLastRegTest2Count = 0; -const unsigned long ulExecutionRate = 5000 / portTICK_RATE_MS; - +const unsigned long ulExecutionRate = 5000 / portTICK_PERIOD_MS; + /* Increment the count of how many times the tick hook has been called. */ ulExecutionCount++; - + /* Is it time to perform the check again? */ if( ulExecutionCount >= ulExecutionRate ) { /* Reset the execution count so this function is called again in 5 seconds time. */ ulExecutionCount = 0; - + /* Has an error been found in any task? */ if( xAreGenericQueueTasksStillRunning() != pdTRUE ) { @@ -254,13 +245,13 @@ const unsigned long ulExecutionRate = 5000 / portTICK_RATE_MS; } /*-----------------------------------------------------------*/ -static void prvSetupHardware( void ) +static void prvSetupHardware( void ) { /* Disable the watchdog, STOP and WAIT modes. */ SOPT1 = 0; /* --- Setup clock to use external 25MHz source. --- */ - + /* Extal and xtal pin ON. */ PTDPF1_D4 = 0x03; PTDPF1_D5 = 0x03; @@ -270,12 +261,12 @@ static void prvSetupHardware( void ) MCGC2 = MCGC2_ERCLKEN_MASK /* Activate external reference clock */ | MCGC2_EREFS_MASK /* Because crystal is being used */ | MCGC2_RANGE_MASK; /* High range */ - + /* Select clock mode and clear IREFs. */ MCGC1 = (0x02 << 6 ) /* CLKS = 10 -> external reference clock. */ | (0x04 << 3 ) /* RDIV = 2^4 -> 25MHz/16 = 1.5625 MHz */ | MCGC1_IRCLKEN_MASK; /* IRCLK to RTC enabled */ - + /* Wait for Reference and Clock status bits to update. */ while( MCGSC_IREFST | ( MCGSC_CLKST != 0x02 ) ) { @@ -293,7 +284,7 @@ static void prvSetupHardware( void ) } - /* Now in PBE Mode, finally switch from PBE to PEE (PLL enabled external + /* Now in PBE Mode, finally switch from PBE to PEE (PLL enabled external mode). */ MCGC1_CLKS = 0b00; /* PLL clock to system (MCGOUT) */ @@ -308,7 +299,7 @@ static void prvSetupHardware( void ) } /*-----------------------------------------------------------*/ -void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName ) +void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) { /* This will get called if a stack overflow is detected during the context switch. Set configCHECK_FOR_STACK_OVERFLOWS to 2 to also check for stack @@ -328,7 +319,7 @@ static void vRegTest1Task( void *pvParameters ) { /* Just to remove compiler warnings. */ ( void ) pvParameters; - + /* Set all the registers to known values, then check that each retains its expected value - as described at the top of this file. If an error is found then the loop counter will no longer be incremented allowing the check @@ -339,7 +330,7 @@ static void vRegTest1Task( void *pvParameters ) " moveq #3, d2 \n\t" " moveq #4, d3 \n\t" " moveq #5, d4 \n\t" - " moveq #6, d5 \n\t" + " moveq #6, d5 \n\t" " moveq #7, d6 \n\t" " moveq #8, d7 \n\t" " move #9, a0 \n\t"