usrp-e100: added passthrough to images makefile, tweaks to usrp-e-utility

This commit is contained in:
Josh Blum 2011-02-03 11:20:37 -08:00
parent d27817a7ad
commit 5b4d90582d
3 changed files with 29 additions and 10 deletions

View file

@ -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

View file

@ -18,6 +18,7 @@
#include <uhd/utils/safe_main.hpp>
#include <boost/program_options.hpp>
#include <boost/format.hpp>
#include <stdexcept>
#include <iostream>
#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<std::string>(&fpga_path)->default_value(""), "loads the specified FPGA file")
("reclk", "runs the clock recovery")
("fpga", po::value<std::string>(&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;

View file

@ -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
########################################################################