Removed cached PRACH signals

master
Xavier Arteaga 3 years ago
parent aa0c936f50
commit 1bffebe0bf

@ -41,16 +41,6 @@ public:
private:
bool generate_buffer(uint32_t f_idx);
bool is_buffer_generated(uint32_t f_idx, uint32_t preamble_index) const
{
return buffer_bitmask.test(f_idx * 64 + preamble_index);
}
void set_buffer_as_generated(uint32_t f_idx, uint32_t preamble_index)
{
buffer_bitmask.set(f_idx * 64 + preamble_index);
}
private:
static constexpr unsigned MAX_LEN_SF = 3;
static constexpr unsigned max_fs = 12;
@ -61,7 +51,6 @@ private:
srsran_cell_t cell = {};
srsran_cfo_t cfo_h = {};
srsran_prach_cfg_t cfg = {};
std::array<std::array<cf_t*, max_preambles>, max_fs> buffer = {};
cf_t* signal_buffer = nullptr;
int preamble_idx = -1;
uint32_t len = 0;
@ -70,7 +59,6 @@ private:
float target_power_dbm = 0;
bool mem_initiated = false;
bool cell_initiated = false;
std::bitset<max_fs * max_preambles> buffer_bitmask;
mutable std::mutex mutex;
};

@ -33,15 +33,6 @@ using namespace srsue;
void prach::init(uint32_t max_prb)
{
std::lock_guard<std::mutex> lock(mutex);
for (auto& i : buffer) {
for (auto& j : i) {
j = srsran_vec_cf_malloc(SRSRAN_PRACH_MAX_LEN);
if (!j) {
perror("malloc");
return;
}
}
}
if (srsran_cfo_init(&cfo_h, SRSRAN_PRACH_MAX_LEN)) {
ERROR("PRACH: Error initiating CFO");
@ -50,7 +41,7 @@ void prach::init(uint32_t max_prb)
srsran_cfo_set_tol(&cfo_h, 0);
signal_buffer = srsran_vec_cf_malloc(MAX_LEN_SF * 30720U);
signal_buffer = srsran_vec_cf_malloc(SRSRAN_MAX(MAX_LEN_SF * 30720U, SRSRAN_PRACH_MAX_LEN));
if (!signal_buffer) {
perror("malloc");
return;
@ -71,12 +62,6 @@ void prach::stop()
return;
}
for (auto& i : buffer) {
for (auto& j : i) {
free(j);
}
}
free(signal_buffer);
srsran_cfo_free(&cfo_h);
srsran_prach_free(&prach_obj);
@ -118,7 +103,6 @@ bool prach::set_cell(srsran_cell_t cell_, srsran_prach_cfg_t prach_cfg)
return false;
}
buffer_bitmask.reset();
len = prach_obj.N_seq + prach_obj.N_cp;
transmitted_tti = -1;
cell_initiated = true;
@ -130,22 +114,16 @@ bool prach::set_cell(srsran_cell_t cell_, srsran_prach_cfg_t prach_cfg)
bool prach::generate_buffer(uint32_t f_idx)
{
if (is_buffer_generated(f_idx, preamble_idx)) {
return true;
}
uint32_t freq_offset = cfg.freq_offset;
if (cell.frame_type == SRSRAN_TDD) {
freq_offset = srsran_prach_f_ra_tdd(
cfg.config_idx, cfg.tdd_config.sf_config, (f_idx / 6) * 10, f_idx % 6, cfg.freq_offset, cell.nof_prb);
}
if (srsran_prach_gen(&prach_obj, preamble_idx, freq_offset, buffer[f_idx][preamble_idx])) {
if (srsran_prach_gen(&prach_obj, preamble_idx, freq_offset, signal_buffer)) {
Error("Generating PRACH preamble %d", preamble_idx);
return false;
}
set_buffer_as_generated(f_idx, preamble_idx);
return true;
}
@ -239,13 +217,8 @@ cf_t* prach::generate(float cfo, uint32_t* nof_sf, float* target_power)
return nullptr;
}
if (!is_buffer_generated(f_idx, preamble_idx)) {
Error("PRACH Buffer not generated: f_idx=%d preamble_idx=%d", f_idx, preamble_idx);
return nullptr;
}
// Correct CFO before transmission
srsran_cfo_correct(&cfo_h, buffer[f_idx][preamble_idx], signal_buffer, cfo / srsran_symbol_sz(cell.nof_prb));
srsran_cfo_correct(&cfo_h, signal_buffer, signal_buffer, cfo / srsran_symbol_sz(cell.nof_prb));
// pad guard symbols with zeros
uint32_t nsf = SRSRAN_CEIL(len, SRSRAN_SF_LEN_PRB(cell.nof_prb));

Loading…
Cancel
Save