]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/ARM7_STR75x_IAR/main.c
Update to MIT licensed FreeRTOS V10.0.0 - see https://www.freertos.org/History.txt
[freertos] / FreeRTOS / Demo / ARM7_STR75x_IAR / main.c
index 25e7289a8fe188c89532202d2e619645d88441df..869c749dc35e63e62e9ab88d40c3e3bcea91bd0f 100644 (file)
@@ -1,68 +1,30 @@
 /*\r
-    FreeRTOS V7.2.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
-       \r
-\r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
-     *    Complete, revised, and edited pdf reference manuals are also       *\r
-     *    available.                                                         *\r
-     *                                                                       *\r
-     *    Purchasing FreeRTOS documentation will not only help you, by       *\r
-     *    ensuring you get running as quickly as possible and with an        *\r
-     *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
-     *    the FreeRTOS project to continue with its mission of providing     *\r
-     *    professional grade, cross platform, de facto standard solutions    *\r
-     *    for microcontrollers - completely free of charge!                  *\r
-     *                                                                       *\r
-     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
-     *                                                                       *\r
-     *    Thank you for using FreeRTOS, and thank you for your support!      *\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
-\r
-    This file is part of the FreeRTOS distribution.\r
-\r
-    FreeRTOS is free software; you can redistribute it and/or modify it under\r
-    the terms of the GNU General Public License (version 2) as published by the\r
-    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
-    >>>NOTE<<< The modification to the GPL is included to allow you to\r
-    distribute a combined work that includes FreeRTOS without being obliged to\r
-    provide the source code for proprietary components outside of the FreeRTOS\r
-    kernel.  FreeRTOS is distributed in the hope that it will be useful, but\r
-    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
-    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
-    more details. You should have received a copy of the GNU General Public\r
-    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
-    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
-    by writing to Richard Barry, contact details for whom are available on the\r
-    FreeRTOS WEB site.\r
-\r
-    1 tab == 4 spaces!\r
-    \r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?                                      *\r
-     *                                                                       *\r
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
-    \r
-    http://www.FreeRTOS.org - Documentation, training, latest information, \r
-    license and contact details.\r
-    \r
-    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
-    including FreeRTOS+Trace - an indispensable productivity tool.\r
-\r
-    Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
-    the code with commercial support, indemnification, and middleware, under \r
-    the OpenRTOS brand: http://www.OpenRTOS.com.  High Integrity Systems also\r
-    provide a safety engineered and independently SIL3 certified version under \r
-    the SafeRTOS brand: http://www.SafeRTOS.com.\r
-*/\r
+ * FreeRTOS Kernel V10.0.0\r
+ * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software. If you wish to use our Amazon\r
+ * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ */\r
 \r
 /*\r
  * Creates all the demo application tasks, then starts the scheduler.  The WEB\r
@@ -169,7 +131,7 @@ static void vPrintTask( void *pvParameters );
 /*-----------------------------------------------------------*/\r
 \r
 /* The queue used to communicate with the LCD print task. */\r
-static xQueueHandle xLCDQueue;\r
+static QueueHandle_t xLCDQueue;\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
@@ -181,8 +143,8 @@ void main( void )
        vParTestInitialise();\r
 \r
        /* Create the queue used to communicate with the LCD print task. */\r
-       xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) ); \r
-       \r
+       xLCDQueue = xQueueCreate( mainLCD_QUEUE_LENGTH, sizeof( LCDMessage ) );\r
+\r
        /* Create the standard demo application tasks.  See the WEB documentation\r
        for more information on these tasks. */\r
        vCreateBlockTimeTasks();\r
@@ -191,13 +153,13 @@ void main( void )
        vStartDynamicPriorityTasks();\r
        vStartLEDFlashTasks( mainLED_TASK_PRIORITY );\r
        vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
-       \r
+\r
        /* Create the tasks defined within this file. */\r
