#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
* 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
* 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
prvConfigurePHY();\r
\r
//wait for Link up...\r
- while(prvSetupLinkStatus() != pdPASS)\r
+ while(!prvSetupLinkStatus())\r
{\r
NyLPC_cThread_sleep(100);\r
}\r
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
\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
\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
\r
if( x >= lMaxTime )\r
{\r
- *plStatus = pdFAIL;\r
+ *plStatus = NyLPC_TBool_FALSE;\r
}\r
\r
return( LPC_EMAC->MRDD );\r
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
}\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
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
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
#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
* 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
* 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
prvConfigurePHY();\r
\r
//wait for Link up...\r
- while(prvSetupLinkStatus() != pdPASS)\r
+ while(!prvSetupLinkStatus())\r
{\r
NyLPC_cThread_sleep(100);\r
}\r
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
\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
\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
\r
if( x >= lMaxTime )\r
{\r
- *plStatus = pdFAIL;\r
+ *o_status =NyLPC_TBool_FALSE;\r
}\r
\r
return( LPC_EMAC->MRDD );\r
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
\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
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
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