Commit 807b3e90 authored by rmagueta's avatar rmagueta

RNTI_SI: update to 0xFFFF

parent cdf72e6d
......@@ -168,13 +168,6 @@ uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB,
/// Scrambling
uint32_t scrambled_output[NR_MAX_DCI_SIZE_DWORD]= {0};
nr_pdcch_scrambling(encoder_output, encoded_length, Nid, scrambling_RNTI, scrambled_output);
printf("polar_encoder_fast: pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d] = %i, pdcch_pdu_rel15->dci_pdu.AggregationLevel[d] = %i, n_RNTI = %i\n",
pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d], pdcch_pdu_rel15->dci_pdu.AggregationLevel[d], n_RNTI);
printf("nr_pdcch_scrambling: encoded_length = %i, Nid = %i, scrambling_RNTI = %i\n\n",encoded_length, Nid, scrambling_RNTI);
#ifdef DEBUG_CHANNEL_CODING
printf("scrambled output: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\t [4]->0x%08x\t [5]->0x%08x\t \
[6]->0x%08x \t [7]->0x%08x \t [8]->0x%08x \t [9]->0x%08x\t [10]->0x%08x\t [11]->0x%08x\n",
......@@ -247,6 +240,15 @@ uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB,
} // m
} // reg_idx
printf("polar_encoder_fast: pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d] = %i, pdcch_pdu_rel15->dci_pdu.AggregationLevel[d] = %i, n_RNTI = %i\n",
pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d], pdcch_pdu_rel15->dci_pdu.AggregationLevel[d], n_RNTI);
printf("nr_pdcch_scrambling: encoded_length = %i, Nid = %i, scrambling_RNTI = %i\n\n",encoded_length, Nid, scrambling_RNTI);
printf("\n>> DCI: payloadSize = %d | payload = %llx\n\n",
*pdcch_pdu_rel15->dci_pdu.PayloadSizeBits,*(unsigned long long*)pdcch_pdu_rel15->dci_pdu.Payload);
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
return 0;
}
......
......@@ -2953,5 +2953,14 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC
AssertFatal(type0_PDCCH_CSS_config->sfn_c!=SFN_C_IMPOSSIBLE,"");
AssertFatal(type0_PDCCH_CSS_config->n_c!=UINT_MAX,"");
type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m))%num_slot_per_frame;
/*printf("\nbig_o = %f\n", big_o);
printf("scs_pdcch = %u\n", scs_pdcch);
printf("ssb_index = %u\n", type0_PDCCH_CSS_config->ssb_index);
printf("big_m = %f\n", big_m);
printf("num_slot_per_frame = %u\n", num_slot_per_frame);*/
return 0;
}
......@@ -121,6 +121,7 @@ typedef struct Type0_PDCCH_CSS_config_s {
uint16_t frame;
SFN_C_TYPE sfn_c;
uint32_t n_c;
uint32_t n_0;
uint32_t number_of_search_space_per_slot;
uint32_t first_symbol_index;
uint32_t search_space_duration;
......
......@@ -148,7 +148,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
// for SPS=14 8 MSBs in positions 13 down to 6
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
rel15->rnti = mac->crnti; // FIXME: Must be 0xFFFF
rel15->rnti = 0xFFFF; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values
rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275);
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275);
rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
......@@ -252,19 +252,21 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
}
}
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
printf("*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = %li\n", *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1);
printf("ss->searchSpaceId = %li\n", ss->searchSpaceId);
// FIXME:
//if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
if(slot == 10){
if( (frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (slot == mac->type0_PDCCH_CSS_config.n_0) ){
rel15->num_dci_options = 1;
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, ss_id);
fill_dci_search_candidates(ss, rel15);
//}
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
}
//}
}
if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
......
......@@ -165,7 +165,6 @@ void schedule_control_sib1(module_id_t module_id,
uint8_t numDmrsCdmGrpsNoData) {
gNB_MAC_INST *gNB_mac = RC.nrmac[module_id];
NR_BWP_Downlink_t *bwp = gNB_mac->secondaryCellGroupCommon->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
if (gNB_mac->sched_ctrlCommon == NULL){
gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon));
......@@ -176,7 +175,7 @@ void schedule_control_sib1(module_id_t module_id,
fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset);
}
gNB_mac->sched_ctrlCommon->active_bwp = bwp;
gNB_mac->sched_ctrlCommon->active_bwp = gNB_mac->secondaryCellGroupCommon->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
gNB_mac->sched_ctrlCommon->rbSize = 0;
gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation;
gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx;
......@@ -193,14 +192,6 @@ void schedule_control_sib1(module_id_t module_id,
0,
0);
// Frequency-domain allocation
const uint16_t bwpSize = NRRIV2BW(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
int rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
while (rbStart < bwpSize && vrb_map[rbStart]) {
rbStart++;
}
// Calculate number of PRB_DMRS
uint8_t N_PRB_DMRS;
if(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) {
......@@ -216,18 +207,14 @@ void schedule_control_sib1(module_id_t module_id,
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
// Calculate rbStart and rbSize
int rbSize = 0;
uint32_t TBS = 0;
do {
rbSize++;
TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
gNB_mac->sched_ctrlCommon->rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
gNB_mac->sched_ctrlCommon->rbSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs;
uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx),
rbSize, nrOfSymbols, N_PRB_DMRS,0,0,1) >> 3;
} while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < 0);
gNB_mac->sched_ctrlCommon->rbSize = rbSize;
gNB_mac->sched_ctrlCommon->rbStart = rbStart;
gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0,0,1) >> 3;
// Mark the corresponding RBs as used
uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) {
vrb_map[rb + gNB_mac->sched_ctrlCommon->rbStart] = 1;
}
......@@ -239,13 +226,13 @@ void schedule_control_sib1(module_id_t module_id,
printf("nr_of_candidates = %i\n", nr_of_candidates);
printf("startSymbolIndex = %i\n", startSymbolIndex);
printf("nrOfSymbols = %i\n", nrOfSymbols);
printf("rbSize = %i\n", rbSize);
printf("rbStart = %i\n", rbStart);
printf("rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize);
printf("rbStart = %i\n", gNB_mac->sched_ctrlCommon->rbStart);
printf("TBS = %i\n", TBS);
printf("N_PRB_DMRS = %i\n", N_PRB_DMRS);
}
void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, rnti_t rnti, nfapi_nr_dl_tti_request_body_t *dl_req) {
void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req) {
gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP];
NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels->ServingCellConfigCommon;
......@@ -283,7 +270,7 @@ void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, rnti_t rnti, nfapi_nr_dl_tti_reques
nr_configure_pdcch(gNB_mac,
pdcch_pdu_rel15,
rnti,
0xFFFF, // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values
gNB_mac->sched_ctrlCommon->search_space,
gNB_mac->sched_ctrlCommon->coreset,
scc,
......@@ -310,29 +297,43 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
printf("frameP = %i, slotP = %i\n", frameP, slotP);
int CC_id = 0;
rnti_t rnti = 0x1234;
int bwp_id = 1;
int time_domain_allocation = 2;
int time_domain_allocation = 0;
uint8_t mcsTableIdx = 0;
uint8_t mcs = 9;
uint8_t numDmrsCdmGrpsNoData = 1;
gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP];
// TODO: Check at gNB_mac->type0_PDCCH_CSS_config if it is to transmit (structure arrives here updated)
bool is_to_transmit_sib1 = false;
is_to_transmit_sib1 = slotP == 10;
if(gNB_mac->type0_PDCCH_CSS_config.num_rbs<=0) {
return;
}
printf("search_space_duration = %i\n", gNB_mac->type0_PDCCH_CSS_config.search_space_duration);
printf("number_of_search_space_per_slot = %i\n", gNB_mac->type0_PDCCH_CSS_config.number_of_search_space_per_slot);
printf("type0_pdcch_ss_mux_pattern = %i\n", gNB_mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern);
printf("ssb_index = %i\n", gNB_mac->type0_PDCCH_CSS_config.ssb_index);
printf("first_symbol_index = %i\n", gNB_mac->type0_PDCCH_CSS_config.first_symbol_index);
printf("num_symbols = %i\n", gNB_mac->type0_PDCCH_CSS_config.num_symbols);
printf("ssb_length = %i\n", gNB_mac->type0_PDCCH_CSS_config.ssb_length);
printf("frame = %i\n", gNB_mac->type0_PDCCH_CSS_config.frame);
printf("n_c = %i\n", gNB_mac->type0_PDCCH_CSS_config.n_c);
printf("num_rbs = %i\n", gNB_mac->type0_PDCCH_CSS_config.num_rbs);
printf("rb_offset = %i\n", gNB_mac->type0_PDCCH_CSS_config.rb_offset);
printf("sfn_c = %i\n", gNB_mac->type0_PDCCH_CSS_config.sfn_c);
printf("n_0 = %i\n", gNB_mac->type0_PDCCH_CSS_config.n_0);
if(is_to_transmit_sib1) {
if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0) ) {
printf("SIB1 will be transmitted here\n");
printf("\nSIB1 will be transmitted here\n");
// Computation of the sched_ctrlCommon: bwp, coreset0, rbStart, rbSize, etc.
schedule_control_sib1(module_idP, CC_id, bwp_id, time_domain_allocation, mcsTableIdx, mcs, numDmrsCdmGrpsNoData);
// Schedule broadcast DCI for the SIB1
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
nr_fill_nfapi_dci_sib1_pdu(module_idP, rnti, dl_req);
nr_fill_nfapi_dci_sib1_pdu(module_idP, dl_req);
// Get SIB1
uint8_t sib1_payload[100];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment