fun_ofdm
1.0
802.11a Physical Layer for USRP
|
The Receiver Chain class. More...
#include <receiver_chain.h>
Public Member Functions | |
receiver_chain () | |
Constructor for receiver_chain. More... | |
std::vector< std::vector < unsigned char > > | process_samples (std::vector< std::complex< double > > samples) |
Processes the raw time domain samples. More... | |
Private Member Functions | |
void | add_block (fun::block_base *block) |
Adds block to the receiver call chain. More... | |
void | run_block (int index, fun::block_base *block) |
Runs the block by calling its work function. More... | |
Private Attributes | |
frame_detector * | m_frame_detector |
Detects start of frame using STS. More... | |
timing_sync * | m_timing_sync |
Aligns frame in time using LTS & some freq correction. More... | |
fft_symbols * | m_fft_symbols |
Forward FFT of symbols. More... | |
channel_est * | m_channel_est |
Channel estimation and equalization in freq domain. More... | |
phase_tracker * | m_phase_tracker |
Phase rotation tracking. More... | |
frame_decoder * | m_frame_decoder |
Frame decoding. More... | |
std::vector< std::thread > | m_threads |
Vector of threads - one for each block. More... | |
std::vector< sem_t > | m_wake_sems |
Vector of semaphores used to "wake up" each block. More... | |
std::vector< sem_t > | m_done_sems |
Vector of semaphores used to determine when the blocks are done. More... | |
The Receiver Chain class.
Inputs raw complex doubles representing the base-band digitized time domain signal.
Outputs vector of correctly received payloads (MPDUs) which are themselves vectors of unsigned chars.
The Receiver Chain class is the main controller for the blocks that are used to receive and decode PHY layer frames. It holds the instances of each block and shifts the data through the receive chain as it is processed eventually returning the correctly received payloads (MPDUs) which can then be passed to the upper layers.
Definition at line 40 of file receiver_chain.h.
fun::receiver_chain::receiver_chain | ( | ) |
Constructor for receiver_chain.
-Initializes each receiver chain block:
Adds each block to the receiver chain.
Definition at line 29 of file receiver_chain.cpp.
References add_block(), m_channel_est, m_done_sems, m_fft_symbols, m_frame_decoder, m_frame_detector, m_phase_tracker, m_timing_sync, and m_wake_sems.
|
private |
Adds block to the receiver call chain.
block | A pointer to the block so that its work function can be called |
The add_block function creates a wake & done semaphore for each block. It then creates a new thread for the block to run in and adds that thread to the thread vector for reference.
Definition at line 58 of file receiver_chain.cpp.
References m_done_sems, m_threads, m_wake_sems, and run_block().
Referenced by receiver_chain().
std::vector< std::vector< unsigned char > > fun::receiver_chain::process_samples | ( | std::vector< std::complex< double > > | samples) |
Processes the raw time domain samples.
samples | A vector of received time-domain samples from the usrp block to pass to the receive chain for signal processing. |
This function is the main scheduler for the receive chain. It takes in raw complex samples from the usrp block and passes them first into the Frame Detector block's input buffer. It then unlocks each of the threads by posting to each block's "wake" semaphore. It then waits for each thread to post that it is done with that call to its work() function. Once all the threads are done it shifts the contents of each blocks output buffer to the input buffer of the next block in the chain and returns the contents of the Frame Decoder's output buffer.
Definition at line 106 of file receiver_chain.cpp.
References fun::block< I, O >::input_buffer, m_channel_est, m_done_sems, m_fft_symbols, m_frame_decoder, m_frame_detector, m_phase_tracker, m_timing_sync, m_wake_sems, and fun::block< I, O >::output_buffer.
Referenced by fun::receiver::receiver_chain_loop(), and test_sim().
|
private |
Runs the block by calling its work function.
index | the block's index for referencing the correct semaphores for that block. |
block | A pointer to the block used as a handle to access its work() function. |
The run_block function is the main thread for controlling the calls to each block's work function. This function is a forever loops that first waits for the wake_sempahore to post indicating its time for the block to "wake up" and process the data that has just been placed in its input_buffer by running its work() function. Then once, the work() function returns run_block posts to the done sempahore that the block has finished processing everything in the input_buffer. At this point it loops back around and waits for the block to be "woken up" again when the next set of input data is ready.
Definition at line 78 of file receiver_chain.cpp.
References m_done_sems, m_wake_sems, and fun::block_base::work().
Referenced by add_block().
|
private |
Channel estimation and equalization in freq domain.
Definition at line 67 of file receiver_chain.h.
Referenced by process_samples(), and receiver_chain().
|
private |
Vector of semaphores used to determine when the blocks are done.
Definition at line 95 of file receiver_chain.h.
Referenced by add_block(), process_samples(), receiver_chain(), and run_block().
|
private |
Forward FFT of symbols.
Definition at line 66 of file receiver_chain.h.
Referenced by process_samples(), and receiver_chain().
|
private |
Frame decoding.
Definition at line 69 of file receiver_chain.h.
Referenced by process_samples(), and receiver_chain().
|
private |
Detects start of frame using STS.
Definition at line 64 of file receiver_chain.h.
Referenced by process_samples(), and receiver_chain().
|
private |
Phase rotation tracking.
Definition at line 68 of file receiver_chain.h.
Referenced by process_samples(), and receiver_chain().
|
private |
Vector of threads - one for each block.
Definition at line 89 of file receiver_chain.h.
Referenced by add_block().
|
private |
Aligns frame in time using LTS & some freq correction.
Definition at line 65 of file receiver_chain.h.
Referenced by process_samples(), and receiver_chain().
|
private |
Vector of semaphores used to "wake up" each block.
Definition at line 92 of file receiver_chain.h.
Referenced by add_block(), process_samples(), receiver_chain(), and run_block().