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;