Commit e7c5bc55 authored by Raymond Knopp's avatar Raymond Knopp

Merge branch 'NR_RRC_PRACH_procedures' of...

Merge branch 'NR_RRC_PRACH_procedures' of https://gitlab.eurecom.fr/oai/openairinterface5g into NR_RRC_PRACH_procedures

Conflicts:
	openair1/SCHED_NR/phy_procedures_nr_gNB.c
	openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
parents 47e0d056 2ada0edd
...@@ -62,7 +62,6 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -62,7 +62,6 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
@param start_rb The starting RB in the RB allocation (used for Resource Allocation Type 1 in NR) @param start_rb The starting RB in the RB allocation (used for Resource Allocation Type 1 in NR)
@param nb_rb_pusch The number of RBs allocated (used for Resource Allocation Type 1 in NR) @param nb_rb_pusch The number of RBs allocated (used for Resource Allocation Type 1 in NR)
@param frame_parms, Pointer to frame descriptor structure @param frame_parms, Pointer to frame descriptor structure
@param is_dmrs_symbol, flag to indicate wether this OFDM symbol contains DMRS symbols or not.
*/ */
void nr_ulsch_extract_rbs_single(int **rxdataF, void nr_ulsch_extract_rbs_single(int **rxdataF,
......
...@@ -361,7 +361,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -361,7 +361,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
// harq_process->trials[nfapi_ulsch_pdu_rel15->round]++; // harq_process->trials[nfapi_ulsch_pdu_rel15->round]++;
harq_process->TBS = pusch_pdu->pusch_data.tb_size; harq_process->TBS = pusch_pdu->pusch_data.tb_size;
A = harq_process->TBS; A = (harq_process->TBS)<<3;
ret = ulsch->max_ldpc_iterations + 1; ret = ulsch->max_ldpc_iterations + 1;
LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, n_layers %d\n",harq_pid,A,G, mcs, n_layers, nb_rb, Qm, n_layers); LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, n_layers %d\n",harq_pid,A,G, mcs, n_layers, nb_rb, Qm, n_layers);
...@@ -548,7 +548,11 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -548,7 +548,11 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
// printf("done\n"); // printf("done\n");
if (harq_process->C == 1) { if (harq_process->C == 1) {
crc_type = CRC24_A; if (A > 3824)
crc_type = CRC24_A;
else
crc_type = CRC16;
length_dec = harq_process->B; length_dec = harq_process->B;
} }
else { else {
......
...@@ -1694,10 +1694,10 @@ void nr_dlsch_decoding_process(void *arg) ...@@ -1694,10 +1694,10 @@ void nr_dlsch_decoding_process(void *arg)
} }
no_iteration_ldpc = nrLDPC_decoder(p_decParams, no_iteration_ldpc = nrLDPC_decoder(p_decParams,
(int8_t*)&pl[0], (int8_t*)&pl[0],
llrProcBuf, llrProcBuf,
p_nrLDPC_procBuf, p_nrLDPC_procBuf,
p_procTime); p_procTime);
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) { if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
......
...@@ -292,18 +292,36 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -292,18 +292,36 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
printf("%02x.",a[i]); printf("%02x.",a[i]);
printf("\n"); printf("\n");
*/ */
// Add 24-bit crc (polynomial A) to payload
crc = crc24a(harq_process->a,A)>>8;
harq_process->a[A>>3] = ((uint8_t*)&crc)[2];
harq_process->a[1+(A>>3)] = ((uint8_t*)&crc)[1];
harq_process->a[2+(A>>3)] = ((uint8_t*)&crc)[0];
//printf("CRC %x (A %d)\n",crc,A);
//printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
harq_process->B = A+24; if (A > 3824) {
// Add 24-bit crc (polynomial A) to payload
crc = crc24a(harq_process->a,A)>>8;
harq_process->a[A>>3] = ((uint8_t*)&crc)[2];
harq_process->a[1+(A>>3)] = ((uint8_t*)&crc)[1];
harq_process->a[2+(A>>3)] = ((uint8_t*)&crc)[0];
//printf("CRC %x (A %d)\n",crc,A);
//printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
memcpy(harq_process->b,harq_process->a,(A/8)+4); harq_process->B = A+24;
AssertFatal((A/8)+4 <= MAX_NR_ULSCH_PAYLOAD_BYTES,"A %d is too big (A/8+4 = %d > %d)\n",A,(A/8)+4,MAX_NR_ULSCH_PAYLOAD_BYTES);
memcpy(harq_process->b,harq_process->a,(A/8)+4);
}
else {
// Add 16-bit crc (polynomial A) to payload
crc = crc16(harq_process->a,A)>>16;
harq_process->a[A>>3] = ((uint8_t*)&crc)[1];
harq_process->a[1+(A>>3)] = ((uint8_t*)&crc)[0];
//printf("CRC %x (A %d)\n",crc,A);
//printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
harq_process->B = A+16;
AssertFatal((A/8)+3 <= MAX_NR_ULSCH_PAYLOAD_BYTES,"A %d is too big (A/8+3 = %d > %d)\n",A,(A/8)+3,MAX_NR_ULSCH_PAYLOAD_BYTES);
memcpy(harq_process->b,harq_process->a,(A/8)+3); // using 3 bytes to mimic the case of 24 bit crc
}
/////////// ///////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
......
...@@ -139,7 +139,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -139,7 +139,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
&UE->dmrs_UplinkConfig, &UE->dmrs_UplinkConfig,
mapping_type, mapping_type,
frame_parms->ofdm_symbol_size); frame_parms->ofdm_symbol_size);
printf("dmrs_symb %d, number_dmrs_symbols %d\n",dmrs_symb,number_dmrs_symbols);
if (dmrs_symb == -1 && number_dmrs_symbols == 1) dmrs_symb = i; if (dmrs_symb == -1 && number_dmrs_symbols == 1) dmrs_symb = i;
} }
AssertFatal(number_dmrs_symbols ==1,"number_dmrs_symbols != 1\n"); AssertFatal(number_dmrs_symbols ==1,"number_dmrs_symbols != 1\n");
...@@ -363,8 +362,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -363,8 +362,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
&UE->dmrs_UplinkConfig, &UE->dmrs_UplinkConfig,
mapping_type, mapping_type,
frame_parms->ofdm_symbol_size); frame_parms->ofdm_symbol_size);
LOG_D(PHY,"dmrs symb %d : k %d, kprime %d is_dmrs %d, mapping_type %d\n",
l,k,k_prime,is_dmrs,mapping_type);
if (is_dmrs == 1) { if (is_dmrs == 1) {
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
......
...@@ -215,7 +215,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -215,7 +215,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->ulsch_pdu; nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->ulsch_pdu;
uint8_t ret; uint8_t ret, nodata_dmrs = 1;
uint8_t l, number_dmrs_symbols = 0; uint8_t l, number_dmrs_symbols = 0;
uint32_t G; uint32_t G;
uint16_t start_symbol, number_symbols, nb_re_dmrs; uint16_t start_symbol, number_symbols, nb_re_dmrs;
...@@ -226,7 +226,10 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -226,7 +226,10 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
for (l = start_symbol; l < start_symbol + number_symbols; l++) for (l = start_symbol; l < start_symbol + number_symbols; l++)
number_dmrs_symbols += ((pusch_pdu->ul_dmrs_symb_pos)>>l)&0x01;; number_dmrs_symbols += ((pusch_pdu->ul_dmrs_symb_pos)>>l)&0x01;;
nb_re_dmrs = 12;//((pusch_pdu->dmrs_config_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols; if (nodata_dmrs)
nb_re_dmrs = 12*number_dmrs_symbols;
else
nb_re_dmrs = ((pusch_pdu->dmrs_config_type == pusch_dmrs_type1)?6:4)*number_dmrs_symbols;
G = nr_get_G(pusch_pdu->rb_size, G = nr_get_G(pusch_pdu->rb_size,
number_symbols, number_symbols,
...@@ -259,7 +262,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -259,7 +262,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
slot_rx, slot_rx,
harq_pid, harq_pid,
G); G);
if (ret > gNB->ulsch[ULSCH_id][0]->max_ldpc_iterations) if (ret > gNB->ulsch[ULSCH_id][0]->max_ldpc_iterations)
LOG_I(PHY, "ULSCH %d in error\n",ULSCH_id); LOG_I(PHY, "ULSCH %d in error\n",ULSCH_id);
else else
......
...@@ -592,7 +592,7 @@ int main(int argc, char **argv) ...@@ -592,7 +592,7 @@ int main(int argc, char **argv)
pusch_pdu->pusch_data.rv_index = 0; pusch_pdu->pusch_data.rv_index = 0;
pusch_pdu->pusch_data.harq_process_id = 0; pusch_pdu->pusch_data.harq_process_id = 0;
pusch_pdu->pusch_data.new_data_indicator = 0; pusch_pdu->pusch_data.new_data_indicator = 0;
pusch_pdu->pusch_data.tb_size = TBS; pusch_pdu->pusch_data.tb_size = TBS>>3;
pusch_pdu->pusch_data.num_cb = 0; pusch_pdu->pusch_data.num_cb = 0;
// prepare ULSCH/PUSCH reception // prepare ULSCH/PUSCH reception
...@@ -639,10 +639,10 @@ int main(int argc, char **argv) ...@@ -639,10 +639,10 @@ int main(int argc, char **argv)
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0);
txlev = signal_energy_amp_shift(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], txlev = signal_energy(&UE->common_vars.txdata[0][tx_offset + 5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0],
frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples);
txlev_float = (double)txlev/(double)AMP; // output of signal_energy is fixed point representation txlev_float = (double)txlev; // output of signal_energy is fixed point representation
n_errors = 0; n_errors = 0;
n_false_positive = 0; n_false_positive = 0;
...@@ -661,8 +661,8 @@ int main(int argc, char **argv) ...@@ -661,8 +661,8 @@ int main(int argc, char **argv)
//---------------------------------------------------------- //----------------------------------------------------------
for (i=0; i<frame_length_complex_samples; i++) { for (i=0; i<frame_length_complex_samples; i++) {
for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) { for (ap=0; ap<frame_parms->nb_antennas_rx; ap++) {
((short*) gNB->common_vars.rxdata[ap])[(2*i) + (delay*2)] = (((int16_t *)UE->common_vars.txdata[ap])[(i<<1)]) + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)*(double)AMP); // convert to fixed point ((short*) gNB->common_vars.rxdata[ap])[(2*i) + (delay*2)] = (((int16_t *)UE->common_vars.txdata[ap])[(i<<1)]) + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)); // convert to fixed point
((short*) gNB->common_vars.rxdata[ap])[2*i+1 + (delay*2)] = (((int16_t *)UE->common_vars.txdata[ap])[(i<<1)+1]) + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0)*(double)AMP); ((short*) gNB->common_vars.rxdata[ap])[2*i+1 + (delay*2)] = (((int16_t *)UE->common_vars.txdata[ap])[(i<<1)+1]) + (int16_t)(sqrt(sigma/2)*gaussdouble(0.0,1.0));
} }
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
......
...@@ -317,67 +317,66 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -317,67 +317,66 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// Check if there are downlink symbols in the slot, // Check if there are downlink symbols in the slot,
if (is_nr_DL_slot(cc->ServingCellConfigCommon,slot_txP)) { if (is_nr_DL_slot(cc->ServingCellConfigCommon,slot_txP)) {
memset(RC.nrmac[module_idP]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int)); memset(RC.nrmac[module_idP]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int));
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
//mbsfn_status[CC_id] = 0; //mbsfn_status[CC_id] = 0;
// clear vrb_maps // clear vrb_maps
memset(cc[CC_id].vrb_map, 0, 100); memset(cc[CC_id].vrb_map, 0, 100);
memset(cc[CC_id].vrb_map_UL, 0, 100); memset(cc[CC_id].vrb_map_UL, 0, 100);
clear_nr_nfapi_information(RC.nrmac[module_idP], CC_id, frame_txP, slot_txP); clear_nr_nfapi_information(RC.nrmac[module_idP], CC_id, frame_txP, slot_txP);
} }
// refresh UE list based on UEs dropped by PHY in previous subframe // refresh UE list based on UEs dropped by PHY in previous subframe
/* /*
for (i = 0; i < MAX_MOBILES_PER_GNB; i++) { for (i = 0; i < MAX_MOBILES_PER_GNB; i++) {
if (UE_list->active[i]) { if (UE_list->active[i]) {
nfapi_nr_config_request_t *cfg = &RC.nrmac[module_idP]->config[CC_id]; nfapi_nr_config_request_t *cfg = &RC.nrmac[module_idP]->config[CC_id];
rnti = 0;//UE_RNTI(module_idP, i);
CC_id = 0;//UE_PCCID(module_idP, i);
rnti = 0;//UE_RNTI(module_idP, i); } //END if (UE_list->active[i])
CC_id = 0;//UE_PCCID(module_idP, i); } //END for (i = 0; i < MAX_MOBILES_PER_GNB; i++)
*/
} //END if (UE_list->active[i]) PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,NOT_A_RNTI, frame_txP, slot_txP,module_idP);
} //END for (i = 0; i < MAX_MOBILES_PER_GNB; i++)
*/
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES,NOT_A_RNTI, frame_txP, slot_txP,module_idP);
// This schedules MIB // This schedules MIB
if((slot_txP == 0) && (frame_txP & 7) == 0){ if((slot_txP == 0) && (frame_txP & 7) == 0){
schedule_nr_mib(module_idP, frame_txP, slot_txP); schedule_nr_mib(module_idP, frame_txP, slot_txP);
} }
// TbD once RACH is available, start ta_timer when UE is connected // TbD once RACH is available, start ta_timer when UE is connected
if (ue_sched_ctl->ta_timer) ue_sched_ctl->ta_timer--; if (ue_sched_ctl->ta_timer) ue_sched_ctl->ta_timer--;
if (ue_sched_ctl->ta_timer == 0) { if (ue_sched_ctl->ta_timer == 0) {
gNB->ta_command = ue_sched_ctl->ta_update; gNB->ta_command = ue_sched_ctl->ta_update;
/* if time is up, then set the timer to not send it for 5 frames /* if time is up, then set the timer to not send it for 5 frames
// regardless of the TA value */ // regardless of the TA value */
ue_sched_ctl->ta_timer = 100; ue_sched_ctl->ta_timer = 100;
/* reset ta_update */ /* reset ta_update */
ue_sched_ctl->ta_update = 31; ue_sched_ctl->ta_update = 31;
/* MAC CE flag indicating TA length */ /* MAC CE flag indicating TA length */
gNB->ta_len = 2; gNB->ta_len = 2;
} }
if (is_nr_DL_slot(cc->ServingCellConfigCommon,slot_rxP))
nr_schedule_RA(module_idP, frame_txP, slot_txP); nr_schedule_RA(module_idP, frame_txP, slot_txP);
// Phytest scheduling
if (get_softmodem_params()->phy_test && slot_txP==1){
// nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP,NULL);
// resetting ta flag
gNB->ta_len = 0;
}
// Phytest scheduling
if (get_softmodem_params()->phy_test && slot_txP==1){
nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP,NULL);
// resetting ta flag
gNB->ta_len = 0;
}
/* /*
// Allocate CCEs for good after scheduling is done // Allocate CCEs for good after scheduling is done
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
allocate_CCEs(module_idP, CC_id, subframeP, 0); allocate_CCEs(module_idP, CC_id, subframeP, 0);
*/ */
} //is_nr_DL_slot } //is_nr_DL_slot
......
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