Revision 3dd244bb

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

  
123 123
    void lock_device(bool lock){
124 124
        if (lock){
125
            this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(U2_FW_REG_LOCK_GPID, boost::uint32_t(get_gpid()));
125
            this->pokefw(U2_FW_REG_LOCK_GPID, boost::uint32_t(get_gpid()));
126 126
            _lock_task = task::make(boost::bind(&usrp2_iface_impl::lock_task, this));
127 127
        }
128 128
        else{
129 129
            _lock_task.reset(); //shutdown the task
130
            this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(U2_FW_REG_LOCK_TIME, 0); //unlock
130
            this->pokefw(U2_FW_REG_LOCK_TIME, 0); //unlock
131 131
        }
132 132
    }
133 133

  
......
135 135
        //never assume lock with fpga image mismatch
136 136
        if ((this->peek32(U2_REG_COMPAT_NUM_RB) >> 16) != USRP2_FPGA_COMPAT_NUM) return false;
137 137

  
138
        boost::uint32_t lock_time = this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_PEEK32>(U2_FW_REG_LOCK_TIME);
139
        boost::uint32_t lock_gpid = this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_PEEK32>(U2_FW_REG_LOCK_GPID);
138
        boost::uint32_t lock_time = this->peekfw(U2_FW_REG_LOCK_TIME);
139
        boost::uint32_t lock_gpid = this->peekfw(U2_FW_REG_LOCK_GPID);
140 140

  
141 141
        //may not be the right tick rate, but this is ok for locking purposes
142 142
        const boost::uint32_t lock_timeout_time = boost::uint32_t(3*100e6);
......
152 152

  
153 153
    void lock_task(void){
154 154
        //re-lock in task
155
        this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(U2_FW_REG_LOCK_TIME, this->get_curr_time());
155
        this->pokefw(U2_FW_REG_LOCK_TIME, this->get_curr_time());
156 156
        //sleep for a bit
157 157
        boost::this_thread::sleep(boost::posix_time::milliseconds(1500));
158 158
    }
......
180 180
        return this->get_reg<boost::uint16_t, USRP2_REG_ACTION_FPGA_PEEK16>(addr);
181 181
    }
182 182

  
183
    void pokefw(wb_addr_type addr, boost::uint32_t data)
184
    {
185
        this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(addr, data);
186
    }
187

  
188
    boost::uint32_t peekfw(wb_addr_type addr)
189
    {
190
        return this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_PEEK32>(addr);
191
    }
192

  
183 193
    template <class T, usrp2_reg_action_t action>
184 194
    T get_reg(wb_addr_type addr, T data = 0){
185 195
        //setup the out data
b/host/lib/usrp/usrp2/usrp2_iface.hpp
1 1
//
2
// Copyright 2010-2011 Ettus Research LLC
2
// Copyright 2010-2012 Ettus Research LLC
3 3
//
4 4
// This program is free software: you can redistribute it and/or modify
5 5
// it under the terms of the GNU General Public License as published by
......
43 43
     */
44 44
    static sptr make(uhd::transport::udp_simple::sptr ctrl_transport);
45 45

  
46
    //! poke a register in the virtual fw table
47
    virtual void pokefw(wb_addr_type addr, boost::uint32_t data) = 0;
48

  
49
    //! peek a register in the virtual fw table
50
    virtual boost::uint32_t peekfw(wb_addr_type addr) = 0;
51

  
46 52
    //! The list of possible revision types
47 53
    enum rev_type {
48 54
        USRP2_REV3 = 3,

Also available in: Unified diff