X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FDemo%2FCORTEX_STM32F103_Keil%2Fmain.c;h=ba860efabe869474cf6e95ad4c5322a547598a02;hb=bb2faca82c580d60469d268594bdc3cb26a632b3;hp=ae1e4e59a2ec12e30b5ce45cf58c8a10b2c3ef86;hpb=a97a430d525b824853f6528cb60d160468690963;p=freertos diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c index ae1e4e59a..ba860efab 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c @@ -1,48 +1,38 @@ /* - FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - 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! */ /* @@ -156,10 +147,10 @@ time. */ #define mainMAX_MSG_LEN 25 /* The time between cycles of the 'check' task. */ -#define mainCHECK_DELAY ( ( portTickType ) 5000 / portTICK_RATE_MS ) +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) /* The number of nano seconds between each processor clock. */ -#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) +#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) /* Baud rate used by the comtest tasks. */ #define mainCOM_TEST_BAUD_RATE ( 115200 ) @@ -214,7 +205,7 @@ extern void vSetupTimerTest( void ); /*-----------------------------------------------------------*/ /* The queue used to send messages to the LCD task. */ -xQueueHandle xLCDQueue; +QueueHandle_t xLCDQueue; /*-----------------------------------------------------------*/ @@ -229,7 +220,7 @@ int main( void ) /* Create the queue used by the LCD task. Messages for display on the LCD are received via this queue. */ xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) ); - + /* Start the standard demo tasks. */ vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); vCreateBlockTimeTasks(); @@ -240,20 +231,20 @@ int main( void ) vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); /* Start the tasks defined within this file/specific to this demo. */ - xTaskCreate( vCheckTask, ( signed portCHAR * ) "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - xTaskCreate( vLCDTask, ( signed portCHAR * ) "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); /* The suicide tasks must be created last as they need to know how many tasks were running prior to their creation in order to ascertain whether or not the correct/expected number of tasks are running at any given time. */ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - + /* Configure the timers used by the fast interrupt timer test. */ vSetupTimerTest(); - + /* Start the scheduler. */ vTaskStartScheduler(); - + /* Will only get here if there was not enough heap space to create the idle task. */ return 0; @@ -266,7 +257,7 @@ xLCDMessage xMessage; /* Initialise the LCD and display a startup message. */ prvConfigureLCD(); - LCD_DrawMonoPict( ( unsigned portLONG * ) pcBitmap ); + LCD_DrawMonoPict( ( unsigned long * ) pcBitmap ); for( ;; ) { @@ -274,21 +265,21 @@ xLCDMessage xMessage; while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ); /* Display the message. Print each message to a different position. */ - printf( ( portCHAR const * ) xMessage.pcMessage ); + printf( ( char const * ) xMessage.pcMessage ); } } /*-----------------------------------------------------------*/ static void vCheckTask( void *pvParameters ) { -portTickType xLastExecutionTime; +TickType_t xLastExecutionTime; xLCDMessage xMessage; -static signed portCHAR cPassMessage[ mainMAX_MSG_LEN ]; -extern unsigned portSHORT usMaxJitter; +static signed char cPassMessage[ mainMAX_MSG_LEN ]; +extern unsigned short usMaxJitter; xLastExecutionTime = xTaskGetTickCount(); xMessage.pcMessage = cPassMessage; - + for( ;; ) { /* Perform this check every mainCHECK_DELAY milliseconds. */ @@ -323,10 +314,10 @@ extern unsigned portSHORT usMaxJitter; else if( xAreComTestTasksStillRunning() != pdTRUE ) { xMessage.pcMessage = "ERROR IN COM TEST\n"; - } + } else { - sprintf( ( portCHAR * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned portLONG ) usMaxJitter ) * mainNS_PER_CLOCK ); + sprintf( ( char * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK ); } /* Send the message to the LCD gatekeeper for display. */ @@ -349,7 +340,7 @@ static void prvSetupHardware( void ) } /* 2 wait states required on the flash. */ - *( ( unsigned portLONG * ) 0x40022000 ) = 0x02; + *( ( unsigned long * ) 0x40022000 ) = 0x02; /* HCLK = SYSCLK */ RCC_HCLKConfig( RCC_SYSCLK_Div1 ); @@ -391,10 +382,10 @@ static void prvSetupHardware( void ) NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 ); NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); - + /* Configure HCLK clock as SysTick clock source. */ SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK ); - + vParTestInitialise(); } /*-----------------------------------------------------------*/ @@ -427,8 +418,8 @@ GPIO_InitTypeDef GPIO_InitStructure; int fputc( int ch, FILE *f ) { -static unsigned portSHORT usColumn = 0, usRefColumn = mainCOLUMN_START; -static unsigned portCHAR ucLine = 0; +static unsigned short usColumn = 0, usRefColumn = mainCOLUMN_START; +static unsigned char ucLine = 0; if( ( usColumn == 0 ) && ( ucLine == 0 ) ) { @@ -439,10 +430,10 @@ static unsigned portCHAR ucLine = 0; { /* Display one character on LCD */ LCD_DisplayChar( ucLine, usRefColumn, (u8) ch ); - + /* Decrement the column position by 16 */ usRefColumn -= mainCOLUMN_INCREMENT; - + /* Increment the character counter */ usColumn++; if( usColumn == mainMAX_COLUMN ) @@ -457,7 +448,7 @@ static unsigned portCHAR ucLine = 0; /* Move back to the first column of the next line. */ ucLine += mainROW_INCREMENT; usRefColumn = mainCOLUMN_START; - usColumn = 0; + usColumn = 0; } /* Wrap back to the top of the display. */ @@ -465,14 +456,14 @@ static unsigned portCHAR ucLine = 0; { ucLine = 0; } - + return ch; } /*-----------------------------------------------------------*/ #ifdef DEBUG /* Keep the linker happy. */ -void assert_failed( unsigned portCHAR* pcFile, unsigned portLONG ulLine ) +void assert_failed( unsigned char* pcFile, unsigned long ulLine ) { for( ;; ) {