Revision 7bcaacdb host/examples/tx_bursts.cpp
| b/host/examples/tx_bursts.cpp | ||
|---|---|---|
| 100 | 100 |
//allocate buffer with data to send |
| 101 | 101 |
const size_t spb = tx_stream->get_max_num_samps(); |
| 102 | 102 |
|
| 103 |
std::vector<std::complex<float> *> buffs; |
|
| 104 |
for(size_t i=0; i < usrp->get_num_mboards(); i++) {
|
|
| 105 |
buffs.push_back(new std::complex<float>[spb]); |
|
| 106 |
for(size_t n=0; n < spb; n++) |
|
| 107 |
buffs.back()[n] = std::complex<float>(ampl, ampl); |
|
| 108 |
}; |
|
| 103 |
std::vector<std::complex<float> > buff(spb, std::complex<float>(ampl, ampl)); |
|
| 104 |
std::vector<std::complex<float> *> buffs(usrp->get_tx_num_channels(), &buff.front()); |
|
| 109 | 105 |
|
| 110 | 106 |
std::signal(SIGINT, &sig_int_handler); |
| 111 | 107 |
if(repeat) std::cout << "Press Ctrl + C to quit..." << std::endl; |
| ... | ... | |
| 127 | 123 |
while(num_acc_samps < total_num_samps){
|
| 128 | 124 |
size_t samps_to_send = std::min(total_num_samps - num_acc_samps, spb); |
| 129 | 125 |
|
| 130 |
//ensure the the last packet has EOB set |
|
| 131 |
md.end_of_burst = samps_to_send <= spb; |
|
| 132 |
|
|
| 133 | 126 |
//send a single packet |
| 134 | 127 |
size_t num_tx_samps = tx_stream->send( |
| 135 | 128 |
buffs, samps_to_send, md, timeout |
| ... | ... | |
| 145 | 138 |
num_acc_samps += num_tx_samps; |
| 146 | 139 |
} |
| 147 | 140 |
|
| 141 |
md.end_of_burst = true; |
|
| 142 |
tx_stream->send(buffs, 0, md, timeout); |
|
| 143 |
|
|
| 148 | 144 |
time_to_send += rep_rate; |
| 149 | 145 |
|
| 150 | 146 |
std::cout << std::endl << "Waiting for async burst ACK... " << std::flush; |
Also available in: Unified diff