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,
@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 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,
......
......@@ -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->TBS = pusch_pdu->pusch_data.tb_size;
A = harq_process->TBS;
A = (harq_process->TBS)<<3;
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);
......@@ -548,7 +548,11 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
// printf("done\n");
if (harq_process->C == 1) {
if (A > 3824)
crc_type = CRC24_A;
else
crc_type = CRC16;
length_dec = harq_process->B;
}
else {
......
......@@ -292,6 +292,8 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
printf("%02x.",a[i]);
printf("\n");
*/
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];
......@@ -302,8 +304,24 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
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,
&UE->dmrs_UplinkConfig,
mapping_type,
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;
}
AssertFatal(number_dmrs_symbols ==1,"number_dmrs_symbols != 1\n");
......@@ -363,8 +362,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
&UE->dmrs_UplinkConfig,
mapping_type,
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) {
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
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;
uint8_t ret;
uint8_t ret, nodata_dmrs = 1;
uint8_t l, number_dmrs_symbols = 0;
uint32_t G;
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
for (l = start_symbol; l < start_symbol + number_symbols; l++)
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,
number_symbols,
......
......@@ -592,7 +592,7 @@ int main(int argc, char **argv)
pusch_pdu->pusch_data.rv_index = 0;
pusch_pdu->pusch_data.harq_process_id = 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;
// prepare ULSCH/PUSCH reception
......@@ -639,10 +639,10 @@ int main(int argc, char **argv)
////////////////////////////////////////////////////
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);
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_false_positive = 0;
......@@ -661,8 +661,8 @@ int main(int argc, char **argv)
//----------------------------------------------------------
for (i=0; i<frame_length_complex_samples; i++) {
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+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) + (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));
}
}
////////////////////////////////////////////////////////////
......
......@@ -335,7 +335,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
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);
......@@ -363,16 +362,16 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
gNB->ta_len = 2;
}
if (is_nr_DL_slot(cc->ServingCellConfigCommon,slot_rxP))
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);
// 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
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
......
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