]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/main.c
Update version number to 8.1.2 after moving the defaulting of configUSE_PORT_OPTIMISE...
[freertos] / FreeRTOS / Demo / MSP430X_MSP430F5438_IAR / main.c
index 97de90dcce16e670c771db8f54b816cd032d7b4c..55bc5e3d414c305e26e8945fa894b33d28bb48d1 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
-    FreeRTOS V7.5.1 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 \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 distribute\r
-    >>! a combined work that includes FreeRTOS without being obliged to provide\r
-    >>! the source code for proprietary components outside of the FreeRTOS\r
-    >>! kernel.\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS 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
@@ -238,7 +239,7 @@ volatile unsigned short usRegTest1Counter = 0, usRegTest2Counter = 0;
 \r
 /* The handle of the queue used to send messages from tasks and interrupts to\r
 the LCD task. */\r
-static xQueueHandle xLCDQueue = NULL;\r
+static QueueHandle_t xLCDQueue = NULL;\r
 \r
 /* The definition of each message sent from tasks and interrupts to the LCD\r
 task. */\r
@@ -250,9 +251,9 @@ typedef struct
 \r
 /*-----------------------------------------------------------*/\r
 \r
-/* The linker script can be used to test the FreeRTOS ports use of 20bit \r
-addresses by locating all code in high memory.  The following pragma ensures \r
-that main remains in low memory when that is done.  The ISR_CODE segment is used \r
+/* The linker script can be used to test the FreeRTOS ports use of 20bit\r
+addresses by locating all code in high memory.  The following pragma ensures\r
+that main remains in low memory when that is done.  The ISR_CODE segment is used\r
 for convenience as ISR functions are always placed in low memory. */\r
 #pragma location="ISR_CODE"\r
 void main( void )\r
@@ -277,22 +278,22 @@ void main( void )
                vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
                vStartDynamicPriorityTasks();\r
                vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY );\r
-               \r
+\r
                /* Create the LCD, button poll and register test tasks, as described at\r
                the top of this file. */\r
