|
|
|
@ -314,6 +314,7 @@ static unsigned char next_pointer_msb; |
|
|
|
|
|
|
|
|
|
static unsigned char buffer[ENC_MAX_FRM_LEN]; |
|
|
|
|
static int rxResetCounter = 0; |
|
|
|
|
|
|
|
|
|
#define RX_RESET_COUNTER 1000; |
|
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
@ -400,8 +401,7 @@ static void encReceiverResetCallback(void) |
|
|
|
|
*/ |
|
|
|
|
int eth_rx (void) |
|
|
|
|
{ |
|
|
|
|
if(rxResetCounter > 0 && --rxResetCounter == 0) |
|
|
|
|
{ |
|
|
|
|
if (rxResetCounter > 0 && --rxResetCounter == 0) { |
|
|
|
|
encReceiverResetCallback (); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -521,7 +521,8 @@ static void encRx(void) |
|
|
|
|
pkt_cnt = m_nic_read (CTL_REG_EPKTCNT); |
|
|
|
|
|
|
|
|
|
/* switch to bank 0 */ |
|
|
|
|
m_nic_bfc(CTL_REG_ECON1, (ENC_ECON1_BSEL1 | ENC_ECON1_BSEL0));
|
|
|
|
|
m_nic_bfc (CTL_REG_ECON1, |
|
|
|
|
(ENC_ECON1_BSEL1 | ENC_ECON1_BSEL0)); |
|
|
|
|
|
|
|
|
|
if (copy_len == 0) { |
|
|
|
|
eir_reg = m_nic_read (CTL_REG_EIR); |
|
|
|
@ -643,8 +644,7 @@ static void encReadBuff(unsigned short length, unsigned char *pBuff) |
|
|
|
|
spi_unlock (); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void encWriteBuff(unsigned short length,
|
|
|
|
|
unsigned char *pBuff) |
|
|
|
|
static void encWriteBuff (unsigned short length, unsigned char *pBuff) |
|
|
|
|
{ |
|
|
|
|
spi_lock (); |
|
|
|
|
enc_cfg_spi (); |
|
|
|
@ -752,6 +752,7 @@ static void encInit(unsigned char *pEthAddr) |
|
|
|
|
/* Wait for Oscillator Start-up Timer (OST). */ |
|
|
|
|
while ((m_nic_read (CTL_REG_ESTAT) & ENC_ESTAT_CLKRDY) == 0) { |
|
|
|
|
static int cnt = 0; |
|
|
|
|
|
|
|
|
|
if (cnt++ >= 1000) { |
|
|
|
|
cnt = 0; |
|
|
|
|
} |
|
|
|
@ -787,8 +788,8 @@ static void encInit(unsigned char *pEthAddr) |
|
|
|
|
|
|
|
|
|
/* configure pad, tx-crc and duplex */ |
|
|
|
|
/* TODO maybe enable FRMLNEN */ |
|
|
|
|
m_nic_write_retry(CTL_REG_MACON3, (ENC_MACON3_PADCFG0|ENC_MACON3_TXCRCEN),
|
|
|
|
|
10); |
|
|
|
|
m_nic_write_retry (CTL_REG_MACON3, |
|
|
|
|
(ENC_MACON3_PADCFG0 | ENC_MACON3_TXCRCEN), 10); |
|
|
|
|
|
|
|
|
|
/* set maximum frame length */ |
|
|
|
|
m_nic_write_retry (CTL_REG_MAMXFLL, (ENC_MAX_FRM_LEN & 0xff), 10); |
|
|
|
|