From 24f5a680fab14b565c5fc21e078dc628e52624c1 Mon Sep 17 00:00:00 2001 From: algin Date: Fri, 19 Jan 2024 14:57:14 +0300 Subject: [PATCH] =?UTF-8?q?dev():=20=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=B8=D0=B5=20=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/free_rtos/ethernet/eth_rx_flow.cpp | 8 +++++--- components/free_rtos/ethernet/eth_tx_flow.cpp | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/components/free_rtos/ethernet/eth_rx_flow.cpp b/components/free_rtos/ethernet/eth_rx_flow.cpp index f1fef6e..c227793 100644 --- a/components/free_rtos/ethernet/eth_rx_flow.cpp +++ b/components/free_rtos/ethernet/eth_rx_flow.cpp @@ -178,6 +178,8 @@ bool free_rtos::EthRxFlow::open(uint32_t id, int32_t enetDmaRxChId, UBaseType_t EnetApp_GetDmaHandleInArgs rxInArgs; EnetApp_GetRxDmaHandleOutArgs rxChInfo; + constexpr uint32_t numPkts[2] = {ENET_DMA_RX_CH0_NUM_PKTS, ENET_DMA_RX_CH1_NUM_PKTS}; + EnetAppUtils_print("rx_flow %u: opening flow...\r\n", id); if (open_) { @@ -216,7 +218,7 @@ bool free_rtos::EthRxFlow::open(uint32_t id, int32_t enetDmaRxChId, UBaseType_t /// �������� ������ EnetAppUtils_assert(rxChInfo.useGlobalEvt == true); EnetAppUtils_assert(rxChInfo.sizeThreshEn == 0U); - EnetAppUtils_assert(rxChInfo.maxNumRxPkts >= (ENET_SYSCFG_TOTAL_NUM_RX_PKT/2U)); + EnetAppUtils_assert(rxChInfo.maxNumRxPkts >= numPkts[enetDmaRxChId]); EnetAppUtils_assert(rxChInfo.chIdx == id_); EnetAppUtils_assert(rxChInfo.useDefaultFlow == true); @@ -228,8 +230,8 @@ bool free_rtos::EthRxFlow::open(uint32_t id, int32_t enetDmaRxChId, UBaseType_t } /// ������������� ������� ������� - initRxFreePktQ(this, &rx_free_pktq_, ENET_SYSCFG_TOTAL_NUM_RX_PKT/2); - submitFreeRxPkts(ENET_SYSCFG_TOTAL_NUM_RX_PKT/4); + initRxFreePktQ(this, &rx_free_pktq_, numPkts[enetDmaRxChId]); + submitFreeRxPkts(numPkts[enetDmaRxChId]/2); open_ = true; diff --git a/components/free_rtos/ethernet/eth_tx_flow.cpp b/components/free_rtos/ethernet/eth_tx_flow.cpp index 7a08d8f..77d6cfc 100644 --- a/components/free_rtos/ethernet/eth_tx_flow.cpp +++ b/components/free_rtos/ethernet/eth_tx_flow.cpp @@ -15,6 +15,8 @@ #include #include +#include + /*----------------------------------------------------------------------*/ /** * ����� ������������ sysconfig. @@ -159,6 +161,8 @@ void free_rtos::EthTxFlow::disable(TEthMacPorts port_id) { bool free_rtos::EthTxFlow::send(TEthMacPorts port_id, uint8_t * p_data, uint32_t len) { if (port_id >= e_ethMacTotal) { + EnetAppUtils_print("Wrong port id\r\n"); + return false; } @@ -176,6 +180,11 @@ bool free_rtos::EthTxFlow::send(TEthMacPorts port_id, uint8_t * p_data, uint32_t txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_); + while(txPktInfo == NULL) + { + txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_); + } + if (txPktInfo != NULL) { ///�������� ������ ������ � ����� @@ -239,6 +248,11 @@ bool free_rtos::EthTxFlow::send(TxFlowHandlerArgs& handlerArgs, uint32_t numScat txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_); + while(txPktInfo == NULL) + { + txPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&tx_free_pktq_); + } + if (txPktInfo != NULL) { for(size_t scatter_segment = 0; scatter_segment < numScatterSegments; scatter_segment++)