-               xTaskCreate( prvLCDTask, ( signed char * ) "LCD", configMINIMAL_STACK_SIZE * 2, mainTASK_PARAMETER_CHECK_VALUE, mainLCD_TASK_PRIORITY, NULL );\r
-               xTaskCreate( prvButtonPollTask, ( signed char * ) "BPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
-               xTaskCreate( vRegTest1Task, ( signed char * ) "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL );\r
-               xTaskCreate( vRegTest2Task, ( signed char * ) "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL );\r
+               xTaskCreate( prvLCDTask, "LCD", configMINIMAL_STACK_SIZE * 2, mainTASK_PARAMETER_CHECK_VALUE, mainLCD_TASK_PRIORITY, NULL );\r
+               xTaskCreate( prvButtonPollTask, "BPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+               xTaskCreate( vRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL );\r
+               xTaskCreate( vRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL );\r
 \r
                /* Start the scheduler. */\r
                vTaskStartScheduler();\r
        }\r
-       \r
+\r
        /* If all is well then this line will never be reached.  If it is reached\r
        then it is likely that there was insufficient (FreeRTOS) heap memory space\r
        to create the idle task.  This may have been trapped by the malloc() failed\r
-       hook function, if one is configured. */ \r
+       hook function, if one is configured. */\r
        for( ;; );\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -312,19 +313,19 @@ unsigned char ucLine = 1;
        /* This function is the only function that uses printf().  If printf() is\r
        used from any other function then some sort of mutual exclusion on stdout\r
        will be necessary.\r
-       \r
+\r
        This is also the only function that is permitted to access the LCD.\r
-       \r
+\r
        First print out the number of bytes that remain in the FreeRTOS heap.  This\r
        can be viewed in the terminal IO window within the IAR Embedded Workbench. */\r
        printf( "%d bytes of heap space remain unallocated\n", ( int ) xPortGetFreeHeapSize() );\r
-       \r
+\r
        /* Just as a test of the port, and for no functional reason, check the task\r
        parameter contains its expected value. */\r
        if( pvParameters != mainTASK_PARAMETER_CHECK_VALUE )\r
        {\r
                halLcdPrintLine( "Invalid parameter", ucLine,  OVERWRITE_TEXT );\r
-               ucLine++;               \r
+               ucLine++;\r
        }\r
 \r
        for( ;; )\r
@@ -342,7 +343,7 @@ unsigned char ucLine = 1;
                        halLcdClearScreen();\r
                        ucLine = 0;\r
                }\r
-               \r
+\r
                /* What is this message?  What does it contain? */\r
                switch( xReceivedMessage.cMessageID )\r
                {\r
@@ -361,9 +362,9 @@ unsigned char ucLine = 1;
                                                                                                the terminal IO window in the IAR\r
                                                                                                embedded workbench. */\r
                                                                                                printf( "\nTask\t     Abs Time\t     %%Time\n*****************************************" );\r
-                                                                                               vTaskGetRunTimeStats( ( signed char * ) cBuffer );\r
+                                                                                               vTaskGetRunTimeStats( cBuffer );\r
                                                                                                printf( cBuffer );\r
-                                                                                               \r
+\r
                                                                                                /* Also print out a message to\r
                                                                                                the LCD - in this case the\r
                                                                                                pointer to the string to print\r
@@ -374,7 +375,7 @@ unsigned char ucLine = 1;
                                                                                                technique. */\r
                                                                                                sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.ulMessageValue );\r
                                                                                                break;\r
-                                                                                               \r
+\r
                        case mainMESSAGE_STATUS                 :       /* The tick interrupt hook\r
                                                                                                function has just informed this\r
                                                                                                task of the system status.\r
@@ -382,11 +383,11 @@ unsigned char ucLine = 1;
                                                                                                with the status value. */\r
                                                                                                prvGenerateStatusMessage( cBuffer, xReceivedMessage.ulMessageValue );\r
                                                                                                break;\r
-                                                                                               \r
+\r
                        default                                                 :       sprintf( cBuffer, "Unknown message" );\r
                                                                                                break;\r
                }\r
-               \r
+\r
                /* Output the message that was placed into the cBuffer array within the\r
                switch statement above, then move onto the next line ready for the next\r
                message to arrive on the queue. */\r
@@ -429,13 +430,13 @@ xQueueMessage xMessage;
        {\r
                /* Check the button state. */\r
                ucState = ( halButtonsPressed() & BUTTON_UP );\r
-               \r
+\r
                if( ucState != 0 )\r
                {\r
                        /* The button was pressed. */\r
                        ucState = pdTRUE;\r
                }\r
-               \r
+\r
                if( ucState != ucLastState )\r
                {\r
                        /* The state has changed, send a message to the LCD task. */\r
@@ -444,10 +445,10 @@ xQueueMessage xMessage;
                        ucLastState = ucState;\r
                        xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY );\r
                }\r
-               \r
+\r
                /* Block for 10 milliseconds so this task does not utilise all the CPU\r
                time and debouncing of the button is not necessary. */\r
-               vTaskDelay( 10 / portTICK_RATE_MS );\r
+               vTaskDelay( 10 / portTICK_PERIOD_MS );\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -471,7 +472,7 @@ static void prvSetupHardware( void )
        halLcdInit();\r
        halLcdSetContrast( 100 );\r
        halLcdClearScreen();\r
-       \r
+\r
        halLcdPrintLine( " www.FreeRTOS.org", 0,  OVERWRITE_TEXT );\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -480,7 +481,7 @@ void vApplicationTickHook( void )
 {\r
 static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0;\r
 static unsigned long ulCounter = 0;\r
-static const unsigned long ulCheckFrequency = 5000UL / portTICK_RATE_MS;\r
+static const unsigned long ulCheckFrequency = 5000UL / portTICK_PERIOD_MS;\r
 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
 \r
 /* Define the status message that is sent to the LCD task.  By default the\r
@@ -506,11 +507,11 @@ static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };
                {\r
                        xStatusMessage.ulMessageValue = mainERROR_DYNAMIC_TASKS;\r
                }\r
-               \r
+\r
                if( xAreGenericQueueTasksStillRunning() != pdPASS )\r
                {\r
                        xStatusMessage.ulMessageValue = mainERROR_GEN_QUEUE_TEST;\r
-               }                       \r
+               }\r
 \r
                /* Check the reg test tasks are still cycling.  They will stop\r
                incrementing their loop counters if they encounter an error. */\r
@@ -526,7 +527,7 @@ static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };
 \r
                usLastRegTest1Counter = usRegTest1Counter;\r
                usLastRegTest2Counter = usRegTest2Counter;\r
-               \r
+\r
                /* As this is the tick hook the lHigherPriorityTaskWoken parameter is not\r
                needed (a context switch is going to be performed anyway), but it must\r
                still be provided. */\r
@@ -563,7 +564,7 @@ portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
        xQueueSendFromISR( xLCDQueue, &xMessage, &xHigherPriorityTaskWoken );\r
 \r
        P2IFG = 0;\r
-       \r
+\r
        /* If writing to xLCDQueue caused a task to unblock, and the unblocked task\r
        has a priority equal to or above the task that this interrupt interrupted,\r
        then lHigherPriorityTaskWoken will have been set to pdTRUE internally within\r
@@ -625,11 +626,11 @@ void vApplicationMallocFailedHook( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )\r
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )\r
 {\r
        ( void ) pxTask;\r
        ( void ) pcTaskName;\r
-       \r
+\r
        /* Run time stack overflow checking is performed if\r
        configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2.  This hook\r
        function is called if a stack overflow is detected. */\r