]> git.sur5r.net Git - freertos/blobdiff - Demo/ARM7_AT91SAM7X256_Eclipse/RTOSDemo/USB/USBSample.c
Remove unnecessary use of portLONG, portCHAR and portSHORT.
[freertos] / Demo / ARM7_AT91SAM7X256_Eclipse / RTOSDemo / USB / USBSample.c
index a81a7cd04d721c4e5b63fe618139b9626adb916a..ecbb166849705da1b1abc363a9ff86a82a3ed9b3 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
@@ -126,7 +127,7 @@ little odd. */
 \r
 /* Misc application definitions. */\r
 #define usbINTERRUPT_PRIORITY                          ( 3 )\r
-#define usbFIFO_LENGTH                                         ( ( unsigned portLONG ) 8 )\r
+#define usbFIFO_LENGTH                                         ( ( unsigned long ) 8 )\r
 #define usbXUP                                                         ( 1 )\r
 #define usbXDOWN                                                       ( 2 )\r
 #define usbYUP                                                         ( 3 )\r
@@ -136,9 +137,9 @@ little odd. */
 #define usbSHORTEST_DELAY                                      ( ( portTickType ) 1 )\r
 #define usbINIT_DELAY                                          ( ( portTickType ) 1000 / portTICK_RATE_MS )\r
 #define usbSHORT_DELAY                                         ( ( portTickType ) 50 / portTICK_RATE_MS )\r
-#define usbEND_POINT_RESET_MASK                                ( ( unsigned portLONG ) 0x0f )\r
-#define usbDATA_INC                                                    ( ( portCHAR ) 5 )\r
-#define usbEXPECTED_NUMBER_OF_BYTES                    ( ( unsigned portLONG ) 8 )\r
+#define usbEND_POINT_RESET_MASK                                ( ( unsigned long ) 0x0f )\r
+#define usbDATA_INC                                                    ( ( char ) 5 )\r
+#define usbEXPECTED_NUMBER_OF_BYTES                    ( ( unsigned long ) 8 )\r
 \r
 /* Control request types. */\r
 #define usbSTANDARD_DEVICE_REQUEST                     ( 0 )\r
@@ -149,11 +150,11 @@ little odd. */
 /* Structure used to hold the received requests. */\r
 typedef struct \r
 {\r
-       unsigned portCHAR ucReqType;\r
-       unsigned portCHAR ucRequest;\r
-       unsigned portSHORT usValue;\r
-       unsigned portSHORT usIndex;\r
-       unsigned portSHORT usLength;\r
+       unsigned char ucReqType;\r
+       unsigned char ucRequest;\r
+       unsigned short usValue;\r
+       unsigned short usIndex;\r
+       unsigned short usLength;\r
 } xUSB_REQUEST;\r
 \r
 typedef enum\r
@@ -169,9 +170,9 @@ typedef enum
 /* Structure used to control the data being sent to the host. */\r
 typedef struct\r
 {\r
-       unsigned portCHAR ucTxBuffer[ usbMAX_TX_MESSAGE_SIZE ];\r
-       unsigned portLONG ulNextCharIndex;\r
-       unsigned portLONG ulTotalDataLength;\r
+       unsigned char ucTxBuffer[ usbMAX_TX_MESSAGE_SIZE ];\r
+       unsigned long ulNextCharIndex;\r
+       unsigned long ulTotalDataLength;\r
 } xTX_MESSAGE;\r
 \r
 /*-----------------------------------------------------------*/\r
@@ -244,7 +245,7 @@ static void prvHandleClassInterfaceRequest( xUSB_REQUEST *pxRequest );
  * in response to TXCOMP interrupts until the entire buffer has been\r
  * sent.\r
  */\r
-static void prvSendControlData( unsigned portCHAR *pucData, unsigned portSHORT usRequestedLength, unsigned portLONG ulLengthLeftToSend, portLONG lSendingDescriptor );\r
+static void prvSendControlData( unsigned char *pucData, unsigned short usRequestedLength, unsigned long ulLengthLeftToSend, long lSendingDescriptor );\r
 \r
 /*\r
  * Examine the Tx buffer to see if there is any more data to be transmitted.\r
@@ -291,7 +292,7 @@ static void vUSBDemoTask( void *pvParameters );
  * Simple algorithm to ramp up the mouse cursor speed to make it easier to\r
  * use.\r
  */\r
