参考git://git.ti.com/hercules_examples/hercules_examples.git代码,验证RMII。实际使用hdkif_transmit接口无内容输出,TX_EN、TXD_0、TXD_0均没有信号输出。
源码:
static void
hdkif_transmit(struct hdkif *hdkif, struct pbuf *pbuf) {
struct pbuf *q;
struct txch *txch;
volatile struct emac_tx_bdp *curr_bd, *active_head, *bd_end;
txch = &(hdkif->txch);
/* Get the buffer descriptor which is free to transmit */
curr_bd = txch->free_head;
active_head = curr_bd;
/* Update the total packet length */
uint32 flags_pktlen = pbuf->tot_len;
flags_pktlen |= (EMAC_BUF_DESC_SOP | EMAC_BUF_DESC_OWNER);
curr_bd->flags_pktlen = hdkif_swizzle_data(flags_pktlen);
/* Copy pbuf information into TX buffer descriptors */
for(q = pbuf; q != NULL; q = q->next) {
/* Intialize the buffer pointer and length */
curr_bd->bufptr = hdkif_swizzle_data((uint32)(q->payload));
curr_bd->bufoff_len = hdkif_swizzle_data((q->len) & 0xFFFF);
bd_end = curr_bd;
curr_bd->pbuf = pbuf;
curr_bd = hdkif_swizzle_txp(curr_bd->next);
//if (curr_bd) curr_bd->flags_pktlen = 0;
}
/* Indicate the end of the packet */
bd_end->next = NULL;
bd_end->flags_pktlen |= hdkif_swizzle_data(EMAC_BUF_DESC_EOP);
txch->free_head = curr_bd;
/* For the first time, write the HDP with the filled bd */
if(txch->active_tail == NULL) {
EMACTxHdrDescPtrWrite(hdkif->emac_base, (unsigned int)(active_head), 0);
}
/*
* Chain the bd's. If the DMA engine, already reached the end of the chain,
* the EOQ will be set. In that case, the HDP shall be written again.
*/
else {
curr_bd = txch->active_tail;
/* TODO: (This is a workaround) Wait for the EOQ bit is set */
while (EMAC_BUF_DESC_EOQ != (hdkif_swizzle_data(curr_bd->flags_pktlen) & EMAC_BUF_DESC_EOQ));
/* TODO: (This is a workaround) Don't write to TXHDP0 until it turns to zero */
while (0 != *((uint32 *)0xFCF78600));
curr_bd->next = hdkif_swizzle_txp(active_head);
if (EMAC_BUF_DESC_EOQ == (hdkif_swizzle_data(curr_bd->flags_pktlen) & EMAC_BUF_DESC_EOQ)) {
/* Write the Header Descriptor Pointer and start DMA */
EMACTxHdrDescPtrWrite(hdkif->emac_base, (unsigned int)(active_head), 0);
}
}
txch->active_tail = bd_end;
}
您好,
感谢您对TI产品的关注!
为更加有效地解决您的问题,我们建议您将问题发布在E2E英文技术论坛上(e2e.ti.com),将由资深的英文论坛工程师为您提供帮助。