]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/RL78_RL78G13_Promo_Board_IAR/main.c
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed releas...
[freertos] / FreeRTOS / Demo / RL78_RL78G13_Promo_Board_IAR / main.c
index bbad469c9b7d1096cdc0beb6a661ed9b10685727..917e59ebdb6eba0c1d5191475d7719235bb7fce8 100644 (file)
@@ -1,77 +1,29 @@
 /*\r
-    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
-    All rights reserved\r
-\r
-    FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
-    http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\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
-\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.\r
-\r
-    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
-    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
-    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
-    details. You should have received a copy of the GNU General Public License\r
-    and the FreeRTOS license exception along with FreeRTOS; if not itcan be\r
-    viewed here: http://www.freertos.org/a00114.html and also obtained by\r
-    writing to Real Time Engineers Ltd., contact details for whom are available\r
-    on the 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, books, training, latest versions, \r
-    license and Real Time Engineers Ltd. contact details.\r
-\r
-    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
-    including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
-    fully thread aware and reentrant UDP/IP stack.\r
-\r
-    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
-    Integrity Systems, who sell the code with commercial support, \r
-    indemnification and middleware, under the OpenRTOS brand.\r
-    \r
-    http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
-    engineered and independently SIL3 certified version for use in safety and \r
-    mission critical applications that require provable dependability.\r
-*/\r
+ * FreeRTOS Kernel V10.3.0\r
+ * Copyright (C) 2020 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.\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
  *\r
 \r
 /* The period at which the check timer will expire, in ms, provided no errors\r
 have been reported by any of the standard demo tasks.  ms are converted to the\r
-equivalent in ticks using the portTICK_RATE_MS constant. */\r
-#define mainCHECK_TIMER_PERIOD_MS                      ( 3000UL / portTICK_RATE_MS )\r
+equivalent in ticks using the portTICK_PERIOD_MS constant. */\r
+#define mainCHECK_TIMER_PERIOD_MS                      ( 3000UL / portTICK_PERIOD_MS )\r
 \r
 /* The period at which the check timer will expire, in ms, if an error has been\r
 reported in one of the standard demo tasks, the check tasks, or the demo timer.\r
-ms are converted to the equivalent in ticks using the portTICK_RATE_MS\r
+ms are converted to the equivalent in ticks using the portTICK_PERIOD_MS\r
 constant. */\r
-#define mainERROR_CHECK_TIMER_PERIOD_MS        ( 200UL / portTICK_RATE_MS )\r
+#define mainERROR_CHECK_TIMER_PERIOD_MS        ( 200UL / portTICK_PERIOD_MS )\r
 \r
 /* These two definitions are used to set the period of the demo timer.  The demo\r
 timer period is always relative to the check timer period, so the check timer\r
@@ -163,12 +115,12 @@ its own executions. */
 /*\r
  * The 'check' timer callback function, as described at the top of this file.\r
  */\r
-static void prvCheckTimerCallback( xTimerHandle xTimer );\r
+static void prvCheckTimerCallback( TimerHandle_t xTimer );\r
 \r
 /*\r
  * The 'demo' timer callback function, as described at the top of this file.\r
  */\r
-static void prvDemoTimerCallback( xTimerHandle xTimer );\r
+static void prvDemoTimerCallback( TimerHandle_t xTimer );\r
 \r
 /*\r
  * This function is called from the C startup routine to setup the processor -\r
@@ -192,19 +144,19 @@ static short sRegTestStatus = pdPASS;
 \r
 /* The check timer.  This uses prvCheckTimerCallback() as its callback\r
 function. */\r
-static xTimerHandle xCheckTimer = NULL;\r
+static TimerHandle_t xCheckTimer = NULL;\r
 \r
 /* The demo timer.  This uses prvDemoTimerCallback() as its callback function. */\r
-static xTimerHandle xDemoTimer = NULL;\r
+static TimerHandle_t xDemoTimer = NULL;\r
 \r
 /* This variable is incremented each time the demo timer expires. */\r
 static volatile unsigned long ulDemoSoftwareTimerCounter = 0UL;\r
 \r
