Agora  1.2.0
Agora project
txrx_worker_usrp.h
Go to the documentation of this file.
1 
7 #ifndef TXRX_WORKER_USRP_H_
8 #define TXRX_WORKER_USRP_H_
9 
10 #include <memory>
11 #include <vector>
12 
13 #include "message.h"
14 #include "radio_lib.h"
15 #include "txrx_worker.h"
16 
17 class TxRxWorkerUsrp : public TxRxWorker {
18  public:
19  TxRxWorkerUsrp(size_t core_offset, size_t tid, size_t radio_hi,
20  size_t radio_lo, Config* const config, size_t* rx_frame_start,
23  moodycamel::ProducerToken& tx_producer,
24  moodycamel::ProducerToken& notify_producer,
25  std::vector<RxPacket>& rx_memory, std::byte* const tx_memory,
26  std::mutex& sync_mutex, std::condition_variable& sync_cond,
27  std::atomic<bool>& can_proceed, RadioConfig& radio_config);
28  TxRxWorkerUsrp() = delete;
29  ~TxRxWorkerUsrp() final;
30 
31  void DoTxRx() final;
32 
33  private:
34  int DequeueSend();
35  int DequeueSend(int frame_id, int symbol_id);
36  std::vector<Packet*> RecvEnqueue(size_t radio_id, size_t frame_id,
37  size_t symbol_id);
38 
39  long long rx_time_bs_;
40  long long tx_time_bs_;
41  // This object is created / owned by the parent process
43 };
44 #endif // TXRX_WORKER_USRP_H_
TxRxWorkerUsrp::RecvEnqueue
std::vector< Packet * > RecvEnqueue(size_t radio_id, size_t frame_id, size_t symbol_id)
Definition: txrx_worker_usrp.cc:144
RadioConfig::RadioRx
int RadioRx(size_t radio_id, std::vector< std::vector< std::complex< int16_t >>> &rx_data, size_t rx_size, Radio::RxFlags &out_flags, long long &rx_time_ns)
Definition: radio_lib.cc:326
fmt::v8::detail::byte
byte
Definition: core.h:388
Config::UeSpecificPilotT
Table< std::complex< int16_t > > & UeSpecificPilotT()
Definition: config.h:374
FrameStats::GetDLSymbolIdx
size_t GetDLSymbolIdx(size_t symbol_number) const
Definition: framestats.cc:152
moodycamel::ProducerToken
Definition: concurrentqueue.h:630
Config::UeAntNum
size_t UeAntNum() const
Definition: config.h:41
PinToCoreWithOffset
void PinToCoreWithOffset(ThreadType thread_type, size_t core_offset, size_t thread_id, bool allow_reuse, bool verbose)
Definition: utils.cc:157
Config::SampsPerSymbol
size_t SampsPerSymbol() const
Definition: config.h:234
fmt::v8::printf
auto printf(const S &fmt, const T &... args) -> int
Definition: printf.h:631
Config::NumChannels
size_t NumChannels() const
Definition: config.h:98
TxRxWorker::rx_frame_start_
size_t *const rx_frame_start_
Definition: txrx_worker.h:59
gen_tag_t::symbol_id_
uint16_t symbol_id_
Definition: message.h:33
ThreadType::kWorkerTXRX
@ kWorkerTXRX
Config::BsAntNum
size_t BsAntNum() const
Definition: config.h:35
EventType::kPacketTX
@ kPacketTX
txrx_worker_usrp.h
Implementation of PacketTxRx datapath functions for communicating with usrp hardware.
TxRxWorker::GetTxPacket
Packet * GetTxPacket(size_t frame, size_t symbol, size_t ant)
Definition: txrx_worker.cc:160
TxRxWorker::Running
bool Running() const
Definition: txrx_worker.h:42
flags
list flags
Definition: .ycm_extra_conf.py:39
Config::Frame
const FrameStats & Frame() const
Definition: config.h:340
Catch::cerr
std::ostream & cerr()
TxRxWorkerUsrp::radio_config_
RadioConfig & radio_config_
Definition: txrx_worker_usrp.h:42
rx_tag_t
Definition: message.h:227
Config::BeaconCi16
std::vector< std::complex< int16_t > > & BeaconCi16()
Definition: config.h:380
TxRxWorker::WaitSync
void WaitSync()
Using a latch might be better but adds c++20 requirement.
Definition: txrx_worker.cc:64
TxRxWorker::ReturnRxPacket
void ReturnRxPacket(RxPacket &unused_packet)
Definition: txrx_worker.cc:129
radio_lib.h
Declaration file for the RadioConfig class.
gen_tag_t
Definition: message.h:22
kDebugPrintInTask
static constexpr bool kDebugPrintInTask
Definition: symbols.h:201
Config::GetTotalDataSymbolIdx
size_t GetTotalDataSymbolIdx(size_t frame_id, size_t symbol_id) const
Definition: config.h:415
kDebugDownlink
static constexpr bool kDebugDownlink
Definition: symbols.h:180
TxRxWorker::GetPendingTxEvents
std::vector< EventData > GetPendingTxEvents(size_t max_events=0)
Definition: txrx_worker.cc:85
Radio::TxFlags
TxFlags
Definition: radio.h:20
EventData
Definition: message.h:142
RadioConfig
Definition: radio_lib.h:21
gen_tag_t::ant_id_
uint16_t ant_id_
Definition: message.h:38
message.h
Self defined functions for message storage and passing.
Catch::cout
std::ostream & cout()
GetTime::Rdtsc
static size_t Rdtsc()
Return the TSC.
Definition: gettime.h:25
TxRxWorkerUsrp
Definition: txrx_worker_usrp.h:17
Packet
Definition: message.h:164
TxRxWorker::Configuration
Config * Configuration()
Definition: txrx_worker.h:46
EventType::kPacketRX
@ kPacketRX
kNumStatsFrames
static constexpr size_t kNumStatsFrames
Definition: symbols.h:300
TxRxWorker::NotifyComplete
bool NotifyComplete(const EventData &complete_event)
Definition: txrx_worker.cc:75
RadioConfig::RadioTx
int RadioTx(size_t radio_id, const void *const *buffs, Radio::TxFlags flags, long long &tx_time)
Definition: radio_lib.cc:306
Radio::RxFlags
RxFlags
Definition: radio.h:19
TxRxWorker
Definition: txrx_worker.h:18
TxRxWorkerUsrp::DoTxRx
void DoTxRx() final
Definition: txrx_worker_usrp.cc:34
kIsWorkerTimingEnabled
static constexpr bool kIsWorkerTimingEnabled
Definition: symbols.h:303
FrameStats::ClientDlPilotSymbols
size_t ClientDlPilotSymbols() const
Definition: framestats.h:76
TxRxWorker::GetRxPacket
RxPacket & GetRxPacket()
Definition: txrx_worker.cc:104
RxPacket::RawPacket
Packet * RawPacket()
Definition: message.h:213
moodycamel::ConcurrentQueue< EventData >
Config::CellId
const std::vector< size_t > & CellId() const
Definition: config.h:368
Config::DlIqT
Table< std::complex< int16_t > > & DlIqT()
Definition: config.h:391
TxRxWorkerUsrp::~TxRxWorkerUsrp
~TxRxWorkerUsrp() final
TxRxWorker::tid_
const size_t tid_
Definition: txrx_worker.h:54
Config
Definition: config.h:26
AGORA_LOG_INFO
#define AGORA_LOG_INFO(...)
Definition: logger.h:62
TxRxWorkerUsrp::rx_time_bs_
long long rx_time_bs_
Definition: txrx_worker_usrp.h:39
FrameStats::GetDLSymbolLast
size_t GetDLSymbolLast() const
Definition: framestats.h:37
zeros
N_SC, NUM_UE, NUM_UE zeros()
TxRxWorkerUsrp::DequeueSend
int DequeueSend()
Definition: txrx_worker_usrp.cc:195
RxPacket
Definition: message.h:186
TxRxWorker::interface_offset_
const size_t interface_offset_
Definition: txrx_worker.h:57
gettime.h
TxRxWorkerUsrp::TxRxWorkerUsrp
TxRxWorkerUsrp()=delete
TxRxWorker::num_interfaces_
const size_t num_interfaces_
Definition: txrx_worker.h:56
gen_tag_t::frame_id_
uint32_t frame_id_
Definition: message.h:32
txrx_worker.h
txrx worker thread definition. This is the parent / interface
TxRxWorker::core_offset_
const size_t core_offset_
Definition: txrx_worker.h:55
TxRxWorkerUsrp::tx_time_bs_
long long tx_time_bs_
Definition: txrx_worker_usrp.h:40
TxRxWorker::running_
bool running_
Definition: txrx_worker.h:60
TX_FRAME_DELTA
#define TX_FRAME_DELTA
Definition: symbols.h:20
FrameStats::NumTotalSyms
size_t NumTotalSyms() const
Definition: framestats.cc:93