Added timeout to cuhd_recv

master
ismagom 10 years ago
parent 5e6abc7186
commit a25fa6a435

@ -186,6 +186,7 @@ int cuhd_recv(void *h, void *data, uint32_t nsamples, bool blocking)
{ {
cuhd_handler *handler = static_cast < cuhd_handler * >(h); cuhd_handler *handler = static_cast < cuhd_handler * >(h);
uhd::rx_metadata_t md; uhd::rx_metadata_t md;
uint32_t nof_packets = 0;
if (blocking) { if (blocking) {
int n = 0, p; int n = 0, p;
complex_t *data_c = (complex_t *) data; complex_t *data_c = (complex_t *) data;
@ -200,7 +201,10 @@ int cuhd_recv(void *h, void *data, uint32_t nsamples, bool blocking)
std::cout << "\nError code: " << md.to_pp_string() << "\n\n"; std::cout << "\nError code: " << md.to_pp_string() << "\n\n";
} }
#endif #endif
} while (n < nsamples && md.error_code == uhd::rx_metadata_t::ERROR_CODE_NONE); nof_packets++;
} while (n < nsamples &&
md.error_code == uhd::rx_metadata_t::ERROR_CODE_NONE &&
nof_packets < 10);
return nsamples; return nsamples;
} else { } else {
return handler->rx_stream->recv(data, nsamples, md, 0.0); return handler->rx_stream->recv(data, nsamples, md, 0.0);

@ -49,7 +49,7 @@ float gain_offset = B210_DEFAULT_GAIN_CORREC;
cell_search_cfg_t cell_detect_config = { cell_search_cfg_t cell_detect_config = {
5000, // maximum number of frames to receive for MIB decoding 5000, // maximum number of frames to receive for MIB decoding
50, // maximum number of frames to receive for PSS correlation 50, // maximum number of frames to receive for PSS correlation
9.0 // early-stops cell detection if mean PSR is above this value 16.0 // early-stops cell detection if mean PSR is above this value
}; };
/********************************************************************** /**********************************************************************

@ -56,7 +56,7 @@ float gain_offset = B210_DEFAULT_GAIN_CORREC;
cell_search_cfg_t cell_detect_config = { cell_search_cfg_t cell_detect_config = {
5000, 5000,
100, // nof_frames_total 100, // nof_frames_total
4.0 // threshold 16.0 // threshold
}; };
/********************************************************************** /**********************************************************************

@ -118,7 +118,7 @@ int chest_dl_init(chest_dl_t *q, lte_cell_t cell)
//float f[3]={0.15, 0.7, 0.15}; //float f[3]={0.15, 0.7, 0.15};
//chest_dl_set_filter_freq(q, f, 3); //chest_dl_set_filter_freq(q, f, 3);
float f[5]={0.05, 0.15, 0.6, 0.15, 0.05}; float f[5]={0.02, 0.18, 0.6, 0.18, 0.02};
chest_dl_set_filter_freq(q, f, 5); chest_dl_set_filter_freq(q, f, 5);
float t[2]={0.1, 0.9}; float t[2]={0.1, 0.9};

Loading…
Cancel
Save