]> git.sur5r.net Git - freertos/blobdiff - Demo/ARM7_LPC2129_Keil_RVDS/serial/serial.c
Remove unnecessary use of portLONG, portCHAR and portSHORT.
[freertos] / Demo / ARM7_LPC2129_Keil_RVDS / serial / serial.c
index 6182188550824408284f4ad963f6522bdf526d9d..ed95fb8126fde34d0386d3030c7e55b68414d9c1 100644 (file)
@@ -1,48 +1,49 @@
 /*\r
-       FreeRTOS V5.4.2 - Copyright (C) 2009 Real Time Engineers Ltd.\r
+    FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.\r
 \r
-       This file is part of the FreeRTOS distribution.\r
+    This file is part of the FreeRTOS distribution.\r
 \r
-       FreeRTOS is free software; you can redistribute it and/or modify it     under \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
-       **NOTE** The exception to the GPL is included to allow you to distribute a\r
-       combined work that includes FreeRTOS without being obliged to provide the \r
-       source code for proprietary components outside of the FreeRTOS kernel.  \r
-       Alternative commercial license and support terms are also available upon \r
-       request.  See the licensing section of http://www.FreeRTOS.org for full \r
-       license details.\r
+    FreeRTOS is free software; you can redistribute it and/or modify it    under\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
+    **NOTE** The exception to the GPL is included to allow you to distribute a\r
+    combined work that includes FreeRTOS without being obliged to provide the\r
+    source code for proprietary components outside of the FreeRTOS kernel.\r
+    Alternative commercial license and support terms are also available upon\r
+    request.  See the licensing section of http://www.FreeRTOS.org for full\r
+    license details.\r
 \r
-       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.\r
+    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.\r
 \r
-       You should have received a copy of the GNU General Public License along\r
-       with FreeRTOS; if not, write to the Free Software Foundation, Inc., 59\r
-       Temple Place, Suite 330, Boston, MA  02111-1307  USA.\r
+    You should have received a copy of the GNU General Public License along\r
+    with FreeRTOS; if not, write to the Free Software Foundation, Inc., 59\r
+    Temple Place, Suite 330, Boston, MA  02111-1307  USA.\r
 \r
 \r
-       ***************************************************************************\r
-       *                                                                         *\r
-       * Looking for a quick start?  Then check out the FreeRTOS eBook!          *\r
-       * See http://www.FreeRTOS.org/Documentation for details                   *\r
-       *                                                                         *\r
-       ***************************************************************************\r
+    ***************************************************************************\r
+    *                                                                         *\r
+    * The FreeRTOS eBook and reference manual are available to purchase for a *\r
+    * small fee. Help yourself get started quickly while also helping the     *\r
+    * FreeRTOS project! See http://www.FreeRTOS.org/Documentation for details *\r
+    *                                                                         *\r
+    ***************************************************************************\r
 \r
-       1 tab == 4 spaces!\r
+    1 tab == 4 spaces!\r
 \r
-       Please ensure to read the configuration and relevant port sections of the\r
-       online documentation.\r
+    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
-       contact details.\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
-       critical systems.\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
-       licensing and training services.\r
+    http://www.OpenRTOS.com - Commercial support, development, porting,\r
+    licensing and training services.\r
 */\r
 \r
 \r
 /*-----------------------------------------------------------*/\r
 \r
 /* Constants to setup and access the UART. */\r
-#define serDLAB                                                        ( ( unsigned portCHAR ) 0x80 )\r
-#define serENABLE_INTERRUPTS                   ( ( unsigned portCHAR ) 0x03 )\r
-#define serNO_PARITY                                   ( ( unsigned portCHAR ) 0x00 )\r
-#define ser1_STOP_BIT                                  ( ( unsigned portCHAR ) 0x00 )\r
-#define ser8_BIT_CHARS                                 ( ( unsigned portCHAR ) 0x03 )\r
-#define serFIFO_ON                                             ( ( unsigned portCHAR ) 0x01 )\r
-#define serCLEAR_FIFO                                  ( ( unsigned portCHAR ) 0x06 )\r
-#define serWANTED_CLOCK_SCALING                        ( ( unsigned portLONG ) 16 )\r
+#define serDLAB                                                        ( ( unsigned char ) 0x80 )\r
+#define serENABLE_INTERRUPTS                   ( ( unsigned char ) 0x03 )\r
+#define serNO_PARITY                                   ( ( unsigned char ) 0x00 )\r
+#define ser1_STOP_BIT                                  ( ( unsigned char ) 0x00 )\r
+#define ser8_BIT_CHARS                                 ( ( unsigned char ) 0x03 )\r
+#define serFIFO_ON                                             ( ( unsigned char ) 0x01 )\r
+#define serCLEAR_FIFO                                  ( ( unsigned char ) 0x06 )\r
+#define serWANTED_CLOCK_SCALING                        ( ( unsigned long ) 16 )\r
 \r
 /* Constants to setup and access the VIC. */\r
