OSDN Git Service

LANドライバからFreeRTOS依存コードの取り除き
authornyatla <nyatla@47198e57-cb75-475f-84c4-a814cd6f29e0>
Fri, 25 Jan 2013 12:20:53 +0000 (12:20 +0000)
committernyatla <nyatla@47198e57-cb75-475f-84c4-a814cd6f29e0>
Fri, 25 Jan 2013 12:20:53 +0000 (12:20 +0000)
git-svn-id: http://svn.osdn.jp/svnroot/mimic/trunk@188 47198e57-cb75-475f-84c4-a814cd6f29e0

lib/src/driver/uip/EtherDev_DP83848C.c
lib/src/driver/uip/EtherDev_DP83848C_protected.h
lib/src/driver/uip/EtherDev_LAN8720.c
lib/src/driver/uip/EtherDev_LAN8720_protected.h

index 2f0c2f8..b65d9d3 100644 (file)
@@ -97,8 +97,9 @@
 #define ETHDEV_PHY_DEF_ADR    0x0100      /* Default PHY device address        */\r
 \r
 \r
-\r
-\r
+#ifndef configEMAC_INTERRUPT_PRIORITY\r
+       #define configEMAC_INTERRUPT_PRIORITY           5\r
+#endif\r
 \r
 /* Time to wait between each inspection of the link status. */\r
 #define emacWAIT_FOR_LINK_TO_ESTABLISH_MS 500\r
@@ -130,11 +131,11 @@ static void prvConfigurePHY( void );
  * Wait for a link to be established, then setup the PHY according to the link\r
  * parameters.\r
  */\r
-static long prvSetupLinkStatus( void );\r
+static NyLPC_TBool prvSetupLinkStatus( void );\r
 /*\r
  * Send lValue to the lPhyReg within the PHY.\r
  */\r
-static long prvWritePHY( long lPhyReg, long lValue );\r
+static NyLPC_TBool prvWritePHY( long lPhyReg, long lValue );\r
 /*\r
  * Read a value from ucPhyReg within the PHY.  *plStatus will be set to\r
  * pdFALSE if there is an error.\r
@@ -165,11 +166,11 @@ const static struct TiEthernetDevice _interface=
  * EthernetDeviceのファクトリー関数\r
  */\r
 \r
