From 7f9e7659b85f13ac6987800261cfefcd7ceba3cc Mon Sep 17 00:00:00 2001 From: algin Date: Mon, 9 Oct 2023 11:09:33 +0300 Subject: [PATCH] =?UTF-8?q?dev(SF-60):=20=D0=9F=D0=B0=D1=80=D0=B0=D0=BC?= =?UTF-8?q?=D0=B5=D1=82=D1=80=D0=B8=D0=B7=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=20=D1=82=D0=B0=D0=B9=D0=BC=D0=B0=D1=83=D1=82=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=82=D0=B0=D0=B9=D0=BC=D0=B5=D1=80=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/free_rtos/ethernet_industry/eth_ecat.cpp | 2 +- .../free_rtos/ethernet_industry/eth_ecat_telegram.hpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/components/free_rtos/ethernet_industry/eth_ecat.cpp b/components/free_rtos/ethernet_industry/eth_ecat.cpp index 19af952..bc856f0 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat.cpp +++ b/components/free_rtos/ethernet_industry/eth_ecat.cpp @@ -20,7 +20,7 @@ EthEcat::EthEcat(Eth& eth) void EthEcat::Init(TEthMacPorts port_id, uint32_t period_microsec = 250) { port_id_ = port_id; - telegram_.init(port_id); + telegram_.init(port_id, period_microsec, 6); Timer::Settings ecat_tmr_sett = { .input_clk_Hz = 25000000, // 25MHz diff --git a/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp b/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp index 6694e70..217b035 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp +++ b/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp @@ -68,8 +68,11 @@ public: virtual int32_t Process(uint8_t *p_data, uint32_t len) override; virtual uint32_t Sender(uint8_t *p_data, size_t scatter_segment) override; - void init(TEthMacPorts port_id) { + void init(TEthMacPorts port_id, uint32_t period_microsec, uint32_t max_transfer_attempts) { port_id_ = port_id; + period_microsec_ = period_microsec; + counter_timeout_ticks_ = (semaphore_timeout_ticks_*1000)/period_microsec; + max_transfer_attempts_ = max_transfer_attempts; eth_.getEthStackPtr()->Register(ETH_PROT_ECAT_LE, this); } @@ -90,14 +93,16 @@ public: private: static constexpr uint32_t semaphore_timeout_ticks_ = 2; - static constexpr uint32_t counter_timeout_ticks_ = 8; - static constexpr uint32_t max_transfer_attempts_ = 6; Eth& eth_; Timer& ecat_timer_; EthTxFlowIface& tx_flow_; EthStackIface& eth_stack_; + TEthMacPorts port_id_; + uint32_t period_microsec_{250}; + uint32_t counter_timeout_ticks_{8}; + uint32_t max_transfer_attempts_{6}; free_rtos::Semaphore rx_sem_; uint8_t idx_{0x00};