提交 e32c1afa 编写于 作者: wuyangyong's avatar wuyangyong

update stm32f107 ethernet driver: optimize eth_rx, use memcpy.

上级 072fd38a
...@@ -3283,7 +3283,7 @@ rt_err_t rt_stm32_eth_tx( rt_device_t dev, struct pbuf* p) ...@@ -3283,7 +3283,7 @@ rt_err_t rt_stm32_eth_tx( rt_device_t dev, struct pbuf* p)
struct pbuf *rt_stm32_eth_rx(rt_device_t dev) struct pbuf *rt_stm32_eth_rx(rt_device_t dev)
{ {
struct pbuf* p; struct pbuf* p;
rt_uint32_t offset = 0, framelength = 0; rt_uint32_t framelength = 0;
/* init p pointer */ /* init p pointer */
p = RT_NULL; p = RT_NULL;
...@@ -3303,24 +3303,16 @@ struct pbuf *rt_stm32_eth_rx(rt_device_t dev) ...@@ -3303,24 +3303,16 @@ struct pbuf *rt_stm32_eth_rx(rt_device_t dev)
p = pbuf_alloc(PBUF_LINK, framelength, PBUF_RAM); p = pbuf_alloc(PBUF_LINK, framelength, PBUF_RAM);
if (p != RT_NULL) if (p != RT_NULL)
{ {
rt_uint8_t* ptr; const char * from;
struct pbuf* q; struct pbuf* q;
rt_size_t len;
from = (const char *)(DMARxDescToGet->Buffer1Addr);
for (q = p; q != RT_NULL; q= q->next) for (q = p; q != RT_NULL; q= q->next)
{ {
ptr = q->payload;
len = q->len;
/* Copy the received frame into buffer from memory pointed by the current ETHERNET DMA Rx descriptor */ /* Copy the received frame into buffer from memory pointed by the current ETHERNET DMA Rx descriptor */
while (len) memcpy(q->payload, from, q->len);
{ from += q->len;
*ptr = (*(__IO uint8_t *)((DMARxDescToGet->Buffer1Addr) + offset));
offset ++;
ptr ++;
len --;
}
} }
#ifdef ETH_RX_DUMP #ifdef ETH_RX_DUMP
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册