-       xTaskCreate( vPrintTask, ( signed char * ) "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );\r
-       xTaskCreate( vCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
-       \r
+       xTaskCreate( vPrintTask, "LCD", configMINIMAL_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );\r
+       xTaskCreate( vCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+\r
        vTaskStartScheduler();\r
-       \r
+\r
        /* Execution will only reach here if there was insufficient heap to\r
        start the scheduler. */\r
 }\r
@@ -205,8 +167,8 @@ void main( void )
 \r
 static void vCheckTask( void *pvParameters )\r
 {\r
-static unsigned long ulErrorDetected = pdFALSE;        \r
-portTickType xLastExecutionTime;\r
+static unsigned long ulErrorDetected = pdFALSE;\r
+TickType_t xLastExecutionTime;\r
 unsigned char *cErrorMessage = "              FAIL";\r
 unsigned char *cSuccessMessage = "              PASS";\r
 unsigned portBASE_TYPE uxColumn = mainMAX_WRITE_COLUMN;\r
@@ -222,7 +184,7 @@ LCDMessage xMessage;
                vTaskDelayUntil( &xLastExecutionTime, mainCHECK_TASK_CYCLE_TIME );\r
 \r
                /* Has an error been found in any of the standard demo tasks? */\r
-               \r
+\r
                if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
                {\r
                        ulErrorDetected = pdTRUE;\r
@@ -237,17 +199,17 @@ LCDMessage xMessage;
                {\r
                        ulErrorDetected = pdTRUE;\r
                }\r
-               \r
+\r
                if( xAreComTestTasksStillRunning() != pdTRUE )\r
                {\r
                        ulErrorDetected = pdTRUE;\r
-               }               \r
-               \r
+               }\r
+\r
                if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
                {\r
                        ulErrorDetected = pdTRUE;\r
-               }               \r
-       \r
+               }\r
+\r
                /* Calculate the LCD line on which we would like the message to\r
                be displayed.  The column variable is used for convenience as\r
                it is incremented each cycle anyway. */\r
@@ -256,19 +218,19 @@ LCDMessage xMessage;
                /* The message displayed depends on whether an error was found or\r
                not.  Any discovered error is latched.  Here the column variable\r
                is used as an index into the text string as a simple way of moving\r
-               the text from column to column. */              \r
+               the text from column to column. */\r
                if( ulErrorDetected == pdFALSE )\r
                {\r
                        xMessage.pucString = cSuccessMessage + uxColumn;\r
                }\r
                else\r
                {\r
-                       xMessage.pucString = cErrorMessage + uxColumn;                  \r
-               }               \r
+                       xMessage.pucString = cErrorMessage + uxColumn;\r
+               }\r
 \r
                /* Send the message to the print task for display. */\r
                xQueueSend( xLCDQueue, ( void * ) &xMessage, mainNO_DELAY );\r
-               \r
+\r
                /* Make sure the message is printed in a different column the next\r
                time around. */\r
                uxColumn--;\r
@@ -288,7 +250,7 @@ LCDMessage xMessage;
        {\r
                /* Wait until a message arrives. */\r
                while( xQueueReceive( xLCDQueue, ( void * ) &xMessage, portMAX_DELAY ) != pdPASS );\r
-               \r
+\r
                /* The message contains the text to display, and the line on which the\r
                text should be displayed. */\r
                LCD_Clear();\r
@@ -299,51 +261,51 @@ LCDMessage xMessage;
 \r
 static void prvSetupHardware(void)\r
 {\r
-ErrorStatus OSC4MStartUpStatus01;      \r
+ErrorStatus OSC4MStartUpStatus01;\r
 \r
        /* ST provided routine. */\r
 \r
        /* MRCC system reset */\r
        MRCC_DeInit();\r
-       \r
+\r
        /* Wait for OSC4M start-up */\r
        OSC4MStartUpStatus01 = MRCC_WaitForOSC4MStartUp();\r
-       \r
+\r
        if(OSC4MStartUpStatus01 == SUCCESS)\r
        {\r
                /* Set HCLK to 60MHz */\r
                MRCC_HCLKConfig(MRCC_CKSYS_Div1);\r
-               \r
+\r
                /* Set CKTIM to 60MHz */\r
                MRCC_CKTIMConfig(MRCC_HCLK_Div1);\r
-               \r
+\r
                /* Set PCLK to 30MHz */\r
                MRCC_PCLKConfig(MRCC_CKTIM_Div2);\r
-               \r
+\r
                /* Enable Flash Burst mode */\r
                CFG_FLASHBurstConfig(CFG_FLASHBurst_Enable);\r
-               \r
+\r
                /* Set CK_SYS to 60 MHz */\r
                MRCC_CKSYSConfig(MRCC_CKSYS_OSC4MPLL, MRCC_PLL_Mul_15);\r
        }\r
-       \r
+\r
        /* GPIO pins optimized for 3V3 operation */\r
        MRCC_IOVoltageRangeConfig(MRCC_IOVoltageRange_3V3);\r
-       \r
+\r
        /* GPIO clock source enable */\r
        MRCC_PeripheralClockConfig(MRCC_Peripheral_GPIO, ENABLE);\r
-       \r
+\r
        /* EXTIT clock source enable */\r
        MRCC_PeripheralClockConfig(MRCC_Peripheral_EXTIT, ENABLE);\r
        /* TB clock source enable */\r
        MRCC_PeripheralClockConfig(MRCC_Peripheral_TB, ENABLE);\r
-       \r
+\r
        /* Initialize the demonstration menu */\r
        LCD_Init();\r
-       \r
+\r
        LCD_DisplayString(Line1, "www.FreeRTOS.org", BlackText);\r
        LCD_DisplayString(Line2, "  STR750 Demo  ", BlackText);\r
-       \r
+\r
        EIC_IRQCmd(ENABLE);\r
 }\r
 /*-----------------------------------------------------------*/\r