xmac port code update

This commit is contained in:
lzh 2024-05-20 18:04:25 +08:00 committed by Rbb666
parent 7d7a53ebc1
commit b764055018
2 changed files with 6 additions and 30 deletions

View File

@ -756,14 +756,12 @@ void FXmacErrorHandler(void *arg, u8 direction, u32 error_word)
if (error_word & FXMAC_RXSR_RXOVR_MASK) if (error_word & FXMAC_RXSR_RXOVR_MASK)
{ {
LOG_I("Receive over run."); LOG_I("Receive over run.");
FXmacRecvHandler(instance_p); FXmacRecvHandler(arg);
SetupRxBds(instance_p, rxring);
} }
if (error_word & FXMAC_RXSR_BUFFNA_MASK) if (error_word & FXMAC_RXSR_BUFFNA_MASK)
{ {
LOG_I("Receive buffer not available."); LOG_I("Receive buffer not available.");
FXmacRecvHandler(arg); FXmacRecvHandler(arg);
SetupRxBds(instance_p, rxring);
} }
break; break;
case FXMAC_SEND: case FXMAC_SEND:
@ -1001,7 +999,6 @@ static void FxmacOsIntrHandler(s32 vector, void *args)
static void FXmacSetupIsr(FXmacOs *instance_p) static void FXmacSetupIsr(FXmacOs *instance_p)
{ {
rt_uint32_t cpu_id = rt_hw_cpu_id();
/* Setup callbacks */ /* Setup callbacks */
FXmacSetHandler(&instance_p->instance, FXMAC_HANDLER_DMARECV, FXmacRecvSemaphoreHandler, instance_p); FXmacSetHandler(&instance_p->instance, FXMAC_HANDLER_DMARECV, FXmacRecvSemaphoreHandler, instance_p);
@ -1222,34 +1219,18 @@ FError FXmacOsTx(FXmacOs *instance_p, void *tx_buf)
{ {
FXmacBdRing *txring; FXmacBdRing *txring;
FError ret; FError ret;
u32 n_pbufs;
struct pbuf *p; struct pbuf *p;
struct pbuf *q;
FASSERT(instance_p != NULL); FASSERT(instance_p != NULL);
if (tx_buf == NULL) FASSERT(tx_buf != NULL);
{
LOG_E("tx_buf is null.");
return FREERTOS_XMAC_PARAM_ERROR;
}
p = tx_buf; p = tx_buf;
txring = &(FXMAC_GET_TXRING(instance_p->instance)); txring = &(FXMAC_GET_TXRING(instance_p->instance));
FXmacProcessSentBds(instance_p, txring);
for (q = p, n_pbufs = 0; q != NULL; q = q->next)
{
n_pbufs++;
}
/* check if space is available to send */ /* check if space is available to send */
if (txring->free_cnt < n_pbufs)
{
FXmacProcessSentBds(instance_p, txring);
}
if (IsTxSpaceAvailable(instance_p)) if (IsTxSpaceAvailable(instance_p))
{ {
FXmacOsOutput(instance_p, p); ret = FXmacOsOutput(instance_p, p);
ret = FT_SUCCESS;
} }
else else
{ {
@ -1406,8 +1387,6 @@ rt_err_t rt_xmac_tx(rt_device_t dev, struct pbuf *p)
return -RT_ENOMEM; return -RT_ENOMEM;
} }
#if RT_LWIP_ETH_PAD_SIZE #if RT_LWIP_ETH_PAD_SIZE
pbuf_header(p, -RT_LWIP_ETH_PAD_SIZE); /* reclaim the padding word */ pbuf_header(p, -RT_LWIP_ETH_PAD_SIZE); /* reclaim the padding word */
#endif #endif
@ -1431,7 +1410,6 @@ struct pbuf *rt_xmac_rx(rt_device_t dev)
FXmacOs *pOsMac; FXmacOs *pOsMac;
struct eth_device *pXmacParent; struct eth_device *pXmacParent;
struct pbuf *p; struct pbuf *p;
rt_base_t level;
pXmacParent = rt_container_of(dev, struct eth_device, parent); pXmacParent = rt_container_of(dev, struct eth_device, parent);
if (NULL == pXmacParent) if (NULL == pXmacParent)
@ -1445,10 +1423,8 @@ struct pbuf *rt_xmac_rx(rt_device_t dev)
return RT_NULL; return RT_NULL;
} }
level = rt_hw_interrupt_disable();
FXmacRecvHandler(pOsMac); FXmacRecvHandler(pOsMac);
p = FXmacOsRx(pOsMac); p = FXmacOsRx(pOsMac);
rt_hw_interrupt_enable(level);
return p; return p;
} }

View File

@ -19,6 +19,6 @@ def clone_repository(branch, commit_hash):
if __name__ == "__main__": if __name__ == "__main__":
branch_to_clone = "master" branch_to_clone = "master"
commit_to_clone = "cd15b23000d0c52968dc322b6d99025195bbf446" commit_to_clone = "588db75e0ca38c0559563303d4ab8cbabab0e3ec"
clone_repository(branch_to_clone, commit_to_clone) clone_repository(branch_to_clone, commit_to_clone)