From 2f8e2e726feb289fcbcf17fed02937d5c4f8811f Mon Sep 17 00:00:00 2001 From: algin Date: Tue, 21 Nov 2023 13:22:08 +0300 Subject: [PATCH] =?UTF-8?q?refactor():=20=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D1=83=D1=81=D1=82=D0=B0=D1=80=D0=B5=D0=B2=D1=88=D0=B8?= =?UTF-8?q?=D0=B9=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../free_rtos/ethernet_ip/eth_udp_client.cpp | 43 ------------------- 1 file changed, 43 deletions(-) diff --git a/components/free_rtos/ethernet_ip/eth_udp_client.cpp b/components/free_rtos/ethernet_ip/eth_udp_client.cpp index b955147..9075a3b 100644 --- a/components/free_rtos/ethernet_ip/eth_udp_client.cpp +++ b/components/free_rtos/ethernet_ip/eth_udp_client.cpp @@ -136,49 +136,6 @@ void free_rtos::EthUpdClient::clear() buff_[out_toggle_].clear(); } -/* -bool free_rtos::EthUpdClient::write(uint32_t ip_dst_be, uint8_t * p_data, uint32_t len) -{ - TUdpHeader * hdr = (TUdpHeader *)(eth_pkt_.data + sizeof(TIpHeader) + sizeof(TEthFrameHeader)); - uint8_t * p_udp_data = (uint8_t *)(eth_pkt_.data + sizeof(TIpHeader) + sizeof(TEthFrameHeader) + sizeof(TUdpHeader)); - - if (ip_dst_be == 0) { - ip_dst_be = src_ip_; - } - - eth_pkt_.length = len + sizeof(TUdpHeader); - - hdr->Src_port = port_src_be_; - hdr->Dst_port = port_dst_be_; - hdr->Length = BASE_SWAP16(eth_pkt_.length); - hdr->Chk_sum = 0; - - memcpy(p_udp_data, p_data, len); - - if (use_checksum_) { - uint32_t self_ip = ip_iface_.getSelfIpAddr(); - uint32_t chk_sum32 = 0; - - uint8_t * const dst_ip = (uint8_t *)&ip_dst_be; - uint8_t * const src_ip = (uint8_t *)&self_ip; - - for (int j = 0; j < ETH_IP_ADDR_LEN; j += 2) - { - chk_sum32 += ((uint16_t)dst_ip[j] << 8) + dst_ip[j+1]; - chk_sum32 += ((uint16_t)src_ip[j] << 8) + src_ip[j+1]; - } - - chk_sum32 += IP_PROT_UDP + eth_pkt_.length; - - uint16_t chk_sum16 = eth_calcChksum(chk_sum32, (uint8_t *)hdr, eth_pkt_.length); - - hdr->Chk_sum = BASE_SWAP16(chk_sum16); - } - - return ip_iface_.send(port_id_, ip_dst_be, IP_PROT_UDP, eth_pkt_); -} -*/ - bool free_rtos::EthUpdClient::write(uint32_t ip_dst_be, uint8_t * p_data, uint32_t len) { UDPHandlerArgs udpHandlerArgs;