]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/RL78_RL78G13_Promo_Board_IAR/main.c
Minor updates to demo projects to ensure correct building with V8 rc1.
[freertos] / FreeRTOS / Demo / RL78_RL78G13_Promo_Board_IAR / main.c
index e3140198a8b38752dcc0e3b03caa5c6c4028cb6b..91d45f46c05821707b8f82921db31d0c934db677 100644 (file)
@@ -1,6 +1,9 @@
 /*\r
-    FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd.\r
-       \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 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
+\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
+    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
      *                                                                       *\r
      *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?                                      *\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
+\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.\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
-    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
+    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
 \r
 /*\r
@@ -191,11 +200,11 @@ static xTimerHandle xDemoTimer = NULL;
 /* 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
@@ -219,31 +228,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
@@ -272,12 +281,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
@@ -288,7 +297,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
@@ -305,7 +314,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
@@ -313,13 +322,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
@@ -328,7 +337,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
@@ -341,58 +350,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
@@ -424,7 +433,7 @@ void vApplicationMallocFailedHook( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )\r
+void vApplicationStackOverflowHook( xTaskHandle pxTask, char *pcTaskName )\r
 {\r
        ( void ) pcTaskName;\r
        ( void ) pxTask;\r
@@ -448,6 +457,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