-/* RL78/G13 Option Byte Definition. Watchdog disabled, LVI enabled, OCD interface\r
+/* RL78 Option Byte Definition. Watchdog disabled, LVI enabled, OCD interface\r
 enabled. */\r
 __root __far const unsigned char OptionByte[] @ 0x00C0 =\r
 {\r
-       WATCHDOG_DISABLED, LVI_ENABLED, RESERVED_FF, OCD_ENABLED\r
+       0x6eU, 0xffU, 0xe8U, 0x85U\r
 };\r
 \r
 /* Security byte definition */\r
@@ -228,31 +180,31 @@ short main( void )
 \r
        /* Create the RegTest tasks as described at the top of this file. */\r
        xTaskCreate( vRegTest1, "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL );\r
-       xTaskCreate( vRegTest2, "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL );      \r
+       xTaskCreate( vRegTest2, "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL );\r
 \r
        /* Create the software timer that performs the 'check' functionality,\r
        as described at the top of this file. */\r
-       xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */\r
+       xCheckTimer = xTimerCreate( "CheckTimer",/* A text name, purely to help debugging. */\r
                                                                ( mainCHECK_TIMER_PERIOD_MS ),          /* The timer period, in this case 3000ms (3s). */\r
                                                                pdTRUE,                                                         /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
                                                                ( void * ) 0,                                           /* The ID is not used, so can be set to anything. */\r
                                                                prvCheckTimerCallback                           /* The callback function that inspects the status of all the other tasks. */\r
                                                          );\r
-                                                       \r
+\r
        /* Create the software timer that just increments a variable for demo\r
        purposes. */\r
-       xDemoTimer = xTimerCreate( ( const signed char * ) "DemoTimer",/* A text name, purely to help debugging. */\r
+       xDemoTimer = xTimerCreate( "DemoTimer",/* A text name, purely to help debugging. */\r
                                                                ( mainDEMO_TIMER_PERIOD_MS ),           /* The timer period, in this case it is always calculated relative to the check timer period (see the definition of mainDEMO_TIMER_PERIOD_MS). */\r
                                                                pdTRUE,                                                         /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
                                                                ( void * ) 0,                                           /* The ID is not used, so can be set to anything. */\r
                                                                prvDemoTimerCallback                            /* The callback function that inspects the status of all the other tasks. */\r
                                                          );\r
-       \r
+\r
        /* Start both the check timer and the demo timer.  The timers won't actually\r
        start until the scheduler is started. */\r
        xTimerStart( xCheckTimer, mainDONT_BLOCK );\r
        xTimerStart( xDemoTimer, mainDONT_BLOCK );\r
-       \r
+\r
        /* Finally start the scheduler running. */\r
        vTaskStartScheduler();\r
 \r
@@ -262,7 +214,7 @@ short main( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvDemoTimerCallback( xTimerHandle xTimer )\r
+static void prvDemoTimerCallback( TimerHandle_t xTimer )\r
 {\r
        /* The demo timer has expired.  All it does is increment a variable.  The\r
        period of the demo timer is relative to that of the check timer, so the\r
@@ -272,7 +224,7 @@ static void prvDemoTimerCallback( xTimerHandle xTimer )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvCheckTimerCallback( xTimerHandle xTimer )\r
+static void prvCheckTimerCallback( TimerHandle_t xTimer )\r
 {\r
 static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS;\r
 \r
@@ -281,12 +233,12 @@ static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS
        {\r
                xErrorStatus = pdFAIL;\r
        }\r
-       \r
+\r
        if( xArePollingQueuesStillRunning() != pdTRUE )\r
        {\r
                xErrorStatus = pdFAIL;\r
        }\r
-       \r
+\r
        if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
        {\r
                xErrorStatus = pdFAIL;\r
@@ -297,7 +249,7 @@ static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS
        {\r
                xErrorStatus = pdFAIL;\r
        }\r
-       \r
+\r
        /* Ensure that the demo software timer has expired\r
        mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT times in between\r
        each call of this function.  A critical section is not required to access\r
@@ -314,7 +266,7 @@ static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS
        {\r
                ulDemoSoftwareTimerCounter = 0UL;\r
        }\r
-       \r
+\r
        if( ( xErrorStatus == pdFAIL ) && ( xChangedTimerPeriodAlready == pdFALSE ) )\r
        {\r
                /* An error has occurred, but the timer's period has not yet been changed,\r
@@ -322,13 +274,13 @@ static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS
                timer's period means the LED will toggle at a faster rate, giving a\r
                visible indication that something has gone wrong. */\r
                xChangedTimerPeriodAlready = pdTRUE;\r
-                       \r
+\r
                /* This call to xTimerChangePeriod() uses a zero block time.  Functions\r
                called from inside of a timer callback function must *never* attempt to\r
                block. */\r
                xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );\r
        }\r
-       \r
+\r
        /* Toggle the LED.  The toggle rate will depend on whether or not an error\r
        has been found in any tasks. */\r
        mainLED_0 = !mainLED_0;\r
@@ -337,7 +289,7 @@ static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS
 \r
 int __low_level_init(void)\r
 {\r
-unsigned portCHAR ucResetFlag = RESF;\r
+unsigned char ucResetFlag = RESF;\r
 \r
        portDISABLE_INTERRUPTS();\r
 \r
@@ -350,58 +302,58 @@ unsigned portCHAR ucResetFlag = RESF;
                /* Set fMX */\r
                CMC = 0x00;\r
                MSTOP = 1U;\r
-               \r
+\r
                /* Set fMAIN */\r
                MCM0 = 0U;\r
-               \r
+\r
                /* Set fSUB */\r
                XTSTOP = 1U;\r
                OSMC = 0x10;\r
-               \r
+\r
                /* Set fCLK */\r
                CSS = 0U;\r
-               \r
+\r
                /* Set fIH */\r
                HIOSTOP = 0U;\r
        }\r
        #else\r
        {\r
-               unsigned char ucTempStabset, ucTempStabWait;    \r
+               unsigned char ucTempStabset, ucTempStabWait;\r
 \r
                /* Set fMX */\r
                CMC = 0x41;\r
                OSTS = 0x07;\r
                MSTOP = 0U;\r
                ucTempStabset = 0xFF;\r
-               \r
+\r
                do\r
                {\r
                        ucTempStabWait = OSTC;\r
                        ucTempStabWait &= ucTempStabset;\r
                }\r
                while( ucTempStabWait != ucTempStabset );\r
-               \r
+\r
                /* Set fMAIN */\r
                MCM0 = 1U;\r
-               \r
+\r
                /* Set fSUB */\r
                XTSTOP = 1U;\r
                OSMC = 0x10;\r
-               \r
+\r
                /* Set fCLK */\r
                CSS = 0U;\r
-               \r
+\r
                /* Set fIH */\r
                HIOSTOP = 0U;\r
        }\r
        #endif /* configCLOCK_SOURCE == 1 */\r
-       \r
+\r
        /* LED port initialization - set port register. */\r
        P7 &= 0x7F;\r
-       \r
+\r
        /* Set port mode register. */\r
        PM7 &= 0x7F;\r
-       \r
+\r
        /* Switch pin initialization - enable pull-up resistor. */\r
        PU12_bit.no0  = 1;\r
 \r
@@ -433,7 +385,7 @@ void vApplicationMallocFailedHook( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )\r
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )\r
 {\r
        ( void ) pcTaskName;\r
        ( void ) pxTask;\r
@@ -457,6 +409,6 @@ volatile size_t xFreeHeapSpace;
        management options.  If there is a lot of heap memory free then the\r
        configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up\r
        RAM. */\r
-       xFreeHeapSpace = xPortGetFreeHeapSize();        \r
+       xFreeHeapSpace = xPortGetFreeHeapSize();\r
 }\r
 \r