fixing support for extended Cyclic Prefix

small cosmetic fixes of CP code
master
yagoda 4 years ago committed by Justin Tallon
parent 21b3635ae4
commit 9501283c1c

@ -203,6 +203,9 @@ static void parse_args(int argc, char** argv)
case 'Q':
use_standard_lte_rate ^= true;
break;
case 'E':
cell.cp = SRSRAN_CP_EXT;
break;
default:
usage(argv[0]);
exit(-1);
@ -307,7 +310,7 @@ static void base_init()
/* create ifft object */
for (i = 0; i < cell.nof_ports; i++) {
if (srsran_ofdm_tx_init(&ifft[i], SRSRAN_CP_NORM, sf_buffer[i], output_buffer[i], cell.nof_prb)) {
if (srsran_ofdm_tx_init(&ifft[i], cell.cp, sf_buffer[i], output_buffer[i], cell.nof_prb)) {
ERROR("Error creating iFFT object");
exit(-1);
}
@ -725,7 +728,7 @@ int main(int argc, char** argv)
generate_mcch_table(mch_table, mbsfn_sf_mask);
}
N_id_2 = cell.id % 3;
sf_n_re = 2 * SRSRAN_CP_NORM_NSYMB * cell.nof_prb * SRSRAN_NRE;
sf_n_re = SRSRAN_SF_LEN_RE(cell.nof_prb, cell.cp);
sf_n_samples = 2 * SRSRAN_SLOT_LEN(srsran_symbol_sz(cell.nof_prb));
cell.phich_length = SRSRAN_PHICH_NORM;
@ -841,8 +844,8 @@ int main(int argc, char** argv)
srsran_vec_cf_zero(sf_symbols[0], sf_n_re);
if (sf_idx == 0 || sf_idx == 5) {
srsran_pss_put_slot(pss_signal, sf_symbols[0], cell.nof_prb, SRSRAN_CP_NORM);
srsran_sss_put_slot(sf_idx ? sss_signal5 : sss_signal0, sf_symbols[0], cell.nof_prb, SRSRAN_CP_NORM);
srsran_pss_put_slot(pss_signal, sf_symbols[0], cell.nof_prb, cell.cp);
srsran_sss_put_slot(sf_idx ? sss_signal5 : sss_signal0, sf_symbols[0], cell.nof_prb, cell.cp);
}
/* Copy zeros, SSS, PSS into the rest of antenna ports */

@ -84,6 +84,7 @@ struct phy_args_t {
uint32_t intra_freq_meas_len_ms = 20;
uint32_t intra_freq_meas_period_ms = 200;
float force_ul_amplitude = 0.0f;
bool detect_cp = false;
float in_sync_rsrp_dbm_th = -130.0f;
float in_sync_snr_db_th = 1.0f;

@ -56,7 +56,7 @@ typedef struct SRSRAN_API {
srsran_dl_sf_cfg_t dl_sf;
cf_t* sf_symbols[SRSRAN_MAX_PORTS];
cf_t* out_buffer[SRSRAN_MAX_PORTS];
srsran_ofdm_t ifft[SRSRAN_MAX_PORTS];
srsran_ofdm_t ifft_mbsfn;

@ -44,6 +44,7 @@ typedef struct SRSRAN_API {
srsran_cell_t cell;
cf_t* sf_symbols;
cf_t* in_buffer;
srsran_chest_ul_res_t chest_res;
srsran_ofdm_t fft;

@ -35,7 +35,7 @@ typedef struct {
uint32_t peak_index;
} srsran_refsignal_dl_sync_t;
SRSRAN_API int srsran_refsignal_dl_sync_init(srsran_refsignal_dl_sync_t* q);
SRSRAN_API int srsran_refsignal_dl_sync_init(srsran_refsignal_dl_sync_t* q, srsran_cp_t cp);
SRSRAN_API int srsran_refsignal_dl_sync_set_cell(srsran_refsignal_dl_sync_t* q, srsran_cell_t cell);

@ -90,5 +90,7 @@ SRSRAN_API int srsran_ue_cellsearch_scan(srsran_ue_cellsearch_t* q,
SRSRAN_API int srsran_ue_cellsearch_set_nof_valid_frames(srsran_ue_cellsearch_t* q, uint32_t nof_frames);
SRSRAN_API void srsran_set_detect_cp(srsran_ue_cellsearch_t* q, bool enable);
#endif // SRSRAN_UE_CELL_SEARCH_H

@ -238,6 +238,8 @@ SRSRAN_API uint32_t srsran_ue_sync_get_sfidx(srsran_ue_sync_t* q);
SRSRAN_API float srsran_ue_sync_get_cfo(srsran_ue_sync_t* q);
SRSRAN_API void srsran_ue_sync_cp_en(srsran_ue_sync_t* q, bool enabled);
SRSRAN_API float srsran_ue_sync_get_sfo(srsran_ue_sync_t* q);
SRSRAN_API int srsran_ue_sync_get_last_sample_offset(srsran_ue_sync_t* q);

@ -41,21 +41,14 @@ int srsran_enb_dl_init(srsran_enb_dl_t* q, cf_t* out_buffer[SRSRAN_MAX_PORTS], u
goto clean_exit;
}
}
for (int i = 0; i < SRSRAN_MAX_PORTS; i++) {
q->out_buffer[i] = out_buffer[i];
}
srsran_ofdm_cfg_t ofdm_cfg = {};
ofdm_cfg.nof_prb = max_prb;
ofdm_cfg.cp = SRSRAN_CP_NORM;
ofdm_cfg.cp = SRSRAN_CP_EXT;
ofdm_cfg.normalize = false;
for (int i = 0; i < SRSRAN_MAX_PORTS; i++) {
ofdm_cfg.in_buffer = q->sf_symbols[i];
ofdm_cfg.out_buffer = out_buffer[i];
ofdm_cfg.sf_type = SRSRAN_SF_NORM;
if (srsran_ofdm_tx_init_cfg(&q->ifft[i], &ofdm_cfg)) {
ERROR("Error initiating FFT (%d)", i);
goto clean_exit;
}
}
ofdm_cfg.in_buffer = q->sf_symbols[0];
ofdm_cfg.out_buffer = out_buffer[0];
ofdm_cfg.sf_type = SRSRAN_SF_MBSFN;
@ -150,6 +143,19 @@ int srsran_enb_dl_set_cell(srsran_enb_dl_t* q, srsran_cell_t cell)
srsran_regs_free(&q->regs);
}
q->cell = cell;
srsran_ofdm_cfg_t ofdm_cfg = {};
ofdm_cfg.nof_prb = q->cell.nof_prb;
ofdm_cfg.cp = cell.cp;
ofdm_cfg.normalize = false;
for (int i = 0; i < SRSRAN_MAX_PORTS; i++) {
ofdm_cfg.in_buffer = q->sf_symbols[i];
ofdm_cfg.out_buffer = q->out_buffer[i];
ofdm_cfg.sf_type = SRSRAN_SF_NORM;
if (srsran_ofdm_tx_init_cfg(&q->ifft[i], &ofdm_cfg)) {
ERROR("Error initiating FFT (%d)", i);
return SRSRAN_ERROR;
}
}
if (srsran_regs_init(&q->regs, q->cell)) {
ERROR("Error resizing REGs");
return SRSRAN_ERROR;

@ -37,19 +37,7 @@ int srsran_enb_ul_init(srsran_enb_ul_t* q, cf_t* in_buffer, uint32_t max_prb)
perror("malloc");
goto clean_exit;
}
srsran_ofdm_cfg_t ofdm_cfg = {};
ofdm_cfg.nof_prb = max_prb;
ofdm_cfg.in_buffer = in_buffer;
ofdm_cfg.out_buffer = q->sf_symbols;
ofdm_cfg.cp = SRSRAN_CP_NORM;
ofdm_cfg.freq_shift_f = -0.5f;
ofdm_cfg.normalize = false;
ofdm_cfg.rx_window_offset = 0.5f;
if (srsran_ofdm_rx_init_cfg(&q->fft, &ofdm_cfg)) {
ERROR("Error initiating FFT");
goto clean_exit;
}
q->in_buffer = in_buffer;
if (srsran_pucch_init_enb(&q->pucch)) {
ERROR("Error creating PUCCH object");
@ -108,6 +96,18 @@ int srsran_enb_ul_set_cell(srsran_enb_ul_t* q,
if (cell.id != q->cell.id || q->cell.nof_prb == 0) {
q->cell = cell;
srsran_ofdm_cfg_t ofdm_cfg = {};
ofdm_cfg.nof_prb = q->cell.nof_prb;
ofdm_cfg.in_buffer = q->in_buffer;
ofdm_cfg.out_buffer = q->sf_symbols;
ofdm_cfg.cp = q->cell.cp;
ofdm_cfg.freq_shift_f = -0.5f;
ofdm_cfg.normalize = false;
ofdm_cfg.rx_window_offset = 0.5f;
if (srsran_ofdm_rx_init_cfg(&q->fft, &ofdm_cfg)) {
ERROR("Error initiating FFT");
return SRSRAN_ERROR;
}
if (srsran_ofdm_rx_set_prb(&q->fft, q->cell.cp, q->cell.nof_prb)) {
ERROR("Error initiating FFT");
return SRSRAN_ERROR;

@ -139,7 +139,7 @@ static inline void refsignal_dl_pss_sss_strength(srsran_refsignal_dl_sync_t* q,
}
}
int srsran_refsignal_dl_sync_init(srsran_refsignal_dl_sync_t* q)
int srsran_refsignal_dl_sync_init(srsran_refsignal_dl_sync_t* q, srsran_cp_t cp)
{
int ret = SRSRAN_ERROR_INVALID_INPUTS;
@ -177,12 +177,12 @@ int srsran_refsignal_dl_sync_init(srsran_refsignal_dl_sync_t* q)
// Initiate OFDM modulator
if (!ret) {
ret = srsran_ofdm_tx_init(&q->ifft, SRSRAN_CP_NORM, q->ifft_buffer_in, q->ifft_buffer_out, SRSRAN_MAX_PRB);
ret = srsran_ofdm_tx_init(&q->ifft, cp, q->ifft_buffer_in, q->ifft_buffer_out, SRSRAN_MAX_PRB);
}
// Set PRB
if (!ret) {
ret = srsran_ofdm_tx_set_prb(&q->ifft, SRSRAN_CP_NORM, SRSRAN_MAX_PRB);
ret = srsran_ofdm_tx_set_prb(&q->ifft, cp, SRSRAN_MAX_PRB);
}
// Initiate FFT Convolution

@ -179,6 +179,11 @@ int srsran_ue_cellsearch_set_nof_valid_frames(srsran_ue_cellsearch_t* q, uint32_
}
}
void srsran_set_detect_cp(srsran_ue_cellsearch_t* q, bool enable)
{
srsran_ue_sync_cp_en(&q->ue_sync, enable);
}
/* Decide the most likely cell based on the mode */
static void get_cell(srsran_ue_cellsearch_t* q, uint32_t nof_detected_frames, srsran_ue_cellsearch_result_t* found_cell)
{

@ -330,7 +330,8 @@ int srsran_ue_sync_set_cell(srsran_ue_sync_t* q, srsran_cell_t cell)
q->cell = cell;
q->fft_size = srsran_symbol_sz(q->cell.nof_prb);
q->sf_len = SRSRAN_SF_LEN(q->fft_size);
srsran_sync_set_cp(&q->sfind, q->cell.cp);
srsran_sync_set_cp(&q->strack, q->cell.cp);
if (cell.id == 1000) {
/* If the cell is unkown, we search PSS/SSS in 5 ms */
q->nof_recv_sf = 5;
@ -499,6 +500,12 @@ float srsran_ue_sync_get_cfo(srsran_ue_sync_t* q)
return 15000 * q->cfo_current_value;
}
void srsran_ue_sync_cp_en(srsran_ue_sync_t* q, bool enabled)
{
srsran_sync_cp_en(&q->strack, enabled);
srsran_sync_cp_en(&q->sfind, enabled);
}
void srsran_ue_sync_copy_cfo(srsran_ue_sync_t* q, srsran_ue_sync_t* src_obj)
{
// Copy find object internal CFO averages

@ -18,33 +18,35 @@ target_link_libraries(phy_dl_test srsran_phy srsran_common srsran_phy ${SEC_LIBR
set(ue_dl_min_mcs 0)
set(ue_dl_max_mcs 28)
set(ue_dl_step_mcs 7)
foreach (cell_n_prb 6 15 25 50 75 100)
foreach (allow_256 0 1)
foreach (ue_dl_tm 1 2 3 4)
foreach (ue_dl_mcs RANGE ${ue_dl_min_mcs} ${ue_dl_max_mcs} ${ue_dl_step_mcs})
set(phy_dl_test_args "")
set(phy_dl_test_args ${phy_dl_test_args} -p ${cell_n_prb})
set(phy_dl_test_args ${phy_dl_test_args} -t ${ue_dl_tm})
if (${allow_256})
if (${ue_dl_mcs} EQUAL 28)
if (${cell_n_prb} EQUAL 15)
set(ue_dl_mcs 26)
else (${cell_n_prb} EQUAL 15)
set(ue_dl_mcs 27)
endif (${cell_n_prb} EQUAL 15)
endif (${ue_dl_mcs} EQUAL 28)
set(phy_dl_test_args ${phy_dl_test_args} -q)
endif (${allow_256})
set(phy_dl_test_args ${phy_dl_test_args} -m ${ue_dl_mcs})
string(REGEX REPLACE "\ " "" test_name_args ${phy_dl_test_args})
add_lte_test(phy_dl_test${test_name_args} phy_dl_test ${phy_dl_test_args})
endforeach (ue_dl_mcs)
endforeach (ue_dl_tm)
endforeach (allow_256 0 1)
endforeach (cell_n_prb)
foreach (cp 0 1)
foreach (cell_n_prb 6 15 25 50 75 100)
foreach (allow_256 0 1)
foreach (ue_dl_tm 1 2 3 4)
foreach (ue_dl_mcs RANGE ${ue_dl_min_mcs} ${ue_dl_max_mcs} ${ue_dl_step_mcs})
set(phy_dl_test_args "")
if(NOT ((${cp} EQUAL 1) AND (ue_dl_mcs GREATER 26)))
set(phy_dl_test_args ${phy_dl_test_args} -p ${cell_n_prb})
set(phy_dl_test_args ${phy_dl_test_args} -t ${ue_dl_tm})
set(phy_dl_test_args ${phy_dl_test_args} -E ${cp})
if (${allow_256})
if (${ue_dl_mcs} EQUAL 28)
if (${cell_n_prb} EQUAL 15)
set(ue_dl_mcs 26)
else (${cell_n_prb} EQUAL 15)
set(ue_dl_mcs 27)
endif (${cell_n_prb} EQUAL 15)
endif (${ue_dl_mcs} EQUAL 28)
set(phy_dl_test_args ${phy_dl_test_args} -q)
endif (${allow_256})
set(phy_dl_test_args ${phy_dl_test_args} -m ${ue_dl_mcs})
string(REGEX REPLACE "\ " "" test_name_args ${phy_dl_test_args})
add_lte_test(phy_dl_test${test_name_args} phy_dl_test ${phy_dl_test_args})
endif(NOT ((${cp} EQUAL 1) AND (ue_dl_mcs GREATER 26)))
endforeach (ue_dl_mcs)
endforeach (ue_dl_tm)
endforeach (allow_256 0 1)
endforeach (cell_n_prb)
endforeach (cp)
add_executable(pucch_ca_test pucch_ca_test.c)
target_link_libraries(pucch_ca_test srsran_phy srsran_common srsran_phy ${SEC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})

@ -40,6 +40,7 @@ void usage(char* prog)
{
printf("Usage: %s [cfpndvs]\n", prog);
printf("\t-c cell id [Default %d]\n", cell.id);
printf("\t-E extended Cyclic prefix [Default %d]\n", cell.cp);
printf("\t-f cfi [Default %d]\n", cfi);
printf("\t-p cell.nof_prb [Default %d]\n", cell.nof_prb);
printf("\t-s number of subframes to simulate [Default %d]\n", nof_subframes);
@ -84,7 +85,7 @@ void parse_args(int argc, char** argv)
nof_rx_ant = 2;
}
while ((opt = getopt(argc, argv, "cfapndvqstm")) != -1) {
while ((opt = getopt(argc, argv, "cfapndvqstmE")) != -1) {
switch (opt) {
case 't':
transmission_mode = (uint32_t)strtol(argv[optind], NULL, 10) - 1;
@ -111,6 +112,9 @@ void parse_args(int argc, char** argv)
case 's':
nof_subframes = (uint32_t)strtol(argv[optind], NULL, 10);
break;
case 'E':
cell.cp = ((uint32_t)strtol(argv[optind], NULL, 10)) ? SRSRAN_CP_EXT : SRSRAN_CP_NORM;
break;
case 'd':
print_dci_table = true;
break;

@ -336,3 +336,4 @@ enable = false
#eea_pref_list = EEA0, EEA2, EEA1
#eia_pref_list = EIA2, EIA1, EIA0
#gtpu_tunnel_timeout = 0
#extended_cp = false

@ -63,7 +63,7 @@ struct phy_args_t {
bool pusch_meas_ta = true;
bool pucch_meas_ta = true;
uint32_t nof_prach_threads = 1;
bool extended_cp = false;
srsran::channel::args_t dl_channel_args;
srsran::channel::args_t ul_channel_args;

@ -825,7 +825,7 @@ namespace enb_conf_sections {
int parse_cell_cfg(all_args_t* args_, srsran_cell_t* cell)
{
cell->frame_type = SRSRAN_FDD;
cell->cp = SRSRAN_CP_NORM;
cell->cp = args_->phy.extended_cp ? SRSRAN_CP_EXT : SRSRAN_CP_NORM;
cell->nof_ports = args_->enb.nof_ports;
cell->nof_prb = args_->enb.n_prb;
// PCI not configured yet

@ -221,6 +221,7 @@ void parse_args(all_args_t* args, int argc, char* argv[])
("expert.max_mac_ul_kos", bpo::value<uint32_t>(&args->general.max_mac_ul_kos)->default_value(100), "Maximum number of consecutive KOs in UL before triggering the UE's release")
("expert.gtpu_tunnel_timeout", bpo::value<uint32_t>(&args->stack.gtpu_indirect_tunnel_timeout_msec)->default_value(0), "Maximum time that GTPU takes to release indirect forwarding tunnel since the last received GTPU PDU. (0 for infinity)")
("expert.rlf_release_timer_ms", bpo::value<uint32_t>(&args->general.rlf_release_timer_ms)->default_value(4000), "Time taken by eNB to release UE context after it detects an RLF")
("expert.extended_cp", bpo::value<bool>(&args->phy.extended_cp)->default_value(false), "Use extended cyclic prefix")
// eMBMS section

@ -1138,6 +1138,7 @@ public:
uint32_t tm_u32 = 1;
uint32_t period_pcell_rotate = 0;
srsran_tm_t tm = SRSRAN_TM1;
bool extended_cp = false;
args_t()
{
cell.nof_prb = 6;
@ -1214,6 +1215,7 @@ public:
q.cell = args.cell;
q.cell.id = i;
q.cell_id = i;
q.cell.cp = args.extended_cp ? SRSRAN_CP_EXT : SRSRAN_CP_NORM;
q.dl_freq_hz = 0.0f; ///< Frequencies are irrelevant in this test
q.ul_freq_hz = 0.0f;
q.root_seq_idx = 25 + i; ///< Different PRACH root sequences
@ -1416,6 +1418,7 @@ int parse_args(int argc, char** argv, phy_test_bench::args_t& args)
("ack_mode", bpo::value<std::string>(&args.ack_mode), "HARQ ACK/NACK mode: normal, pucch3, cs")
("cell.nof_prb", bpo::value<uint32_t>(&args.cell.nof_prb)->default_value(args.cell.nof_prb), "eNb Cell/Carrier bandwidth")
("cell.nof_ports", bpo::value<uint32_t>(&args.cell.nof_ports)->default_value(args.cell.nof_ports), "eNb Cell/Carrier number of ports")
("cell.cp", bpo::value<bool>(&args.extended_cp)->default_value(false), "use extended CP")
("tm", bpo::value<uint32_t>(&args.tm_u32)->default_value(args.tm_u32), "Transmission mode")
("rotation", bpo::value<uint32_t>(&args.period_pcell_rotate), "Serving cells rotation period in ms, set to zero to disable")
;

@ -41,6 +41,7 @@ public:
float get_last_cfo();
void set_agc_enable(bool enable);
ret_code run(srsran_cell_t* cell, std::array<uint8_t, SRSRAN_BCH_PAYLOAD_LEN>& bch_payload);
void set_cp_en(bool enable);
private:
search_callback* p = nullptr;

@ -376,6 +376,10 @@ static int parse_args(all_args_t* args, int argc, char* argv[])
bpo::value<float>(&args->phy.force_ul_amplitude)->default_value(0.0),
"Forces the peak amplitude in the PUCCH, PUSCH and SRS (set 0.0 to 1.0, set to 0 or negative for disabling)")
("phy.detect_cp",
bpo::value<bool>(&args->phy.detect_cp)->default_value(false),
"enable CP length detection")
("phy.in_sync_rsrp_dbm_th",
bpo::value<float>(&args->phy.in_sync_rsrp_dbm_th)->default_value(-130.0f),
"RSRP threshold (in dBm) above which the UE considers to be in-sync")

@ -34,7 +34,7 @@ void intra_measure_lte::init(uint32_t cc_idx, const args_t& args)
init_generic(cc_idx, args);
// Initialise Reference signal measurement
srsran_refsignal_dl_sync_init(&refsignal_dl_sync);
srsran_refsignal_dl_sync_init(&refsignal_dl_sync, SRSRAN_CP_NORM);
// Start scell
scell_rx.init(args.len_ms);

@ -67,6 +67,11 @@ void search::init(srsran::rf_buffer_t& buffer_, uint32_t nof_rx_channels, search
force_N_id_2 = force_N_id_2_;
}
void search::set_cp_en(bool enable)
{
srsran_set_detect_cp(&cs, enable);
}
void search::reset()
{
srsran_ue_sync_reset(&ue_mib_sync.ue_sync);
@ -154,11 +159,12 @@ search::ret_code search::run(srsran_cell_t* cell_, std::array<uint8_t, SRSRAN_BC
std::copy(std::begin(mib_packed), std::end(mib_packed), std::begin(bch_payload));
fprintf(stdout,
"Found Cell: Mode=%s, PCI=%d, PRB=%d, Ports=%d, CFO=%.1f KHz\n",
"Found Cell: Mode=%s, PCI=%d, PRB=%d, Ports=%d, CP=%s, CFO=%.1f KHz\n",
new_cell.frame_type ? "TDD" : "FDD",
new_cell.id,
new_cell.nof_prb,
new_cell.nof_ports,
new_cell.cp ? "Normal" : "Extended",
cfo / 1000);
Info("SYNC: MIB Decoded: Mode=%s, PCI=%d, PRB=%d, Ports=%d, CFO=%.1f KHz",

@ -74,6 +74,7 @@ void sync::init(srsran::radio_interface_phy* _radio,
Error("SYNC: Initiating ue_sync");
return;
}
srsran_ue_sync_cp_en(&ue_sync, worker_com->args->detect_cp);
if (worker_com->args->dl_channel_args.enable) {
channel_emulator =
@ -82,7 +83,7 @@ void sync::init(srsran::radio_interface_phy* _radio,
// Initialize cell searcher
search_p.init(sf_buffer, nof_rf_channels, this, worker_com->args->force_N_id_2);
search_p.set_cp_en(worker_com->args->detect_cp);
// Initialize SFN synchronizer, it uses only pcell buffer
sfn_p.init(&ue_sync, worker_com->args, sf_buffer, sf_buffer.size());

@ -367,6 +367,7 @@ enable = false
#pdsch_csi_enabled = true
#pdsch_8bit_decoder = false
#force_ul_amplitude = 0
#detect_cp = false
#in_sync_rsrp_dbm_th = -130.0
#in_sync_snr_db_th = 3.0

Loading…
Cancel
Save