]> git.sur5r.net Git - freertos/blobdiff - Demo/ARM7_LPC2106_GCC/serial/serial.c
Remove unnecessary use of portLONG, portCHAR and portSHORT.
[freertos] / Demo / ARM7_LPC2106_GCC / serial / serial.c
index 9c23caeb6175489d0370cec16c64719b6c5d5655..f30bc46f571bf4dd7c724b04637000e302bb19fd 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 serUART0_VIC_CHANNEL                   ( ( unsigned portLONG ) 0x0006 )\r
-#define serUART0_VIC_CHANNEL_BIT               ( ( unsigned portLONG ) 0x0040 )\r
-#define serUART0_VIC_ENABLE                            ( ( unsigned portLONG ) 0x0020 )\r
-#define serCLEAR_VIC_INTERRUPT                 ( ( unsigned portLONG ) 0 )\r
+#define serUART0_VIC_CHANNEL                   ( ( unsigned long ) 0x0006 )\r
+#define serUART0_VIC_CHANNEL_BIT               ( ( unsigned long ) 0x0040 )\r
+#define serUART0_VIC_ENABLE                            ( ( unsigned long ) 0x0020 )\r
+#define serCLEAR_VIC_INTERRUPT                 ( ( unsigned long ) 0 )\r
 \r
 #define serINVALID_QUEUE                               ( ( xQueueHandle ) 0 )\r
 #define serHANDLE                                              ( ( xComPortHandle ) 1 )\r
@@ -116,19 +117,19 @@ static xQueueHandle xCharsForTx;
 /*-----------------------------------------------------------*/\r
 \r
 /* Communication flag between the interrupt service routine and serial API. */\r
-static volatile portLONG *plTHREEmpty;\r
+static volatile long *plTHREEmpty;\r
 \r
 /* \r
  * The queues are created in serialISR.c as they are used from the ISR.\r
  * Obtain references to the queues and THRE Empty flag. \r
  */\r
-extern void vSerialISRCreateQueues(    unsigned portBASE_TYPE uxQueueLength, xQueueHandle *pxRxedChars, xQueueHandle *pxCharsForTx, portLONG volatile **pplTHREEmptyFlag );\r
+extern void vSerialISRCreateQueues(    unsigned portBASE_TYPE uxQueueLength, xQueueHandle *pxRxedChars, xQueueHandle *pxCharsForTx, long volatile **pplTHREEmptyFlag );\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
 extern void ( vUART_ISR_Wrapper )( void );\r
 \r
@@ -139,7 +140,7 @@ extern void ( vUART_ISR_Wrapper )( void );
        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
@@ -152,9 +153,9 @@ extern void ( vUART_ISR_Wrapper )( void );
                        UART0_LCR |= serDLAB;\r
 \r
                        /* Setup the divisor. */\r
-                       UART0_DLL = ( unsigned portCHAR ) ( ulDivisor & ( unsigned portLONG ) 0xff );\r
+                       UART0_DLL = ( unsigned char ) ( ulDivisor & ( unsigned long ) 0xff );\r
                        ulDivisor >>= 8;\r
-                       UART0_DLM = ( unsigned portCHAR ) ( ulDivisor & ( unsigned portLONG ) 0xff );\r
+                       UART0_DLM = ( unsigned char ) ( ulDivisor & ( unsigned long ) 0xff );\r
 \r
                        /* Turn on the FIFO's and clear the buffers. */\r
                        UART0_FCR = ( serFIFO_ON | serCLEAR_FIFO );\r
@@ -165,7 +166,7 @@ extern void ( vUART_ISR_Wrapper )( void );
                        /* Setup the VIC for the UART. */\r
                        VICIntSelect &= ~( serUART0_VIC_CHANNEL_BIT );\r
                        VICIntEnable |= serUART0_VIC_CHANNEL_BIT;\r
-                       VICVectAddr1 = ( portLONG ) vUART_ISR_Wrapper;\r
+                       VICVectAddr1 = ( long ) vUART_ISR_Wrapper;\r
                        VICVectCntl1 = serUART0_VIC_CHANNEL | serUART0_VIC_ENABLE;\r
 \r
                        /* Enable UART0 interrupts. */\r
@@ -182,7 +183,7 @@ extern void ( vUART_ISR_Wrapper )( void );
 }\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
@@ -200,9 +201,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
@@ -212,7 +213,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
@@ -221,7 +222,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
@@ -231,7 +232,7 @@ signed portBASE_TYPE xReturn;
        portENTER_CRITICAL();\r
        {\r
                /* Is there space to write directly to the UART? */\r
-               if( *plTHREEmpty == ( portLONG ) pdTRUE )\r
+               if( *plTHREEmpty == ( long ) pdTRUE )\r
                {\r
                        /* We wrote the character directly to the UART, so was \r
                        successful. */\r
@@ -250,7 +251,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( ( *plTHREEmpty == ( portLONG ) pdTRUE ) && ( xReturn == pdPASS ) )\r
+                       if( ( *plTHREEmpty == ( long ) pdTRUE ) && ( xReturn == pdPASS ) )\r
                        {\r
                                xQueueReceive( xCharsForTx, &cOutChar, serNO_BLOCK );\r
                                *plTHREEmpty = pdFALSE;\r