-static void prvControlCursorSpeed( signed portCHAR *cVal, unsigned portLONG ulInput, unsigned portLONG ulSwitch1, unsigned portLONG ulSwitch2 );\r
+static void prvControlCursorSpeed( signed char *cVal, unsigned long ulInput, unsigned long ulSwitch1, unsigned long ulSwitch2 );\r
 /*-----------------------------------------------------------*/\r
 \r
 /*\r
@@ -307,14 +308,14 @@ These take the form:
        Data\r
 }\r
 */\r
-const portCHAR pxLanguageStringDescriptor[] =\r
+const char pxLanguageStringDescriptor[] =\r
 {\r
        4,\r
        usbDESCRIPTOR_TYPE_STRING,\r
        0x09, 0x04\r
 };\r
 \r
-const portCHAR pxManufacturerStringDescriptor[] = \r
+const char pxManufacturerStringDescriptor[] = \r
 {\r
        18,\r
        usbDESCRIPTOR_TYPE_STRING,\r
@@ -329,7 +330,7 @@ const portCHAR pxManufacturerStringDescriptor[] =
        'S', 0x00       \r
 };\r
 \r
-const portCHAR pxProductStringDescriptor[] = \r
+const char pxProductStringDescriptor[] = \r
 {\r
        38,\r
        usbDESCRIPTOR_TYPE_STRING,\r
@@ -354,7 +355,7 @@ const portCHAR pxProductStringDescriptor[] =
        'e', 0x00\r
 };\r
 \r
-const portCHAR pxConfigurationStringDescriptor[] = \r
+const char pxConfigurationStringDescriptor[] = \r
 {\r
        38,\r
        usbDESCRIPTOR_TYPE_STRING,\r
@@ -379,7 +380,7 @@ const portCHAR pxConfigurationStringDescriptor[] =
        'e', 0x00\r
 };\r
 \r
-const portCHAR pxInterfaceStringDescriptor[] = \r
+const char pxInterfaceStringDescriptor[] = \r
 {\r
        30,\r
        usbDESCRIPTOR_TYPE_STRING,\r
@@ -401,7 +402,7 @@ const portCHAR pxInterfaceStringDescriptor[] =
 };\r
 \r
 /* Enumeration descriptors. */\r
