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)