]> git.sur5r.net Git - freertos/commitdiff
Minor formatting and name changes only.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 26 Mar 2010 10:03:32 +0000 (10:03 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 26 Mar 2010 10:03:32 +0000 (10:03 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1002 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/CORTUS_APS3_GCC/Demo/7seg.c
Demo/CORTUS_APS3_GCC/Demo/serial.c

index 2d7159895bca84984d4d7ead574ce6ae0f7b31d2..8d7d6ef2f3d94e230691755407a18f336d9da441 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.\r
+    FreeRTOS V6.0.4 - Copyright (C) 2010 Real Time Engineers Ltd.\r
 \r
     ***************************************************************************\r
     *                                                                         *\r
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
     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
+    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
 \r
@@ -51,6 +51,7 @@
     licensing and training services.\r
 */\r
 \r
+\r
 #include <stdlib.h>\r
 \r
 /* Scheduler include files. */\r
 \r
 #define x7segSTACK_SIZE                        configMINIMAL_STACK_SIZE\r
 \r
-static portTASK_FUNCTION_PROTO( vRefreshTask, pvParameters );\r
-static portTASK_FUNCTION_PROTO( vCountTask, pvParameters );\r
+static void prvRefreshTask( void *pvParameters );\r
+static void prvCountTask( void *pvParameters );\r
+\r
+/* Value to output to 7 segment display\r
+led_digits[0] is the right most digit */\r
+static signed char seg7_digits[4];\r
 \r
 void vStart7SegTasks( unsigned portBASE_TYPE uxPriority )\r
 {\r
-       xTaskCreate (vRefreshTask, ( signed char * ) "7SegRefresh", x7segSTACK_SIZE, NULL, uxPriority, ( xTaskHandle *) NULL );\r
-       xTaskCreate (vCountTask,   ( signed char * ) "7SegCount",       x7segSTACK_SIZE, NULL, uxPriority, ( xTaskHandle *) NULL );\r
+       xTaskCreate( prvRefreshTask, ( signed char * ) "7SegRefresh", x7segSTACK_SIZE, NULL, uxPriority, ( xTaskHandle *) NULL );\r
+       xTaskCreate( prvCountTask,   ( signed char * ) "7SegCount",     x7segSTACK_SIZE, NULL, uxPriority, ( xTaskHandle *) NULL );\r
 }\r
+/*-----------------------------------------------------------*/\r
 \r
-/* Value to output to 7 segment display \r
-led_digits[0] is the right most digit */\r
-static signed char seg7_digits[4];\r
-\r
-static portTASK_FUNCTION_PROTO( vRefreshTask, pvParameters )\r
+static void prvRefreshTask( void *pvParameters )\r
 {\r
 /* This is table 3.3 from the Spartan-3 Starter Kit board user guide */\r
-const unsigned char bits[16] = {\r
+const unsigned char bits[ 16 ] =\r
+{\r
        0x01,\r
        0x4f,\r
        0x12,\r
@@ -98,13 +101,14 @@ const unsigned char bits[16] = {
        0x38\r
 };\r
 \r
-const unsigned char apsx[4] = {\r
+const unsigned char apsx[4] =\r
+{\r
        0x06, /* 3 */\r
        0x24, /* S */\r
        0x18, /* P */\r
        0x08  /* A */\r
 };\r
-       \r
+\r
 portTickType xRefreshRate, xLastRefreshTime;\r
 \r
 /* Digit to scan */\r
@@ -112,60 +116,66 @@ static int d = 0;
 \r
        xRefreshRate = 2;\r
 \r
-       /* We need to initialise xLastRefreshTime prior to the first call to \r
+       /* We need to initialise xLastRefreshTime prior to the first call to\r
        vTaskDelayUntil(). */\r
        xLastRefreshTime = xTaskGetTickCount();\r
 \r
        for (;;)\r
        {\r
-               for (d = 0; d < 4; d++)\r
+               for( d = 0; d < 4; d++ )\r
                {\r
-                       vTaskDelayUntil ( &xLastRefreshTime, xRefreshRate);\r
-                       \r
+                       vTaskDelayUntil ( &xLastRefreshTime, xRefreshRate );\r
+\r
                        /* Display digit */\r
                        gpio->out.an  = -1;\r
-                       if (seg7_digits[1] == 4 || seg7_digits[1] == 5) {\r
-                               gpio->out.digit = apsx[d];\r
-                       } else {\r
-                               gpio->out.digit = bits[seg7_digits[d]];\r
+                       if( ( seg7_digits[ 1 ] == 4 ) || ( seg7_digits[ 1 ] == 5 ) )\r
+                       {\r
+                               gpio->out.digit = apsx[ d ];\r
+                       }\r
+                       else\r
+                       {\r
+                               gpio->out.digit = bits[ seg7_digits[ d ] ];\r
                        }\r
+\r
                        gpio->out.dp = 1;\r
                        gpio->out.an  = ~(1 << d);\r
                }\r
        }\r
 }\r
+/*-----------------------------------------------------------*/\r
 \r
-\r
-\r
-static portTASK_FUNCTION_PROTO( vCountTask, pvParameters )\r
+static void prvCountTask( void *pvParameters )\r
 {\r
 portTickType xCountRate, xLastCountTime;\r
 \r
-\r
        /* Approximately 20HZ */\r
-       xCountRate = configTICK_RATE_HZ/20;\r
+       xCountRate = configTICK_RATE_HZ / 20;\r
 \r
-       /* We need to initialise xLastCountTime prior to the first call to \r
+       /* We need to initialise xLastCountTime prior to the first call to\r
        vTaskDelayUntil(). */\r
        xLastCountTime = xTaskGetTickCount();\r
 \r
        for (;;)\r
        {\r
-               vTaskDelayUntil ( &xLastCountTime, xCountRate);\r
-       \r
+               vTaskDelayUntil( &xLastCountTime, xCountRate );\r
+\r
                /* Really ugly way to do BCD arithmetic.... */\r
-               seg7_digits[0] -= 1;\r
-               if (seg7_digits[0] < 0) {\r
-                       seg7_digits[0] = 9;\r
-                       seg7_digits[1] -= 1;\r
-                       if (seg7_digits[1] < 0) {\r
-                               seg7_digits[1] = 9;\r
-                               seg7_digits[2] -= 1;\r
-                               if (seg7_digits[2] < 0) {\r
-                                       seg7_digits[2] = 9;\r
-                                       seg7_digits[3] -= 1;\r
-                                       if (seg7_digits[3] < 0) {\r
-                                               seg7_digits[3] = 9;\r
+               seg7_digits[ 0 ] -= 1;\r
+               if( seg7_digits[ 0 ] < 0 )\r
+               {\r
+                       seg7_digits[ 0 ] = 9;\r
+                       seg7_digits[ 1 ] -= 1;\r
+                       if( seg7_digits[ 1 ] < 0 )\r
+                       {\r
+                               seg7_digits[ 1 ] = 9;\r
+                               seg7_digits[ 2 ] -= 1;\r
+                               if( seg7_digits[ 2 ] < 0 )\r
+                               {\r
+                                       seg7_digits[ 2 ] = 9;\r
+                                       seg7_digits[ 3 ] -= 1;\r
+                                       if( seg7_digits[ 3 ] < 0 )\r
+                                       {\r
+                                               seg7_digits[ 3 ] = 9;\r
                                        }\r
                                }\r
                        }\r
@@ -173,6 +183,4 @@ portTickType xCountRate, xLastCountTime;
        }\r
 }\r
 \r
-// Local Variables:\r
-// tab-width:4\r
-// End:\r
+\r
index 0fe1b9482b245b957805c405d0e738b263b2cef1..81a68e5443d79af5c86444aca2b96579b9b314a4 100644 (file)
@@ -68,7 +68,7 @@
 #include "serial.h"
 /*-----------------------------------------------------------*/
 
-#define COM_BLOCK_RETRYTIME                            10
+#define comBLOCK_RETRY_TIME                            10
 /*-----------------------------------------------------------*/
 
 void vUARTInterruptHandlerTxWrapper(void) __attribute((naked));
@@ -132,7 +132,7 @@ void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString
        for( i = 0; i < usStringLength; i++ )
        {
                /* Block until character has been transmitted. */
-               while( xSerialPutChar( pxPort, *pChNext, COM_BLOCK_RETRYTIME ) != pdTRUE ); pChNext++;
+               while( xSerialPutChar( pxPort, *pChNext, comBLOCK_RETRY_TIME ) != pdTRUE ); pChNext++;
        }
 }