]> git.sur5r.net Git - freertos/commitdiff
Allow the task priorities to be overwritten.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 16 Nov 2008 19:21:25 +0000 (19:21 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 16 Nov 2008 19:21:25 +0000 (19:21 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@548 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/Common/Minimal/blocktim.c

index ba72d77960e18a7e93440f1e4e972ea5876e1341..4d7dd0b8b1dc810064cf6498da71f85b039400f3 100644 (file)
        Please ensure to read the configuration and relevant port sections of the\r
        online documentation.\r
 \r
-       http://www.FreeRTOS.org - Documentation, latest information, license and \r
+       http://www.FreeRTOS.org - Documentation, latest information, license and\r
        contact details.\r
 \r
-       http://www.SafeRTOS.com - A version that is certified for use in safety \r
+       http://www.SafeRTOS.com - A version that is certified for use in safety\r
        critical systems.\r
 \r
-       http://www.OpenRTOS.com - Commercial support, development, porting, \r
+       http://www.OpenRTOS.com - Commercial support, development, porting,\r
        licensing and training services.\r
 */\r
 \r
 /* Demo includes. */\r
 #include "blocktim.h"\r
 \r
-/* Task priorities. */\r
-#define bktPRIMARY_PRIORITY                    ( 3 )\r
-#define bktSECONDARY_PRIORITY          ( 2 )\r
+/* Task priorities.  Allow these to be overridden. */\r
+#ifndef bktPRIMARY_PRIORITY\r
+       #define bktPRIMARY_PRIORITY                     ( 3 )\r
+#endif\r
+\r
+#ifndef bktSECONDARY_PRIORITY\r
+       #define bktSECONDARY_PRIORITY           ( 2 )\r
+#endif\r
 \r
 /* Task behaviour. */\r
 #define bktQUEUE_LENGTH                                ( 5 )\r
@@ -101,10 +106,10 @@ void vCreateBlockTimeTasks( void )
     xTestQueue = xQueueCreate( bktQUEUE_LENGTH, sizeof( portBASE_TYPE ) );\r
 \r
        /* vQueueAddToRegistry() adds the queue to the queue registry, if one is\r
-       in use.  The queue registry is provided as a means for kernel aware \r
+       in use.  The queue registry is provided as a means for kernel aware\r
        debuggers to locate queues and has no purpose if a kernel aware debugger\r
        is not being used.  The call to vQueueAddToRegistry() will be removed\r
-       by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is \r
+       by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is\r
        defined to be less than 1. */\r
        vQueueAddToRegistry( xTestQueue, ( signed portCHAR * ) "Block_Time_Queue" );\r
 \r
@@ -135,7 +140,7 @@ portTickType xTimeToBlock, xBlockedTime;
                        xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;\r
 \r
                        xTimeWhenBlocking = xTaskGetTickCount();\r
-                       \r
+\r
                        /* We should unblock after xTimeToBlock having not received\r
                        anything on the queue. */\r
                        if( xQueueReceive( xTestQueue, &xData, xTimeToBlock ) != errQUEUE_EMPTY )\r
@@ -186,7 +191,7 @@ portTickType xTimeToBlock, xBlockedTime;
                        xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;\r
 \r
                        xTimeWhenBlocking = xTaskGetTickCount();\r
-                       \r
+\r
                        /* We should unblock after xTimeToBlock having not received\r
                        anything on the queue. */\r
                        if( xQueueSend( xTestQueue, &xItem, xTimeToBlock ) != errQUEUE_FULL )\r
@@ -240,7 +245,7 @@ portTickType xTimeToBlock, xBlockedTime;
                for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )\r
                {\r
                        /* Now when we make space on the queue the other task should wake\r
-                       but not execute as this task has higher priority. */                            \r
+                       but not execute as this task has higher priority. */\r
                        if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )\r
                        {\r
                                xErrorOccurred = pdTRUE;\r
@@ -274,7 +279,7 @@ portTickType xTimeToBlock, xBlockedTime;
                        }\r
 \r
                        /* Set the priority back down. */\r
-                       vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );                  \r
+                       vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );\r
                }\r
 \r
                /* Let the other task timeout.  When it unblockes it will check that it\r
@@ -301,7 +306,7 @@ portTickType xTimeToBlock, xBlockedTime;
                                xErrorOccurred = pdTRUE;\r
                        }\r
                }\r
-               \r
+\r
                /* Wake the other task so it blocks attempting to read from  the\r
                already empty queue. */\r
                vTaskResume( xSecondary );\r
@@ -317,7 +322,7 @@ portTickType xTimeToBlock, xBlockedTime;
                for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )\r
                {\r
                        /* Now when we place an item on the queue the other task should\r
-                       wake but not execute as this task has higher priority. */                               \r
+                       wake but not execute as this task has higher priority. */\r
                        if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )\r
                        {\r
                                xErrorOccurred = pdTRUE;\r
@@ -349,7 +354,7 @@ portTickType xTimeToBlock, xBlockedTime;
                                queue function. */\r
                                xErrorOccurred = pdTRUE;\r
                        }\r
-                       vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );                  \r
+                       vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );\r
                }\r
 \r
                /* Let the other task timeout.  When it unblockes it will check that it\r
@@ -387,7 +392,7 @@ portBASE_TYPE xData;
                full so we block.  Note the time before we block so we can check the\r
                wake time is as per that expected. */\r
                xTimeWhenBlocking = xTaskGetTickCount();\r
-               \r
+\r
                /* We should unblock after bktTIME_TO_BLOCK having not received\r
                anything on the queue. */\r
                xData = 0;\r
@@ -423,7 +428,7 @@ portBASE_TYPE xData;
 \r
                As per test three, but with the send and receive reversed. */\r
                xTimeWhenBlocking = xTaskGetTickCount();\r
-               \r
+\r
                /* We should unblock after bktTIME_TO_BLOCK having not received\r
                anything on the queue. */\r
                xRunIndicator = bktRUN_INDICATOR;\r