-const NyLPC_TBool EthDev_DP83848C_getInterface(\r
+NyLPC_TBool EthDev_DP83848C_getInterface(\r
        const struct TiEthernetDevice** o_dev)\r
 {\r
        unsigned long ulID1, ulID2;\r
-       long lReturn = pdPASS;\r
+       NyLPC_TBool lReturn = NyLPC_TBool_TRUE;\r
        //Reset MCU Interface. and wait for reset.\r
        prvSetupEMACHardware();\r
        //Check peripheral name\r
@@ -202,7 +203,7 @@ static NyLPC_TBool start(const struct NyLPC_TEthAddr* i_eth_addr)
        prvConfigurePHY();\r
 \r
        //wait for Link up...\r
-       while(prvSetupLinkStatus() != pdPASS)\r
+       while(!prvSetupLinkStatus())\r
        {\r
                NyLPC_cThread_sleep(100);\r
        }\r
@@ -258,7 +259,8 @@ static void stop(void)
 static void prvSetupEMACHardware( void )\r
 {\r
        unsigned short us;\r
-       long x, lDummy;\r
+       long x;\r
+       NyLPC_TBool lDummy;\r
 \r
        /* Power Up the EMAC controller. */\r
        LPC_SC->PCONP |= 0x40000000;\r
@@ -316,7 +318,7 @@ static void prvSetupEMACHardware( void )
 \r
 /*-----------------------------------------------------------*/\r
 \r
-static long prvWritePHY( long lPhyReg, long lValue )\r
+static NyLPC_TBool prvWritePHY( long lPhyReg, long lValue )\r
 {\r
        const long lMaxTime = 10;\r
        long x;\r
@@ -338,16 +340,16 @@ static long prvWritePHY( long lPhyReg, long lValue )
 \r
        if( x < lMaxTime )\r
        {\r
-               return pdPASS;\r
+               return NyLPC_TBool_TRUE;\r
        }\r
        else\r
        {\r
-               return pdFAIL;\r
+               return NyLPC_TBool_FALSE;\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static unsigned short prvReadPHY( unsigned int ucPhyReg, long *plStatus )\r
+static unsigned short prvReadPHY( unsigned int ucPhyReg, NyLPC_TBool* plStatus )\r
 {\r
        long x;\r
        const long lMaxTime = 10;\r
@@ -370,7 +372,7 @@ static unsigned short prvReadPHY( unsigned int ucPhyReg, long *plStatus )
 \r
        if( x >= lMaxTime )\r
        {\r
-               *plStatus = pdFAIL;\r
+               *plStatus = NyLPC_TBool_FALSE;\r
        }\r
 \r
        return( LPC_EMAC->MRDD );\r
@@ -391,7 +393,8 @@ static unsigned short prvReadPHY( unsigned int ucPhyReg, long *plStatus )
 static void prvConfigurePHY( void )\r
 {\r
        unsigned short us;\r
-       long x, lDummy;\r
+       long x;\r
+       NyLPC_TBool lDummy;\r
 \r
        /* Auto negotiate the configuration. */\r
        if( prvWritePHY( PHY_REG_BMCR, PHY_AUTO_NEG ) )\r
@@ -412,9 +415,10 @@ static void prvConfigurePHY( void )
        }\r
 }\r
 \r
-static long prvSetupLinkStatus( void )\r
+static NyLPC_TBool prvSetupLinkStatus( void )\r
 {\r
-       long lReturn = pdFAIL, x;\r
+       NyLPC_TBool lReturn = NyLPC_TBool_FALSE;\r
+       long x;\r
        unsigned short usLinkStatus;\r
 \r
        /* Wait with timeout for the link to be established. */\r
@@ -424,14 +428,14 @@ static long prvSetupLinkStatus( void )
                if( usLinkStatus & emacLINK_ESTABLISHED )\r
                {\r
                        /* Link is established. */\r
-                       lReturn = pdPASS;\r
+                       lReturn = NyLPC_TBool_TRUE;\r
                        break;\r
                }\r
 \r
                NyLPC_cThread_sleep( emacWAIT_FOR_LINK_TO_ESTABLISH_MS);\r
        }\r
 \r
-       if( lReturn == pdPASS )\r
+       if( lReturn == NyLPC_TBool_TRUE )\r
        {\r
                /* Configure Full/Half Duplex mode. */\r
                if( usLinkStatus & emacFULL_DUPLEX_ENABLED )\r
index e5757a0..5e1dcfb 100644 (file)
@@ -12,7 +12,7 @@
 extern "C" {\r
 #endif /* __cplusplus */\r
 \r
-const NyLPC_TBool EthDev_DP83848C_getInterface(\r
+NyLPC_TBool EthDev_DP83848C_getInterface(\r
        const struct TiEthernetDevice** o_dev);\r
 \r
 #ifdef __cplusplus\r
index bfd4ddf..ee32af8 100644 (file)
@@ -88,6 +88,9 @@
 #define PHY_SPEED_100                  0x0008  /* 100Mbit   */\r
 #define ETHDEV_PHY_DEF_ADR             0x0100  /* Default PHY device address        */\r
 \r
+#ifndef configEMAC_INTERRUPT_PRIORITY\r
+       #define configEMAC_INTERRUPT_PRIORITY           5\r
+#endif\r
 \r
 /* Time to wait between each inspection of the link status. */\r
 #define emacWAIT_FOR_LINK_TO_ESTABLISH_MS 500\r
@@ -126,7 +129,7 @@ static long prvWritePHY( long lPhyReg, long lValue );
  * Read a value from ucPhyReg within the PHY.  *plStatus will be set to\r
  * pdFALSE if there is an error.\r
  */\r
-static unsigned short prvReadPHY( unsigned int ucPhyReg, long *plStatus );\r
+static unsigned short prvReadPHY( unsigned int ucPhyReg, NyLPC_TBool* o_status);\r
 \r
 \r
 \r
@@ -153,16 +156,16 @@ const static struct TiEthernetDevice _interface=
  * EthernetDeviceのファクトリー関数。インターフェイスを生成できればtrue\r
  *\r
  */\r
-const NyLPC_TBool EthDev_LAN8720_getInterface(\r
+NyLPC_TBool EthDev_LAN8720_getInterface(\r
        const struct TiEthernetDevice** o_dev)\r
 {\r
        unsigned long ulID1, ulID2;\r
-       long lReturn = pdPASS;\r
+       NyLPC_TBool ret=NyLPC_TBool_TRUE;\r
        //Reset MCU Interface. and wait for reset.\r
        prvSetupEMACHardware();\r
        //Check peripheral name\r
-       ulID1 = prvReadPHY( PHY_REG_IDR1, &lReturn );\r
-       ulID2 = prvReadPHY( PHY_REG_IDR2, &lReturn );\r
+       ulID1 = prvReadPHY( PHY_REG_IDR1, &ret );\r
+       ulID2 = prvReadPHY( PHY_REG_IDR2, &ret );\r
        if( ( (ulID1 << 16UL ) | ( ulID2 & 0xFFF0UL ) ) != LAN8720_ID)\r
        {\r
                return NyLPC_TBool_FALSE;\r
@@ -195,7 +198,7 @@ static NyLPC_TBool start(const struct NyLPC_TEthAddr* i_eth_addr)
        prvConfigurePHY();\r
 \r
        //wait for Link up...\r
-       while(prvSetupLinkStatus() != pdPASS)\r
+       while(!prvSetupLinkStatus())\r
        {\r
                NyLPC_cThread_sleep(100);\r
        }\r
@@ -251,7 +254,8 @@ static void stop(void)
 static void prvSetupEMACHardware( void )\r
 {\r
        unsigned short us;\r
-       long x, lDummy;\r
+       long x;\r
+       NyLPC_TBool lDummy;\r
 \r
        /* Power Up the EMAC controller. */\r
        LPC_SC->PCONP |= 0x40000000;\r
@@ -309,7 +313,7 @@ static void prvSetupEMACHardware( void )
 \r
 /*-----------------------------------------------------------*/\r
 \r
-static long prvWritePHY( long lPhyReg, long lValue )\r
+static NyLPC_TBool prvWritePHY( long lPhyReg, long lValue )\r
 {\r
        const long lMaxTime = 10;\r
        long x;\r
@@ -331,16 +335,16 @@ static long prvWritePHY( long lPhyReg, long lValue )
 \r
        if( x < lMaxTime )\r
        {\r
-               return pdPASS;\r
+               return NyLPC_TBool_TRUE;\r
        }\r
        else\r
        {\r
-               return pdFAIL;\r
+               return NyLPC_TBool_FALSE;\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static unsigned short prvReadPHY( unsigned int ucPhyReg, long *plStatus )\r
+static unsigned short prvReadPHY( unsigned int ucPhyReg, NyLPC_TBool *o_status)\r
 {\r
        long x;\r
        const long lMaxTime = 10;\r
@@ -363,7 +367,7 @@ static unsigned short prvReadPHY( unsigned int ucPhyReg, long *plStatus )
 \r
        if( x >= lMaxTime )\r
        {\r
-               *plStatus = pdFAIL;\r
+               *o_status =NyLPC_TBool_FALSE;\r
        }\r
 \r
        return( LPC_EMAC->MRDD );\r
@@ -379,7 +383,8 @@ static unsigned short prvReadPHY( unsigned int ucPhyReg, long *plStatus )
 static void prvConfigurePHY( void )\r
 {\r
        unsigned short us;\r
-       long x, lDummy;\r
+       long x;\r
+       NyLPC_TBool lDummy;\r
        /* Auto negotiate the configuration. */\r
        if( prvWritePHY( PHY_REG_BMCR, PHY_AUTO_NEG ) )\r
        {\r
@@ -399,8 +404,9 @@ static void prvConfigurePHY( void )
 \r
 static long prvSetupLinkStatus( void )\r
 {\r
-       long lReturn = pdFAIL, x;\r
+       long x;\r
        unsigned short usLinkStatus;\r
+       NyLPC_TBool lReturn=NyLPC_TBool_TRUE;\r
 \r
        /* Wait with timeout for the link to be established. */\r
        for( x = 0; x < 10; x++ )\r
@@ -409,13 +415,13 @@ static long prvSetupLinkStatus( void )
                if( usLinkStatus & PHY_AUTO_NEG_COMPLETE )\r
                {\r
                        /* Link is established. */\r
-                       lReturn = pdPASS;\r
+                       lReturn = NyLPC_TBool_TRUE;\r
                        break;\r
                }\r
                NyLPC_cThread_sleep( emacWAIT_FOR_LINK_TO_ESTABLISH_MS);\r
        }\r
 \r
-       if( lReturn == pdPASS )\r
+       if( lReturn == NyLPC_TBool_TRUE )\r
        {\r
                /* Configure Full/Half Duplex mode. */\r
                if (usLinkStatus & PHY_SPEED_FDUPLX )\r
index 424cacc..d3c4835 100644 (file)
@@ -11,7 +11,7 @@
 extern "C" {\r
 #endif /* __cplusplus */\r
 \r
-const NyLPC_TBool EthDev_LAN8720_getInterface(\r
+NyLPC_TBool EthDev_LAN8720_getInterface(\r
        const struct TiEthernetDevice** o_dev);\r
 \r
 #ifdef __cplusplus\r