From aad5a08dcc0ff43841a96381dd57e306147041c8 Mon Sep 17 00:00:00 2001 From: algin Date: Tue, 2 Jul 2024 14:07:24 +0300 Subject: [PATCH] =?UTF-8?q?dev():=20=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=B0=20=D0=BD=D0=B0=20=D0=BD=D0=BE=D0=B2=D1=83=D1=8E=20?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8E=20mcu=5Fplus=5Fsdk=5Fam64x?= =?UTF-8?q?=5F09=5F01=5F00=5F41?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/free_rtos/ethernet/eth.cpp | 2 ++ components/free_rtos/ethernet/eth_rx_flow.cpp | 11 +++---- .../free_rtos/ethernet/eth_ti_enet_inst.c | 30 +++---------------- components/free_rtos/ethernet/eth_tx_flow.cpp | 6 ++-- 4 files changed, 16 insertions(+), 33 deletions(-) diff --git a/components/free_rtos/ethernet/eth.cpp b/components/free_rtos/ethernet/eth.cpp index 600cbe9..19c624b 100644 --- a/components/free_rtos/ethernet/eth.cpp +++ b/components/free_rtos/ethernet/eth.cpp @@ -257,6 +257,8 @@ bool free_rtos::Eth::Open() EnetAppUtils_print("%s: Open enet driver\r\n", name_.c_str()); + EnetApp_driverInit(); + status = EnetApp_driverOpen(enetType_, instId_); if (ENET_SOK != status) { EnetAppUtils_print("%s: fail to open enet driver\r\n", name_.c_str()); diff --git a/components/free_rtos/ethernet/eth_rx_flow.cpp b/components/free_rtos/ethernet/eth_rx_flow.cpp index d85146d..cea2aa1 100644 --- a/components/free_rtos/ethernet/eth_rx_flow.cpp +++ b/components/free_rtos/ethernet/eth_rx_flow.cpp @@ -53,12 +53,14 @@ void free_rtos::EthRxFlow::initRxFreePktQ(void * appPriv, EnetDma_PktQ * p_packe EnetDma_Pkt *pPktInfo; uint32_t i; int32_t status; + uint32_t scatterSegmentSize[1] = {ENET_MEM_LARGE_POOL_PKT_SIZE}; for (i = 0U; i < qCount; ++i) { pPktInfo = EnetMem_allocEthPkt(appPriv, - ENET_MEM_LARGE_POOL_PKT_SIZE, - ENETDMA_CACHELINE_ALIGNMENT); + ENETDMA_CACHELINE_ALIGNMENT, + 1, + scatterSegmentSize); EnetAppUtils_assert(pPktInfo != NULL); ENET_UTILS_SET_PKT_APP_STATE(&pPktInfo->pktState, ENET_PKTSTATE_APP_WITH_FREEQ); @@ -171,9 +173,9 @@ bool free_rtos::EthRxFlow::open(TEthMacPorts port_id, int32_t enetDmaRxChId, UBa rx_flow_idx_ = rxChInfo.rxFlowIdx; dma_handle_ = rxChInfo.hRxCh; - if (rxChInfo.macAddressValid) + if (rxChInfo.numValidMacAddress != 0) { - EnetUtils_copyMacAddr(mac_addr_.bytes, rxChInfo.macAddr); + EnetUtils_copyMacAddr(mac_addr_.bytes, rxChInfo.macAddr[0]); mac_addr_.addr&= ETH_FRAME_MAC_ADDR_MASK; eth_stack_.set_mac_address(mac_addr_.addr); @@ -183,7 +185,6 @@ bool free_rtos::EthRxFlow::open(TEthMacPorts port_id, int32_t enetDmaRxChId, UBa EnetAppUtils_assert(rxChInfo.sizeThreshEn == 0U); EnetAppUtils_assert(rxChInfo.maxNumRxPkts >= numPkts[enetDmaRxChId]); EnetAppUtils_assert(rxChInfo.chIdx == port_id); - EnetAppUtils_assert(rxChInfo.useDefaultFlow == true); if (dma_handle_ == nullptr) { diff --git a/components/free_rtos/ethernet/eth_ti_enet_inst.c b/components/free_rtos/ethernet/eth_ti_enet_inst.c index 13b8372..f29c35b 100644 --- a/components/free_rtos/ethernet/eth_ti_enet_inst.c +++ b/components/free_rtos/ethernet/eth_ti_enet_inst.c @@ -57,7 +57,7 @@ void EnetApp_initLinkArgs(Enet_Type enetType, IcssgMacPort_initCfg(icssgMacCfg); icssgMacCfg->specialFramePrio = 1U; - /* Set port link params */ + /* Set port link params */ portLinkCfg->macPort = macPort; mii->layerType = ethPort.mii.layerType; @@ -71,32 +71,10 @@ void EnetApp_initLinkArgs(Enet_Type enetType, if (boardPhyCfg != NULL) { EnetPhy_initCfg(phyCfg); - if ((ENET_ICSSG_DUALMAC == enetType) && (2U == instId)) - { - phyCfg->phyAddr = CONFIG_ENET_ICSS0_PHY1_ADDR; - } - else if ((ENET_ICSSG_DUALMAC == enetType) && (3U == instId)) - { - phyCfg->phyAddr = CONFIG_ENET_ICSS0_PHY2_ADDR; - } - else if ((ENET_ICSSG_SWITCH == enetType) && (1U == instId)) - { - if (macPort == ENET_MAC_PORT_1) - { - phyCfg->phyAddr = CONFIG_ENET_ICSS0_PHY1_ADDR; - } - else - { - phyCfg->phyAddr = CONFIG_ENET_ICSS0_PHY2_ADDR; - } - } - else - { - EnetAppUtils_assert(false); - } - phyCfg->isStrapped = boardPhyCfg->isStrapped; - phyCfg->loopbackEn = false; + phyCfg->phyAddr = boardPhyCfg->phyAddr; + phyCfg->isStrapped = boardPhyCfg->isStrapped; + phyCfg->loopbackEn = false; phyCfg->skipExtendedCfg = boardPhyCfg->skipExtendedCfg; phyCfg->extendedCfgSize = boardPhyCfg->extendedCfgSize; memcpy(phyCfg->extendedCfg, boardPhyCfg->extendedCfg, phyCfg->extendedCfgSize); diff --git a/components/free_rtos/ethernet/eth_tx_flow.cpp b/components/free_rtos/ethernet/eth_tx_flow.cpp index 013be5f..a6ff833 100644 --- a/components/free_rtos/ethernet/eth_tx_flow.cpp +++ b/components/free_rtos/ethernet/eth_tx_flow.cpp @@ -25,13 +25,15 @@ static void eth_initTxFreePktQ(void * appPriv, EnetDma_PktQ * p_packet_queue, ui { EnetDma_Pkt *pPktInfo; uint32_t i; + uint32_t scatterSegmentSize[1] = {ENET_MEM_LARGE_POOL_PKT_SIZE}; /* Initialize TX EthPkts and queue them to txFreePktInfoQ */ for (i = 0U; i < qCount; i++) { pPktInfo = EnetMem_allocEthPkt(appPriv, - ENET_MEM_LARGE_POOL_PKT_SIZE, - ENETDMA_CACHELINE_ALIGNMENT); + ENETDMA_CACHELINE_ALIGNMENT, + 1, + scatterSegmentSize); EnetAppUtils_assert(pPktInfo != NULL); ENET_UTILS_SET_PKT_APP_STATE(&pPktInfo->pktState, ENET_PKTSTATE_APP_WITH_FREEQ);