52 ETH_MACAHR(0) = ((uint32_t)mac[5] << 8) | (uint32_t)mac[4] |
54 ETH_MACALR(0) = ((uint32_t)mac[3] << 24) | ((uint32_t)mac[2] << 16) |
55 ((uint32_t)mac[1] << 8) | mac[0];
73void eth_desc_init(uint8_t *buf, uint32_t nTx, uint32_t nRx, uint32_t cTx,
74 uint32_t cRx,
bool isext)
76 uint32_t bd = (uint32_t)buf;
79 memset(buf, 0, nTx * (cTx + sz) + nRx * (cRx + sz));
154bool eth_rx(uint8_t *ppkt, uint32_t *len, uint32_t maxlen)
158 bool overrun =
false;
167 overrun |= fs && (maxlen < l);
169 if (fs && !overrun) {
185 return fs && ls && !overrun;
#define ETH_MACA0HR_MACA0H
#define ETH_DMABMR_PBL_SHIFT
#define ETH_DMABMR_RDP_SHIFT
#define ETH_TDES0_CIC_IPPLPH
#define ETH_MACMIIAR_MR_SHIFT
#define ETH_MACMIIAR_PA_SHIFT
#define ETH_MACFCR_PT_SHIFT
#define ETH_RDES0_FL_SHIFT
#define ETH_DMAOMR_DTCEFD
#define ETH_DMABMR_PM_2_1
static void eth_smi_transact(void)
Process pending SMI transaction and wait to be done.
void eth_irq_enable(uint32_t reason)
Enable the Ethernet IRQ.
bool eth_irq_ack_pending(uint32_t reason)
Check if IRQ is pending, and acknowledge it.
bool eth_tx(uint8_t *ppkt, uint32_t n)
Transmit packet.
void eth_enable_checksum_offload(void)
Enable checksum offload feature.
void eth_desc_init(uint8_t *buf, uint32_t nTx, uint32_t nRx, uint32_t cTx, uint32_t cRx, bool isext)
Initialize buffers and descriptors.
void eth_irq_disable(uint32_t reason)
Disable the Ethernet IRQ.
void eth_smi_write(uint8_t phy, uint8_t reg, uint16_t data)
Write 16-bit register to the PHY.
bool eth_rx(uint8_t *ppkt, uint32_t *len, uint32_t maxlen)
Receive packet.
uint16_t eth_smi_read(uint8_t phy, uint8_t reg)
Read the 16-bit register from the PHY.
void eth_init(uint8_t phy, enum eth_clk clock)
Initialize ethernet.
void eth_smi_bit_clear(uint8_t phy, uint8_t reg, uint16_t clearbits)
Clear bits in the register.
bool eth_irq_is_pending(uint32_t reason)
Check if IRQ is pending.
void eth_set_mac(const uint8_t *mac)
Set MAC to the PHY.
void eth_start(void)
Start the Ethernet DMA processing.
void eth_smi_bit_set(uint8_t phy, uint8_t reg, uint16_t setbits)
Set bits in the register.
void eth_smi_bit_op(uint8_t phy, uint8_t reg, uint16_t bits, uint16_t mask)
Process the bit-operation on PHY register.
void phy_reset(uint8_t phy)
Reset the PHY.