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++)