diff options
author | Martin Braun <martin.braun@ettus.com> | 2015-11-25 15:47:37 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2015-12-14 13:26:44 -0800 |
commit | 87860fc3226c8915cb45a4fc39d5e64bf667470d (patch) | |
tree | ee8f041a7860a6c502f92f9792733590d052a4d5 /host/utils | |
parent | 4cc09da892141fc08c33eec6cc168bccdb6b84ac (diff) | |
download | uhd-87860fc3226c8915cb45a4fc39d5e64bf667470d.tar.gz uhd-87860fc3226c8915cb45a4fc39d5e64bf667470d.tar.bz2 uhd-87860fc3226c8915cb45a4fc39d5e64bf667470d.zip |
octoclock: Now uses internal ihex parser
Diffstat (limited to 'host/utils')
-rw-r--r-- | host/utils/CMakeLists.txt | 2 | ||||
-rw-r--r-- | host/utils/octoclock_firmware_burner.cpp | 22 |
2 files changed, 5 insertions, 19 deletions
diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt index 4f56dad0d..8367c0184 100644 --- a/host/utils/CMakeLists.txt +++ b/host/utils/CMakeLists.txt @@ -84,7 +84,7 @@ IF(ENABLE_OCTOCLOCK) SET(octoclock_burner_sources octoclock_firmware_burner.cpp - ${CMAKE_SOURCE_DIR}/lib/usrp_clock/octoclock/kk_ihex_read.c + ${CMAKE_SOURCE_DIR}/lib/utils/ihex.cpp ) ADD_DEFINITIONS(-DIHEX_USE_STDBOOL) diff --git a/host/utils/octoclock_firmware_burner.cpp b/host/utils/octoclock_firmware_burner.cpp index c338cd818..326985df5 100644 --- a/host/utils/octoclock_firmware_burner.cpp +++ b/host/utils/octoclock_firmware_burner.cpp @@ -42,7 +42,7 @@ #include <uhd/utils/safe_main.hpp> #include "../lib/usrp_clock/octoclock/common.h" -#include "kk_ihex_read.h" +#include "../lib/utils/ihex.hpp" #define MAX_FIRMWARE_SIZE 1024*120 #define BLOCK_SIZE 256 @@ -142,7 +142,7 @@ device_addrs_t bootloader_find(const std::string &ip_addr){ device_addrs_t addrs; boost::system_time comm_timeout = boost::get_system_time() + boost::posix_time::milliseconds(3000); - + while(boost::get_system_time() < comm_timeout){ UHD_OCTOCLOCK_SEND_AND_RECV(udp_transport, OCTOCLOCK_QUERY_CMD, pkt_out, len, octoclock_data); if(UHD_OCTOCLOCK_PACKET_MATCHES(OCTOCLOCK_QUERY_ACK, pkt_out, pkt_in, len) and @@ -292,22 +292,8 @@ void finalize(udp_simple::sptr udp_transport){ } void octoclock_convert_ihex(const std::string &hex_path, const std::string &bin_path){ - struct ihex_state ihex; - ihex_count_t count; - char buf[256]; - FILE* infile = fopen(hex_path.c_str(), "r"); - FILE* outfile = fopen(bin_path.c_str(), "w"); - uint64_t line_number = 1; - - ihex_begin_read(&ihex); - while(fgets(buf, 256, infile)){ - count = ihex_count_t(strlen(buf)); - ihex_read_bytes(&ihex, buf, count, outfile); - line_number += (count && buf[count - 1] == '\n'); - } - ihex_end_read(&ihex, outfile); // Closes outfile - - (void)fclose(infile); + ihex_reader hex_reader(hex_path); + hex_reader.to_bin_file(bin_path); } int UHD_SAFE_MAIN(UHD_UNUSED(int argc), UHD_UNUSED(char *argv[])){ |