-#define serU1VIC_CHANNEL                               ( ( unsigned portLONG ) 0x0007 )\r
-#define serU1VIC_CHANNEL_BIT                   ( ( unsigned portLONG ) 0x0080 )\r
-#define serU1VIC_ENABLE                                        ( ( unsigned portLONG ) 0x0020 )\r
+#define serU1VIC_CHANNEL                               ( ( unsigned long ) 0x0007 )\r
+#define serU1VIC_CHANNEL_BIT                   ( ( unsigned long ) 0x0080 )\r
+#define serU1VIC_ENABLE                                        ( ( unsigned long ) 0x0020 )\r
 \r
 /* Misc. */\r
 #define serINVALID_QUEUE                               ( ( xQueueHandle ) 0 )\r
 #define serNO_BLOCK                                            ( ( portTickType ) 0 )\r
 \r
 /* Constant to access the VIC. */\r
-#define serCLEAR_VIC_INTERRUPT                 ( ( unsigned portLONG ) 0 )\r
+#define serCLEAR_VIC_INTERRUPT                 ( ( unsigned long ) 0 )\r
 \r
 /* Constants to determine the ISR source. */\r
-#define serSOURCE_THRE                                 ( ( unsigned portCHAR ) 0x02 )\r
-#define serSOURCE_RX_TIMEOUT                   ( ( unsigned portCHAR ) 0x0c )\r
-#define serSOURCE_ERROR                                        ( ( unsigned portCHAR ) 0x06 )\r
-#define serSOURCE_RX                                   ( ( unsigned portCHAR ) 0x04 )\r
-#define serINTERRUPT_SOURCE_MASK               ( ( unsigned portCHAR ) 0x0f )\r
-#define serINTERRUPT_IS_PENDING                        ( ( unsigned portCHAR ) 0x01 )\r
+#define serSOURCE_THRE                                 ( ( unsigned char ) 0x02 )\r
+#define serSOURCE_RX_TIMEOUT                   ( ( unsigned char ) 0x0c )\r
+#define serSOURCE_ERROR                                        ( ( unsigned char ) 0x06 )\r
+#define serSOURCE_RX                                   ( ( unsigned char ) 0x04 )\r
+#define serINTERRUPT_SOURCE_MASK               ( ( unsigned char ) 0x0f )\r
+#define serINTERRUPT_IS_PENDING                        ( ( unsigned char ) 0x01 )\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
@@ -117,18 +118,18 @@ static xQueueHandle xRxedChars;
 static xQueueHandle xCharsForTx; \r
 \r
 /* Communication flag between the interrupt service routine and serial API. */\r
-static volatile portLONG lTHREEmpty;\r
+static volatile long lTHREEmpty;\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
-xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )\r
+xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )\r
 {\r
-unsigned portLONG ulDivisor, ulWantedClock;\r
+unsigned long ulDivisor, ulWantedClock;\r
 xComPortHandle xReturn = serHANDLE;\r
 \r
        /* Create the queues used to hold Rx and Tx characters. */\r
-       xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );\r
-       xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );\r
+       xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) );\r
+       xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) );\r
 \r
        /* Initialise the THRE empty flag. */\r
        lTHREEmpty = pdTRUE;\r
