]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_STM32L152_IAR/main.c
Start to remove unnecessary 'signed char *' casts from strings that are now just...
[freertos] / FreeRTOS / Demo / CORTEX_STM32L152_IAR / main.c
index ef7e96bcb1f548d9a93e3811ac0a89316aea556b..10dfd992c4311640bb1e1318d5e39c4c10624dc5 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -238,11 +238,11 @@ void main( void )
        /* Configure the peripherals used by this demo application.  This includes\r
        configuring the joystick input select button to generate interrupts. */\r
        prvSetupHardware();\r
-       \r
+\r
        /* Create the queue used by tasks and interrupts to send strings to the LCD\r
        task. */\r
        xLCDQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( xQueueMessage ) );\r
-       \r
+\r
        /* If the queue could not be created then don't create any tasks that might\r
        attempt to use the queue. */\r
        if( xLCDQueue != NULL )\r
@@ -250,22 +250,22 @@ void main( void )
                /* Add the created queue to the queue registry so it can be viewed in\r
                the IAR FreeRTOS state viewer plug-in. */\r
                vQueueAddToRegistry( xLCDQueue, "LCDQueue" );\r
-               \r
+\r
                /* Create the LCD and button poll tasks, as described at the top of this\r
                file. */\r
-               xTaskCreate( prvLCDTask, ( signed char * ) "LCD", mainLCD_TASK_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );\r
-               xTaskCreate( prvButtonPollTask, ( signed char * ) "ButPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
-               \r
+               xTaskCreate( prvLCDTask, "LCD", mainLCD_TASK_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );\r
+               xTaskCreate( prvButtonPollTask, "ButPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+\r
                /* Create a subset of the standard demo tasks. */\r
                vStartDynamicPriorityTasks();\r
                vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );\r
                vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
                vStartGenericQueueTasks( mainGENERIC_QUEUE_TEST_PRIORITY );\r
-               \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
@@ -289,9 +289,9 @@ static char cBuffer[ 512 ];
        /* 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", xPortGetFreeHeapSize() );\r
@@ -311,7 +311,7 @@ static char cBuffer[ 512 ];
                        LCD_Clear( Blue );\r
                        lLine = 0;\r
                }\r
-                               \r
+\r
                /* What is this message?  What does it contain? */\r
                switch( xReceivedMessage.cMessageID )\r
                {\r
@@ -330,9 +330,9 @@ static char cBuffer[ 512 ];
                                                                                                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
@@ -343,7 +343,7 @@ static char cBuffer[ 512 ];
                                                                                                technique. */\r
                                                                                                sprintf( cBuffer, "%s", ( char * ) xReceivedMessage.lMessageValue );\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
@@ -351,15 +351,15 @@ static char cBuffer[ 512 ];
                                                                                                with the status value. */\r
                                                                                                prvGenerateStatusMessage( cBuffer, xReceivedMessage.lMessageValue );\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. */\r
                LCD_DisplayStringLine( lLine, ( uint8_t * ) cBuffer );\r
-               \r
+\r
                /* Move onto the next LCD line, ready for the next iteration of this\r
                loop. */\r
                lLine += lFontHeight;\r
@@ -377,7 +377,7 @@ static void prvGenerateStatusMessage( char *pcBuffer, long lStatusValue )
                                                                                        break;\r
                case mainERROR_DYNAMIC_TASKS    :       sprintf( pcBuffer, "Error: Dynamic tasks" );\r
                                                                                        break;\r
-               case mainERROR_COM_TEST                 :       sprintf( pcBuffer, "Err: loop connected?" ); /* Error in COM test - is the Loopback connector connected? */                                                                                                             \r
+               case mainERROR_COM_TEST                 :       sprintf( pcBuffer, "Err: loop connected?" ); /* Error in COM test - is the Loopback connector connected? */\r
                                                                                        break;\r
                case mainERROR_GEN_QUEUE_TEST   :       sprintf( pcBuffer, "Error: Gen Q test" );\r
                                                                                        break;\r
@@ -396,9 +396,9 @@ long lHigherPriorityTaskWoken = pdFALSE;
        /* This is the interrupt handler for the joystick select button input.\r
        The button has been pushed, write a message to the LCD via the LCD task. */\r
        xQueueSendFromISR( xLCDQueue, &xMessage, &lHigherPriorityTaskWoken );\r
-       \r
+\r
        EXTI_ClearITPendingBit( SEL_BUTTON_EXTI_LINE );\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
@@ -432,17 +432,17 @@ static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };
                {\r
                        xStatusMessage.lMessageValue = mainERROR_DYNAMIC_TASKS;\r
                }\r
-               \r
+\r
                if( xAreComTestTasksStillRunning() != pdPASS )\r
                {\r
                        xStatusMessage.lMessageValue = mainERROR_COM_TEST;\r
                }\r
-               \r
+\r
                if( xAreGenericQueueTasksStillRunning() != pdPASS )\r
                {\r
                        xStatusMessage.lMessageValue = mainERROR_GEN_QUEUE_TEST;\r
                }\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
@@ -472,7 +472,7 @@ xQueueMessage xMessage;
                        lLastState = lState;\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
@@ -485,7 +485,7 @@ static void prvSetupHardware( void )
        /* Ensure that all 4 interrupt priority bits are used as the pre-emption\r
        priority. */\r
        NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );\r
