![]() |
USRP_Server
2.0
A flexible, GPU-accelerated radio-frequency readout software.
|
Manages the hardware I/O of one usrp unit. More...
#include <USRP_hardware_manager.hpp>
Public Member Functions | |
hardware_manager (server_settings *settings, bool sw_loop_init, size_t usrp_number=0) | |
The initializer of the class can be used to select which usrp is controlled by the class Default call suppose only one USRP is connected. More... | |
bool | preset_usrp (usrp_param *requested_config) |
Set the USRP device with user parameters. More... | |
bool | check_rx_status (bool verbose=false) |
Check the status of every rx operations. Returns the status of A or B. More... | |
bool | check_A_rx_status (bool verbose=false) |
Check the status of A rx operations. More... | |
bool | check_B_rx_status (bool verbose=false) |
Check the status of B rx operations. More... | |
bool | check_tx_status (bool verbose=false) |
Check the status of every tx operations. Returns the status of A or B. More... | |
bool | check_A_tx_status (bool verbose=false) |
Check the status of A tx operations. More... | |
bool | check_B_tx_status (bool verbose=false) |
Check the status of B tx operations. More... | |
void | start_tx (threading_condition *wait_condition, int thread_op, param *current_settings, char front_end, preallocator< float2 > *memory=NULL) |
Start a transmission thread. The threads started by this function do two things: pop a packet from the respective queue; stram the packet via UHD interface. Each streamer is handled by an independent thread. If the source queue is empty a warning is printed on the console and an error is pushed in the erorr queue. More... | |
void | start_rx (int buffer_len, threading_condition *wait_condition, preallocator< float2 > *memory, int thread_op, param *current_settings, char front_end) |
@ brief start a rx thread. More... | |
void | close_tx () |
Close all the tx streamer threads. More... | |
void | close_rx () |
Close all the rx streamer threads. More... | |
int | clean_tx_queue (tx_queue *TX_queue, preallocator< float2 > *memory) |
Release the memory associated with pointers holded by a tx queue using the respective memory allocator. More... | |
int | clean_rx_queue (rx_queue *RX_queue, preallocator< float2 > *memory) |
Release the memory associated with pointers holded by a rx queue using the respective memory allocator. More... | |
Public Attributes | |
size_t | this_usrp_number |
bool | sw_loop |
uhd::usrp::multi_usrp::sptr | main_usrp |
rx_queue * | A_RX_queue |
Queue accessed to retrive data from A frontend. More... | |
tx_queue * | A_TX_queue |
Queue accessed to stream data from A frontend. More... | |
rx_queue * | B_RX_queue |
Queue accessed to retrive data from B frontend. More... | |
tx_queue * | B_TX_queue |
Queue accessed to stream data from B frontend. More... | |
std::atomic< bool > | B_rx_thread_operation |
std::atomic< bool > | A_rx_thread_operation |
Manages the hardware I/O of one usrp unit.
Definition at line 12 of file USRP_hardware_manager.hpp.
hardware_manager::hardware_manager | ( | server_settings * | settings, |
bool | sw_loop_init, | ||
size_t | usrp_number = 0 |
||
) |
The initializer of the class can be used to select which usrp is controlled by the class Default call suppose only one USRP is connected.
Initializer of the class can be used to select which usrp is controlled by the class Default call suppose only one USRP is connected.
Definition at line 8 of file USRP_hardware_manager.cpp.
References A_RX_queue, A_rx_thread_operation, A_TX_queue, B_RX_queue, B_rx_thread_operation, B_TX_queue, device_arguments, main_usrp, sw_loop, and this_usrp_number.
bool hardware_manager::preset_usrp | ( | usrp_param * | requested_config | ) |
Set the USRP device with user parameters.
This function set the USRP device with user parameters. It's really a wrappe raround the private methods apply(), set_streams() and check_tuning() of this class.
Definition at line 100 of file USRP_hardware_manager.cpp.
References sw_loop.
Referenced by TXRX::set().
bool hardware_manager::check_rx_status | ( | bool | verbose = false | ) |
Check the status of every rx operations. Returns the status of A or B.
Definition at line 133 of file USRP_hardware_manager.cpp.
References A_rx_thread_operation, B_rx_thread_operation, and print_debug().
Referenced by TXRX::stop().
bool hardware_manager::check_A_rx_status | ( | bool | verbose = false | ) |
Check the status of A rx operations.
Definition at line 119 of file USRP_hardware_manager.cpp.
References A_rx_thread_operation, and print_debug().
Referenced by TXRX::start().
bool hardware_manager::check_B_rx_status | ( | bool | verbose = false | ) |
Check the status of B rx operations.
Definition at line 126 of file USRP_hardware_manager.cpp.
References B_rx_thread_operation, and print_debug().
Referenced by TXRX::start().
bool hardware_manager::check_tx_status | ( | bool | verbose = false | ) |
Check the status of every tx operations. Returns the status of A or B.
Definition at line 140 of file USRP_hardware_manager.cpp.
References print_debug().
Referenced by TXRX::stop().
bool hardware_manager::check_A_tx_status | ( | bool | verbose = false | ) |
Check the status of A tx operations.
Definition at line 147 of file USRP_hardware_manager.cpp.
References print_debug().
Referenced by TXRX::start().
bool hardware_manager::check_B_tx_status | ( | bool | verbose = false | ) |
Check the status of B tx operations.
Definition at line 154 of file USRP_hardware_manager.cpp.
References print_debug().
Referenced by TXRX::start().
void hardware_manager::start_tx | ( | threading_condition * | wait_condition, |
int | thread_op, | ||
param * | current_settings, | ||
char | front_end, | ||
preallocator< float2 > * | memory = NULL |
||
) |
Start a transmission thread. The threads started by this function do two things: pop a packet from the respective queue; stram the packet via UHD interface. Each streamer is handled by an independent thread. If the source queue is empty a warning is printed on the console and an error is pushed in the erorr queue.
Definition at line 165 of file USRP_hardware_manager.cpp.
References A_TX_queue, B_TX_queue, print_error(), SetThreadName(), sw_loop, this_usrp_number, and Thread_Prioriry().
Referenced by TXRX::start().
void hardware_manager::start_rx | ( | int | buffer_len, |
threading_condition * | wait_condition, | ||
preallocator< float2 > * | memory, | ||
int | thread_op, | ||
param * | current_settings, | ||
char | front_end | ||
) |
@ brief start a rx thread.
Start a receiver thread.
Definition at line 234 of file USRP_hardware_manager.cpp.
References A_RX_queue, A_rx_thread_operation, B_RX_queue, B_rx_thread_operation, print_error(), SetThreadName(), sw_loop, this_usrp_number, and Thread_Prioriry().
Referenced by TXRX::start().
void hardware_manager::close_tx | ( | ) |
Close all the tx streamer threads.
Force close the tx uploading threads if active (thread safe)
Definition at line 299 of file USRP_hardware_manager.cpp.
Referenced by TXRX::stop().
void hardware_manager::close_rx | ( | ) |
Close all the rx streamer threads.
Force close the rx downloading threads if active (thread safe)
Definition at line 321 of file USRP_hardware_manager.cpp.
References A_rx_thread_operation, and B_rx_thread_operation.
Referenced by TXRX::stop().
int hardware_manager::clean_tx_queue | ( | tx_queue * | TX_queue, |
preallocator< float2 > * | memory | ||
) |
Release the memory associated with pointers holded by a tx queue using the respective memory allocator.
close a TX queue object preventing memory leaks. Before closing the queue (as the queue used supports multiple consumers) the frontend operation MUST be terminated.
Definition at line 343 of file USRP_hardware_manager.cpp.
References print_warning(), and preallocator< vector_type >::trash().
int hardware_manager::clean_rx_queue | ( | rx_queue * | RX_queue, |
preallocator< float2 > * | memory | ||
) |
Release the memory associated with pointers holded by a rx queue using the respective memory allocator.
close a RX queue object preventing memory leaks. Before closing the queue (as the queue used supports multiple consumers) the frontend operation MUST be terminated.
Definition at line 368 of file USRP_hardware_manager.cpp.
References A_rx_thread_operation, B_rx_thread_operation, preallocator< vector_type >::get(), get_rx_errors(), get_tx_error(), main_usrp, print_error(), print_warning(), set_this_thread_name(), sw_loop, this_usrp_number, and preallocator< vector_type >::trash().
size_t hardware_manager::this_usrp_number |
Definition at line 16 of file USRP_hardware_manager.hpp.
Referenced by clean_rx_queue(), hardware_manager(), TXRX::start(), start_rx(), and start_tx().
bool hardware_manager::sw_loop |
Definition at line 19 of file USRP_hardware_manager.hpp.
Referenced by clean_rx_queue(), hardware_manager(), preset_usrp(), TXRX::start(), start_rx(), and start_tx().
uhd::usrp::multi_usrp::sptr hardware_manager::main_usrp |
Definition at line 22 of file USRP_hardware_manager.hpp.
Referenced by clean_rx_queue(), hardware_manager(), and TXRX::start().
rx_queue* hardware_manager::A_RX_queue |
Queue accessed to retrive data from A frontend.
Definition at line 33 of file USRP_hardware_manager.hpp.
Referenced by hardware_manager(), start_rx(), and TXRX::stop().
tx_queue* hardware_manager::A_TX_queue |
Queue accessed to stream data from A frontend.
Definition at line 36 of file USRP_hardware_manager.hpp.
Referenced by hardware_manager(), TXRX::start(), and start_tx().
rx_queue* hardware_manager::B_RX_queue |
Queue accessed to retrive data from B frontend.
Definition at line 39 of file USRP_hardware_manager.hpp.
Referenced by hardware_manager(), start_rx(), and TXRX::stop().
tx_queue* hardware_manager::B_TX_queue |
Queue accessed to stream data from B frontend.
Definition at line 42 of file USRP_hardware_manager.hpp.
Referenced by hardware_manager(), TXRX::start(), and start_tx().
std::atomic<bool> hardware_manager::B_rx_thread_operation |
Definition at line 100 of file USRP_hardware_manager.hpp.
Referenced by check_B_rx_status(), check_rx_status(), clean_rx_queue(), close_rx(), hardware_manager(), and start_rx().
std::atomic<bool> hardware_manager::A_rx_thread_operation |
Definition at line 101 of file USRP_hardware_manager.hpp.
Referenced by check_A_rx_status(), check_rx_status(), clean_rx_queue(), close_rx(), hardware_manager(), and start_rx().