@ -51,9 +51,9 @@
u08 Enc28j60Bank ;
u08 Enc28j60Bank ;
u16 NextPacketPtr ;
u16 NextPacketPtr ;
void nicInit ( void )
char nicInit ( void )
{
{
enc28j60Init( ) ;
return enc28j60Init( ) ;
}
}
void nicSend ( unsigned int len , unsigned char * packet )
void nicSend ( unsigned int len , unsigned char * packet )
@ -90,7 +90,7 @@ void nicSetMacAddress(uint8_t* macaddr)
enc28j60Write ( MAADR0 , * macaddr + + ) ;
enc28j60Write ( MAADR0 , * macaddr + + ) ;
}
}
# if def NET_DEBUG || NIC_DEBUG
# if defined(NET_DEBUG) || defined(NIC_DEBUG)
void nicRegDump ( void )
void nicRegDump ( void )
{
{
enc28j60RegDump ( ) ;
enc28j60RegDump ( ) ;
@ -297,7 +297,7 @@ void enc28j60PhyWrite(uint8_t address, uint16_t data)
while ( enc28j60Read ( MISTAT ) & MISTAT_BUSY ) ;
while ( enc28j60Read ( MISTAT ) & MISTAT_BUSY ) ;
}
}
void enc28j60Init ( void )
char enc28j60Init ( void )
{
{
/**
/**
* Enable ENC28J560 Control ports
* Enable ENC28J560 Control ports
@ -346,18 +346,24 @@ void enc28j60Init(void)
SPrintln ( " PHY reboot done " ) ;
SPrintln ( " PHY reboot done " ) ;
# endif
# endif
# ifdef ENC28J60_LAMPS_MODE
# ifdef ENC28J60_LAMPS_MODE
# ifdef DEBUG_ENC_INIT
SPrintln ( " Custom lamps " ) ;
SPrintln ( " Custom lamps " ) ;
# endif
enc28j60PhyWrite ( PHLCON , ENC28J60_LAMPS_MODE ) ;
enc28j60PhyWrite ( PHLCON , ENC28J60_LAMPS_MODE ) ;
# else
# else
// Errata #9 correction
// Errata #9 correction
if ( enc28j60Read ( MACON3 ) & MACON3_FULDPX )
if ( enc28j60Read ( MACON3 ) & MACON3_FULDPX )
{
{
# ifdef DEBUG_ENC_INIT
SPrintln ( " Full duplex lamps " ) ;
SPrintln ( " Full duplex lamps " ) ;
# endif
enc28j60PhyWrite ( PHLCON , PHLCON_DEFAULT ) ;
enc28j60PhyWrite ( PHLCON , PHLCON_DEFAULT ) ;
} else {
} else {
# ifdef DEBUG_ENC_INIT
SPrintln ( " Half duplex lamps " ) ;
SPrintln ( " Half duplex lamps " ) ;
# endif
enc28j60PhyWrite ( PHLCON , PHLCON_DEFAULT_HD ) ;
enc28j60PhyWrite ( PHLCON , PHLCON_DEFAULT_HD ) ;
}
}
# endif
# endif
@ -480,6 +486,7 @@ void enc28j60Init(void)
// setup duplex ----------------------
// setup duplex ----------------------
*/
*/
return 0 ;
}
}
# define ETHERNET_MIN_PACKET_LENGTH 0x3C
# define ETHERNET_MIN_PACKET_LENGTH 0x3C
@ -628,7 +635,7 @@ void enc28j60ReceiveOverflowRecover(void)
// recovery completed
// recovery completed
}
}
# if def NET_DEBUG || NIC_DEBUG
# if defined(NET_DEBUG) || defined(NIC_DEBUG)
# define SPrint_D(str) SPrint(str); delayMicroseconds(100);
# define SPrint_D(str) SPrint(str); delayMicroseconds(100);
void enc28j60RegDump ( void )
void enc28j60RegDump ( void )