USRP Hardware Driver and USRP Manual  Version: 4.0.0.0-368-g1b502694e
UHD and USRP Manual
uhd::soft_register_t< reg_data_t, readable, writable > Class Template Reference

#include <uhd/utils/soft_register.hpp>

Inheritance diagram for uhd::soft_register_t< reg_data_t, readable, writable >:
uhd::soft_register_base uhd::soft_register_sync_t< reg_data_t, readable, writable >

Public Types

typedef std::shared_ptr< soft_register_t< reg_data_t, readable, writable > > sptr
 

Public Member Functions

 soft_register_t (wb_iface::wb_addr_type wr_addr, wb_iface::wb_addr_type rd_addr, soft_reg_flush_mode_t mode=ALWAYS_FLUSH)
 
 soft_register_t (wb_iface::wb_addr_type addr, soft_reg_flush_mode_t mode=ALWAYS_FLUSH)
 
UHD_INLINE void initialize (wb_iface &iface, bool sync=false)
 
UHD_INLINE void set (const soft_reg_field_t field, const reg_data_t value)
 
UHD_INLINE reg_data_t get (const soft_reg_field_t field)
 
UHD_INLINE void flush ()
 
UHD_INLINE void refresh ()
 
UHD_INLINE void write (const soft_reg_field_t field, const reg_data_t value)
 
UHD_INLINE reg_data_t read (const soft_reg_field_t field)
 
UHD_INLINE size_t get_bitwidth ()
 
UHD_INLINE bool is_readable ()
 
UHD_INLINE bool is_writable ()
 
- Public Member Functions inherited from uhd::soft_register_base
virtual ~soft_register_base ()
 

Static Public Attributes

static const uhd::soft_reg_field_t REGISTER = ((( 0 & 0xFF) << 8) | ( sizeof(reg_data_t) * 8 & 0xFF))
 

Additional Inherited Members

- Static Public Member Functions inherited from uhd::soft_register_base
template<typename soft_reg_t >
static UHD_INLINE soft_reg_t & cast (soft_register_base &reg)
 

Detailed Description

template<typename reg_data_t, bool readable, bool writable>
class uhd::soft_register_t< reg_data_t, readable, writable >

Soft register object that holds offset, soft-copy and the control iface. Methods give convenient field-level access to soft-copy and the ability to do read-modify-write operations.

Member Typedef Documentation

◆ sptr

template<typename reg_data_t , bool readable, bool writable>
typedef std::shared_ptr<soft_register_t<reg_data_t, readable, writable> > uhd::soft_register_t< reg_data_t, readable, writable >::sptr

Constructor & Destructor Documentation

◆ soft_register_t() [1/2]

template<typename reg_data_t , bool readable, bool writable>
uhd::soft_register_t< reg_data_t, readable, writable >::soft_register_t ( wb_iface::wb_addr_type  wr_addr,
wb_iface::wb_addr_type  rd_addr,
soft_reg_flush_mode_t  mode = ALWAYS_FLUSH 
)
inline

Generic constructor for all soft_register types

◆ soft_register_t() [2/2]

template<typename reg_data_t , bool readable, bool writable>
uhd::soft_register_t< reg_data_t, readable, writable >::soft_register_t ( wb_iface::wb_addr_type  addr,
soft_reg_flush_mode_t  mode = ALWAYS_FLUSH 
)
inlineexplicit

Constructor for read-only, write-only registers and read-write registers with rd_addr == wr_addr

Member Function Documentation

◆ flush()

template<typename reg_data_t , bool readable, bool writable>
UHD_INLINE void uhd::soft_register_t< reg_data_t, readable, writable >::flush ( )
inlinevirtual

Write the contents of the soft-copy to hardware.

Implements uhd::soft_register_base.

Reimplemented in uhd::soft_register_sync_t< reg_data_t, readable, writable >.

◆ get()

template<typename reg_data_t , bool readable, bool writable>
UHD_INLINE reg_data_t uhd::soft_register_t< reg_data_t, readable, writable >::get ( const soft_reg_field_t  field)
inline

Get the value of the specified field from the soft-copy. NOTE: This does not read anything from hardware.

◆ get_bitwidth()

template<typename reg_data_t , bool readable, bool writable>
UHD_INLINE size_t uhd::soft_register_t< reg_data_t, readable, writable >::get_bitwidth ( )
inlinevirtual

Get bitwidth for this register

Implements uhd::soft_register_base.

◆ initialize()

template<typename reg_data_t , bool readable, bool writable>
UHD_INLINE void uhd::soft_register_t< reg_data_t, readable, writable >::initialize ( wb_iface iface,
bool  sync = false 
)
inlinevirtual

Initialize the register when the underlying bus is usable. Can be optionally synced with hardware. NOTE: Memory management of the iface is up to the caller

Implements uhd::soft_register_base.

Reimplemented in uhd::soft_register_sync_t< reg_data_t, readable, writable >.

◆ is_readable()

template<typename reg_data_t , bool readable, bool writable>
UHD_INLINE bool uhd::soft_register_t< reg_data_t, readable, writable >::is_readable ( )
inlinevirtual

Is the register readable?

Implements uhd::soft_register_base.

◆ is_writable()

template<typename reg_data_t , bool readable, bool writable>
UHD_INLINE bool uhd::soft_register_t< reg_data_t, readable, writable >::is_writable ( )
inlinevirtual

Is the register writable?

Implements uhd::soft_register_base.

◆ read()

template<typename reg_data_t , bool readable, bool writable>
UHD_INLINE reg_data_t uhd::soft_register_t< reg_data_t, readable, writable >::read ( const soft_reg_field_t  field)
inline

Shortcut for refresh and get

◆ refresh()

template<typename reg_data_t , bool readable, bool writable>
UHD_INLINE void uhd::soft_register_t< reg_data_t, readable, writable >::refresh ( )
inlinevirtual

Read the contents of the register from hardware and update the soft copy.

Implements uhd::soft_register_base.

Reimplemented in uhd::soft_register_sync_t< reg_data_t, readable, writable >.

◆ set()

template<typename reg_data_t , bool readable, bool writable>
UHD_INLINE void uhd::soft_register_t< reg_data_t, readable, writable >::set ( const soft_reg_field_t  field,
const reg_data_t  value 
)
inline

Update specified field in the soft-copy with the arg value. Performs a read-modify-write operation so all other field are preserved. NOTE: This does not write the value to hardware.

◆ write()

template<typename reg_data_t , bool readable, bool writable>
UHD_INLINE void uhd::soft_register_t< reg_data_t, readable, writable >::write ( const soft_reg_field_t  field,
const reg_data_t  value 
)
inline

Shortcut for a set and a flush.

Member Data Documentation

◆ REGISTER

template<typename reg_data_t , bool readable, bool writable>
const uhd::soft_reg_field_t uhd::soft_register_t< reg_data_t, readable, writable >::REGISTER = ((( 0 & 0xFF) << 8) | ( sizeof(reg_data_t) * 8 & 0xFF))
static

The documentation for this class was generated from the following file: