mirror of https://github.com/PentHertz/srsLTE.git
SRS working over the air
This commit is contained in:
parent
9761d1a3a1
commit
caf37dbf86
|
@ -8,7 +8,7 @@ for csbw=2:7
|
|||
for uebw=0:3
|
||||
for hop=0:3
|
||||
for ncs=0:7
|
||||
for n_rrc=1:23
|
||||
for n_rrc=0:23
|
||||
srsConfig.BWConfig = csbw;
|
||||
srsConfig.BW = uebw;
|
||||
srsConfig.CyclicShift = ncs;
|
||||
|
|
|
@ -246,6 +246,7 @@ void process_connsetup(LIBLTE_RRC_CONNECTION_SETUP_STRUCT *msg, srslte::ue::mac
|
|||
phy->set_param(srslte::ue::phy_params::SRS_UE_HOP, msg->rr_cnfg.phy_cnfg_ded.srs_ul_cnfg_ded.srs_hopping_bandwidth);
|
||||
phy->set_param(srslte::ue::phy_params::SRS_UE_CYCLICSHIFT, msg->rr_cnfg.phy_cnfg_ded.srs_ul_cnfg_ded.cyclic_shift);
|
||||
phy->set_param(srslte::ue::phy_params::SRS_UE_TXCOMB, msg->rr_cnfg.phy_cnfg_ded.srs_ul_cnfg_ded.tx_comb);
|
||||
phy->set_param(srslte::ue::phy_params::SRS_IS_CONFIGURED, 1);
|
||||
phy->set_param(srslte::ue::phy_params::SRS_BETA, 10);
|
||||
}
|
||||
}
|
||||
|
@ -496,8 +497,6 @@ int main(int argc, char *argv[])
|
|||
// Wait for ConnectionSetup
|
||||
n = mac.recv_dcch0_sdu(bit_msg.msg, LIBLTE_MAX_MSG_SIZE);
|
||||
if (n > 0) {
|
||||
phy.set_param(srslte::ue::phy_params::SRS_IS_CS_CONFIGURED, 1);
|
||||
phy.set_param(srslte::ue::phy_params::SRS_IS_UE_CONFIGURED, 1);
|
||||
printf("Received on DCCH0 %d bytes\n", n/8);
|
||||
printf("Send RLC ACK\n");
|
||||
srslte_bit_pack_vector(reply, bit_msg.msg, 2*8);
|
||||
|
|
|
@ -88,11 +88,10 @@ namespace ue {
|
|||
SRS_UE_HOP,
|
||||
SRS_UE_CS,
|
||||
SRS_UE_CYCLICSHIFT,
|
||||
SRS_IS_UE_CONFIGURED,
|
||||
SRS_CS_BWCFG,
|
||||
SRS_CS_SFCFG,
|
||||
SRS_CS_ACKNACKSIMUL,
|
||||
SRS_IS_CS_CONFIGURED,
|
||||
SRS_IS_CONFIGURED,
|
||||
|
||||
UCI_I_OFFSET_ACK,
|
||||
UCI_I_OFFSET_RI,
|
||||
|
|
|
@ -122,19 +122,19 @@ bool ul_buffer::generate_data(ul_sched_grant *grant,
|
|||
|
||||
|
||||
bool ul_buffer::srs_is_ready_to_send() {
|
||||
|
||||
if (params_db->get_param(phy_params::SRS_IS_CS_CONFIGURED) &&
|
||||
params_db->get_param(phy_params::SRS_IS_UE_CONFIGURED))
|
||||
if (params_db->get_param(phy_params::SRS_IS_CONFIGURED))
|
||||
{
|
||||
if (srslte_refsignal_srs_send_cs(params_db->get_param(phy_params::SRS_CS_SFCFG), tti%10) == 1 &&
|
||||
srslte_refsignal_srs_send_ue(params_db->get_param(phy_params::SRS_UE_CONFIGINDEX), tti) == 1)
|
||||
{
|
||||
Info("SRS ready to send at TTI=%d\n", tti);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int srspkt = 0;
|
||||
|
||||
bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *softbuffer, uint8_t *payload)
|
||||
{
|
||||
if (is_ready()) {
|
||||
|
@ -174,7 +174,7 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
|
|||
pucch_cfg.delta_pucch_shift = params_db->get_param(phy_params::PUCCH_DELTA_SHIFT);
|
||||
pucch_cfg.N_cs = params_db->get_param(phy_params::PUCCH_CYCLIC_SHIFT);
|
||||
pucch_cfg.n_rb_2 = params_db->get_param(phy_params::PUCCH_N_RB_2);
|
||||
pucch_cfg.srs_cs_configured = params_db->get_param(phy_params::SRS_IS_CS_CONFIGURED)?true:false;
|
||||
pucch_cfg.srs_configured = params_db->get_param(phy_params::SRS_IS_CONFIGURED)?true:false;
|
||||
pucch_cfg.srs_cs_subf_cfg = (uint32_t) params_db->get_param(phy_params::SRS_CS_SFCFG);
|
||||
pucch_cfg.srs_simul_ack = params_db->get_param(phy_params::SRS_CS_ACKNACKSIMUL)?true:false;
|
||||
|
||||
|
@ -191,8 +191,7 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
|
|||
|
||||
srslte_refsignal_srs_cfg_t srs_cfg;
|
||||
bzero(&srs_cfg, sizeof(srslte_refsignal_srs_cfg_t));
|
||||
srs_cfg.cs_configured = params_db->get_param(phy_params::SRS_IS_CS_CONFIGURED)?true:false;
|
||||
srs_cfg.ue_configured = params_db->get_param(phy_params::SRS_IS_UE_CONFIGURED)?true:false;
|
||||
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);
|
||||
|
@ -201,6 +200,7 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
|
|||
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, &pucch_cfg, &srs_cfg, &pucch_sched,
|
||||
group_hopping_en, sequence_hopping_en);
|
||||
|
@ -237,17 +237,16 @@ bool ul_buffer::generate_data(ul_sched_grant *grant, srslte_softbuffer_tx_t *sof
|
|||
grant->get_rnti(), ue_ul.pusch.shortened?"yes":"no");
|
||||
|
||||
|
||||
} else {
|
||||
if (uci_data.scheduling_request || uci_data.uci_cqi_len > 0 || uci_data.uci_ack_len) {
|
||||
n = srslte_ue_ul_pucch_encode(&ue_ul, uci_data, tti%10, signal_buffer);
|
||||
} else if (uci_data.scheduling_request || uci_data.uci_cqi_len > 0 || uci_data.uci_ack_len) {
|
||||
n = srslte_ue_ul_pucch_encode(&ue_ul, uci_data, tti%10, signal_buffer);
|
||||
|
||||
Info("PUCCH: TTI=%d n_cce=%d, ack=%s, sr=%s, shortened=%s\n", tti, last_n_cce,
|
||||
uci_data.uci_ack_len>0?(uci_data.uci_ack?"1":"0"):"no",uci_data.scheduling_request?"yes":"no",
|
||||
ue_ul.pucch.shortened?"yes":"no");
|
||||
} else {
|
||||
n = srslte_ue_ul_srs_encode(&ue_ul, tti, signal_buffer);
|
||||
}
|
||||
|
||||
Info("PUCCH: TTI=%d n_cce=%d, ack=%s, sr=%s, shortened=%s\n", tti, last_n_cce,
|
||||
uci_data.uci_ack_len>0?(uci_data.uci_ack?"1":"0"):"no",uci_data.scheduling_request?"yes":"no",
|
||||
ue_ul.pucch.shortened?"yes":"no");
|
||||
} else {
|
||||
n = srslte_ue_ul_srs_encode(&ue_ul, tti, signal_buffer);
|
||||
|
||||
Info("SRS only: TX at TTI=%d\n", tti);
|
||||
}
|
||||
// Reset UCI data
|
||||
bzero(&uci_data, sizeof(srslte_uci_data_t));
|
||||
|
@ -293,7 +292,7 @@ bool ul_buffer::send(srslte::radio* radio_handler, float time_adv_sec, float cfo
|
|||
srslte_vec_sc_prod_cfc(signal_buffer, 0.7/max, signal_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
||||
}
|
||||
|
||||
Debug("TX CFO: %f, len=%d, rx_time= %.6f tx_time = %.6f TA: %.1f PeakAmplitude=%.2f PKT#%d\n",
|
||||
Info("TX CFO: %f, len=%d, rx_time= %.6f tx_time = %.6f TA: %.1f PeakAmplitude=%.2f PKT#%d\n",
|
||||
cfo*15000, SRSLTE_SF_LEN_PRB(cell.nof_prb),
|
||||
srslte_timestamp_real(&rx_time),
|
||||
srslte_timestamp_real(&tx_time), time_adv_sec*1000000, max, nof_tx);
|
||||
|
@ -305,7 +304,7 @@ bool ul_buffer::send(srslte::radio* radio_handler, float time_adv_sec, float cfo
|
|||
sprintf(filename, "pusch%d",nof_tx);
|
||||
srslte_vec_save_file(filename, signal_buffer, sizeof(cf_t)*SRSLTE_SF_LEN_PRB(cell.nof_prb));
|
||||
nof_tx++;
|
||||
*/
|
||||
*/
|
||||
|
||||
ready();
|
||||
}
|
||||
|
|
|
@ -63,8 +63,7 @@ typedef struct SRSLTE_API {
|
|||
uint32_t n_rrc;
|
||||
uint32_t B;
|
||||
uint32_t b_hop;
|
||||
bool cs_configured;
|
||||
bool ue_configured;
|
||||
bool configured;
|
||||
}srslte_refsignal_srs_cfg_t;
|
||||
|
||||
/** Uplink DeModulation Reference Signal (DMRS) */
|
||||
|
@ -149,6 +148,6 @@ SRSLTE_API uint32_t srslte_refsignal_srs_rb_start_cs(uint32_t bw_cfg,
|
|||
SRSLTE_API uint32_t srslte_refsignal_srs_rb_L_cs(uint32_t bw_cfg,
|
||||
uint32_t nof_prb);
|
||||
|
||||
SRSLTE_API uint32_t srslte_refsignal_M_sc(srslte_refsignal_ul_t *q);
|
||||
SRSLTE_API uint32_t srslte_refsignal_srs_M_sc(srslte_refsignal_ul_t *q);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -69,7 +69,7 @@ typedef struct SRSLTE_API {
|
|||
uint32_t delta_pucch_shift;
|
||||
uint32_t n_rb_2;
|
||||
uint32_t N_cs;
|
||||
bool srs_cs_configured;
|
||||
bool srs_configured;
|
||||
uint32_t srs_cs_subf_cfg;
|
||||
bool srs_simul_ack;
|
||||
} srslte_pucch_cfg_t;
|
||||
|
|
|
@ -718,7 +718,6 @@ uint32_t srs_k0_ue(srslte_refsignal_srs_cfg_t *cfg, uint32_t nof_prb, uint32_t t
|
|||
} else {
|
||||
nb = ((4*cfg->n_rrc/m_srs)+srs_Fb(cfg, nof_prb, tti))%Nb[srsbwtable_idx(nof_prb)][b][cfg->bw_cfg];
|
||||
}
|
||||
printf("nb[%d]=%d\n",b,nb);
|
||||
k0 += 2*m_sc*nb;
|
||||
}
|
||||
return k0;
|
||||
|
@ -726,7 +725,7 @@ uint32_t srs_k0_ue(srslte_refsignal_srs_cfg_t *cfg, uint32_t nof_prb, uint32_t t
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t srslte_refsignal_M_sc(srslte_refsignal_ul_t *q) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -737,12 +736,11 @@ int srslte_refsignal_srs_gen(srslte_refsignal_ul_t *q, uint32_t sf_idx, cf_t *r_
|
|||
if (r_srs && q) {
|
||||
ret = SRSLTE_ERROR;
|
||||
|
||||
uint32_t M_sc = srslte_refsignal_M_sc(q);
|
||||
uint32_t M_sc = srslte_refsignal_srs_M_sc(q);
|
||||
for (uint32_t ns=2*sf_idx;ns<2*(sf_idx+1);ns++) {
|
||||
|
||||
compute_r(q, M_sc/SRSLTE_NRE, ns, 0);
|
||||
float alpha = 2*M_PI*q->srs_cfg.n_srs/8;
|
||||
|
||||
// Do complex exponential and adjust amplitude
|
||||
for (int i=0;i<M_sc;i++) {
|
||||
r_srs[(ns%2)*M_sc+i] = q->srs_cfg.beta_srs * cexpf(I*(q->tmp_arg[i] + alpha*i));
|
||||
|
@ -758,15 +756,10 @@ int srslte_refsignal_srs_put(srslte_refsignal_ul_t *q, uint32_t tti, cf_t *r_srs
|
|||
if (r_srs && q) {
|
||||
ret = SRSLTE_ERROR;
|
||||
|
||||
if (srslte_refsignal_srs_send_ue(q->srs_cfg.I_srs, tti) == 1 &&
|
||||
srslte_refsignal_srs_send_cs(q->srs_cfg.subframe_config, tti) == 1)
|
||||
{
|
||||
uint32_t M_sc = srslte_refsignal_M_sc(q);
|
||||
uint32_t k0 = srs_k0_ue(&q->srs_cfg, q->cell.nof_prb, tti);
|
||||
printf("k0=%d, n_rrc=%d\n", k0, q->srs_cfg.n_rrc);
|
||||
for (int i=0;i<M_sc;i++) {
|
||||
sf_symbols[SRSLTE_RE_IDX(q->cell.nof_prb, 2*SRSLTE_CP_NSYMB(q->cell.cp)-1, k0 + 2*i)] = r_srs[i];
|
||||
}
|
||||
uint32_t M_sc = srslte_refsignal_srs_M_sc(q);
|
||||
uint32_t k0 = srs_k0_ue(&q->srs_cfg, q->cell.nof_prb, tti);
|
||||
for (int i=0;i<M_sc;i++) {
|
||||
sf_symbols[SRSLTE_RE_IDX(q->cell.nof_prb, 2*SRSLTE_CP_NSYMB(q->cell.cp)-1, k0 + 2*i)] = r_srs[i];
|
||||
}
|
||||
ret = SRSLTE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
}
|
||||
|
||||
if (nlhs >= 1) {
|
||||
uint32_t M_sc = srslte_refsignal_M_sc(&refsignal); ;
|
||||
uint32_t M_sc = srslte_refsignal_srs_M_sc(&refsignal); ;
|
||||
mexutils_write_cf(r_srs, &plhs[0], M_sc, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ int cuhd_open_(char *args, void **h, bool create_thread_gain, bool tx_gain_same_
|
|||
{
|
||||
cuhd_handler *handler = new cuhd_handler();
|
||||
std::string _args = std::string(args);
|
||||
handler->usrp = uhd::usrp::multi_usrp::make(_args + ", master_clock_rate=30720000, num_recv_frames=512");
|
||||
handler->usrp = uhd::usrp::multi_usrp::make(_args + ", master_clock_rate=30720000, num_recv_frames=64");
|
||||
|
||||
// handler->usrp = uhd::usrp::multi_usrp::make(_args + ", master_clock_rate=50000000" + ", num_recv_frames=512");
|
||||
handler->usrp->set_clock_source("internal");
|
||||
|
|
|
@ -483,7 +483,7 @@ int srslte_pucch_encode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|||
ret = SRSLTE_ERROR;
|
||||
|
||||
// Shortened PUCCH happen in every cell-specific SRS subframes for Format 1/1a/1b
|
||||
if (q->pucch_cfg.srs_cs_configured && format < SRSLTE_PUCCH_FORMAT_2) {
|
||||
if (q->pucch_cfg.srs_configured && format < SRSLTE_PUCCH_FORMAT_2) {
|
||||
q->shortened = false;
|
||||
// If CQI is not transmitted, PUCCH will be normal unless ACK/NACK and SRS simultaneous transmission is enabled
|
||||
if (q->pucch_cfg.srs_simul_ack) {
|
||||
|
@ -511,7 +511,6 @@ int srslte_pucch_encode(srslte_pucch_t* q, srslte_pucch_format_t format,
|
|||
f_gh = q->f_gh[ns];
|
||||
}
|
||||
uint32_t u = (f_gh + (q->cell.id%30))%30;
|
||||
printf("u=%d\n", u);
|
||||
|
||||
srslte_refsignal_r_uv_arg_1prb(q->tmp_arg, u);
|
||||
uint32_t N_sf_widx = N_sf==3?1:0;
|
||||
|
|
|
@ -330,15 +330,13 @@ int srslte_pusch_cfg(srslte_pusch_t *q, srslte_pusch_cfg_t *cfg, srslte_dci_msg_
|
|||
}
|
||||
if (srs_cfg) {
|
||||
q->shortened = false;
|
||||
if (srs_cfg->cs_configured) {
|
||||
if (srs_cfg->configured) {
|
||||
// If UE-specific SRS is configured, PUSCH is shortened every time UE transmits SRS even if overlaping in the same RB or not
|
||||
if (srs_cfg->ue_configured) {
|
||||
if (srslte_refsignal_srs_send_cs(srs_cfg->subframe_config, tti%10) == 1 &&
|
||||
srslte_refsignal_srs_send_ue(srs_cfg->I_srs, tti) == 1)
|
||||
{
|
||||
printf("SRS UE transmission\n");
|
||||
q->shortened = true;
|
||||
}
|
||||
if (srslte_refsignal_srs_send_cs(srs_cfg->subframe_config, tti%10) == 1 &&
|
||||
srslte_refsignal_srs_send_ue(srs_cfg->I_srs, tti) == 1)
|
||||
{
|
||||
printf("PUSCH shorteneed for SRS UE transmission\n");
|
||||
q->shortened = true;
|
||||
}
|
||||
// If not coincides with UE transmission. PUSCH shall be shortened if cell-specific SRS transmission RB coincides with PUSCH allocated RB
|
||||
if (!q->shortened) {
|
||||
|
|
|
@ -158,8 +158,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
cfg.grant.prb_idx[0][i] = true;
|
||||
}
|
||||
}
|
||||
cfg.grant.prb_idx[1][i] = cfg.grant.prb_idx[0][i];
|
||||
}
|
||||
memcpy(&cfg.grant.prb_idx[1], &cfg.grant.prb_idx[0], SRSLTE_MAX_PRB*sizeof(bool));
|
||||
|
||||
free(prbset);
|
||||
|
||||
|
|
|
@ -349,9 +349,9 @@ int srslte_ue_ul_srs_encode(srslte_ue_ul_t *q, uint32_t tti, cf_t *output_signal
|
|||
if (q && output_signal) {
|
||||
ret = SRSLTE_ERROR;
|
||||
|
||||
if (srslte_ue_ul_srs_tx_enabled(&q->dmrs.srs_cfg, q->pusch_cfg.tti) && q->pusch.shortened) {
|
||||
srslte_refsignal_srs_gen(&q->dmrs, q->pusch_cfg.sf_idx, q->srs_signal);
|
||||
srslte_refsignal_srs_put(&q->dmrs, q->pusch_cfg.tti, q->srs_signal, q->sf_symbols);
|
||||
if (srslte_ue_ul_srs_tx_enabled(&q->dmrs.srs_cfg, tti)) {
|
||||
srslte_refsignal_srs_gen(&q->dmrs, tti%10, q->srs_signal);
|
||||
srslte_refsignal_srs_put(&q->dmrs, tti, q->srs_signal, q->sf_symbols);
|
||||
}
|
||||
|
||||
srslte_ofdm_tx_sf(&q->fft, q->sf_symbols, output_signal);
|
||||
|
@ -361,7 +361,7 @@ int srslte_ue_ul_srs_encode(srslte_ue_ul_t *q, uint32_t tti, cf_t *output_signal
|
|||
}
|
||||
|
||||
if (q->normalize_en) {
|
||||
float norm_factor = (float) q->cell.nof_prb/10/sqrtf(q->pusch_cfg.grant.L_prb);
|
||||
float norm_factor = (float) q->cell.nof_prb/10/sqrtf(srslte_refsignal_srs_M_sc(&q->dmrs)/6);
|
||||
srslte_vec_sc_prod_cfc(output_signal, norm_factor, output_signal, SRSLTE_SF_LEN_PRB(q->cell.nof_prb));
|
||||
}
|
||||
|
||||
|
@ -461,14 +461,11 @@ int srslte_ue_ul_sr_send_tti(uint32_t I_sr, uint32_t current_tti) {
|
|||
|
||||
|
||||
bool srslte_ue_ul_srs_tx_enabled(srslte_refsignal_srs_cfg_t *srs_cfg, uint32_t tti) {
|
||||
if (srs_cfg->cs_configured) {
|
||||
if (srs_cfg->ue_configured) {
|
||||
if (srslte_refsignal_srs_send_cs(srs_cfg->subframe_config, tti%10) == 1 &&
|
||||
srslte_refsignal_srs_send_ue(srs_cfg->I_srs, tti) == 1)
|
||||
{
|
||||
printf("SRS UE transmission\n");
|
||||
return true;
|
||||
}
|
||||
if (srs_cfg->configured) {
|
||||
if (srslte_refsignal_srs_send_cs(srs_cfg->subframe_config, tti%10) == 1 &&
|
||||
srslte_refsignal_srs_send_ue(srs_cfg->I_srs, tti) == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue