Skip to content

Commit efa6eb1

Browse files
committed
[bsp/ls1cdev]修复以太网驱动发送字节丢失问题
1 parent 67832e4 commit efa6eb1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bsp/ls1cdev/drivers/net/synopGMAC.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ static rt_err_t eth_init(rt_device_t device )
304304

305305
init_phy(adapter->synopGMACdev);
306306

307-
rt_kprintf("tx desc_queue\n");
307+
DEBUG_MES("tx desc_queue\n");
308308
synopGMAC_setup_tx_desc_queue(gmacdev,TRANSMIT_DESC_SIZE, RINGMODE);
309309
synopGMAC_init_tx_desc_base(gmacdev);
310310

311-
rt_kprintf("rx desc_queue\n");
311+
DEBUG_MES("rx desc_queue\n");
312312
synopGMAC_setup_rx_desc_queue(gmacdev,RECEIVE_DESC_SIZE, RINGMODE);
313313
synopGMAC_init_rx_desc_base(gmacdev);
314314
DEBUG_MES("DmaRxBaseAddr = %08x\n",synopGMACReadReg(gmacdev->DmaBase,DmaRxBaseAddr));
@@ -460,7 +460,7 @@ rt_err_t rt_eth_tx(rt_device_t device, struct pbuf* p)
460460
if(!synopGMAC_is_desc_owned_by_dma(gmacdev->TxNextDesc))
461461
{
462462

463-
pbuf = (u32)plat_alloc_memory(p->len);
463+
pbuf = (u32)plat_alloc_memory(p->tot_len);
464464
//pbuf = (u32)pbuf_alloc(PBUF_LINK, p->len, PBUF_RAM);
465465
if(pbuf == 0)
466466
{
@@ -469,10 +469,10 @@ rt_err_t rt_eth_tx(rt_device_t device, struct pbuf* p)
469469
}
470470

471471
DEBUG_MES("p->len = %d\n", p->len);
472-
memcpy((void *)pbuf, p->payload, p->len);
473-
dma_addr = plat_dma_map_single(gmacdev,(void*)pbuf,p->len);
472+
pbuf_copy_partial(p, (void *)pbuf, p->tot_len, 0);
473+
dma_addr = plat_dma_map_single(gmacdev,(void*)pbuf,p->tot_len);
474474

475-
status = synopGMAC_set_tx_qptr(gmacdev,dma_addr,p->len,pbuf,0,0,0,offload_needed,&index,dpr);
475+
status = synopGMAC_set_tx_qptr(gmacdev,dma_addr,p->tot_len,pbuf,0,0,0,offload_needed,&index,dpr);
476476
if(status < 0){
477477
rt_kprintf("%s No More Free Tx Descriptors\n",__FUNCTION__);
478478

0 commit comments

Comments
 (0)