From 546220b3b1fef3bd0b6571f13fcdb6ba84d9b4eb Mon Sep 17 00:00:00 2001 From: algin Date: Fri, 8 Dec 2023 14:41:58 +0300 Subject: [PATCH] =?UTF-8?q?fix():=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=BA=D0=BE=D0=BF=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D1=85=20UDP=20=D0=B1=D0=B5=D0=B7=20=D0=BF=D0=BE=D0=B4=D1=81?= =?UTF-8?q?=D1=87=D0=B5=D1=82=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D0=BE=D0=B9=20=D1=81=D1=83=D0=BC=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/free_rtos/ethernet/eth_task_settings.hpp | 2 +- components/free_rtos/ethernet_ip/eth_udp_client.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/free_rtos/ethernet/eth_task_settings.hpp b/components/free_rtos/ethernet/eth_task_settings.hpp index 8ff6a2d..fa71b34 100644 --- a/components/free_rtos/ethernet/eth_task_settings.hpp +++ b/components/free_rtos/ethernet/eth_task_settings.hpp @@ -14,7 +14,7 @@ namespace free_rtos { static constexpr uint32_t LINK_TASK_PRIORITY = tskIDLE_PRIORITY + 2; - static constexpr uint32_t LINK_TASK_STACK_SIZE = 0x2000 / sizeof(StackType_t); + static constexpr uint32_t LINK_TASK_STACK_SIZE = 0x1800 / sizeof(StackType_t); } #endif /* FREE_RTOS_ETHERNET_ETH_TASK_SETTINGS_HPP_ */ diff --git a/components/free_rtos/ethernet_ip/eth_udp_client.cpp b/components/free_rtos/ethernet_ip/eth_udp_client.cpp index 9075a3b..c9e9c76 100644 --- a/components/free_rtos/ethernet_ip/eth_udp_client.cpp +++ b/components/free_rtos/ethernet_ip/eth_udp_client.cpp @@ -189,14 +189,20 @@ uint16_t free_rtos::EthUpdClient::fill_udp_header(UDPHandlerArgs& udpHandlerArgs chk_sum32 += IP_PROT_UDP + udp_len; //uint16_t chk_sum16 = eth_calcChksum2(chk_sum32, (uint8_t *)&udpHandlerArgs.udp_header, sizeof(TUdpHeader), (uint8_t *)udpHandlerArgs.p_data, udpHandlerArgs.ip_data_len); + //Расчет контрольной суммы совмещен с копированием данных ! uint16_t chk_sum16 = eth_calcChksum3(udp_hdr, chk_sum32, &udp_header, sizeof(TUdpHeader), udpHandlerArgs.p_data, udpHandlerArgs.ip_data_len); udp_hdr->Chk_sum = BASE_SWAP16(chk_sum16); + } else { + uint8_t* udp_data = udpHandlerArgs.buffer + sizeof(TEthFrameHeader) + sizeof(TIpHeader) + sizeof(TUdpHeader); + + *udp_hdr = udp_header; + memcpy(udp_data, udpHandlerArgs.p_data, udpHandlerArgs.ip_data_len); } - return sizeof(TUdpHeader); + return sizeof(TUdpHeader) + udpHandlerArgs.ip_data_len; } uint16_t free_rtos::EthUpdClient::Sender(HandlerArgs& handlerArgs, size_t scatter_segment) @@ -205,7 +211,7 @@ uint16_t free_rtos::EthUpdClient::Sender(HandlerArgs& handlerArgs, size_t scatte fill_udp_header(udpHandlerArgs); - return udpHandlerArgs.ip_header_len + udpHandlerArgs.ip_data_len; + return sizeof(TUdpHeader) + udpHandlerArgs.ip_data_len; } int32_t free_rtos::EthUpdClient::Process(uint8_t * p_data, uint32_t len)