diff options
author | Josh Blum <josh@joshknows.com> | 2010-08-19 18:23:19 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-08-19 18:23:19 -0700 |
commit | 2f3269f359043290fcaa7659e90292919306a8bc (patch) | |
tree | 0063f653dbfdaf51cdf386a1e96f81f700a2a52d | |
parent | a32c3217cb703430f417cf5a3b816f6fd0f70ed3 (diff) | |
download | uhd-2f3269f359043290fcaa7659e90292919306a8bc.tar.gz uhd-2f3269f359043290fcaa7659e90292919306a8bc.tar.bz2 uhd-2f3269f359043290fcaa7659e90292919306a8bc.zip |
usrp1: images for usrp1, makefile checks for image generation dependencies
-rw-r--r-- | firmware/fx2/.gitignore | 5 | ||||
-rw-r--r-- | host/AUTHORS | 10 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.cpp | 34 | ||||
-rw-r--r-- | host/lib/usrp/usrp1/usrp1_impl.hpp | 6 | ||||
-rw-r--r-- | images/Makefile | 27 |
5 files changed, 64 insertions, 18 deletions
diff --git a/firmware/fx2/.gitignore b/firmware/fx2/.gitignore index 75bb241c8..affc0b779 100644 --- a/firmware/fx2/.gitignore +++ b/firmware/fx2/.gitignore @@ -23,3 +23,8 @@ /missing /make.log /usrp.pc +/INSTALL +/config.guess +/config.sub +/install-sh +/ltmain.sh diff --git a/host/AUTHORS b/host/AUTHORS index 137eba0e6..7292da8f9 100644 --- a/host/AUTHORS +++ b/host/AUTHORS @@ -1,5 +1,6 @@ Matt Ettus - matt@ettus.com - USRP1/USRP2 FPGA code + USRP1 FPGA code + USRP2 FPGA code Josh Blum - josh@ettus.com driver framework @@ -14,4 +15,11 @@ Jason Abele - jason@ettus.com WBX host code Eric Blossom - eb@comsec.com + USRP1 firmware USRP2 firmware + +Tom Tsou - ttsou@vt.edu + UHD-USB framework + LIBUSB host code + USRP1 host code + USRP1 firmware diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp index ece5f1dea..33a069bc6 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.cpp +++ b/host/lib/usrp/usrp1/usrp1_impl.cpp @@ -23,9 +23,11 @@ #include <uhd/usrp/device_props.hpp> #include <uhd/utils/assert.hpp> #include <uhd/utils/static.hpp> +#include <uhd/utils/images.hpp> #include <boost/format.hpp> #include <boost/assign/list_of.hpp> #include <boost/filesystem.hpp> +#include <boost/thread/thread.hpp> #include <iostream> using namespace uhd; @@ -42,11 +44,16 @@ const std::vector<usrp1_impl::dboard_slot_t> usrp1_impl::_dboard_slots = boost:: static device_addrs_t usrp1_find(const device_addr_t &hint) { device_addrs_t usrp1_addrs; - std::string filename = "/usr/local/share/usrp/rev4/std.ihx"; //return an empty list of addresses when type is set to non-usrp1 if (hint.has_key("type") and hint["type"] != "usrp1") return usrp1_addrs; + //extract the firmware path for the USRP1 + std::string usrp1_fw_image = find_image_path( + hint.has_key("fw")? hint["fw"] : "usrp1_fw.ihx" + ); + std::cout << "USRP1 firmware image: " << usrp1_fw_image << std::endl; + //see what we got on the USB bus usb_descriptors_t usb_descriptors; usb_descriptors = usb_control::get_device_list(); @@ -56,12 +63,12 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) if (desc.vendor_id == 0xfffe && desc.product_id == 0x0002) { usb_control::sptr ctrl_transport = usb_control::make(desc); usrp_ctrl::sptr usrp_ctrl = usrp_ctrl::make(ctrl_transport); - usrp_ctrl->usrp_load_firmware(filename); + usrp_ctrl->usrp_load_firmware(usrp1_fw_image); } } //wait for things to settle - sleep(1); + boost::this_thread::sleep(boost::posix_time::milliseconds(500)); //get descriptors again with serial number usb_descriptors = usb_control::get_device_list(); @@ -83,14 +90,11 @@ static device_addrs_t usrp1_find(const device_addr_t &hint) **********************************************************************/ static device::sptr usrp1_make(const device_addr_t &device_addr) { - std::string filename; - - if (device_addr.has_key("fpga")) - filename = device_addr["fpga"]; - else - filename = "/usr/local/share/usrp/rev4/std_2rxhb_2tx.rbf"; - - std::cout << "Make usrp1 with " << filename << std::endl; + //extract the FPGA path for the USRP1 + std::string usrp1_fpga_image = find_image_path( + device_addr.has_key("fpga")? device_addr["fpga"] : "usrp1_fpga.rbf" + ); + std::cout << "USRP1 FPGA image: " << usrp1_fpga_image << std::endl; //try to match the given device address with something on the USB bus usb_descriptors_t usb_descriptors; @@ -106,7 +110,7 @@ static device::sptr usrp1_make(const device_addr_t &device_addr) usb_control::sptr ctrl_transport = usb_control::make(desc); usrp_ctrl = usrp_ctrl::make(ctrl_transport); - usrp_ctrl->usrp_load_fpga(filename); + usrp_ctrl->usrp_load_fpga(usrp1_fpga_image); data_transport = usb_zero_copy::make(desc, // identifier 6, // IN endpoint @@ -167,6 +171,12 @@ usrp1_impl::~usrp1_impl(void){ /* NOP */ } +bool usrp1_impl::recv_async_msg(uhd::async_metadata_t &, size_t timeout_ms){ + //dummy fill-in for the recv_async_msg + boost::this_thread::sleep(boost::posix_time::milliseconds(timeout_ms)); + return false; +} + /*********************************************************************** * Device Get **********************************************************************/ diff --git a/host/lib/usrp/usrp1/usrp1_impl.hpp b/host/lib/usrp/usrp1/usrp1_impl.hpp index f57f9a09a..cbd3d5315 100644 --- a/host/lib/usrp/usrp1/usrp1_impl.hpp +++ b/host/lib/usrp/usrp1/usrp1_impl.hpp @@ -93,11 +93,7 @@ public: size_t get_max_send_samps_per_packet(void) const { return 0; } size_t get_max_recv_samps_per_packet(void) const { return 0; } - - bool recv_async_msg(uhd::async_metadata_t &, size_t) { - //TODO sleep the number of ms supplied (dont want to hog CPU) - return false; - } + bool recv_async_msg(uhd::async_metadata_t &, size_t); private: /*! diff --git a/images/Makefile b/images/Makefile index 0a829a296..0e58fbb18 100644 --- a/images/Makefile +++ b/images/Makefile @@ -31,8 +31,25 @@ CMAKE_BUILD_DIR = $(TOP_DIR)/build IMAGES_LIST = ######################################################################## +# Utility Checks +######################################################################## +ifeq ($(shell sdcc --help > /dev/null 2>&1 && echo $$?),0) + HAS_SDCC=1 +endif + +ifeq ($(shell mb-gcc --help > /dev/null 2>&1 && echo $$?),0) + HAS_MB_GCC=1 +endif + +ifeq ($(shell xtclsh -h > /dev/null 2>&1 && echo $$?),0) + HAS_XTCLSH=1 +endif + +######################################################################## # USRP1 firmware ######################################################################## +ifdef HAS_SDCC + _usrp1_fw_dir = $(TOP_FW_DIR)/fx2 _usrp1_fw_ihx = $(BUILT_IMAGES_DIR)/usrp1_fw.ihx IMAGES_LIST += $(_usrp1_fw_ihx) @@ -44,6 +61,8 @@ $(_usrp1_fw_ihx): make -C $(_usrp1_fw_dir) all cp $(_usrp1_fw_dir)/src/usrp1/std.ihx $@ +endif + ######################################################################## # USRP1 fpga ######################################################################## @@ -57,6 +76,8 @@ $(_usrp1_fpga_rbf): ######################################################################## # USRP2 firmware ######################################################################## +ifdef HAS_MB_GCC + _usrp2_fw_dir = $(TOP_FW_DIR)/microblaze _usrp2_fw_bin = $(BUILT_IMAGES_DIR)/usrp2_fw.bin IMAGES_LIST += $(_usrp2_fw_bin) @@ -68,9 +89,13 @@ $(_usrp2_fw_bin): make -C $(_usrp2_fw_dir) all cp $(_usrp2_fw_dir)/usrp2/usrp2_txrx_uhd.bin $@ +endif + ######################################################################## # USRP2 fpga ######################################################################## +ifdef HAS_XTCLSH + _usrp2_fpga_dir = $(TOP_FPGA_DIR)/usrp2/top/u2_rev3 _usrp2_fpga_bin = $(BUILT_IMAGES_DIR)/usrp2_fpga.bin IMAGES_LIST += $(_usrp2_fpga_bin) @@ -80,6 +105,8 @@ $(_usrp2_fpga_bin): cd $(_usrp2_fpga_dir) && make -f Makefile.udp bin cp $(_usrp2_fpga_dir)/build-udp/u2_rev3.bin $@ +endif + ######################################################################## # Build rules ######################################################################## |