-const portCHAR pxReportDescriptor[] =\r
+const char pxReportDescriptor[] =\r
 {\r
        0x05, 0x01,                                             /* USAGE_PAGE (Generic Desktop)                 */\r
        0x09, 0x02,                                             /* USAGE (Mouse)                                                */\r
@@ -496,8 +497,8 @@ const char pxConfigDescriptor[] = {
 /*-----------------------------------------------------------*/\r
 \r
 /* File scope state variables. */\r
-static unsigned portCHAR ucUSBConfig = ( unsigned portCHAR ) 0;\r
-static unsigned portLONG ulReceivedAddress = ( unsigned portLONG ) 0;\r
+static unsigned char ucUSBConfig = ( unsigned char ) 0;\r
+static unsigned long ulReceivedAddress = ( unsigned long ) 0;\r
 static eDRIVER_STATE eDriverState = eNOTHING;\r
 \r
 /* Structure used to control the characters being sent to the host. */\r
@@ -563,9 +564,9 @@ xISRStatus *pxMessage;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvControlCursorSpeed( signed portCHAR *cVal, unsigned portLONG ulInput, unsigned portLONG ulSwitch1, unsigned portLONG ulSwitch2 )\r
+static void prvControlCursorSpeed( signed char *cVal, unsigned long ulInput, unsigned long ulSwitch1, unsigned long ulSwitch2 )\r
 {\r
-const portCHAR cSpeed = 20;\r
+const char cSpeed = 20;\r
 \r
        if( !( ulInput & ulSwitch1 ) )\r
        {\r
@@ -609,8 +610,8 @@ const portCHAR cSpeed = 20;
 static void prvTransmitSampleValues( void )\r
 {\r
 /* Variables to hold dummy x, y and z joystick axis data. */\r
-static signed portCHAR x = 0, y = 0, z = 0;\r
-unsigned portLONG ulStatus;\r
+static signed char x = 0, y = 0, z = 0;\r
+unsigned long ulStatus;\r
 \r
        ulStatus =      AT91C_BASE_PIOA->PIO_PDSR;\r
 \r
@@ -642,7 +643,7 @@ unsigned portLONG ulStatus;
 \r
 static void prvUSBTransmitNull( void )\r
 {\r
-unsigned portLONG ulStatus;\r
+unsigned long ulStatus;\r
 \r
        /* Wait until the FIFO is free - even though we are not going to use it.\r
        THERE IS NO TIMEOUT HERE! */\r
@@ -669,7 +670,7 @@ unsigned portLONG ulStatus;
 \r
 static void prvSendStall( void )\r
 {\r
-unsigned portLONG ulStatus;\r
+unsigned long ulStatus;\r
 \r
        portENTER_CRITICAL();\r
        {\r
@@ -684,13 +685,13 @@ unsigned portLONG ulStatus;
 \r
 static void prvResetEndPoints( void )\r
 {\r
-unsigned portLONG ulTemp;\r
+unsigned long ulTemp;\r
 \r
        eDriverState = eJUST_RESET;\r
 \r
        /* Reset all the end points. */\r
        AT91C_BASE_UDP->UDP_RSTEP  = usbEND_POINT_RESET_MASK;\r
-       AT91C_BASE_UDP->UDP_RSTEP  = ( unsigned portLONG ) 0x00;\r
+       AT91C_BASE_UDP->UDP_RSTEP  = ( unsigned long ) 0x00;\r
 \r
        /* Enable data to be sent and received. */\r
        AT91C_BASE_UDP->UDP_FADDR = AT91C_UDP_FEN;\r
@@ -699,7 +700,7 @@ unsigned portLONG ulTemp;
        portENTER_CRITICAL();\r
        {\r
                ulTemp = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ];\r
-               usbCSR_SET_BIT( &ulTemp, ( ( unsigned portLONG ) ( AT91C_UDP_EPEDS | AT91C_UDP_EPTYPE_CTRL ) ) );\r
+               usbCSR_SET_BIT( &ulTemp, ( ( unsigned long ) ( AT91C_UDP_EPEDS | AT91C_UDP_EPTYPE_CTRL ) ) );\r
                AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ] = ulTemp;\r
                AT91C_BASE_UDP->UDP_IER = AT91C_UDP_EPINT0;\r
        }\r
@@ -731,7 +732,7 @@ static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage )
                        /* Read the end point for data transfer. */\r
                        portENTER_CRITICAL();\r
                        {\r
-                               unsigned portLONG ulTemp;\r
+                               unsigned long ulTemp;\r
 \r
                                ulTemp = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_1 ];                                     \r
                                usbCSR_SET_BIT( &ulTemp, AT91C_UDP_EPEDS | AT91C_UDP_EPTYPE_INT_IN );\r
@@ -746,7 +747,7 @@ static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage )
                {\r
                        /* We sent an acknowledgement of a SET_ADDRESS request.  Move\r
                        to the addressed state. */\r
-                       if( ulReceivedAddress != ( unsigned portLONG ) 0 )\r
+                       if( ulReceivedAddress != ( unsigned long ) 0 )\r
                        {                       \r
                                AT91C_BASE_UDP->UDP_GLBSTATE = AT91C_UDP_FADDEN;\r
                        }\r
@@ -769,8 +770,8 @@ static void prvProcessEndPoint0Interrupt( xISRStatus *pxMessage )
        if( pxMessage->ulCSR0 & AT91C_UDP_RXSETUP )\r
        {\r
                xUSB_REQUEST xRequest;\r
-               unsigned portCHAR ucRequest;\r
-               unsigned portLONG ulRxBytes;\r
+               unsigned char ucRequest;\r
+               unsigned long ulRxBytes;\r
 \r
                /* A data packet is available. */       \r
                ulRxBytes = pxMessage->ulCSR0 >> 16;\r
@@ -840,11 +841,11 @@ static void prvGetStandardDeviceDescriptor( xUSB_REQUEST *pxRequest )
        switch( ( pxRequest->usValue & 0xff00 ) >> 8 )\r
        {\r
            case usbDESCRIPTOR_TYPE_DEVICE:\r
-                       prvSendControlData( ( unsigned portCHAR * ) &pxDeviceDescriptor, pxRequest->usLength, sizeof( pxDeviceDescriptor ), pdTRUE );\r
+                       prvSendControlData( ( unsigned char * ) &pxDeviceDescriptor, pxRequest->usLength, sizeof( pxDeviceDescriptor ), pdTRUE );\r
                    break;\r
        \r
            case usbDESCRIPTOR_TYPE_CONFIGURATION:\r
-                       prvSendControlData( ( unsigned portCHAR * ) &( pxConfigDescriptor ), pxRequest->usLength, sizeof( pxConfigDescriptor ), pdTRUE );\r
+                       prvSendControlData( ( unsigned char * ) &( pxConfigDescriptor ), pxRequest->usLength, sizeof( pxConfigDescriptor ), pdTRUE );\r
                    break;\r
 \r
            case usbDESCRIPTOR_TYPE_STRING:\r
@@ -853,23 +854,23 @@ static void prvGetStandardDeviceDescriptor( xUSB_REQUEST *pxRequest )
                    switch( pxRequest->usValue & 0xff )\r
                        {                       \r
                        case usbLANGUAGE_STRING:\r
-                                       prvSendControlData( ( unsigned portCHAR * ) &pxLanguageStringDescriptor, pxRequest->usLength, sizeof(pxLanguageStringDescriptor), pdTRUE );\r
+                                       prvSendControlData( ( unsigned char * ) &pxLanguageStringDescriptor, pxRequest->usLength, sizeof(pxLanguageStringDescriptor), pdTRUE );\r
                                break;\r
 \r
                        case usbMANUFACTURER_STRING:\r
-                                       prvSendControlData( ( unsigned portCHAR * ) &pxManufacturerStringDescriptor, pxRequest->usLength, sizeof( pxManufacturerStringDescriptor ), pdTRUE );\r
+                                       prvSendControlData( ( unsigned char * ) &pxManufacturerStringDescriptor, pxRequest->usLength, sizeof( pxManufacturerStringDescriptor ), pdTRUE );\r
                                break;\r
 \r
                        case usbPRODUCT_STRING:\r
-                                       prvSendControlData( ( unsigned portCHAR * ) &pxProductStringDescriptor, pxRequest->usLength, sizeof( pxProductStringDescriptor ), pdTRUE );\r
+                                       prvSendControlData( ( unsigned char * ) &pxProductStringDescriptor, pxRequest->usLength, sizeof( pxProductStringDescriptor ), pdTRUE );\r
                                break;\r
 \r
                        case usbCONFIGURATION_STRING:\r
-                                       prvSendControlData( ( unsigned portCHAR * ) &pxConfigurationStringDescriptor, pxRequest->usLength, sizeof( pxConfigurationStringDescriptor ), pdTRUE );\r
+                                       prvSendControlData( ( unsigned char * ) &pxConfigurationStringDescriptor, pxRequest->usLength, sizeof( pxConfigurationStringDescriptor ), pdTRUE );\r
                                break;\r
 \r
                        case usbINTERFACE_STRING:\r
-                                       prvSendControlData( ( unsigned portCHAR * ) &pxInterfaceStringDescriptor, pxRequest->usLength, sizeof( pxInterfaceStringDescriptor ), pdTRUE );\r
+                                       prvSendControlData( ( unsigned char * ) &pxInterfaceStringDescriptor, pxRequest->usLength, sizeof( pxInterfaceStringDescriptor ), pdTRUE );\r
                                break;\r
 \r
                        default:\r
@@ -890,13 +891,13 @@ static void prvGetStandardDeviceDescriptor( xUSB_REQUEST *pxRequest )
 \r
 static void prvHandleStandardDeviceRequest( xUSB_REQUEST *pxRequest )\r
 {\r
-unsigned portSHORT usStatus = 0;\r
+unsigned short usStatus = 0;\r
 \r
        switch( pxRequest->ucRequest )\r
        {\r
            case usbGET_STATUS_REQUEST:\r
                        /* Just send two byte dummy status. */\r
-                       prvSendControlData( ( unsigned portCHAR * ) &usStatus, sizeof( usStatus ), sizeof( usStatus ), pdFALSE );\r
+                       prvSendControlData( ( unsigned char * ) &usStatus, sizeof( usStatus ), sizeof( usStatus ), pdFALSE );\r
                    break;\r
 \r
            case usbGET_DESCRIPTOR_REQUEST:\r
@@ -906,7 +907,7 @@ unsigned portSHORT usStatus = 0;
 \r
            case usbGET_CONFIGURATION_REQUEST:\r
                        /* Send selected device configuration */\r
-                       prvSendControlData( ( unsigned portCHAR * ) &ucUSBConfig, sizeof( ucUSBConfig ), sizeof( ucUSBConfig ), pdFALSE );\r
+                       prvSendControlData( ( unsigned char * ) &ucUSBConfig, sizeof( ucUSBConfig ), sizeof( ucUSBConfig ), pdFALSE );\r
                    break;\r
 \r
                case usbSET_FEATURE_REQUEST:\r
@@ -921,7 +922,7 @@ unsigned portSHORT usStatus = 0;
                        address and set our state so we know we have received the address. */\r
                prvUSBTransmitNull();                   \r
                        eDriverState = eJUST_GOT_ADDRESS;               \r
-                       ulReceivedAddress = ( unsigned portLONG ) pxRequest->usValue;\r
+                       ulReceivedAddress = ( unsigned long ) pxRequest->usValue;\r
                    break;\r
 \r
            case usbSET_CONFIGURATION_REQUEST:\r
@@ -930,7 +931,7 @@ unsigned portSHORT usStatus = 0;
                        we cannot actually move to the configured state until we get a \r
                        TXCOMP interrupt from this NULL packet.  Therefore we just remember the\r
                        config and set our state so we know we have received the go ahead. */                   \r
-                       ucUSBConfig = ( unsigned portCHAR ) ( pxRequest->usValue & 0xff );\r
+                       ucUSBConfig = ( unsigned char ) ( pxRequest->usValue & 0xff );\r
                        eDriverState = eJUST_GOT_CONFIG;\r
                        prvUSBTransmitNull();\r
                    break;\r
@@ -968,10 +969,10 @@ static void prvHandleClassInterfaceRequest( xUSB_REQUEST *pxRequest )
 \r
 static void prvGetStandardInterfaceDescriptor( xUSB_REQUEST *pxRequest )\r
 {\r
-       switch( ( pxRequest->usValue & ( unsigned portSHORT ) 0xff00 ) >> 8 )\r
+       switch( ( pxRequest->usValue & ( unsigned short ) 0xff00 ) >> 8 )\r
        {\r
            case usbHID_REPORT_DESCRIPTOR:\r
-                       prvSendControlData( ( unsigned portCHAR * ) pxReportDescriptor, pxRequest->usLength, sizeof( pxReportDescriptor ), pdTRUE );\r
+                       prvSendControlData( ( unsigned char * ) pxReportDescriptor, pxRequest->usLength, sizeof( pxReportDescriptor ), pdTRUE );\r
                    break;\r
 \r
            default:\r
@@ -985,13 +986,13 @@ static void prvGetStandardInterfaceDescriptor( xUSB_REQUEST *pxRequest )
 \r
 static void prvHandleStandardInterfaceRequest( xUSB_REQUEST *pxRequest )\r
 {\r
-unsigned portSHORT usStatus = 0;\r
+unsigned short usStatus = 0;\r
 \r
        switch( pxRequest->ucRequest )\r
        {\r
            case usbGET_STATUS_REQUEST:\r
                        /* Send dummy 2 bytes. */\r
-                       prvSendControlData( ( unsigned portCHAR * ) &usStatus, sizeof( usStatus ), sizeof( usStatus ), pdFALSE );\r
+                       prvSendControlData( ( unsigned char * ) &usStatus, sizeof( usStatus ), sizeof( usStatus ), pdFALSE );\r
                        break;\r
 \r
            case usbGET_DESCRIPTOR_REQUEST:\r
@@ -1028,11 +1029,11 @@ static void prvHandleStandardEndPointRequest( xUSB_REQUEST *pxRequest )
 \r
 static void vInitUSBInterface( void )\r
 {\r
-volatile unsigned portLONG ulTemp;\r
+volatile unsigned long ulTemp;\r
 \r
        /* Initialise a few state variables. */\r
-       pxCharsForTx.ulNextCharIndex = ( unsigned portLONG ) 0;\r
-       ucUSBConfig = ( unsigned portCHAR ) 0;\r
+       pxCharsForTx.ulNextCharIndex = ( unsigned long ) 0;\r
+       ucUSBConfig = ( unsigned char ) 0;\r
        eDriverState = eNOTHING;\r
 \r
        /* HARDWARE SETUP */\r
@@ -1056,10 +1057,10 @@ volatile unsigned portLONG ulTemp;
        /* When using the USB debugger the peripheral registers do not always get\r
        set to the correct default values.  To make sure set the relevant registers\r
        manually here. */\r
-       AT91C_BASE_UDP->UDP_IDR = ( unsigned portLONG ) 0xffffffff;\r
-       AT91C_BASE_UDP->UDP_ICR = ( unsigned portLONG ) 0xffffffff;\r
-       AT91C_BASE_UDP->UDP_CSR[ 0 ] = ( unsigned portLONG ) 0x00;\r
-       AT91C_BASE_UDP->UDP_CSR[ 1 ] = ( unsigned portLONG ) 0x00;\r
+       AT91C_BASE_UDP->UDP_IDR = ( unsigned long ) 0xffffffff;\r
+       AT91C_BASE_UDP->UDP_ICR = ( unsigned long ) 0xffffffff;\r
+       AT91C_BASE_UDP->UDP_CSR[ 0 ] = ( unsigned long ) 0x00;\r
+       AT91C_BASE_UDP->UDP_CSR[ 1 ] = ( unsigned long ) 0x00;\r
        AT91C_BASE_UDP->UDP_GLBSTATE = 0;\r
        AT91C_BASE_UDP->UDP_FADDR = 0;\r
 \r
@@ -1077,14 +1078,14 @@ volatile unsigned portLONG ulTemp;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvSendControlData( unsigned portCHAR *pucData, unsigned portSHORT usRequestedLength, unsigned portLONG ulLengthToSend, portLONG lSendingDescriptor )\r
+static void prvSendControlData( unsigned char *pucData, unsigned short usRequestedLength, unsigned long ulLengthToSend, long lSendingDescriptor )\r
 {\r
-       if( ( ( unsigned portLONG ) usRequestedLength < ulLengthToSend ) )\r
+       if( ( ( unsigned long ) usRequestedLength < ulLengthToSend ) )\r
        {\r
                /* Cap the data length to that requested. */\r
-               ulLengthToSend = ( unsigned portSHORT ) usRequestedLength;\r
+               ulLengthToSend = ( unsigned short ) usRequestedLength;\r
        }\r
-       else if( ( ulLengthToSend < ( unsigned portLONG ) usRequestedLength ) && lSendingDescriptor )\r
+       else if( ( ulLengthToSend < ( unsigned long ) usRequestedLength ) && lSendingDescriptor )\r
        {\r
                /* We are sending a descriptor.  If the descriptor is an exact \r
                multiple of the FIFO length then it will have to be terminated\r
@@ -1106,7 +1107,7 @@ static void prvSendControlData( unsigned portCHAR *pucData, unsigned portSHORT u
        /* Reinitialise the buffer index so we start sending from the start of \r
        the data. */\r
        pxCharsForTx.ulTotalDataLength = ulLengthToSend;\r
-       pxCharsForTx.ulNextCharIndex = ( unsigned portLONG ) 0;\r
+       pxCharsForTx.ulNextCharIndex = ( unsigned long ) 0;\r
 \r
        /* Send the first 8 bytes now.  The rest will get sent in response to \r
        TXCOMP interrupts. */\r
@@ -1116,7 +1117,7 @@ static void prvSendControlData( unsigned portCHAR *pucData, unsigned portSHORT u
 \r
 static void prvSendNextSegment( void )\r
 {\r
-volatile unsigned portLONG ulNextLength, ulStatus, ulLengthLeftToSend;\r
+volatile unsigned long ulNextLength, ulStatus, ulLengthLeftToSend;\r
 \r
        /* Is there any data to send? */\r
        if( pxCharsForTx.ulTotalDataLength > pxCharsForTx.ulNextCharIndex )\r
@@ -1141,7 +1142,7 @@ volatile unsigned portLONG ulNextLength, ulStatus, ulLengthLeftToSend;
                }\r
 \r
                /* Write the data to the FIFO. */\r
-               while( ulNextLength > ( unsigned portLONG ) 0 )\r
+               while( ulNextLength > ( unsigned long ) 0 )\r
                {\r
                        AT91C_BASE_UDP->UDP_FDR[ usbEND_POINT_0 ] = pxCharsForTx.ucTxBuffer[ pxCharsForTx.ulNextCharIndex ];\r
        \r
@@ -1153,7 +1154,7 @@ volatile unsigned portLONG ulNextLength, ulStatus, ulLengthLeftToSend;
                portENTER_CRITICAL();\r
                {\r
                        ulStatus = AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ];\r
-                       usbCSR_SET_BIT( &ulStatus, ( ( unsigned portLONG ) 0x10 ) );\r
+                       usbCSR_SET_BIT( &ulStatus, ( ( unsigned long ) 0x10 ) );\r
                        AT91C_BASE_UDP->UDP_CSR[ usbEND_POINT_0 ] = ulStatus;\r
                }\r
                portEXIT_CRITICAL();\r