Added pregeneration of SRS and DMRS PUSCH signals

master
ismagom 10 years ago
parent 39f4484ede
commit 8dba2055f6

@ -168,7 +168,7 @@ private:
void tr_log_end(uint32_t tti); void tr_log_end(uint32_t tti);
void tr_log_dl(uint32_t tti); void tr_log_dl(uint32_t tti);
void tr_log_ul(uint32_t tti); void tr_log_ul(uint32_t tti);
void set_phy_crnti(uint16_t phy_rnti); void pregen_phy(uint16_t phy_rnti);
}; };

@ -321,9 +321,13 @@ void mac::main_radio_loop() {
ra_procedure.start_rlc_order(); ra_procedure.start_rlc_order();
} }
} }
if (ra_procedure.is_successful() && phy_rnti != params_db.get_param(mac_params::RNTI_C) && params_db.get_param(mac_params::RNTI_C) > 0) { if (ra_procedure.is_successful() &&
phy_rnti != params_db.get_param(mac_params::RNTI_C) &&
params_db.get_param(mac_params::RNTI_C) > 0 &&
phy_h->get_param(srslte::ue::phy_params::SRS_IS_CONFIGURED) == 1)
{
phy_rnti = params_db.get_param(mac_params::RNTI_C); phy_rnti = params_db.get_param(mac_params::RNTI_C);
set_phy_crnti(phy_rnti); pregen_phy(phy_rnti);
} }
} }
} }
@ -336,16 +340,17 @@ struct phy_crnti {
uint16_t crnti; uint16_t crnti;
}; };
void *set_phy_crnti_thread(void *arg) { void *pregen_phy_thread(void *arg) {
struct phy_crnti *a = (struct phy_crnti*) arg; struct phy_crnti *a = (struct phy_crnti*) arg;
a->log_h->info("Setting PHY RNTI=%d\n", a->crnti); a->log_h->info("Setting PHY RNTI=%d\n", a->crnti);
a->phy_ptr->set_crnti(a->crnti); a->phy_ptr->set_crnti(a->crnti);
a->phy_ptr->pregen_signals();
a->log_h->info("Done Setting PHY RNTI\n"); a->log_h->info("Done Setting PHY RNTI\n");
free(a); free(a);
return NULL; return NULL;
} }
void mac::set_phy_crnti(uint16_t phy_rnti) void mac::pregen_phy(uint16_t phy_rnti)
{ {
pthread_t rnti_thread; pthread_t rnti_thread;
struct phy_crnti *arg = (struct phy_crnti*) malloc(sizeof(struct phy_crnti)); struct phy_crnti *arg = (struct phy_crnti*) malloc(sizeof(struct phy_crnti));
@ -355,7 +360,8 @@ void mac::set_phy_crnti(uint16_t phy_rnti)
pthread_attr_t attr; pthread_attr_t attr;
pthread_attr_init(&attr); pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (pthread_create(&rnti_thread, &attr, set_phy_crnti_thread, arg)) { pthread_attr_setschedpolicy(&attr, SCHED_OTHER);
if (pthread_create(&rnti_thread, &attr, pregen_phy_thread, arg)) {
perror("pthread_create"); perror("pthread_create");
} }
} }

@ -83,6 +83,7 @@ public:
float get_agc_gain(); float get_agc_gain();
void set_crnti(uint16_t rnti); void set_crnti(uint16_t rnti);
void pregen_signals();
// Indicate the PHY to send PRACH as soon as possible // Indicate the PHY to send PRACH as soon as possible
bool init_prach(); bool init_prach();

@ -63,6 +63,7 @@ namespace ue {
bool generate_data(ul_sched_grant *pusch_grant, srslte_softbuffer_tx_t *softbuffer, uint8_t *payload); bool generate_data(ul_sched_grant *pusch_grant, srslte_softbuffer_tx_t *softbuffer, uint8_t *payload);
void set_tx_params(float cfo, float time_adv_sec, srslte_timestamp_t tx_time); void set_tx_params(float cfo, float time_adv_sec, srslte_timestamp_t tx_time);
void send_end_of_burst(); void send_end_of_burst();
void pregen_signals();
static const uint32_t tx_advance_sf = 1; // Number of subframes to advance transmission static const uint32_t tx_advance_sf = 1; // Number of subframes to advance transmission
static const bool normalize_amp = true; static const bool normalize_amp = true;
private: private:

@ -109,7 +109,13 @@ namespace ue {
} }
bool to_pusch_cfg(srslte_pusch_hopping_cfg_t *hopping_cfg, srslte_refsignal_srs_cfg_t *srs_cfg, uint32_t tti, srslte_ue_ul_t *ue_ul) { bool to_pusch_cfg(srslte_pusch_hopping_cfg_t *hopping_cfg, srslte_refsignal_srs_cfg_t *srs_cfg, uint32_t tti, srslte_ue_ul_t *ue_ul) {
memcpy(&ue_ul->pusch_cfg.grant, &grant, sizeof(srslte_ra_ul_grant_t)); memcpy(&ue_ul->pusch_cfg.grant, &grant, sizeof(srslte_ra_ul_grant_t));
if (srslte_ue_ul_cfg_grant(ue_ul, NULL, hopping_cfg, srs_cfg, tti, get_rv())) {
uint32_t cyclic_shift_for_dmrs = 0;
if (!is_from_rar()) {
cyclic_shift_for_dmrs = get_n_dmrs();
}
if (srslte_ue_ul_cfg_grant(ue_ul, NULL, hopping_cfg, srs_cfg, tti, cyclic_shift_for_dmrs, get_rv())) {
return false; return false;
} }
return true; return true;

@ -169,10 +169,6 @@ bool phy::send_prach(uint32_t preamble_idx, int allowed_subframe) {
bool phy::send_prach(uint32_t preamble_idx, int allowed_subframe, int target_power_dbm) bool phy::send_prach(uint32_t preamble_idx, int allowed_subframe, int target_power_dbm)
{ {
if (phy_state == RXTX) { if (phy_state == RXTX) {
srslte_agc_lock(&ue_sync.agc, true);
old_gain = radio_handler->get_tx_gain();
radio_handler->set_tx_gain(80);
Info("Stopped AGC. Set TX gain to %.1f dB\n", radio_handler->get_tx_gain());
return prach_buffer.prepare_to_send(preamble_idx, allowed_subframe, target_power_dbm); return prach_buffer.prepare_to_send(preamble_idx, allowed_subframe, target_power_dbm);
} }
return false; return false;
@ -240,7 +236,13 @@ void phy::set_crnti(uint16_t rnti) {
for(uint32_t i=0;i<NOF_ULDL_QUEUES;i++) { for(uint32_t i=0;i<NOF_ULDL_QUEUES;i++) {
((ul_buffer*) ul_buffer_queue->get(i))->set_crnti(rnti); ((ul_buffer*) ul_buffer_queue->get(i))->set_crnti(rnti);
((dl_buffer*) dl_buffer_queue->get(i))->set_crnti(rnti); ((dl_buffer*) dl_buffer_queue->get(i))->set_crnti(rnti);
}
}
void phy::pregen_signals()
{
for(uint32_t i=0;i<NOF_ULDL_QUEUES;i++) {
((ul_buffer*) ul_buffer_queue->get(i))->pregen_signals();
} }
} }
@ -544,9 +546,6 @@ void phy::run_rx_tx_state()
// send prach if we have to // send prach if we have to
prach_buffer.send(radio_handler, cfo, last_rx_time); prach_buffer.send(radio_handler, cfo, last_rx_time);
radio_handler->tx_end(); radio_handler->tx_end();
radio_handler->set_tx_gain(old_gain);
srslte_agc_lock(&ue_sync.agc, false);
Info("Restoring AGC. Set TX gain to %.1f dB\n", old_gain);
} }
// Receive alligned buffer for the current tti // Receive alligned buffer for the current tti

@ -75,6 +75,33 @@ void ul_buffer::set_crnti(uint16_t rnti)
srslte_ue_ul_set_rnti(&ue_ul, rnti); srslte_ue_ul_set_rnti(&ue_ul, rnti);
} }
void ul_buffer::pregen_signals()
{
srslte_refsignal_dmrs_pusch_cfg_t dmrs_cfg;
bzero(&dmrs_cfg, sizeof(srslte_refsignal_dmrs_pusch_cfg_t));
dmrs_cfg.beta_pusch = (float) params_db->get_param(phy_params::PUSCH_BETA)/10;
bool group_hopping_en = params_db->get_param(phy_params::DMRS_GROUP_HOPPING_EN);
bool sequence_hopping_en = params_db->get_param(phy_params::DMRS_SEQUENCE_HOPPING_EN);
dmrs_cfg.cyclic_shift = params_db->get_param(phy_params::PUSCH_RS_CYCLIC_SHIFT);
dmrs_cfg.delta_ss = params_db->get_param(phy_params::PUSCH_RS_GROUP_ASSIGNMENT);
srslte_refsignal_srs_cfg_t srs_cfg;
bzero(&srs_cfg, sizeof(srslte_refsignal_srs_cfg_t));
srs_cfg.configured = params_db->get_param(phy_params::SRS_IS_CONFIGURED)?true:false;
srs_cfg.subframe_config = (uint32_t) params_db->get_param(phy_params::SRS_CS_SFCFG);
srs_cfg.bw_cfg = (uint32_t) params_db->get_param(phy_params::SRS_CS_BWCFG);
srs_cfg.I_srs = (uint32_t) params_db->get_param(phy_params::SRS_UE_CONFIGINDEX);
srs_cfg.B = (uint32_t) params_db->get_param(phy_params::SRS_UE_BW);
srs_cfg.b_hop = (uint32_t) params_db->get_param(phy_params::SRS_UE_HOP);
srs_cfg.n_rrc = (uint32_t) params_db->get_param(phy_params::SRS_UE_NRRC);
srs_cfg.k_tc = (uint32_t) params_db->get_param(phy_params::SRS_UE_TXCOMB);
srs_cfg.n_srs = (uint32_t) params_db->get_param(phy_params::SRS_UE_CYCLICSHIFT);
srs_cfg.beta_srs = ((float) params_db->get_param(phy_params::SRS_BETA))/10;
srslte_ue_ul_set_cfg(&ue_ul, &dmrs_cfg, NULL, &srs_cfg, NULL, group_hopping_en, sequence_hopping_en);
srslte_ue_ul_pregen_signals(&ue_ul);
}
bool ul_buffer::generate_ack(bool ack, dl_sched_grant *last_dl_grant) bool ul_buffer::generate_ack(bool ack, dl_sched_grant *last_dl_grant)
{ {
uci_data.uci_ack_len = 1; uci_data.uci_ack_len = 1;
@ -154,14 +181,6 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
dmrs_cfg.cyclic_shift = params_db->get_param(phy_params::PUSCH_RS_CYCLIC_SHIFT); dmrs_cfg.cyclic_shift = params_db->get_param(phy_params::PUSCH_RS_CYCLIC_SHIFT);
dmrs_cfg.delta_ss = params_db->get_param(phy_params::PUSCH_RS_GROUP_ASSIGNMENT); dmrs_cfg.delta_ss = params_db->get_param(phy_params::PUSCH_RS_GROUP_ASSIGNMENT);
// Get cyclic shift for DMRS if PUSCH is not for RAR or (TODO) is not SPS
if (grant) {
if (!grant->is_from_rar()) {
dmrs_cfg.en_dmrs_2 = true;
dmrs_cfg.cyclic_shift_for_dmrs = grant->get_n_dmrs();
}
}
srslte_pusch_hopping_cfg_t pusch_hopping; srslte_pusch_hopping_cfg_t pusch_hopping;
if (grant) { if (grant) {
bzero(&pusch_hopping, sizeof(srslte_pusch_hopping_cfg_t)); bzero(&pusch_hopping, sizeof(srslte_pusch_hopping_cfg_t));

@ -390,8 +390,6 @@ cell.nof_ports = 1;
bool sequence_hopping_en = false; bool sequence_hopping_en = false;
dmrs_cfg.delta_ss = 0; dmrs_cfg.delta_ss = 0;
dmrs_cfg.cyclic_shift = 0; dmrs_cfg.cyclic_shift = 0;
dmrs_cfg.cyclic_shift_for_dmrs = 0;
dmrs_cfg.en_dmrs_2 = false;
srslte_ue_ul_set_cfg(&ue_ul, &dmrs_cfg, NULL, NULL, NULL, group_hopping_en, sequence_hopping_en); srslte_ue_ul_set_cfg(&ue_ul, &dmrs_cfg, NULL, NULL, NULL, group_hopping_en, sequence_hopping_en);
cf_t *ul_signal = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb)); cf_t *ul_signal = srslte_vec_malloc(sizeof(cf_t) * SRSLTE_SF_LEN_PRB(cell.nof_prb));
@ -521,7 +519,7 @@ cell.nof_ports = 1;
srslte_ue_ul_set_cfo(&ue_ul, cfo); srslte_ue_ul_set_cfo(&ue_ul, cfo);
memcpy(&ue_ul.pusch_cfg.grant, &ra_grant, sizeof(srslte_ra_ul_grant_t)); memcpy(&ue_ul.pusch_cfg.grant, &ra_grant, sizeof(srslte_ra_ul_grant_t));
srslte_ue_ul_cfg_grant(&ue_ul, NULL, 0, 0, ul_sf_idx, 0); srslte_ue_ul_cfg_grant(&ue_ul, NULL, 0, 0, ul_sf_idx, 0, 0);
n = srslte_ue_ul_pusch_encode_rnti(&ue_ul, data, rar_msg.temp_c_rnti, ul_signal); n = srslte_ue_ul_pusch_encode_rnti(&ue_ul, data, rar_msg.temp_c_rnti, ul_signal);
if (n < 0) { if (n < 0) {

@ -47,9 +47,7 @@
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t cyclic_shift; uint32_t cyclic_shift;
uint32_t cyclic_shift_for_dmrs;
uint32_t delta_ss; uint32_t delta_ss;
bool en_dmrs_2;
float beta_pusch; float beta_pusch;
}srslte_refsignal_dmrs_pusch_cfg_t; }srslte_refsignal_dmrs_pusch_cfg_t;
@ -83,6 +81,13 @@ typedef struct SRSLTE_API {
uint32_t v_pusch[SRSLTE_NSLOTS_X_FRAME][SRSLTE_NOF_DELTA_SS]; uint32_t v_pusch[SRSLTE_NSLOTS_X_FRAME][SRSLTE_NOF_DELTA_SS];
} srslte_refsignal_ul_t; } srslte_refsignal_ul_t;
typedef struct {
cf_t **r[SRSLTE_NOF_CSHIFT][SRSLTE_NSUBFRAMES_X_FRAME];
} srslte_refsignal_ul_dmrs_pregen_t;
typedef struct {
cf_t *r[SRSLTE_NSUBFRAMES_X_FRAME];
} srslte_refsignal_srs_pregen_t;
SRSLTE_API int srslte_refsignal_ul_init(srslte_refsignal_ul_t *q, SRSLTE_API int srslte_refsignal_ul_init(srslte_refsignal_ul_t *q,
srslte_cell_t cell); srslte_cell_t cell);
@ -103,9 +108,24 @@ SRSLTE_API bool srslte_refsignal_dmrs_pusch_cfg_isvalid(srslte_refsignal_ul_t *q
srslte_refsignal_dmrs_pusch_cfg_t *cfg, srslte_refsignal_dmrs_pusch_cfg_t *cfg,
uint32_t nof_prb); uint32_t nof_prb);
SRSLTE_API int srslte_refsignal_dmrs_pusch_pregen(srslte_refsignal_ul_t *q,
srslte_refsignal_ul_dmrs_pregen_t *pregen);
SRSLTE_API void srslte_refsignal_dmrs_pusch_pregen_free(srslte_refsignal_ul_t *q,
srslte_refsignal_ul_dmrs_pregen_t *pregen);
SRSLTE_API int srslte_refsignal_dmrs_pusch_pregen_put(srslte_refsignal_ul_t *q,
srslte_refsignal_ul_dmrs_pregen_t *pregen,
uint32_t nof_prb,
uint32_t sf_idx,
uint32_t cyclic_shift_for_dmrs,
uint32_t n_prb[2],
cf_t *sf_symbols);
SRSLTE_API int srslte_refsignal_dmrs_pusch_gen(srslte_refsignal_ul_t *q, SRSLTE_API int srslte_refsignal_dmrs_pusch_gen(srslte_refsignal_ul_t *q,
uint32_t nof_prb, uint32_t nof_prb,
uint32_t sf_idx, uint32_t sf_idx,
uint32_t cyclic_shift_for_dmrs,
cf_t *r_pusch); cf_t *r_pusch);
SRSLTE_API void srslte_refsignal_dmrs_pusch_put(srslte_refsignal_ul_t *q, SRSLTE_API void srslte_refsignal_dmrs_pusch_put(srslte_refsignal_ul_t *q,
@ -127,6 +147,17 @@ SRSLTE_API int srslte_refsignal_dmrs_pucch_put(srslte_refsignal_ul_t* q,
cf_t *r_pucch, cf_t *r_pucch,
cf_t *output); cf_t *output);
SRSLTE_API int srslte_refsignal_srs_pregen(srslte_refsignal_ul_t *q,
srslte_refsignal_srs_pregen_t *pregen);
SRSLTE_API int srslte_refsignal_srs_pregen_put(srslte_refsignal_ul_t *q,
srslte_refsignal_srs_pregen_t *pregen,
uint32_t tti,
cf_t *sf_symbols);
SRSLTE_API void srslte_refsignal_srs_pregen_free(srslte_refsignal_ul_t *q,
srslte_refsignal_srs_pregen_t *pregen);
SRSLTE_API int srslte_refsignal_srs_gen(srslte_refsignal_ul_t *q, SRSLTE_API int srslte_refsignal_srs_gen(srslte_refsignal_ul_t *q,
uint32_t sf_idx, uint32_t sf_idx,
cf_t *r_srs); cf_t *r_srs);

@ -109,6 +109,7 @@ SRSLTE_API int srslte_pusch_cfg(srslte_pusch_t *q,
srslte_pusch_hopping_cfg_t *hopping_cfg, srslte_pusch_hopping_cfg_t *hopping_cfg,
srslte_refsignal_srs_cfg_t *srs_cfg, srslte_refsignal_srs_cfg_t *srs_cfg,
uint32_t tti, uint32_t tti,
uint32_t cyclic_shift_for_dmrs,
uint32_t rvidx); uint32_t rvidx);
SRSLTE_API int srslte_pusch_set_rnti(srslte_pusch_t *q, SRSLTE_API int srslte_pusch_set_rnti(srslte_pusch_t *q,

@ -44,6 +44,7 @@ typedef struct SRSLTE_API {
srslte_cbsegm_t cb_segm; srslte_cbsegm_t cb_segm;
srslte_ra_ul_grant_t grant; srslte_ra_ul_grant_t grant;
srslte_ra_nbits_t nbits; srslte_ra_nbits_t nbits;
uint32_t cyclic_shift_for_dmrs;
uint32_t rv; uint32_t rv;
uint32_t sf_idx; uint32_t sf_idx;
uint32_t tti; uint32_t tti;

@ -68,7 +68,10 @@ typedef struct SRSLTE_API {
float current_cfo; float current_cfo;
srslte_pusch_cfg_t pusch_cfg; srslte_pusch_cfg_t pusch_cfg;
srslte_refsignal_ul_t dmrs; srslte_refsignal_ul_t signals;
srslte_refsignal_ul_dmrs_pregen_t pregen_drms;
srslte_refsignal_srs_pregen_t pregen_srs;
srslte_softbuffer_tx_t softbuffer; srslte_softbuffer_tx_t softbuffer;
srslte_pusch_t pusch; srslte_pusch_t pusch;
@ -76,12 +79,12 @@ typedef struct SRSLTE_API {
srslte_pucch_sched_t pucch_sched; srslte_pucch_sched_t pucch_sched;
cf_t *refsignal; cf_t *refsignal;
cf_t *srs_signal; cf_t *srs_signal;
cf_t *sf_symbols; cf_t *sf_symbols;
uint16_t current_rnti; uint16_t current_rnti;
bool signals_pregenerated;
}srslte_ue_ul_t; }srslte_ue_ul_t;
/* This function shall be called just after the initial synchronization */ /* This function shall be called just after the initial synchronization */
@ -112,6 +115,7 @@ SRSLTE_API int srslte_ue_ul_cfg_grant(srslte_ue_ul_t *q,
srslte_pusch_hopping_cfg_t *hopping_cfg, srslte_pusch_hopping_cfg_t *hopping_cfg,
srslte_refsignal_srs_cfg_t *srs_cfg, srslte_refsignal_srs_cfg_t *srs_cfg,
uint32_t tti, uint32_t tti,
uint32_t cyclic_shift_for_dmrs,
uint32_t rvidx); uint32_t rvidx);
SRSLTE_API int srslte_ue_ul_pucch_encode(srslte_ue_ul_t *q, SRSLTE_API int srslte_ue_ul_pucch_encode(srslte_ue_ul_t *q,
@ -152,6 +156,8 @@ SRSLTE_API int srslte_ue_ul_srs_encode(srslte_ue_ul_t *q,
SRSLTE_API void srslte_ue_ul_reset(srslte_ue_ul_t *q); SRSLTE_API void srslte_ue_ul_reset(srslte_ue_ul_t *q);
SRSLTE_API int srslte_ue_ul_pregen_signals(srslte_ue_ul_t *q);
SRSLTE_API void srslte_ue_ul_set_rnti(srslte_ue_ul_t *q, SRSLTE_API void srslte_ue_ul_set_rnti(srslte_ue_ul_t *q,
uint16_t rnti); uint16_t rnti);

@ -36,6 +36,7 @@
#include "srslte/utils/vector.h" #include "srslte/utils/vector.h"
#include "srslte/utils/debug.h" #include "srslte/utils/debug.h"
#include "srslte/common/sequence.h" #include "srslte/common/sequence.h"
#include "srslte/dft/dft_precoding.h"
#include "ul_rs_tables.h" #include "ul_rs_tables.h"
@ -299,20 +300,19 @@ static void compute_r_uv_arg(srslte_refsignal_ul_t *q, uint32_t nof_prb, uint32_
} }
/* Calculates alpha according to 5.5.2.1.1 of 36.211 */ /* Calculates alpha according to 5.5.2.1.1 of 36.211 */
static float pusch_alpha(srslte_refsignal_ul_t *q, srslte_refsignal_dmrs_pusch_cfg_t *cfg, uint32_t ns) { static float pusch_alpha(srslte_refsignal_ul_t *q, srslte_refsignal_dmrs_pusch_cfg_t *cfg,
uint32_t n_dmrs_2_val = 0; uint32_t cyclic_shift_for_dmrs, uint32_t ns)
if (cfg->en_dmrs_2) { {
n_dmrs_2_val = n_dmrs_2[cfg->cyclic_shift_for_dmrs]; uint32_t n_dmrs_2_val = n_dmrs_2[cyclic_shift_for_dmrs];
}
uint32_t n_cs = (n_dmrs_1[cfg->cyclic_shift] + n_dmrs_2_val + q->n_prs_pusch[cfg->delta_ss][ns]) % 12; uint32_t n_cs = (n_dmrs_1[cfg->cyclic_shift] + n_dmrs_2_val + q->n_prs_pusch[cfg->delta_ss][ns]) % 12;
return 2 * M_PI * (n_cs) / 12; return 2 * M_PI * (n_cs) / 12;
} }
bool srslte_refsignal_dmrs_pusch_cfg_isvalid(srslte_refsignal_ul_t *q, srslte_refsignal_dmrs_pusch_cfg_t *cfg, uint32_t nof_prb) { bool srslte_refsignal_dmrs_pusch_cfg_isvalid(srslte_refsignal_ul_t *q, srslte_refsignal_dmrs_pusch_cfg_t *cfg,
uint32_t nof_prb) {
if (cfg->cyclic_shift < SRSLTE_NOF_CSHIFT && if (cfg->cyclic_shift < SRSLTE_NOF_CSHIFT &&
cfg->cyclic_shift_for_dmrs < SRSLTE_NOF_CSHIFT &&
cfg->delta_ss < SRSLTE_NOF_DELTA_SS && cfg->delta_ss < SRSLTE_NOF_DELTA_SS &&
nof_prb <= q->cell.nof_prb) { nof_prb <= q->cell.nof_prb) {
return true; return true;
@ -351,8 +351,73 @@ void compute_r(srslte_refsignal_ul_t *q, uint32_t nof_prb, uint32_t ns, uint32_t
} }
int srslte_refsignal_dmrs_pusch_pregen(srslte_refsignal_ul_t *q, srslte_refsignal_ul_dmrs_pregen_t *pregen)
{
for (uint32_t sf_idx=0;sf_idx<SRSLTE_NSUBFRAMES_X_FRAME;sf_idx++) {
for (uint32_t cs=0;cs<SRSLTE_NOF_CSHIFT;cs++) {
pregen->r[cs][sf_idx] = (cf_t**) calloc(sizeof(cf_t*), q->cell.nof_prb + 1);
if (pregen->r[cs][sf_idx]) {
for (uint32_t n=0;n<=q->cell.nof_prb;n++) {
if (srslte_dft_precoding_valid_prb(n)) {
pregen->r[cs][sf_idx][n] = (cf_t*) srslte_vec_malloc(sizeof(cf_t)*n*2*SRSLTE_NRE);
if (pregen->r[cs][sf_idx][n]) {
if (srslte_refsignal_dmrs_pusch_gen(q, n, sf_idx, cs, pregen->r[cs][sf_idx][n])) {
return SRSLTE_ERROR;
}
} else {
return SRSLTE_ERROR;
}
}
}
} else {
return SRSLTE_ERROR;
}
}
}
return SRSLTE_SUCCESS;
}
void srslte_refsignal_dmrs_pusch_pregen_free(srslte_refsignal_ul_t *q, srslte_refsignal_ul_dmrs_pregen_t *pregen)
{
for (uint32_t sf_idx=0;sf_idx<SRSLTE_NSUBFRAMES_X_FRAME;sf_idx++) {
for (uint32_t cs=0;cs<SRSLTE_NOF_CSHIFT;cs++) {
if (pregen->r[cs][sf_idx]) {
for (uint32_t n=0;n<=q->cell.nof_prb;n++) {
if (srslte_dft_precoding_valid_prb(n)) {
if (pregen->r[cs][sf_idx][n]) {
free(pregen->r[cs][sf_idx][n]);
}
}
}
free(pregen->r[cs][sf_idx]);
}
}
}
}
int srslte_refsignal_dmrs_pusch_pregen_put(srslte_refsignal_ul_t *q,
srslte_refsignal_ul_dmrs_pregen_t *pregen,
uint32_t nof_prb,
uint32_t sf_idx,
uint32_t cyclic_shift_for_dmrs,
uint32_t n_prb[2],
cf_t *sf_symbols)
{
if (srslte_dft_precoding_valid_prb(nof_prb) &&
sf_idx < SRSLTE_NSUBFRAMES_X_FRAME &&
cyclic_shift_for_dmrs < SRSLTE_NOF_CSHIFT)
{
srslte_refsignal_dmrs_pusch_put(q, pregen->r[cyclic_shift_for_dmrs][sf_idx][nof_prb], nof_prb, n_prb, sf_symbols);
return SRSLTE_SUCCESS;
} else {
return SRSLTE_ERROR_INVALID_INPUTS;
}
}
/* Generate DRMS for PUSCH signal according to 5.5.2.1 of 36.211 */ /* Generate DRMS for PUSCH signal according to 5.5.2.1 of 36.211 */
int srslte_refsignal_dmrs_pusch_gen(srslte_refsignal_ul_t *q, uint32_t nof_prb, uint32_t sf_idx, cf_t *r_pusch) int srslte_refsignal_dmrs_pusch_gen(srslte_refsignal_ul_t *q, uint32_t nof_prb, uint32_t sf_idx,
uint32_t cyclic_shift_for_dmrs, cf_t *r_pusch)
{ {
int ret = SRSLTE_ERROR_INVALID_INPUTS; int ret = SRSLTE_ERROR_INVALID_INPUTS;
@ -364,7 +429,7 @@ int srslte_refsignal_dmrs_pusch_gen(srslte_refsignal_ul_t *q, uint32_t nof_prb,
compute_r(q, nof_prb, ns, q->pusch_cfg.delta_ss); compute_r(q, nof_prb, ns, q->pusch_cfg.delta_ss);
// Add cyclic prefix alpha // Add cyclic prefix alpha
float alpha = pusch_alpha(q, &q->pusch_cfg, ns); float alpha = pusch_alpha(q, &q->pusch_cfg, cyclic_shift_for_dmrs, ns);
// Do complex exponential and adjust amplitude // Do complex exponential and adjust amplitude
for (int i=0;i<SRSLTE_NRE*nof_prb;i++) { for (int i=0;i<SRSLTE_NRE*nof_prb;i++) {
@ -734,6 +799,38 @@ uint32_t srslte_refsignal_srs_M_sc(srslte_refsignal_ul_t *q) {
return m_srs_b[srsbwtable_idx(q->cell.nof_prb)][q->srs_cfg.B][q->srs_cfg.bw_cfg]*SRSLTE_NRE/2; return m_srs_b[srsbwtable_idx(q->cell.nof_prb)][q->srs_cfg.B][q->srs_cfg.bw_cfg]*SRSLTE_NRE/2;
} }
int srslte_refsignal_srs_pregen(srslte_refsignal_ul_t *q, srslte_refsignal_srs_pregen_t *pregen)
{
uint32_t M_sc = srslte_refsignal_srs_M_sc(q);
for (uint32_t sf_idx=0;sf_idx<SRSLTE_NSUBFRAMES_X_FRAME;sf_idx++) {
pregen->r[sf_idx] = srslte_vec_malloc(2*M_sc*sizeof(cf_t));
if (pregen->r[sf_idx]) {
if (srslte_refsignal_srs_gen(q, sf_idx, pregen->r[sf_idx])) {
return SRSLTE_ERROR;
}
} else {
return SRSLTE_ERROR;
}
}
return SRSLTE_SUCCESS;
}
void srslte_refsignal_srs_pregen_free(srslte_refsignal_ul_t *q, srslte_refsignal_srs_pregen_t *pregen)
{
for (uint32_t sf_idx=0;sf_idx<SRSLTE_NSUBFRAMES_X_FRAME;sf_idx++) {
if (pregen->r[sf_idx]) {
free(pregen->r[sf_idx]);
}
}
}
int srslte_refsignal_srs_pregen_put(srslte_refsignal_ul_t *q, srslte_refsignal_srs_pregen_t *pregen,
uint32_t tti, cf_t *sf_symbols)
{
return srslte_refsignal_srs_put(q, tti, pregen->r[tti%SRSLTE_NSUBFRAMES_X_FRAME], sf_symbols);
}
/* Genearte SRS signal as defined in Section 5.5.3.1 */ /* Genearte SRS signal as defined in Section 5.5.3.1 */
int srslte_refsignal_srs_gen(srslte_refsignal_ul_t *q, uint32_t sf_idx, cf_t *r_srs) int srslte_refsignal_srs_gen(srslte_refsignal_ul_t *q, uint32_t sf_idx, cf_t *r_srs)
{ {

@ -104,11 +104,9 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
} }
uint32_t nof_prb = mexutils_read_f(p, &prbset); uint32_t nof_prb = mexutils_read_f(p, &prbset);
if (mexutils_read_uint32_struct(PUSCHCFG, "DynCyclicShift", &pusch_cfg.cyclic_shift_for_dmrs)) { uint32_t cyclic_shift_for_dmrs = 0;
pusch_cfg.cyclic_shift_for_dmrs = 0; if (mexutils_read_uint32_struct(PUSCHCFG, "DynCyclicShift", &cyclic_shift_for_dmrs)) {
pusch_cfg.en_dmrs_2 = false; cyclic_shift_for_dmrs = 0;
} else {
pusch_cfg.en_dmrs_2 = true;
} }
pusch_cfg.beta_pusch = 1.0; pusch_cfg.beta_pusch = 1.0;
@ -120,7 +118,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
mexPrintf("nof_prb: %d, ",nof_prb); mexPrintf("nof_prb: %d, ",nof_prb);
mexPrintf("cyclic_shift: %d, ",pusch_cfg.cyclic_shift); mexPrintf("cyclic_shift: %d, ",pusch_cfg.cyclic_shift);
mexPrintf("cyclic_shift_for_dmrs: %d, ",pusch_cfg.cyclic_shift_for_dmrs); mexPrintf("cyclic_shift_for_dmrs: %d, ", cyclic_shift_for_dmrs);
mexPrintf("delta_ss: %d, ",pusch_cfg.delta_ss); mexPrintf("delta_ss: %d, ",pusch_cfg.delta_ss);
cf_t *signal = srslte_vec_malloc(2*SRSLTE_NRE*nof_prb*sizeof(cf_t)); cf_t *signal = srslte_vec_malloc(2*SRSLTE_NRE*nof_prb*sizeof(cf_t));
@ -138,7 +136,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
srslte_refsignal_ul_set_cfg(&refs, &pusch_cfg, NULL, NULL, group_hopping_en, sequence_hopping_en); srslte_refsignal_ul_set_cfg(&refs, &pusch_cfg, NULL, NULL, group_hopping_en, sequence_hopping_en);
//mexPrintf("Generating DRMS for ns=%d, nof_prb=%d\n", 2*sf_idx+i,pusch_cfg.nof_prb); //mexPrintf("Generating DRMS for ns=%d, nof_prb=%d\n", 2*sf_idx+i,pusch_cfg.nof_prb);
srslte_refsignal_dmrs_pusch_gen(&refs, nof_prb, sf_idx, signal); srslte_refsignal_dmrs_pusch_gen(&refs, nof_prb, sf_idx, cyclic_shift_for_dmrs, signal);
uint32_t n_prb[2]; uint32_t n_prb[2];
n_prb[0] = prbset[0]; n_prb[0] = prbset[0];
n_prb[1] = prbset[0]; n_prb[1] = prbset[0];

@ -82,17 +82,16 @@ int main(int argc, char **argv) {
parse_args(argc,argv); parse_args(argc,argv);
signal = malloc(2 * SRSLTE_NRE * cell.nof_prb * sizeof(cf_t));
if (!signal) {
perror("malloc");
goto do_exit;
}
if (srslte_refsignal_ul_init(&refs, cell)) { if (srslte_refsignal_ul_init(&refs, cell)) {
fprintf(stderr, "Error initializing UL reference signal\n"); fprintf(stderr, "Error initializing UL reference signal\n");
goto do_exit; goto do_exit;
} }
signal = malloc(2 * SRSLTE_NRE * cell.nof_prb * sizeof(cf_t));
if (!signal) {
perror("malloc");
goto do_exit;
}
printf("Running tests for %d PRB\n", cell.nof_prb); printf("Running tests for %d PRB\n", cell.nof_prb);
for (int n=6;n<cell.nof_prb;n++) { for (int n=6;n<cell.nof_prb;n++) {
@ -104,7 +103,6 @@ int main(int argc, char **argv) {
pusch_cfg.beta_pusch = 1.0; pusch_cfg.beta_pusch = 1.0;
uint32_t nof_prb = n; uint32_t nof_prb = n;
pusch_cfg.cyclic_shift = cshift; pusch_cfg.cyclic_shift = cshift;
pusch_cfg.cyclic_shift_for_dmrs = cshift_dmrs;
pusch_cfg.delta_ss = delta_ss; pusch_cfg.delta_ss = delta_ss;
bool group_hopping_en = false; bool group_hopping_en = false;
bool sequence_hopping_en = false; bool sequence_hopping_en = false;
@ -119,16 +117,27 @@ int main(int argc, char **argv) {
group_hopping_en = true; group_hopping_en = true;
sequence_hopping_en = false; sequence_hopping_en = false;
} }
pusch_cfg.en_dmrs_2 = true;
printf("Beta: %f, ",pusch_cfg.beta_pusch); printf("Beta: %f, ",pusch_cfg.beta_pusch);
printf("nof_prb: %d, ",nof_prb); printf("nof_prb: %d, ",nof_prb);
printf("cyclic_shift: %d, ",pusch_cfg.cyclic_shift); printf("cyclic_shift: %d, ",pusch_cfg.cyclic_shift);
printf("cyclic_shift_for_dmrs: %d, ",pusch_cfg.cyclic_shift_for_dmrs); printf("cyclic_shift_for_dmrs: %d, ", cshift_dmrs);
printf("delta_ss: %d, ",pusch_cfg.delta_ss); printf("delta_ss: %d, ",pusch_cfg.delta_ss);
printf("SF_idx: %d\n", sf_idx); printf("SF_idx: %d\n", sf_idx);
struct timeval t[3];
gettimeofday(&t[1], NULL);
srslte_refsignal_ul_set_cfg(&refs, &pusch_cfg, NULL, NULL, group_hopping_en, sequence_hopping_en); srslte_refsignal_ul_set_cfg(&refs, &pusch_cfg, NULL, NULL, group_hopping_en, sequence_hopping_en);
srslte_refsignal_dmrs_pusch_gen(&refs, nof_prb, sf_idx, signal); srslte_refsignal_dmrs_pusch_gen(&refs, nof_prb, sf_idx, cshift_dmrs, signal);
exit(0); gettimeofday(&t[2], NULL);
get_time_interval(t);
printf("DMRS ExecTime: %d us\n", t[0].tv_usec);
gettimeofday(&t[1], NULL);
srslte_refsignal_srs_gen(&refs, sf_idx, signal);
gettimeofday(&t[2], NULL);
get_time_interval(t);
printf("SRS ExecTime: %d us\n", t[0].tv_usec);
} }
} }
} }

@ -88,7 +88,9 @@ void srslte_dft_precoding_free(srslte_dft_precoding_t *q)
} }
bool srslte_dft_precoding_valid_prb(uint32_t nof_prb) { bool srslte_dft_precoding_valid_prb(uint32_t nof_prb) {
if (nof_prb == 1 || (nof_prb%2) == 0 || (nof_prb%3) == 0 || (nof_prb%5) == 0) { if (nof_prb > 0 &&
(nof_prb == 1 || (nof_prb%2) == 0 || (nof_prb%3) == 0 || (nof_prb%5) == 0))
{
return true; return true;
} else { } else {
return false; return false;

@ -307,7 +307,7 @@ void srslte_pusch_free(srslte_pusch_t *q) {
*/ */
int srslte_pusch_cfg(srslte_pusch_t *q, srslte_pusch_cfg_t *cfg, srslte_dci_msg_t *dci_msg, int srslte_pusch_cfg(srslte_pusch_t *q, srslte_pusch_cfg_t *cfg, srslte_dci_msg_t *dci_msg,
srslte_pusch_hopping_cfg_t *hopping_cfg, srslte_refsignal_srs_cfg_t *srs_cfg, srslte_pusch_hopping_cfg_t *hopping_cfg, srslte_refsignal_srs_cfg_t *srs_cfg,
uint32_t tti, uint32_t rvidx) uint32_t tti, uint32_t cyclic_shift_for_dmrs, uint32_t rvidx)
{ {
if (dci_msg) { if (dci_msg) {
srslte_ra_ul_dci_t ul_dci; srslte_ra_ul_dci_t ul_dci;
@ -321,6 +321,8 @@ int srslte_pusch_cfg(srslte_pusch_t *q, srslte_pusch_cfg_t *cfg, srslte_dci_msg_
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
cfg->cyclic_shift_for_dmrs = cyclic_shift_for_dmrs;
/* Compute PUSCH frequency hopping */ /* Compute PUSCH frequency hopping */
if (hopping_cfg) { if (hopping_cfg) {
compute_freq_hopping(q, &cfg->grant, hopping_cfg, tti%10); compute_freq_hopping(q, &cfg->grant, hopping_cfg, tti%10);

@ -122,13 +122,15 @@ int main(int argc, char **argv) {
for (uint32_t d=1;d<=3;d++) { for (uint32_t d=1;d<=3;d++) {
for (uint32_t ncs=0;ncs<8;ncs+=d) { for (uint32_t ncs=0;ncs<8;ncs+=d) {
for (uint32_t n_pucch=1;n_pucch<130;n_pucch++) { for (uint32_t n_pucch=1;n_pucch<130;n_pucch++) {
INFO("format %d, n_pucch: %d, ncs: %d, d: %d\n", format, n_pucch, ncs, d); struct timeval t[3];
pucch_cfg.beta_pucch = 1.0; pucch_cfg.beta_pucch = 1.0;
pucch_cfg.delta_pucch_shift = d; pucch_cfg.delta_pucch_shift = d;
bool group_hopping_en = false; bool group_hopping_en = false;
pucch_cfg.N_cs = ncs; pucch_cfg.N_cs = ncs;
pucch_cfg.n_rb_2 = 0; pucch_cfg.n_rb_2 = 0;
gettimeofday(&t[1], NULL);
if (!srslte_pucch_set_cfg(&pucch, &pucch_cfg, group_hopping_en)) { if (!srslte_pucch_set_cfg(&pucch, &pucch_cfg, group_hopping_en)) {
fprintf(stderr, "Error setting PUCCH config\n"); fprintf(stderr, "Error setting PUCCH config\n");
goto quit; goto quit;
@ -148,6 +150,9 @@ int main(int argc, char **argv) {
fprintf(stderr, "Error encoding PUCCH\n"); fprintf(stderr, "Error encoding PUCCH\n");
goto quit; goto quit;
} }
gettimeofday(&t[2], NULL);
get_time_interval(t);
INFO("format %d, n_pucch: %d, ncs: %d, d: %d, t_exec=%d us\n", format, n_pucch, ncs, d, t[0].tv_usec);
} }
} }
} }

@ -119,7 +119,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
cfg.grant.M_sc = cfg.grant.L_prb*SRSLTE_NRE; cfg.grant.M_sc = cfg.grant.L_prb*SRSLTE_NRE;
cfg.grant.M_sc_init = cfg.grant.M_sc; // FIXME: What should M_sc_init be? cfg.grant.M_sc_init = cfg.grant.M_sc; // FIXME: What should M_sc_init be?
cfg.grant.Qm = srslte_mod_bits_x_symbol(cfg.grant.mcs.mod); cfg.grant.Qm = srslte_mod_bits_x_symbol(cfg.grant.mcs.mod);
if (srslte_pusch_cfg(&pusch, &cfg, NULL, NULL, NULL, cfg.sf_idx, cfg.rv)) { if (srslte_pusch_cfg(&pusch, &cfg, NULL, NULL, NULL, cfg.sf_idx, 0, cfg.rv)) {
fprintf(stderr, "Error configuring PDSCH\n"); fprintf(stderr, "Error configuring PDSCH\n");
exit(-1); exit(-1);
} }

@ -168,7 +168,7 @@ int main(int argc, char **argv) {
cfg.grant.mcs.tbs = tbs; cfg.grant.mcs.tbs = tbs;
cfg.grant.mcs.mod = modulation; cfg.grant.mcs.mod = modulation;
cfg.grant.Qm = srslte_mod_bits_x_symbol(modulation); cfg.grant.Qm = srslte_mod_bits_x_symbol(modulation);
if (srslte_pusch_cfg(&pusch, &cfg, NULL, &ul_hopping, NULL, subframe, 0)) { if (srslte_pusch_cfg(&pusch, &cfg, NULL, &ul_hopping, NULL, subframe, 0, 0)) {
fprintf(stderr, "Error configuring PDSCH\n"); fprintf(stderr, "Error configuring PDSCH\n");
exit(-1); exit(-1);
} }

@ -78,7 +78,7 @@ int srslte_ue_ul_init(srslte_ue_ul_t *q,
fprintf(stderr, "Error initiating soft buffer\n"); fprintf(stderr, "Error initiating soft buffer\n");
goto clean_exit; goto clean_exit;
} }
if (srslte_refsignal_ul_init(&q->dmrs, cell)) { if (srslte_refsignal_ul_init(&q->signals, cell)) {
fprintf(stderr, "Error initiating srslte_refsignal_ul\n"); fprintf(stderr, "Error initiating srslte_refsignal_ul\n");
goto clean_exit; goto clean_exit;
} }
@ -98,7 +98,7 @@ int srslte_ue_ul_init(srslte_ue_ul_t *q,
perror("malloc"); perror("malloc");
goto clean_exit; goto clean_exit;
} }
q->signals_pregenerated = false;
ret = SRSLTE_SUCCESS; ret = SRSLTE_SUCCESS;
} else { } else {
fprintf(stderr, "Invalid cell properties: Id=%d, Ports=%d, PRBs=%d\n", fprintf(stderr, "Invalid cell properties: Id=%d, Ports=%d, PRBs=%d\n",
@ -120,7 +120,7 @@ void srslte_ue_ul_free(srslte_ue_ul_t *q) {
srslte_softbuffer_tx_free(&q->softbuffer); srslte_softbuffer_tx_free(&q->softbuffer);
srslte_cfo_free(&q->cfo); srslte_cfo_free(&q->cfo);
srslte_refsignal_ul_free(&q->dmrs); srslte_refsignal_ul_free(&q->signals);
if (q->sf_symbols) { if (q->sf_symbols) {
free(q->sf_symbols); free(q->sf_symbols);
@ -131,6 +131,10 @@ void srslte_ue_ul_free(srslte_ue_ul_t *q) {
if (q->srs_signal) { if (q->srs_signal) {
free(q->srs_signal); free(q->srs_signal);
} }
if (q->signals_pregenerated) {
srslte_refsignal_dmrs_pusch_pregen_free(&q->signals, &q->pregen_drms);
srslte_refsignal_srs_pregen_free(&q->signals, &q->pregen_srs);
}
bzero(q, sizeof(srslte_ue_ul_t)); bzero(q, sizeof(srslte_ue_ul_t));
} }
} }
@ -163,6 +167,21 @@ void srslte_ue_ul_reset(srslte_ue_ul_t *q) {
srslte_softbuffer_tx_reset(&q->softbuffer); srslte_softbuffer_tx_reset(&q->softbuffer);
} }
int srslte_ue_ul_pregen_signals(srslte_ue_ul_t *q) {
if (q->signals_pregenerated) {
srslte_refsignal_dmrs_pusch_pregen_free(&q->signals, &q->pregen_drms);
srslte_refsignal_srs_pregen_free(&q->signals, &q->pregen_srs);
}
if (srslte_refsignal_dmrs_pusch_pregen(&q->signals, &q->pregen_drms)) {
return SRSLTE_ERROR;
}
if (srslte_refsignal_srs_pregen(&q->signals, &q->pregen_srs)) {
return SRSLTE_ERROR;
}
q->signals_pregenerated = true;
return SRSLTE_SUCCESS;
}
void srslte_ue_ul_set_cfg(srslte_ue_ul_t *q, void srslte_ue_ul_set_cfg(srslte_ue_ul_t *q,
srslte_refsignal_dmrs_pusch_cfg_t *pusch_cfg, srslte_refsignal_dmrs_pusch_cfg_t *pusch_cfg,
srslte_pucch_cfg_t *pucch_cfg, srslte_pucch_cfg_t *pucch_cfg,
@ -171,7 +190,7 @@ void srslte_ue_ul_set_cfg(srslte_ue_ul_t *q,
bool group_hopping_en, bool group_hopping_en,
bool sequence_hopping_en) bool sequence_hopping_en)
{ {
srslte_refsignal_ul_set_cfg(&q->dmrs, pusch_cfg, pucch_cfg, srs_cfg, group_hopping_en, sequence_hopping_en); srslte_refsignal_ul_set_cfg(&q->signals, pusch_cfg, pucch_cfg, srs_cfg, group_hopping_en, sequence_hopping_en);
srslte_pucch_set_cfg(&q->pucch, pucch_cfg, group_hopping_en); srslte_pucch_set_cfg(&q->pucch, pucch_cfg, group_hopping_en);
if (pucch_sched) { if (pucch_sched) {
memcpy(&q->pucch_sched, pucch_sched, sizeof(srslte_pucch_sched_t)); memcpy(&q->pucch_sched, pucch_sched, sizeof(srslte_pucch_sched_t));
@ -181,9 +200,9 @@ void srslte_ue_ul_set_cfg(srslte_ue_ul_t *q,
int srslte_ue_ul_cfg_grant(srslte_ue_ul_t *q, srslte_dci_msg_t *dci_msg, int srslte_ue_ul_cfg_grant(srslte_ue_ul_t *q, srslte_dci_msg_t *dci_msg,
srslte_pusch_hopping_cfg_t *hopping_cfg, srslte_pusch_hopping_cfg_t *hopping_cfg,
srslte_refsignal_srs_cfg_t *srs_cfg, srslte_refsignal_srs_cfg_t *srs_cfg,
uint32_t tti, uint32_t rvidx) uint32_t tti, uint32_t cyclic_shift_for_dmrs, uint32_t rvidx)
{ {
return srslte_pusch_cfg(&q->pusch, &q->pusch_cfg, dci_msg, hopping_cfg, srs_cfg, tti, rvidx); return srslte_pusch_cfg(&q->pusch, &q->pusch_cfg, dci_msg, hopping_cfg, srs_cfg, tti, cyclic_shift_for_dmrs, rvidx);
} }
/* Choose PUCCH format as in Sec 10.1 of 36.213 and generate PUCCH signal /* Choose PUCCH format as in Sec 10.1 of 36.213 and generate PUCCH signal
@ -270,16 +289,16 @@ int srslte_ue_ul_pucch_encode(srslte_ue_ul_t *q, srslte_uci_data_t uci_data,
return ret; return ret;
} }
if (srslte_refsignal_dmrs_pucch_gen(&q->dmrs, format, n_pucch, sf_idx, pucch2_bits, q->refsignal)) if (srslte_refsignal_dmrs_pucch_gen(&q->signals, format, n_pucch, sf_idx, pucch2_bits, q->refsignal))
{ {
fprintf(stderr, "Error generating PUSCH DRMS signals\n"); fprintf(stderr, "Error generating PUSCH DRMS signals\n");
return ret; return ret;
} }
srslte_refsignal_dmrs_pucch_put(&q->dmrs, format, n_pucch, q->refsignal, q->sf_symbols); srslte_refsignal_dmrs_pucch_put(&q->signals, format, n_pucch, q->refsignal, q->sf_symbols);
if (srslte_ue_ul_srs_tx_enabled(&q->dmrs.srs_cfg, tti) && q->pucch.shortened) { if (srslte_ue_ul_srs_tx_enabled(&q->signals.srs_cfg, tti) && q->pucch.shortened) {
srslte_refsignal_srs_gen(&q->dmrs, tti%10, q->srs_signal); srslte_refsignal_srs_gen(&q->signals, tti%10, q->srs_signal);
srslte_refsignal_srs_put(&q->dmrs, tti, q->srs_signal, q->sf_symbols); srslte_refsignal_srs_put(&q->signals, tti, q->srs_signal, q->sf_symbols);
} }
srslte_ofdm_tx_sf(&q->fft, q->sf_symbols, output_signal); srslte_ofdm_tx_sf(&q->fft, q->sf_symbols, output_signal);
@ -343,9 +362,13 @@ int srslte_ue_ul_srs_encode(srslte_ue_ul_t *q, uint32_t tti, cf_t *output_signal
if (q && output_signal) { if (q && output_signal) {
ret = SRSLTE_ERROR; ret = SRSLTE_ERROR;
if (srslte_ue_ul_srs_tx_enabled(&q->dmrs.srs_cfg, tti)) { if (srslte_ue_ul_srs_tx_enabled(&q->signals.srs_cfg, tti)) {
srslte_refsignal_srs_gen(&q->dmrs, tti%10, q->srs_signal); if (q->signals_pregenerated) {
srslte_refsignal_srs_put(&q->dmrs, tti, q->srs_signal, q->sf_symbols); srslte_refsignal_srs_pregen_put(&q->signals, &q->pregen_srs, tti, q->sf_symbols);
} else {
srslte_refsignal_srs_gen(&q->signals, tti%10, q->srs_signal);
srslte_refsignal_srs_put(&q->signals, tti, q->srs_signal, q->sf_symbols);
}
} }
srslte_ofdm_tx_sf(&q->fft, q->sf_symbols, output_signal); srslte_ofdm_tx_sf(&q->fft, q->sf_symbols, output_signal);
@ -355,7 +378,7 @@ int srslte_ue_ul_srs_encode(srslte_ue_ul_t *q, uint32_t tti, cf_t *output_signal
} }
if (q->normalize_en) { if (q->normalize_en) {
float norm_factor = (float) q->cell.nof_prb/10/sqrtf(srslte_refsignal_srs_M_sc(&q->dmrs)/6); float norm_factor = (float) q->cell.nof_prb/10/sqrtf(srslte_refsignal_srs_M_sc(&q->signals)/6);
srslte_vec_sc_prod_cfc(output_signal, norm_factor, output_signal, SRSLTE_SF_LEN_PRB(q->cell.nof_prb)); srslte_vec_sc_prod_cfc(output_signal, norm_factor, output_signal, SRSLTE_SF_LEN_PRB(q->cell.nof_prb));
} }
@ -383,20 +406,35 @@ int srslte_ue_ul_pusch_encode_rnti_softbuffer(srslte_ue_ul_t *q,
return ret; return ret;
} }
// FIXME: Pregenerate for all possible number of prb if (q->signals_pregenerated) {
if (srslte_refsignal_dmrs_pusch_gen(&q->dmrs, q->pusch_cfg.grant.L_prb, q->pusch_cfg.sf_idx, q->refsignal)) srslte_refsignal_dmrs_pusch_pregen_put(&q->signals, &q->pregen_drms,
q->pusch_cfg.grant.L_prb,
q->pusch_cfg.sf_idx,
q->pusch_cfg.cyclic_shift_for_dmrs,
q->pusch_cfg.grant.n_prb_tilde,
q->sf_symbols);
} else {
if (srslte_refsignal_dmrs_pusch_gen(&q->signals, q->pusch_cfg.grant.L_prb,
q->pusch_cfg.sf_idx,
q->pusch_cfg.cyclic_shift_for_dmrs,
q->refsignal))
{ {
fprintf(stderr, "Error generating PUSCH DRMS signals\n"); fprintf(stderr, "Error generating PUSCH DRMS signals\n");
return ret; return ret;
} }
srslte_refsignal_dmrs_pusch_put(&q->dmrs, q->refsignal, srslte_refsignal_dmrs_pusch_put(&q->signals, q->refsignal,
q->pusch_cfg.grant.L_prb, q->pusch_cfg.grant.L_prb,
q->pusch_cfg.grant.n_prb_tilde, q->pusch_cfg.grant.n_prb_tilde,
q->sf_symbols); q->sf_symbols);
}
if (srslte_ue_ul_srs_tx_enabled(&q->dmrs.srs_cfg, q->pusch_cfg.tti)) { if (srslte_ue_ul_srs_tx_enabled(&q->signals.srs_cfg, q->pusch_cfg.tti)) {
srslte_refsignal_srs_gen(&q->dmrs, q->pusch_cfg.sf_idx, q->srs_signal); if (q->signals_pregenerated) {
srslte_refsignal_srs_put(&q->dmrs, q->pusch_cfg.tti, q->srs_signal, q->sf_symbols); srslte_refsignal_srs_pregen_put(&q->signals, &q->pregen_srs, q->pusch_cfg.tti, q->sf_symbols);
} else {
srslte_refsignal_srs_gen(&q->signals, q->pusch_cfg.sf_idx, q->srs_signal);
srslte_refsignal_srs_put(&q->signals, q->pusch_cfg.tti, q->srs_signal, q->sf_symbols);
}
} }
srslte_ofdm_tx_sf(&q->fft, q->sf_symbols, output_signal); srslte_ofdm_tx_sf(&q->fft, q->sf_symbols, output_signal);

Loading…
Cancel
Save