From: richardbarry Date: Fri, 26 Mar 2010 10:03:32 +0000 (+0000) Subject: Minor formatting and name changes only. X-Git-Tag: V6.0.5~16 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=530cc46ca35f90659e751754e832a8c13b9d19cc;p=freertos Minor formatting and name changes only. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1002 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/CORTUS_APS3_GCC/Demo/7seg.c b/Demo/CORTUS_APS3_GCC/Demo/7seg.c index 2d7159895..8d7d6ef2f 100644 --- a/Demo/CORTUS_APS3_GCC/Demo/7seg.c +++ b/Demo/CORTUS_APS3_GCC/Demo/7seg.c @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.0.4 - Copyright (C) 2010 Real Time Engineers Ltd. *************************************************************************** * * @@ -33,9 +33,9 @@ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License and the FreeRTOS license exception along with FreeRTOS; if not it - can be viewed here: http://www.freertos.org/a00114.html and also obtained + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained by writing to Richard Barry, contact details for whom are available on the FreeRTOS WEB site. @@ -51,6 +51,7 @@ licensing and training services. */ + #include /* Scheduler include files. */ @@ -63,23 +64,25 @@ #define x7segSTACK_SIZE configMINIMAL_STACK_SIZE -static portTASK_FUNCTION_PROTO( vRefreshTask, pvParameters ); -static portTASK_FUNCTION_PROTO( vCountTask, pvParameters ); +static void prvRefreshTask( void *pvParameters ); +static void prvCountTask( void *pvParameters ); + +/* Value to output to 7 segment display +led_digits[0] is the right most digit */ +static signed char seg7_digits[4]; void vStart7SegTasks( unsigned portBASE_TYPE uxPriority ) { - xTaskCreate (vRefreshTask, ( signed char * ) "7SegRefresh", x7segSTACK_SIZE, NULL, uxPriority, ( xTaskHandle *) NULL ); - xTaskCreate (vCountTask, ( signed char * ) "7SegCount", x7segSTACK_SIZE, NULL, uxPriority, ( xTaskHandle *) NULL ); + xTaskCreate( prvRefreshTask, ( signed char * ) "7SegRefresh", x7segSTACK_SIZE, NULL, uxPriority, ( xTaskHandle *) NULL ); + xTaskCreate( prvCountTask, ( signed char * ) "7SegCount", x7segSTACK_SIZE, NULL, uxPriority, ( xTaskHandle *) NULL ); } +/*-----------------------------------------------------------*/ -/* Value to output to 7 segment display -led_digits[0] is the right most digit */ -static signed char seg7_digits[4]; - -static portTASK_FUNCTION_PROTO( vRefreshTask, pvParameters ) +static void prvRefreshTask( void *pvParameters ) { /* This is table 3.3 from the Spartan-3 Starter Kit board user guide */ -const unsigned char bits[16] = { +const unsigned char bits[ 16 ] = +{ 0x01, 0x4f, 0x12, @@ -98,13 +101,14 @@ const unsigned char bits[16] = { 0x38 }; -const unsigned char apsx[4] = { +const unsigned char apsx[4] = +{ 0x06, /* 3 */ 0x24, /* S */ 0x18, /* P */ 0x08 /* A */ }; - + portTickType xRefreshRate, xLastRefreshTime; /* Digit to scan */ @@ -112,60 +116,66 @@ static int d = 0; xRefreshRate = 2; - /* We need to initialise xLastRefreshTime prior to the first call to + /* We need to initialise xLastRefreshTime prior to the first call to vTaskDelayUntil(). */ xLastRefreshTime = xTaskGetTickCount(); for (;;) { - for (d = 0; d < 4; d++) + for( d = 0; d < 4; d++ ) { - vTaskDelayUntil ( &xLastRefreshTime, xRefreshRate); - + vTaskDelayUntil ( &xLastRefreshTime, xRefreshRate ); + /* Display digit */ gpio->out.an = -1; - if (seg7_digits[1] == 4 || seg7_digits[1] == 5) { - gpio->out.digit = apsx[d]; - } else { - gpio->out.digit = bits[seg7_digits[d]]; + if( ( seg7_digits[ 1 ] == 4 ) || ( seg7_digits[ 1 ] == 5 ) ) + { + gpio->out.digit = apsx[ d ]; + } + else + { + gpio->out.digit = bits[ seg7_digits[ d ] ]; } + gpio->out.dp = 1; gpio->out.an = ~(1 << d); } } } +/*-----------------------------------------------------------*/ - - -static portTASK_FUNCTION_PROTO( vCountTask, pvParameters ) +static void prvCountTask( void *pvParameters ) { portTickType xCountRate, xLastCountTime; - /* Approximately 20HZ */ - xCountRate = configTICK_RATE_HZ/20; + xCountRate = configTICK_RATE_HZ / 20; - /* We need to initialise xLastCountTime prior to the first call to + /* We need to initialise xLastCountTime prior to the first call to vTaskDelayUntil(). */ xLastCountTime = xTaskGetTickCount(); for (;;) { - vTaskDelayUntil ( &xLastCountTime, xCountRate); - + vTaskDelayUntil( &xLastCountTime, xCountRate ); + /* Really ugly way to do BCD arithmetic.... */ - seg7_digits[0] -= 1; - if (seg7_digits[0] < 0) { - seg7_digits[0] = 9; - seg7_digits[1] -= 1; - if (seg7_digits[1] < 0) { - seg7_digits[1] = 9; - seg7_digits[2] -= 1; - if (seg7_digits[2] < 0) { - seg7_digits[2] = 9; - seg7_digits[3] -= 1; - if (seg7_digits[3] < 0) { - seg7_digits[3] = 9; + seg7_digits[ 0 ] -= 1; + if( seg7_digits[ 0 ] < 0 ) + { + seg7_digits[ 0 ] = 9; + seg7_digits[ 1 ] -= 1; + if( seg7_digits[ 1 ] < 0 ) + { + seg7_digits[ 1 ] = 9; + seg7_digits[ 2 ] -= 1; + if( seg7_digits[ 2 ] < 0 ) + { + seg7_digits[ 2 ] = 9; + seg7_digits[ 3 ] -= 1; + if( seg7_digits[ 3 ] < 0 ) + { + seg7_digits[ 3 ] = 9; } } } @@ -173,6 +183,4 @@ portTickType xCountRate, xLastCountTime; } } -// Local Variables: -// tab-width:4 -// End: + diff --git a/Demo/CORTUS_APS3_GCC/Demo/serial.c b/Demo/CORTUS_APS3_GCC/Demo/serial.c index 0fe1b9482..81a68e544 100644 --- a/Demo/CORTUS_APS3_GCC/Demo/serial.c +++ b/Demo/CORTUS_APS3_GCC/Demo/serial.c @@ -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++; } }