我现在手里的板子是这样的
我现在用的是里面的evmomapl138_emac.c驱动
回环模式可以调通,但是我用wireshark监测不到包,是不是回环模式不发送到PC上
uint32_t EMAC_txPacket(uint8_t *src_buffer, uint32_t length)
{
// check link before sending.
if (!isLinkActive(g_active_phy_id))
{
return (ERR_ENET_LINK_INACTIVE);
}
// check the length of the packet.
if (length > MAX_PACKET_SIZE)
{
// NOTE: in pratice, if a packet is too large for the buffer, you
// should break it into multiple ethernet frames and transmit.
return (ERR_ENET_PKT_TOO_LARGE);
}
else if (length < MIN_PACKET_SIZE)
{
// bump the length up to the min packet size.
length = MIN_PACKET_SIZE;
}
// populate the tx descriptor.
g_tx_desc->next = 0;
g_tx_desc->buffer = src_buffer;
g_tx_desc->buff_offset_length = (length & 0xFFFF);
g_tx_desc->flags_pkt_length = ((length & 0xFFFF) |
EMAC_DSC_FLAG_SOP |
EMAC_DSC_FLAG_EOP |
EMAC_DSC_FLAG_OWNER);
// kick off the transmit
EMAC->TXHDP[0] = (uint32_t)g_tx_desc;
// wait for packet to complete.
while (!CHKBIT(EMAC->TXINTSTATRAW, TX0PEND))
{
// make sure the link is not broken.
if (!isLinkActive(g_active_phy_id))
{
return (ERR_ENET_LINK_INACTIVE);
}
}
// if we make it here, the transmit succeeded!
return (ERR_NO_ERROR);
}
这个函数能直接将包发出去吗?
谢谢了 调了好几天了卡在这了,还有别的驱动可以用吗》有的话给我一个例程谢谢了!
Denny%20Yang99373:
硬件和参考设计不一样,这一块要针对具体硬件修改驱动
软件建议采用starterware里面的例子
如果是138可以直接ARM跑LINUX,PING主机试试