From ee44eecc3e2047b1514794add99203c4d2d3c7cc Mon Sep 17 00:00:00 2001 From: Philip Balister Date: Sat, 28 Aug 2010 19:54:03 -0400 Subject: Test if usrp_e kernel module is loaded before trying to load the FPGA. Do not load the the fpga if the kernel module is loaded. --- host/utils/fpga-downloader.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/host/utils/fpga-downloader.cpp b/host/utils/fpga-downloader.cpp index fb96b64a3..80ee71600 100644 --- a/host/utils/fpga-downloader.cpp +++ b/host/utils/fpga-downloader.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -240,6 +241,21 @@ int main(int argc, char *argv[]) if (argc == 2) bit_file = argv[1]; + bool module_found(false); + std::ifstream mod_file("/proc/modules"); + while (!mod_file.eof()) { + std::string line; + getline(mod_file, line); + if (line.find("usrp_e") != std::string::npos) + module_found = true; + } + mod_file.close(); + + if (module_found) { + std::cout << "USRP Embedded kernel module loaded, not loading FPGA." << std::endl; + return -1; + } + std::cout << "FPGA config file: " << bit_file << std::endl; prepare_fpga_for_configuration(gpio_prog_b, gpio_init_b); -- cgit v1.2.3