From 5b4d90582d827d7ba2483d7916b2f0400a5bd9fa Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 3 Feb 2011 11:20:37 -0800 Subject: usrp-e100: added passthrough to images makefile, tweaks to usrp-e-utility --- host/lib/usrp/usrp_e100/fpga_downloader.cpp | 2 +- host/usrp_e_utils/usrp-e-utility.cpp | 21 ++++++++++++--------- images/Makefile | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/host/lib/usrp/usrp_e100/fpga_downloader.cpp b/host/lib/usrp/usrp_e100/fpga_downloader.cpp index 926e6fcaf..c0013fcbd 100644 --- a/host/lib/usrp/usrp_e100/fpga_downloader.cpp +++ b/host/lib/usrp/usrp_e100/fpga_downloader.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010 Ettus Research LLC +// Copyright 2010-2011 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/host/usrp_e_utils/usrp-e-utility.cpp b/host/usrp_e_utils/usrp-e-utility.cpp index 139aabc30..4b4fc0178 100644 --- a/host/usrp_e_utils/usrp-e-utility.cpp +++ b/host/usrp_e_utils/usrp-e-utility.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "fpga_downloader.cpp" @@ -25,8 +26,6 @@ namespace po = boost::program_options; -static const std::string default_passthrough_path = "/usr/share/uhd/images/usrp_e1xx_passthrough.bin"; - int UHD_SAFE_MAIN(int argc, char *argv[]){ //variables to be set by po @@ -36,8 +35,8 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ po::options_description desc("Allowed options"); desc.add_options() ("help", "help message") - ("fpga", po::value(&fpga_path)->default_value(""), "loads the specified FPGA file") - ("reclk", "runs the clock recovery") + ("fpga", po::value(&fpga_path), "loads the specified FPGA file") + ("reclk", "runs the clock recovery") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); @@ -50,20 +49,24 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ } bool loaded_fpga_image = false; - if (vm.count("fpga")){ + if (vm.count("fpga") != 0){ std::cout << "USRP-E Utility loading the FPGA..." << std::endl << std::endl; usrp_e100_load_fpga(fpga_path); loaded_fpga_image = true; sleep(1); } - if (vm.count("reclk")){ + if (vm.count("reclk") != 0){ std::cout << "USRP-E Utility running the clock recovery..." << std::endl << std::endl; //if an image was not loaded or specified, we load pass-through - if (fpga_path.empty()) fpga_path = default_passthrough_path; - if (not loaded_fpga_image) usrp_e100_load_fpga(fpga_path); + if (fpga_path.empty()) throw std::runtime_error( + "Please specify the path to the pass-though FPGA image for your device.\n" + " usrp-e-utility --reclk --fpga=/usr/share/uhd/images/usrp_e1xx_pt_fpga.bin" + ); clock_genconfig_main(); - std::system("rm /tmp/usrp*hash"); //clear hash so driver must reload + if (std::system("rm /tmp/usrp*hash") != 0){ //clear hash so driver must reload + std::cerr << "No hash to remove! Don't worry, its not a problem." << std::endl; + } } std::cout << "Done!" << std::endl; diff --git a/images/Makefile b/images/Makefile index 34c18cdc2..cfc783ee4 100644 --- a/images/Makefile +++ b/images/Makefile @@ -151,6 +151,22 @@ $(_usrp_e100_fpga_bin): $(GLOBAL_DEPS) endif +######################################################################## +# USRP-E100 pass-through fpga +######################################################################## +ifdef HAS_XTCLSH + +_usrp_e100_pt_fpga_dir = $(TOP_FPGA_DIR)/usrp2/top/u1e_passthru +_usrp_e100_pt_fpga_bin = $(BUILT_IMAGES_DIR)/usrp_e100_pt_fpga.bin +IMAGES_LIST += $(_usrp_e100_pt_fpga_bin) + +$(_usrp_e100_pt_fpga_bin): $(GLOBAL_DEPS) + cd $(_usrp_e100_pt_fpga_dir) && make clean + cd $(_usrp_e100_pt_fpga_dir) && make bin + cp $(_usrp_e100_pt_fpga_dir)/build/passthru.bin $@ + +endif + ######################################################################## # Build rules ######################################################################## -- cgit v1.2.3