-       \r
+\r
        /* Initialise the LEDs. */\r
        vParTestInitialise();\r
 \r
@@ -494,7 +494,7 @@ static void prvSetupHardware( void )
        STM_EVAL_PBInit( BUTTON_DOWN, BUTTON_MODE_GPIO );\r
        STM_EVAL_PBInit( BUTTON_LEFT, BUTTON_MODE_GPIO );\r
        STM_EVAL_PBInit( BUTTON_RIGHT, BUTTON_MODE_GPIO );\r
-       \r
+\r
        /* The select button in the middle of the joystick is configured to generate\r
        an interrupt.  The Eval board library will configure the interrupt\r
        priority to be the lowest priority available so the priority need not be\r
@@ -504,7 +504,7 @@ static void prvSetupHardware( void )
        STM_EVAL_PBInit( BUTTON_SEL, BUTTON_MODE_EXTI );\r
 \r
        /* Initialize the LCD */\r
-       STM32L152_LCD_Init();   \r
+       STM32L152_LCD_Init();\r
        LCD_Clear( Blue );\r
        LCD_SetBackColor( Blue );\r
        LCD_SetTextColor( White );\r
@@ -524,7 +524,7 @@ NVIC_InitTypeDef NVIC_InitStructure;
        significant two bytes are given by the current TIM6 counter value.  Care\r
        must be taken with data consistency when combining the two in case a timer\r
        overflow occurs as the value is being read.\r
-       \r
+\r
        The portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() macro (in FreeRTOSConfig.h) is\r
        defined to call this function, so the kernel will call this function\r
        automatically at the appropriate time. */\r
@@ -538,22 +538,22 @@ NVIC_InitTypeDef NVIC_InitStructure;
        TIM_TimeBaseStructure.TIM_Prescaler = 5000;\r
        TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;\r
        TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;\r
-       \r
+\r
        TIM_TimeBaseInit( TIM6, &TIM_TimeBaseStructure );\r
-       \r
+\r
        /* Only interrupt on overflow events. */\r
        TIM6->CR1 |= TIM_CR1_URS;\r
-       \r
+\r
        /* Enable the interrupt. */\r
        TIM_ITConfig( TIM6, TIM_IT_Update, ENABLE );\r
-       \r
+\r
        /* Enable the TIM6 global Interrupt */\r
        NVIC_InitStructure.NVIC_IRQChannel = TIM6_IRQn;\r
        NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_LOWEST_INTERRUPT_PRIORITY;\r
        NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00; /* Not used as 4 bits are used for the pre-emption priority. */\r
        NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\r
        NVIC_Init(&NVIC_InitStructure);\r
-       \r
+\r
        TIM_ClearITPendingBit( TIM6, TIM_IT_Update );\r
        TIM_Cmd( TIM6, ENABLE );\r
 }\r
@@ -562,7 +562,7 @@ NVIC_InitTypeDef NVIC_InitStructure;
 void TIM6_IRQHandler( void )\r
 {\r
        /* Interrupt handler for TIM 6\r
-       \r
+\r
        The time base for the run time stats is generated by the 16 bit timer 6.\r
        Each time the timer overflows ulTIM6_OverflowCount is incremented.\r
        Therefore, when converting the total run time to a 32 bit number, the most\r
@@ -582,7 +582,7 @@ void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName
 {\r
        ( void ) pcTaskName;\r
        ( void ) pxTask;\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