@@ -136,7 +137,7 @@ xComPortHandle xReturn = serHANDLE;
        if( \r
                ( xRxedChars != serINVALID_QUEUE ) && \r
                ( xCharsForTx != serINVALID_QUEUE ) && \r
-               ( ulWantedBaud != ( unsigned portLONG ) 0 ) \r
+               ( ulWantedBaud != ( unsigned long ) 0 ) \r
          )\r
        {\r
                portENTER_CRITICAL()\r
@@ -149,9 +150,9 @@ xComPortHandle xReturn = serHANDLE;
                        U1LCR |= serDLAB;\r
 \r
                        /* Setup the divisor. */\r
-                       U1DLL = ( unsigned portCHAR ) ( ulDivisor & ( unsigned portLONG ) 0xff );\r
+                       U1DLL = ( unsigned char ) ( ulDivisor & ( unsigned long ) 0xff );\r
                        ulDivisor >>= 8;\r
-                       U1DLM = ( unsigned portCHAR ) ( ulDivisor & ( unsigned portLONG ) 0xff );\r
+                       U1DLM = ( unsigned char ) ( ulDivisor & ( unsigned long ) 0xff );\r
 \r
                        /* Turn on the FIFO's and clear the buffers. */\r
                        U1FCR = ( serFIFO_ON | serCLEAR_FIFO );\r
@@ -162,7 +163,7 @@ xComPortHandle xReturn = serHANDLE;
                        /* Setup the VIC for the UART. */\r
                        VICIntSelect &= ~( serU1VIC_CHANNEL_BIT );\r
                        VICIntEnable |= serU1VIC_CHANNEL_BIT;\r
-                       VICVectAddr1 = ( unsigned portLONG ) vUART_ISREntry;\r
+                       VICVectAddr1 = ( unsigned long ) vUART_ISREntry;\r
                        VICVectCntl1 = serU1VIC_CHANNEL | serU1VIC_ENABLE;\r
 \r
                        /* Enable UART0 interrupts. */\r
@@ -179,7 +180,7 @@ xComPortHandle xReturn = serHANDLE;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )\r
+signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed char *pcRxedChar, portTickType xBlockTime )\r
 {\r
        /* The port handle is not required as this driver only supports UART0. */\r
        ( void ) pxPort;\r
@@ -197,9 +198,9 @@ signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcR
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength )\r
+void vSerialPutString( xComPortHandle pxPort, const signed char * const pcString, unsigned short usStringLength )\r
 {\r
-signed portCHAR *pxNext;\r
+signed char *pxNext;\r
 \r
        /* NOTE: This implementation does not handle the queue being full as no\r
        block time is used! */\r
@@ -209,7 +210,7 @@ signed portCHAR *pxNext;
        ( void ) usStringLength;\r
 \r
        /* Send each character in the string, one at a time. */\r
-       pxNext = ( signed portCHAR * ) pcString;\r
+       pxNext = ( signed char * ) pcString;\r
        while( *pxNext )\r
        {\r
                xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );\r
@@ -218,7 +219,7 @@ signed portCHAR *pxNext;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )\r
+signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed char cOutChar, portTickType xBlockTime )\r
 {\r
 signed portBASE_TYPE xReturn;\r
 \r
@@ -228,7 +229,7 @@ signed portBASE_TYPE xReturn;
        portENTER_CRITICAL();\r
        {\r
                /* Is there space to write directly to the UART? */\r
-               if( lTHREEmpty == ( portLONG ) pdTRUE )\r
+               if( lTHREEmpty == ( long ) pdTRUE )\r
                {\r
                        /* We wrote the character directly to the UART, so was \r
                        successful. */\r
@@ -248,7 +249,7 @@ signed portBASE_TYPE xReturn;
                        were blocked waiting to post interrupts were not disabled.  It is \r
                        possible that the serial ISR has emptied the Tx queue, in which\r
                        case we need to start the Tx off again. */\r
-                       if( lTHREEmpty == ( portLONG ) pdTRUE )\r
+                       if( lTHREEmpty == ( long ) pdTRUE )\r
                        {\r
                                xQueueReceive( xCharsForTx, &cOutChar, serNO_BLOCK );\r
                                lTHREEmpty = pdFALSE;\r
@@ -264,9 +265,9 @@ signed portBASE_TYPE xReturn;
 \r
 void vUART_ISRHandler( void )\r
 {\r
-signed portCHAR cChar;\r
+signed char cChar;\r
 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
-unsigned portCHAR ucInterrupt;\r
+unsigned char ucInterrupt;\r
 \r
        ucInterrupt = U1IIR;\r
 \r