From b76405501818bc0d446c543c04b733a2c193c8c2 Mon Sep 17 00:00:00 2001 From: lzh Date: Mon, 20 May 2024 18:04:25 +0800 Subject: [PATCH] xmac port code update --- bsp/phytium/libraries/drivers/drv_xmac.c | 34 +++---------------- .../phytium_standalone_sdk_install.py | 2 +- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/bsp/phytium/libraries/drivers/drv_xmac.c b/bsp/phytium/libraries/drivers/drv_xmac.c index 37cdc98cf2..0ba31ee20f 100644 --- a/bsp/phytium/libraries/drivers/drv_xmac.c +++ b/bsp/phytium/libraries/drivers/drv_xmac.c @@ -756,14 +756,12 @@ void FXmacErrorHandler(void *arg, u8 direction, u32 error_word) if (error_word & FXMAC_RXSR_RXOVR_MASK) { LOG_I("Receive over run."); - FXmacRecvHandler(instance_p); - SetupRxBds(instance_p, rxring); + FXmacRecvHandler(arg); } if (error_word & FXMAC_RXSR_BUFFNA_MASK) { LOG_I("Receive buffer not available."); FXmacRecvHandler(arg); - SetupRxBds(instance_p, rxring); } break; case FXMAC_SEND: @@ -1001,8 +999,7 @@ static void FxmacOsIntrHandler(s32 vector, void *args) static void FXmacSetupIsr(FXmacOs *instance_p) { - rt_uint32_t cpu_id = rt_hw_cpu_id(); - + /* Setup callbacks */ FXmacSetHandler(&instance_p->instance, FXMAC_HANDLER_DMARECV, FXmacRecvSemaphoreHandler, instance_p); FXmacSetHandler(&instance_p->instance, FXMAC_HANDLER_ERROR, FXmacErrorHandler, instance_p); @@ -1222,34 +1219,18 @@ FError FXmacOsTx(FXmacOs *instance_p, void *tx_buf) { FXmacBdRing *txring; FError ret; - u32 n_pbufs; struct pbuf *p; - struct pbuf *q; FASSERT(instance_p != NULL); - if (tx_buf == NULL) - { - LOG_E("tx_buf is null."); - return FREERTOS_XMAC_PARAM_ERROR; - } + FASSERT(tx_buf != NULL); p = tx_buf; txring = &(FXMAC_GET_TXRING(instance_p->instance)); - - for (q = p, n_pbufs = 0; q != NULL; q = q->next) - { - n_pbufs++; - } + FXmacProcessSentBds(instance_p, txring); /* check if space is available to send */ - if (txring->free_cnt < n_pbufs) - { - FXmacProcessSentBds(instance_p, txring); - } - if (IsTxSpaceAvailable(instance_p)) { - FXmacOsOutput(instance_p, p); - ret = FT_SUCCESS; + ret = FXmacOsOutput(instance_p, p); } else { @@ -1406,8 +1387,6 @@ rt_err_t rt_xmac_tx(rt_device_t dev, struct pbuf *p) return -RT_ENOMEM; } - - #if RT_LWIP_ETH_PAD_SIZE pbuf_header(p, -RT_LWIP_ETH_PAD_SIZE); /* reclaim the padding word */ #endif @@ -1431,7 +1410,6 @@ struct pbuf *rt_xmac_rx(rt_device_t dev) FXmacOs *pOsMac; struct eth_device *pXmacParent; struct pbuf *p; - rt_base_t level; pXmacParent = rt_container_of(dev, struct eth_device, parent); if (NULL == pXmacParent) @@ -1445,10 +1423,8 @@ struct pbuf *rt_xmac_rx(rt_device_t dev) return RT_NULL; } - level = rt_hw_interrupt_disable(); FXmacRecvHandler(pOsMac); p = FXmacOsRx(pOsMac); - rt_hw_interrupt_enable(level); return p; } diff --git a/bsp/phytium/libraries/phytium_standalone_sdk_install.py b/bsp/phytium/libraries/phytium_standalone_sdk_install.py index d660f702ac..143eb53657 100644 --- a/bsp/phytium/libraries/phytium_standalone_sdk_install.py +++ b/bsp/phytium/libraries/phytium_standalone_sdk_install.py @@ -19,6 +19,6 @@ def clone_repository(branch, commit_hash): if __name__ == "__main__": branch_to_clone = "master" - commit_to_clone = "cd15b23000d0c52968dc322b6d99025195bbf446" + commit_to_clone = "588db75e0ca38c0559563303d4ab8cbabab0e3ec" clone_repository(branch_to_clone, commit_to_clone) \ No newline at end of file