dev(SF-60): Незначительные доработки
This commit is contained in:
parent
53229dbfa7
commit
75a0d57eb4
@ -53,7 +53,7 @@ free_rtos::EthRxFlow::EthRxFlow(TEthFrameMacAddr& mac_addr, EthStackIface& eth_s
|
||||
EnetQueue_initQ(&rx_free_pktq_);
|
||||
}
|
||||
|
||||
void free_rtos::EthRxFlow::initRxFreePktQ(uint32_t qCount, void * appPriv)
|
||||
void free_rtos::EthRxFlow::initRxFreePktQ(void * appPriv, EnetDma_PktQ * p_packet_queue, uint32_t qCount)
|
||||
{
|
||||
EnetDma_PktQ rxReadyQ;
|
||||
EnetDma_Pkt *pPktInfo;
|
||||
@ -69,11 +69,12 @@ void free_rtos::EthRxFlow::initRxFreePktQ(uint32_t qCount, void * appPriv)
|
||||
|
||||
ENET_UTILS_SET_PKT_APP_STATE(&pPktInfo->pktState, ENET_PKTSTATE_APP_WITH_FREEQ);
|
||||
|
||||
EnetQueue_enq(&rx_free_pktq_, &pPktInfo->node);
|
||||
EnetQueue_enq(p_packet_queue, &pPktInfo->node);
|
||||
}
|
||||
|
||||
/* Retrieve any packets which are ready */
|
||||
EnetQueue_initQ(&rxReadyQ);
|
||||
|
||||
status = EnetDma_retrieveRxPktQ(dma_handle_, &rxReadyQ);
|
||||
EnetAppUtils_assert(status == ENET_SOK);
|
||||
|
||||
@ -89,7 +90,7 @@ void free_rtos::EthRxFlow::submitFreeRxPkts(uint32_t qCount)
|
||||
|
||||
EnetQueue_initQ(&rxSubmitQ);
|
||||
|
||||
while((rxPktInfo != nullptr) && (qCount > 0))
|
||||
while((qCount > 0) && (rxPktInfo != nullptr))
|
||||
{
|
||||
EnetQueue_enq(&rxSubmitQ, &rxPktInfo->node);
|
||||
|
||||
@ -102,22 +103,12 @@ void free_rtos::EthRxFlow::submitFreeRxPkts(uint32_t qCount)
|
||||
ENET_PKTSTATE_APP_WITH_DRIVER);
|
||||
|
||||
status = EnetDma_submitRxPktQ(dma_handle_, &rxSubmitQ);
|
||||
|
||||
if(status != ENET_SOK) {
|
||||
EnetAppUtils_print("rx_flow %u: failed to reload rx dma flow\r\n", id_);
|
||||
EnetAppUtils_assert(status == ENET_SOK);
|
||||
|
||||
return;
|
||||
}
|
||||
EnetAppUtils_assert(status == ENET_SOK);
|
||||
|
||||
qCount = EnetQueue_getQCount(&rxSubmitQ);
|
||||
|
||||
/* Assert here, as during init, the number of DMA descriptors should be equal to
|
||||
* the number of free Ethernet buffers available with app */
|
||||
if(qCount != 0U) {
|
||||
EnetAppUtils_print("rx_flow %u: number of DMA descriptors should be equal to the number of free Ethernet buffers\r\n", id_);
|
||||
EnetAppUtils_assert(qCount == 0U);
|
||||
}
|
||||
* the number of free Ethernet buffers available with app */
|
||||
EnetAppUtils_assert(qCount == 0U);
|
||||
}
|
||||
|
||||
void free_rtos::EthRxFlow::rxProcessPktTask()
|
||||
@ -132,19 +123,16 @@ void free_rtos::EthRxFlow::rxProcessPktTask()
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
status = sem_[e_signalRxPkt].pend();
|
||||
|
||||
if(status != SystemP_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
do {
|
||||
EnetDma_PktQ rxFreeQ;
|
||||
|
||||
EnetQueue_initQ(&rxFreeQ);
|
||||
|
||||
status = EnetDma_retrieveRxPktQ(dma_handle_, &rxReadyQ);
|
||||
EnetAppUtils_assert(status == ENET_SOK);
|
||||
|
||||
readyQCount = EnetQueue_getQCount(&rxReadyQ);
|
||||
|
||||
if(readyQCount == 0) {
|
||||
break;
|
||||
}
|
||||
EnetAppUtils_assert(readyQCount != 0);
|
||||
|
||||
// Reload DMA with a new rx free queue as fast as possible
|
||||
submitFreeRxPkts(readyQCount);
|
||||
@ -159,17 +147,16 @@ void free_rtos::EthRxFlow::rxProcessPktTask()
|
||||
}
|
||||
//}
|
||||
|
||||
EnetDma_checkPktState(&rxPktInfo->pktState,
|
||||
ENET_PKTSTATE_MODULE_APP,
|
||||
ENET_PKTSTATE_APP_WITH_DRIVER,
|
||||
ENET_PKTSTATE_APP_WITH_FREEQ);
|
||||
|
||||
EnetQueue_enq(&rx_free_pktq_, &rxPktInfo->node);
|
||||
EnetQueue_enq(&rxFreeQ, &rxPktInfo->node);
|
||||
|
||||
rxPktInfo = (EnetDma_Pkt *)EnetQueue_deq(&rxReadyQ);
|
||||
|
||||
++rx_pkt_counter_;
|
||||
}
|
||||
|
||||
EnetAppUtils_validatePacketState(&rxFreeQ,
|
||||
ENET_PKTSTATE_APP_WITH_DRIVER,
|
||||
ENET_PKTSTATE_APP_WITH_FREEQ);
|
||||
|
||||
EnetQueue_append(&rx_free_pktq_, &rxFreeQ);
|
||||
} while(readyQCount > 0);
|
||||
}
|
||||
}
|
||||
@ -181,8 +168,6 @@ bool free_rtos::EthRxFlow::open(uint32_t id, int32_t enetDmaRxChId, UBaseType_t
|
||||
|
||||
EnetAppUtils_print("rx_flow %u: opening flow...\r\n", id);
|
||||
|
||||
rx_pkt_counter_ = 0;
|
||||
|
||||
if (open_) {
|
||||
EnetAppUtils_print("rx_flow %u: rx flow is already open. Do nothing.\r\n", id_);
|
||||
return true;
|
||||
@ -230,7 +215,7 @@ bool free_rtos::EthRxFlow::open(uint32_t id, int32_t enetDmaRxChId, UBaseType_t
|
||||
}
|
||||
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
initRxFreePktQ(ENET_SYSCFG_TOTAL_NUM_RX_PKT/2, this);
|
||||
initRxFreePktQ(this, &rx_free_pktq_, ENET_SYSCFG_TOTAL_NUM_RX_PKT/2);
|
||||
submitFreeRxPkts(ENET_SYSCFG_TOTAL_NUM_RX_PKT/4);
|
||||
|
||||
open_ = true;
|
||||
|
||||
@ -40,7 +40,7 @@ private:
|
||||
|
||||
friend void rxTaskHandler(void *appData); ///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
void initRxFreePktQ(uint32_t qCount, void * appPriv);
|
||||
void initRxFreePktQ(void * appPriv, EnetDma_PktQ * p_packet_queue, uint32_t qCount);
|
||||
void submitFreeRxPkts(uint32_t qCount);
|
||||
|
||||
void rxProcessPktTask(); ///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@ -60,11 +60,8 @@ private:
|
||||
|
||||
TEthFrameMacAddr& mac_addr_; /// mac <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
uint32_t rx_pkt_counter_;
|
||||
|
||||
EthStackIface& eth_stack_;
|
||||
|
||||
///------------------------------------
|
||||
uint32_t rx_start_flow_idx_;
|
||||
uint32_t rx_flow_idx_;
|
||||
EnetDma_RxChHandle dma_handle_;
|
||||
|
||||
@ -26,16 +26,13 @@
|
||||
/**
|
||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> p_packet_queue
|
||||
*/
|
||||
static void eth_initTxFreePktQ(void * appPriv, EnetDma_PktQ * p_packet_queue)
|
||||
static void eth_initTxFreePktQ(void * appPriv, EnetDma_PktQ * p_packet_queue, uint32_t qCount)
|
||||
{
|
||||
EnetDma_Pkt *pPktInfo;
|
||||
uint32_t i;
|
||||
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int i_max = (ENET_SYSCFG_TOTAL_NUM_TX_PKT);
|
||||
|
||||
/* Initialize TX EthPkts and queue them to txFreePktInfoQ */
|
||||
for (i = 0U; i < i_max; i++)
|
||||
for (i = 0U; i < qCount; i++)
|
||||
{
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pPktInfo = EnetMem_allocEthPkt(appPriv,
|
||||
@ -125,7 +122,7 @@ bool free_rtos::EthTxFlow::open(uint32_t id, int32_t enetDmaTxChId)
|
||||
dma_handle_ = txChInfo.hTxCh;
|
||||
|
||||
EnetAppUtils_assert(txChInfo.useGlobalEvt == true);
|
||||
EnetAppUtils_assert(txChInfo.maxNumTxPkts >= (ENET_SYSCFG_TOTAL_NUM_TX_PKT));
|
||||
EnetAppUtils_assert(txChInfo.maxNumTxPkts >= ENET_SYSCFG_TOTAL_NUM_TX_PKT);
|
||||
|
||||
if (dma_handle_ == nullptr)
|
||||
{
|
||||
@ -134,7 +131,7 @@ bool free_rtos::EthTxFlow::open(uint32_t id, int32_t enetDmaTxChId)
|
||||
return false;
|
||||
}
|
||||
|
||||
eth_initTxFreePktQ(this, &tx_free_pktq_);
|
||||
eth_initTxFreePktQ(this, &tx_free_pktq_, ENET_SYSCFG_TOTAL_NUM_TX_PKT);
|
||||
|
||||
open_= true;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user