aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/e100
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/e100')
-rw-r--r--host/lib/usrp/e100/e100_impl.cpp9
-rw-r--r--host/lib/usrp/e100/e100_impl.hpp3
-rw-r--r--host/lib/usrp/e100/e100_mmap_zero_copy.cpp45
3 files changed, 26 insertions, 31 deletions
diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp
index d610c0b12..c9a7eb30e 100644
--- a/host/lib/usrp/e100/e100_impl.cpp
+++ b/host/lib/usrp/e100/e100_impl.cpp
@@ -64,7 +64,7 @@ static device_addrs_t e100_find(const device_addr_t &hint){
new_addr["node"] = fs::system_complete(fs::path(hint["node"])).string();
try{
i2c_iface::sptr i2c_iface = e100_ctrl::make_dev_i2c_iface(E100_I2C_DEV_NODE);
- const mboard_eeprom_t mb_eeprom(*i2c_iface, mboard_eeprom_t::MAP_E100);
+ const mboard_eeprom_t mb_eeprom(*i2c_iface, E100_EEPROM_MAP_KEY);
new_addr["name"] = mb_eeprom["name"];
new_addr["serial"] = mb_eeprom["serial"];
}
@@ -120,7 +120,7 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){
//read the eeprom so we can determine the hardware
_dev_i2c_iface = e100_ctrl::make_dev_i2c_iface(E100_I2C_DEV_NODE);
- const mboard_eeprom_t mb_eeprom(*_dev_i2c_iface, mboard_eeprom_t::MAP_E100);
+ const mboard_eeprom_t mb_eeprom(*_dev_i2c_iface, E100_EEPROM_MAP_KEY);
//determine the model string for this device
const std::string model = device_addr.get("model", mb_eeprom.get("model", ""));
@@ -189,7 +189,8 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){
////////////////////////////////////////////////////////////////////
_tree->create<std::string>("/name").set("E-Series Device");
const fs_path mb_path = "/mboards/0";
- _tree->create<std::string>(mb_path / "name").set(str(boost::format("%s (euewanee)") % model));
+ _tree->create<std::string>(mb_path / "name").set(model);
+ _tree->create<std::string>(mb_path / "codename").set("Euwanee");
////////////////////////////////////////////////////////////////////
// setup the mboard eeprom
@@ -448,7 +449,7 @@ double e100_impl::update_rx_codec_gain(const double gain){
}
void e100_impl::set_mb_eeprom(const uhd::usrp::mboard_eeprom_t &mb_eeprom){
- mb_eeprom.commit(*_dev_i2c_iface, mboard_eeprom_t::MAP_E100);
+ mb_eeprom.commit(*_dev_i2c_iface, E100_EEPROM_MAP_KEY);
}
void e100_impl::set_db_eeprom(const std::string &type, const uhd::usrp::dboard_eeprom_t &db_eeprom){
diff --git a/host/lib/usrp/e100/e100_impl.hpp b/host/lib/usrp/e100/e100_impl.hpp
index 1d36cb2ac..381c085e0 100644
--- a/host/lib/usrp/e100/e100_impl.hpp
+++ b/host/lib/usrp/e100/e100_impl.hpp
@@ -49,10 +49,11 @@ static const double E100_RX_LINK_RATE_BPS = 166e6/3/2*2;
static const double E100_TX_LINK_RATE_BPS = 166e6/3/1*2;
static const std::string E100_I2C_DEV_NODE = "/dev/i2c-3";
static const std::string E100_UART_DEV_NODE = "/dev/ttyO0";
-static const boost::uint16_t E100_FPGA_COMPAT_NUM = 0x09;
+static const boost::uint16_t E100_FPGA_COMPAT_NUM = 10;
static const boost::uint32_t E100_RX_SID_BASE = 2;
static const boost::uint32_t E100_TX_ASYNC_SID = 1;
static const double E100_DEFAULT_CLOCK_RATE = 64e6;
+static const std::string E100_EEPROM_MAP_KEY = "E100";
//! load an fpga image from a bin file into the usrp-e fpga
extern void e100_load_fpga(const std::string &bin_file);
diff --git a/host/lib/usrp/e100/e100_mmap_zero_copy.cpp b/host/lib/usrp/e100/e100_mmap_zero_copy.cpp
index cdb7094f4..58beeb424 100644
--- a/host/lib/usrp/e100/e100_mmap_zero_copy.cpp
+++ b/host/lib/usrp/e100/e100_mmap_zero_copy.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2011 Ettus Research LLC
+// Copyright 2010-2012 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
@@ -19,6 +19,7 @@
#include <uhd/transport/zero_copy.hpp>
#include <uhd/utils/log.hpp>
#include <uhd/exception.hpp>
+#include <boost/make_shared.hpp>
#include <linux/usrp_e.h>
#include <sys/mman.h> //mmap
#include <unistd.h> //getpagesize
@@ -41,23 +42,19 @@ public:
_mem(mem), _info(info) { /* NOP */ }
void release(void){
- if (_info->flags != RB_USER_PROCESS) return;
if (fp_verbose) UHD_LOGV(always) << "recv buff: release" << std::endl;
_info->flags = RB_KERNEL; //release the frame
}
- bool ready(void){return _info->flags & RB_USER;}
+ UHD_INLINE bool ready(void){return _info->flags & RB_USER;}
- sptr get_new(void){
- if (fp_verbose) UHD_LOGV(always) << " make_recv_buff: " << get_size() << std::endl;
+ UHD_INLINE sptr get_new(void){
+ if (fp_verbose) UHD_LOGV(always) << " make_recv_buff: " << _info->len << std::endl;
_info->flags = RB_USER_PROCESS; //claim the frame
- return make_managed_buffer(this);
+ return make(this, _mem, _info->len);
}
private:
- const void *get_buff(void) const{return _mem;}
- size_t get_size(void) const{return _info->len;}
-
void *_mem;
ring_buffer_info *_info;
};
@@ -71,28 +68,24 @@ public:
e100_mmap_zero_copy_msb(void *mem, ring_buffer_info *info, size_t len, int fd):
_mem(mem), _info(info), _len(len), _fd(fd) { /* NOP */ }
- void commit(size_t len){
- if (_info->flags != RB_USER_PROCESS) return;
- if (fp_verbose) UHD_LOGV(always) << "send buff: commit " << len << std::endl;
- _info->len = len;
+ void release(void){
+ if (fp_verbose) UHD_LOGV(always) << "send buff: commit " << size() << std::endl;
+ _info->len = size();
_info->flags = RB_USER; //release the frame
if (::write(_fd, NULL, 0) < 0){ //notifies the kernel
UHD_LOGV(rarely) << UHD_THROW_SITE_INFO("write error") << std::endl;
}
}
- bool ready(void){return _info->flags & RB_KERNEL;}
+ UHD_INLINE bool ready(void){return _info->flags & RB_KERNEL;}
- sptr get_new(void){
- if (fp_verbose) UHD_LOGV(always) << " make_send_buff: " << get_size() << std::endl;
+ UHD_INLINE sptr get_new(void){
+ if (fp_verbose) UHD_LOGV(always) << " make_send_buff: " << _len << std::endl;
_info->flags = RB_USER_PROCESS; //claim the frame
- return make_managed_buffer(this);
+ return make(this, _mem, _len);
}
private:
- void *get_buff(void) const{return _mem;}
- size_t get_size(void) const{return _len;}
-
void *_mem;
ring_buffer_info *_info;
size_t _len;
@@ -162,14 +155,14 @@ public:
//initialize the managed receive buffers
for (size_t i = 0; i < get_num_recv_frames(); i++){
- _mrb_pool.push_back(e100_mmap_zero_copy_mrb(
+ _mrb_pool.push_back(boost::make_shared<e100_mmap_zero_copy_mrb>(
recv_buff + get_recv_frame_size()*i, (*recv_info) + i
));
}
//initialize the managed send buffers
for (size_t i = 0; i < get_num_recv_frames(); i++){
- _msb_pool.push_back(e100_mmap_zero_copy_msb(
+ _msb_pool.push_back(boost::make_shared<e100_mmap_zero_copy_msb>(
send_buff + get_send_frame_size()*i, (*send_info) + i,
get_send_frame_size(), _fd
));
@@ -183,7 +176,7 @@ public:
managed_recv_buffer::sptr get_recv_buff(double timeout){
if (fp_verbose) UHD_LOGV(always) << "get_recv_buff: " << _recv_index << std::endl;
- e100_mmap_zero_copy_mrb &mrb = _mrb_pool[_recv_index];
+ e100_mmap_zero_copy_mrb &mrb = *_mrb_pool[_recv_index];
//poll/wait for a ready frame
if (not mrb.ready()){
@@ -215,7 +208,7 @@ public:
managed_send_buffer::sptr get_send_buff(double timeout){
if (fp_verbose) UHD_LOGV(always) << "get_send_buff: " << _send_index << std::endl;
- e100_mmap_zero_copy_msb &msb = _msb_pool[_send_index];
+ e100_mmap_zero_copy_msb &msb = *_msb_pool[_send_index];
//poll/wait for a ready frame
if (not msb.ready()){
@@ -254,8 +247,8 @@ private:
size_t _frame_size, _map_size;
//re-usable managed buffers
- std::vector<e100_mmap_zero_copy_mrb> _mrb_pool;
- std::vector<e100_mmap_zero_copy_msb> _msb_pool;
+ std::vector<boost::shared_ptr<e100_mmap_zero_copy_mrb> > _mrb_pool;
+ std::vector<boost::shared_ptr<e100_mmap_zero_copy_msb> > _msb_pool;
//indexes into sub-sections of mapped memory
size_t _recv_index, _send_index;