Refactor csi-rs handling
Similarly to the parent commit, simplify the array type to the FAPI PDU towards further refactoring, and encapsulate the code in a function for easier reuse in a later refactoring step. Note on ZP-CSI: after this commit, we continue treating CSI PDUs. The prior code was returning, which I think is wrong (as this information is only for the currently treated CSI-RS PDU).
This commit is contained in:
@@ -72,11 +72,6 @@ typedef struct {
|
|||||||
uint32_t unav_res;
|
uint32_t unav_res;
|
||||||
} NR_DL_gNB_HARQ_t;
|
} NR_DL_gNB_HARQ_t;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t active;
|
|
||||||
nfapi_nr_dl_tti_csi_rs_pdu csirs_pdu;
|
|
||||||
} NR_gNB_CSIRS_t;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int dump_frame;
|
int dump_frame;
|
||||||
int round_trials[8];
|
int round_trials[8];
|
||||||
@@ -597,10 +592,11 @@ typedef struct processingData_L1tx {
|
|||||||
nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS];
|
nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS];
|
||||||
/// corresponds to UL_dci_req->ul_dci_pdu_list
|
/// corresponds to UL_dci_req->ul_dci_pdu_list
|
||||||
nfapi_nr_dl_tti_pdcch_pdu ul_pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS];
|
nfapi_nr_dl_tti_pdcch_pdu ul_pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS];
|
||||||
NR_gNB_CSIRS_t csirs_pdu[NR_SYMBOLS_PER_SLOT];
|
nfapi_nr_dl_tti_csi_rs_pdu csirs_pdu[NFAPI_NR_MAX_NB_CORESETS];
|
||||||
NR_gNB_DLSCH_t **dlsch;
|
NR_gNB_DLSCH_t **dlsch;
|
||||||
nfapi_nr_dl_tti_ssb_pdu ssb_pdu[64];
|
nfapi_nr_dl_tti_ssb_pdu ssb_pdu[64];
|
||||||
int n_ssb_pdu;
|
int n_ssb_pdu;
|
||||||
|
int n_csirs_pdu;
|
||||||
uint16_t num_pdsch_slot;
|
uint16_t num_pdsch_slot;
|
||||||
int num_dl_pdcch;
|
int num_dl_pdcch;
|
||||||
int num_ul_pdcch;
|
int num_ul_pdcch;
|
||||||
|
|||||||
@@ -52,20 +52,7 @@ static void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx, int frame, int
|
|||||||
|
|
||||||
static void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, int frame, int slot, nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu)
|
static void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, int frame, int slot, nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu)
|
||||||
{
|
{
|
||||||
int found = 0;
|
msgTx->csirs_pdu[msgTx->n_csirs_pdu++] = *csirs_pdu;
|
||||||
|
|
||||||
for (int id = 0; id < NR_NUMBER_OF_SYMBOLS_PER_SLOT; id++) {
|
|
||||||
NR_gNB_CSIRS_t *csirs = &msgTx->csirs_pdu[id];
|
|
||||||
if (csirs->active == 0) {
|
|
||||||
LOG_D(NR_PHY,"Frame %d Slot %d CSI_RS with ID %d is now active\n",frame,slot,id);
|
|
||||||
csirs->active = 1;
|
|
||||||
memcpy((void*)&csirs->csirs_pdu, (void*)csirs_pdu, sizeof(nfapi_nr_dl_tti_csi_rs_pdu));
|
|
||||||
found = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found == 0)
|
|
||||||
LOG_E(MAC,"CSI-RS list is full\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_schedule_dl_tti_req(PHY_VARS_gNB *gNB, nfapi_nr_dl_tti_request_t *DL_req)
|
void nr_schedule_dl_tti_req(PHY_VARS_gNB *gNB, nfapi_nr_dl_tti_request_t *DL_req)
|
||||||
|
|||||||
@@ -203,6 +203,46 @@ void clear_slot_beamid(PHY_VARS_gNB *gNB, int slot)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nr_generate_csi_rs_gNB(PHY_VARS_gNB *gNB,
|
||||||
|
int slot,
|
||||||
|
const nfapi_nr_config_request_scf_t *cfg,
|
||||||
|
const nfapi_nr_dl_tti_csi_rs_pdu *csi_rs_pdu)
|
||||||
|
{
|
||||||
|
const nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csi_params = &csi_rs_pdu->csi_rs_pdu_rel15;
|
||||||
|
if (csi_params->csi_type == 2) // ZP-CSI
|
||||||
|
return;
|
||||||
|
|
||||||
|
csi_mapping_parms_t mapping_parms =
|
||||||
|
get_csi_mapping_parms(csi_params->row, csi_params->freq_domain, csi_params->symb_l0, csi_params->symb_l1);
|
||||||
|
const nfapi_nr_tx_precoding_and_beamforming_t *pb = &csi_params->precodingAndBeamforming;
|
||||||
|
int csi_bitmap = 0;
|
||||||
|
int lprime_num = mapping_parms.lprime + 1;
|
||||||
|
for (int j = 0; j < mapping_parms.size; j++)
|
||||||
|
csi_bitmap |= ((1 << lprime_num) - 1) << mapping_parms.loverline[j];
|
||||||
|
int beam_nb = beam_index_allocation(gNB->enable_analog_das,
|
||||||
|
pb->prgs_list[0].dig_bf_interface_list[0].beam_idx,
|
||||||
|
&cfg->analog_beamforming_ve,
|
||||||
|
&gNB->common_vars,
|
||||||
|
slot,
|
||||||
|
gNB->frame_parms.symbols_per_slot,
|
||||||
|
csi_bitmap);
|
||||||
|
|
||||||
|
nr_generate_csi_rs(&gNB->frame_parms,
|
||||||
|
&mapping_parms,
|
||||||
|
gNB->TX_AMP,
|
||||||
|
slot,
|
||||||
|
csi_params->freq_density,
|
||||||
|
csi_params->start_rb,
|
||||||
|
csi_params->nr_of_rbs,
|
||||||
|
csi_params->symb_l0,
|
||||||
|
csi_params->symb_l1,
|
||||||
|
csi_params->row,
|
||||||
|
csi_params->scramb_id,
|
||||||
|
csi_params->power_control_offset_ss,
|
||||||
|
csi_params->cdm_type,
|
||||||
|
gNB->common_vars.txdataF[beam_nb]);
|
||||||
|
}
|
||||||
|
|
||||||
void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
||||||
int frame,
|
int frame,
|
||||||
int slot,
|
int slot,
|
||||||
@@ -277,49 +317,9 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
|||||||
}
|
}
|
||||||
msgTx->num_pdsch_slot = 0;
|
msgTx->num_pdsch_slot = 0;
|
||||||
|
|
||||||
for (int i = 0; i < NR_SYMBOLS_PER_SLOT; i++){
|
for (int i = 0; i < msgTx->n_csirs_pdu; i++)
|
||||||
NR_gNB_CSIRS_t *csirs = &msgTx->csirs_pdu[i];
|
nr_generate_csi_rs_gNB(gNB, slot, cfg, &msgTx->csirs_pdu[i]);
|
||||||
if (csirs->active == 1) {
|
msgTx->n_csirs_pdu = 0;
|
||||||
LOG_D(PHY, "CSI-RS generation started in frame %d.%d\n",frame,slot);
|
|
||||||
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csi_params = &csirs->csirs_pdu.csi_rs_pdu_rel15;
|
|
||||||
if (csi_params->csi_type == 2) { // ZP-CSI
|
|
||||||
csirs->active = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
csi_mapping_parms_t mapping_parms = get_csi_mapping_parms(csi_params->row,
|
|
||||||
csi_params->freq_domain,
|
|
||||||
csi_params->symb_l0,
|
|
||||||
csi_params->symb_l1);
|
|
||||||
nfapi_nr_tx_precoding_and_beamforming_t *pb = &csi_params->precodingAndBeamforming;
|
|
||||||
int csi_bitmap = 0;
|
|
||||||
int lprime_num = mapping_parms.lprime + 1;
|
|
||||||
for (int j = 0; j < mapping_parms.size; j++)
|
|
||||||
csi_bitmap |= ((1 << lprime_num) - 1) << mapping_parms.loverline[j];
|
|
||||||
int beam_nb = beam_index_allocation(gNB->enable_analog_das,
|
|
||||||
pb->prgs_list[0].dig_bf_interface_list[0].beam_idx,
|
|
||||||
&cfg->analog_beamforming_ve,
|
|
||||||
&gNB->common_vars,
|
|
||||||
slot,
|
|
||||||
fp->symbols_per_slot,
|
|
||||||
csi_bitmap);
|
|
||||||
|
|
||||||
nr_generate_csi_rs(&gNB->frame_parms,
|
|
||||||
&mapping_parms,
|
|
||||||
gNB->TX_AMP,
|
|
||||||
slot,
|
|
||||||
csi_params->freq_density,
|
|
||||||
csi_params->start_rb,
|
|
||||||
csi_params->nr_of_rbs,
|
|
||||||
csi_params->symb_l0,
|
|
||||||
csi_params->symb_l1,
|
|
||||||
csi_params->row,
|
|
||||||
csi_params->scramb_id,
|
|
||||||
csi_params->power_control_offset_ss,
|
|
||||||
csi_params->cdm_type,
|
|
||||||
gNB->common_vars.txdataF[beam_nb]);
|
|
||||||
csirs->active = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//apply the OFDM symbol rotation here
|
//apply the OFDM symbol rotation here
|
||||||
start_meas(&gNB->phase_comp_stats);
|
start_meas(&gNB->phase_comp_stats);
|
||||||
|
|||||||
Reference in New Issue
Block a user