mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
9 years ago
|
|
||
|
|
||
|
/* This file implements a few features not currently provided by the UHD C-API */
|
||
|
#include <uhd.h>
|
||
|
#include <uhd/usrp/multi_usrp.hpp>
|
||
|
|
||
|
extern "C" {
|
||
|
#include "srslte/rf/rf.h"
|
||
|
#include "uhd_c_api.h"
|
||
|
}
|
||
|
|
||
9 years ago
|
static void (*handler)(const char*);
|
||
9 years ago
|
|
||
|
void translate_handler(uhd::msg::type_t type, const std::string & msg)
|
||
|
{
|
||
9 years ago
|
if(handler)
|
||
|
handler(msg.c_str());
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
void rf_uhd_register_msg_handler_c(void (*new_handler)(const char*))
|
||
9 years ago
|
{
|
||
9 years ago
|
handler = new_handler;
|
||
9 years ago
|
uhd::msg::register_handler(translate_handler);
|
||
|
}
|
||
|
|
||
|
void uhd_tx_metadata_set_time_spec(uhd_tx_metadata_handle *md, time_t secs, double frac_secs)
|
||
|
{
|
||
|
(*md)->tx_metadata_cpp.time_spec = uhd::time_spec_t(secs, frac_secs);
|
||
9 years ago
|
(*md)->tx_metadata_cpp.has_time_spec = true;
|
||
9 years ago
|
}
|
||
|
|
||
|
void uhd_tx_metadata_set_start(uhd_tx_metadata_handle *md, bool is_start_of_burst)
|
||
|
{
|
||
|
(*md)->tx_metadata_cpp.start_of_burst = is_start_of_burst;
|
||
|
}
|
||
|
|
||
|
void uhd_tx_metadata_set_end(uhd_tx_metadata_handle *md, bool is_end_of_burst)
|
||
|
{
|
||
|
(*md)->tx_metadata_cpp.end_of_burst = is_end_of_burst;
|
||
|
}
|
||
|
|
||
|
void uhd_tx_metadata_add_time_spec(uhd_tx_metadata_handle *md, double frac_secs)
|
||
|
{
|
||
|
(*md)->tx_metadata_cpp.time_spec += frac_secs;
|
||
|
}
|
||
|
|