fun_ofdm
1.0
802.11a Physical Layer for USRP
|
A simple class used to easily interface with a USRP. More...
#include <usrp.h>
Public Member Functions | |
usrp (usrp_params params) | |
Constructor for usrp class. More... | |
void | send_burst_sync (std::vector< std::complex< double > > samples) |
Sends a burst of samples and block until the burst has finished. More... | |
void | send_burst (std::vector< std::complex< double > > samples) |
Sends a burst of samples but does not block until the burst has finished. More... | |
void | get_samples (int num_samples, std::vector< std::complex< double > > &buffer) |
Gets num_samples samples and places them in the first num_samples of buffer. More... | |
Private Attributes | |
usrp_params | m_params |
Container for the parameters for this instance of the USRP class. More... | |
boost::shared_ptr < uhd::usrp::multi_usrp > | m_usrp |
multi_usrp (main USRP handle) More... | |
boost::shared_ptr< uhd::device > | m_device |
device (receives async messages) More... | |
uhd::rx_streamer::sptr | m_rx_streamer |
TX (output) streamer. More... | |
uhd::tx_streamer::sptr | m_tx_streamer |
RX (input) streamer. More... | |
sem_t | m_tx_sem |
Sempahore used to block for send_burst_sync. More... | |
A simple class used to easily interface with a USRP.
The usrp class is a wrapper class for the UHD API. It provides a simple interface for transmitting and receiving samples to/from the USRP.
fun::usrp::usrp | ( | usrp_params | params) |
Constructor for usrp class.
params | the parameters for the intance of this class. These parameters will remain fixed for the lifetime of the USRP object. |
-Initializations
Definition at line 20 of file usrp.cpp.
References fun::usrp_params::device_addr, fun::usrp_params::freq, m_device, m_params, m_rx_streamer, m_tx_sem, m_tx_streamer, m_usrp, fun::usrp_params::rate, fun::usrp_params::rx_gain, and fun::usrp_params::tx_gain.
void fun::usrp::get_samples | ( | int | num_samples, |
std::vector< std::complex< double > > & | buffer | ||
) |
Gets num_samples samples and places them in the first num_samples of buffer.
num_samples | The number of samples to retrieve from USRP. |
buffer | The buffer to place the retrieved samples in. |
Gets num_samples from the USRP and places them in the buffer parameter. If this function is not called "fast enough" the USRP will get upset because the computer is not consuming samples fast enough to keep up with the USRPs receive sample rate. This will cause the USRP to indicate an overflow and thus not guarantee the integrity of the retrieved data. See link to ettus' website for more details.
Definition at line 125 of file usrp.cpp.
References m_rx_streamer.
Referenced by fun::receiver::receiver_chain_loop().
void fun::usrp::send_burst | ( | std::vector< std::complex< double > > | samples) |
Sends a burst of samples but does not block until the burst has finished.
samples | A vector of complex doubles representing the base band time domain signal to be up-converted and transmitted by the USRP. |
Sends a burst of samples to the USRP which represent the digital base-band signal to be up-converted and transmitted by the USRP.
This function does not block after it is called. Due to the multi-threading nature of the UHD API, this function may return before the USRP has finished transmitting all of the samples. This is generally ok as subsequent calls to this method will just buffer more samples in the USRP. However, if it is not called fast enough an underrun may occer. See link to ettus' website for more details.
Definition at line 66 of file usrp.cpp.
References m_tx_sem, and m_tx_streamer.
void fun::usrp::send_burst_sync | ( | std::vector< std::complex< double > > | samples) |
Sends a burst of samples and block until the burst has finished.
samples | A vector of complex doubles representing the base band time domain signal to be up-converted and transmitted by the USRP. |
Sends a burst of samples to the USRP which represent the digital base-band signal to be up-converted and transmitted by the USRP.
This function uses a semaphore to block until the USRP has responded with an acknowledgement that all the samples have been transmitted over the air. This prevents the user from sending too much data at once so that the user has some sense of when the transmission is finished. If the user does not call this fast enough an underrun may occur. See link to ettus' website for more details.
Definition at line 91 of file usrp.cpp.
References m_device, m_params, m_tx_streamer, and fun::usrp_params::tx_amp.
Referenced by fun::transmitter::send_packet().
|
private |
device (receives async messages)
Definition at line 102 of file usrp.h.
Referenced by send_burst_sync(), and usrp().
|
private |
Container for the parameters for this instance of the USRP class.
Definition at line 99 of file usrp.h.
Referenced by send_burst_sync(), and usrp().
|
private |
TX (output) streamer.
Definition at line 103 of file usrp.h.
Referenced by get_samples(), and usrp().
|
private |
Sempahore used to block for send_burst_sync.
Definition at line 106 of file usrp.h.
Referenced by send_burst(), and usrp().
|
private |
RX (input) streamer.
Definition at line 104 of file usrp.h.
Referenced by send_burst(), send_burst_sync(), and usrp().
|
private |