]> git.sur5r.net Git - freertos/blobdiff - Demo/MCF5235_GCC/system/serial.c
Remove unnecessary use of portLONG, portCHAR and portSHORT.
[freertos] / Demo / MCF5235_GCC / system / serial.c
index 1c2e31e512066cc73d35f21c32b787ed54019f1a..32edb346cf631ebc271a90976eefeadcaa06fb47 100644 (file)
@@ -4,7 +4,7 @@
     This file is part of the FreeRTOS distribution.\r
 \r
     FreeRTOS is free software; you can redistribute it and/or modify\r
-    it under the terms of the GNU General Public License as published by\r
+    it under the terms of the GNU General Public License** as published by\r
     the Free Software Foundation; either version 2 of the License, or\r
     (at your option) any later version.\r
 \r
     ***************************************************************************\r
     ***************************************************************************\r
     *                                                                         *\r
-    * SAVE TIME AND MONEY!  We can port FreeRTOS.org to your own hardware,    *\r
-    * and even write all or part of your application on your behalf.          *\r
-    * See http://www.OpenRTOS.com for details of the services we provide to   *\r
-    * expedite your project.                                                  *\r
+    * Get the FreeRTOS eBook!  See http://www.FreeRTOS.org/Documentation      *\r
+       *                                                                         *\r
+       * This is a concise, step by step, 'hands on' guide that describes both   *\r
+       * general multitasking concepts and FreeRTOS specifics. It presents and   *\r
+       * explains numerous examples that are written using the FreeRTOS API.     *\r
+       * Full source code for all the examples is provided in an accompanying    *\r
+       * .zip file.                                                              *\r
     *                                                                         *\r
     ***************************************************************************\r
     ***************************************************************************\r
@@ -79,7 +82,7 @@ static xComPortIF_t xComPortIF[ COM_NIFACE ];
 \r
 /* ------------------------ Begin implementation -------------------------- */\r
 xComPortHandle\r
-xSerialPortInitMinimal( unsigned portLONG ulWantedBaud,\r
+xSerialPortInitMinimal( unsigned long ulWantedBaud,\r
                         unsigned portBASE_TYPE uxQueueLength )\r
 {\r
     extern void     ( *__RAMVEC[] ) (  );\r
@@ -88,9 +91,9 @@ xSerialPortInitMinimal( unsigned portLONG ulWantedBaud,
 \r
     /* Create the queues used to hold Rx and Tx characters. */\r
     xComPortIF[ 0 ].xRXChars =\r
-        xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE )sizeof( signed portCHAR ) );\r
+        xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE )sizeof( signed char ) );\r
     xComPortIF[ 0 ].xTXChars =\r
-        xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE )sizeof( signed portCHAR ) );\r
+        xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE )sizeof( signed char ) );\r
 \r
     /* If the queues were created correctly then setup the serial port hardware. */\r
     if( ( xComPortIF[ 0 ].xRXChars != 0 ) && ( xComPortIF[ 0 ].xTXChars != 0 ) )\r
@@ -141,7 +144,7 @@ xSerialPortInitMinimal( unsigned portLONG ulWantedBaud,
 }\r
 \r
 signed          portBASE_TYPE\r
-xSerialGetChar( xComPortHandle pxPort, signed portCHAR * pcRxedChar,\r
+xSerialGetChar( xComPortHandle pxPort, signed char * pcRxedChar,\r
                 portTickType xBlockTime )\r
 {\r
     int i;\r
@@ -169,14 +172,14 @@ xSerialGetChar( xComPortHandle pxPort, signed portCHAR * pcRxedChar,
 }\r
 \r
 void\r
-vSerialPutString( xComPortHandle pxPort, const signed portCHAR *\r
-                  const pcString, unsigned portSHORT usStringLength )\r
+vSerialPutString( xComPortHandle pxPort, const signed char *\r
+                  const pcString, unsigned short usStringLength )\r
 {\r
     int i;\r
-    signed portCHAR *pChNext;\r
+    signed char *pChNext;\r
 \r
     /* Send each character in the string, one at a time. */\r
-    pChNext = ( signed portCHAR * )pcString;\r
+    pChNext = ( signed char * )pcString;\r
     for( i = 0; i < usStringLength; i++ )\r
     {\r
         /* Block until character has been transmitted. */\r
@@ -185,7 +188,7 @@ vSerialPutString( xComPortHandle pxPort, const signed portCHAR *
 }\r
 \r
 signed          portBASE_TYPE\r
-xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar,\r
+xSerialPutChar( xComPortHandle pxPort, signed char cOutChar,\r
                 portTickType xBlockTime )\r
 {\r
     int i;\r
@@ -215,7 +218,7 @@ xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar,
 }\r
 \r
 signed          portBASE_TYPE\r
-xSerialPutCharNOISR( xComPortHandle pxPort, signed portCHAR cOutChar )\r
+xSerialPutCharNOISR( xComPortHandle pxPort, signed char cOutChar )\r
 {\r
     int i;\r
     portBASE_TYPE xResult = pdFALSE;\r
@@ -242,15 +245,15 @@ xSerialPutCharNOISR( xComPortHandle pxPort, signed portCHAR cOutChar )
 }\r
 \r
 void\r
-vSerialPutStringNOISR( xComPortHandle pxPort, const signed portCHAR *\r
-                       const pcString, unsigned portSHORT usStringLength )\r
+vSerialPutStringNOISR( xComPortHandle pxPort, const signed char *\r
+                       const pcString, unsigned short usStringLength )\r
 {\r
     int i;\r
-    signed portCHAR *pChNext;\r
+    signed char *pChNext;\r
     portBASE_TYPE xOldIPL = portSET_IPL( portIPL_MAX );\r
 \r
     /* Send each character in the string, one at a time. */\r
-    pChNext = ( signed portCHAR * )pcString;\r
+    pChNext = ( signed char * )pcString;\r
     for( i = 0; i < usStringLength; i++ )\r
     {\r
         /* Block until character has been transmitted. */\r
@@ -269,8 +272,8 @@ vSerialClose( xComPortHandle xPort )
 void\r
 prvSerialISR( void )\r
 {\r
-    static signed portCHAR cChar;\r
-    static portBASE_TYPE xTaskWokenByTx = pdFALSE, xTaskWokenByRx = pdFALSE;\r
+    static signed char cChar;\r
+    static portBASE_TYPE xHigherPriorityTaskWoken;\r
 \r
     /* We have to remvoe the effect of the GCC. Please note that the\r
      * __attribute__ ((interrupt_handler)) does not work here because we\r
@@ -285,12 +288,13 @@ prvSerialISR( void )
      * variable declarations.\r
      */\r
     portENTER_SWITCHING_ISR();\r
+       xHigherPriorityTaskWoken = pdFALSE;\r
 \r
     /* Ready to send a character from the buffer. */\r
     if( MCF_UART_USR0 & MCF_UART_USR_TXRDY )\r
     {\r
         /* Transmit buffer is ready. Test if there are characters available. */\r
-        if( xQueueReceiveFromISR( xComPortIF[ 0 ].xTXChars, &cChar, &xTaskWokenByTx ) ==\r
+        if( xQueueReceiveFromISR( xComPortIF[ 0 ].xTXChars, &cChar, &xHigherPriorityTaskWoken ) ==\r
             pdTRUE )\r
         {\r
             /* A character was retrieved from the queue so can be sent. */\r
@@ -305,11 +309,10 @@ prvSerialISR( void )
     if( MCF_UART_USR0 & MCF_UART_USR_RXRDY )\r
     {\r
         cChar = MCF_UART_URB0;\r
-        xTaskWokenByRx =\r
-            xQueueSendFromISR( xComPortIF[ 0].xRXChars, &cChar, xTaskWokenByRx );\r
+        xQueueSendFromISR( xComPortIF[ 0].xRXChars, &cChar, &xHigherPriorityTaskWoken );\r
     }\r
     /* Exit the ISR.  If a task was woken by either a character being\r
      * or transmitted then a context switch will occur.\r
      */\r
-    portEXIT_SWITCHING_ISR( ( xTaskWokenByTx || xTaskWokenByRx ) );\r
+    portEXIT_SWITCHING_ISR( xHigherPriorityTaskWoken );\r
 }\r