Revision 476afe68 host/lib/usrp/usrp2/usrp2_iface.cpp

b/host/lib/usrp/usrp2/usrp2_iface.cpp
17 17

  
18 18
#include "usrp2_regs.hpp"
19 19
#include "usrp2_iface.hpp"
20
#include <uhd/utils/exception.hpp>
20 21
#include <uhd/utils/assert.hpp>
21 22
#include <uhd/types/dict.hpp>
22 23
#include <boost/thread.hpp>
......
51 52
 **********************************************************************/
52 53
    usrp2_iface_impl(udp_simple::sptr ctrl_transport){
53 54
        _ctrl_transport = ctrl_transport;
54
        
55

  
55 56
        mb_eeprom = mboard_eeprom_t(*this, mboard_eeprom_t::MAP_N100);
56
        regs = usrp2_get_regs(get_hw_rev());
57
        switch(this->get_rev()){
58
        case USRP2_REV3:
59
        case USRP2_REV4:
60
            regs = usrp2_get_regs(false);
61
            break;
62

  
63
        case USRP_NXXX:
64
        case USRP_N200:
65
        case USRP_N210:
66
            regs = usrp2_get_regs(true);
67
            break;
68
        }
57 69

  
58
         //check the fpga compatibility number
70
        //check the fpga compatibility number
59 71
        const boost::uint32_t fpga_compat_num = this->peek32(this->regs.compat_num_rb);
60 72
        if (fpga_compat_num != USRP2_FPGA_COMPAT_NUM){
61 73
            throw std::runtime_error(str(boost::format(
......
259 271
        }
260 272
        throw std::runtime_error("usrp2 no control response");
261 273
    }
262
    
263
    bool is_usrp2p(void) {
264
        return (get_hw_rev() >= usrp2_rev_nums(N2XX));
265
    }
266 274

  
267
    boost::uint16_t get_hw_rev(void) {
268
        return boost::lexical_cast<boost::uint16_t>(mb_eeprom["rev"]);
275
    rev_type get_rev(void){
276
        switch (boost::lexical_cast<boost::uint16_t>(mb_eeprom["rev"])){
277
        case 0x0003: return USRP2_REV3;
278
        case 0x0004: return USRP2_REV4;
279
        case 0x0A00: return USRP_N200;
280
        case 0x0A01: return USRP_N210;
281
        }
282
        return USRP_NXXX; //unknown type
269 283
    }
270 284

  
285
    const std::string get_cname(void){
286
        switch(this->get_rev()){
287
        case USRP2_REV3: return "USRP2-REV3";
288
        case USRP2_REV4: return "USRP2-REV4";
289
        case USRP_N200: return "USRP-N200";
290
        case USRP_N210: return "USRP-N210";
291
        case USRP_NXXX: return "USRP-N???";
292
        }
293
        UHD_THROW_INVALID_CODE_PATH();
294
    }
271 295

  
272 296
private:
273 297
    //this lovely lady makes it all possible

Also available in: Unified diff