Commit 0e01b63b authored by lfq's avatar lfq Committed by Chenyu

do dl and ul after msg2 is rcv

dl is ok with rfsim

ping is ok. fix crnti for 2 PCs and use real data from rlc

msg3 send to drb for ue side

send msg3 to drb fro ue side

messg3\4\5 is ok
parent be31d514
......@@ -224,7 +224,21 @@ struct timespec clock_difftime(struct timespec start, struct timespec end) {
void print_difftimes(void) {
LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec);
}
int create_tasks_nrue(uint32_t ue_nb) {
LOG_D(NR_RRC, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb);
itti_wait_ready(1);
if (ue_nb > 0) {
LOG_I(NR_RRC,"create TASK_RRC_NRUE \n");
if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1;
}
}
itti_wait_ready(0);
return 0;
}
void exit_function(const char *file, const char *function, const int line, const char *s) {
int CC_id;
......@@ -777,7 +791,14 @@ int main( int argc, char **argv ) {
// wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n");
protocol_ctxt_t ctxt_pP = {0};
ctxt_pP.enb_flag = ENB_FLAG_NO;
ctxt_pP.rnti = 0x1234;
rrc_ue_generate_RRCSetupRequest(&ctxt_pP, 0);
if (create_tasks_nrue(1) < 0) {
printf("cannot create ITTI tasks\n");
exit(-1); // need a softer mode
}
while(true)
sleep(3600);
......
......@@ -407,7 +407,7 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
#ifdef RM_DEBUG
printf("nr_rate_matching_ldpc: E %d, F %d, Foffset %d, k0 %d, Ncb %d, rvidx %d\n", E, F, Foffset,ind, Ncb, rvidx);
#endif
AssertFatal(Foffset <= E,"Foffset %d > E %d\n",Foffset,E);
//AssertFatal(Foffset <= E,"Foffset %d > E %d\n",Foffset,E);
AssertFatal(Foffset <= Ncb,"Foffset %d > Ncb %d\n",Foffset,Ncb);
if (ind >= Foffset && ind < (F+Foffset)) ind = F+Foffset;
......
......@@ -393,7 +393,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
LOG_D(PHY,"%02x\n",a[i]);
LOG_D(PHY,"\n");
*/
log_dump(PHY, a, 8, LOG_DUMP_CHAR,"gNB pdsch tx frame %d %d: ", frame, slot);
if (A > 3824) {
// Add 24-bit crc (polynomial A) to payload
crc = crc24a(a,A)>>8;
......
......@@ -514,7 +514,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
A = (harq_process->TBS)<<3;
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_I(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);
if (R<1024)
Coderate = (float) R /(float) 1024;
......@@ -656,5 +656,13 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0));
//////////////////////////////////////////////////////////////////////////////////////////
}
//log_dump(PHY, harq_process->b, 8, LOG_DUMP_CHAR,"gnb pusch rx frame %d %d: ", frame, nr_tti_rx);
LOG_I(PHY,"ULSCH Decoding C %d, A %d, G %d, E %d, Kb %d, F %d, Zc %d, Kr %d, BG %d\n", harq_process->C, A, G, E, -1, harq_process->F, harq_process->Z, Kr, p_decParams->BG);
LOG_I(PHY,"ULSCH Decoding Kr_bytes %d, encLen %d\n", Kr_bytes, (3*8*Kr_bytes)+12);
return 1;
}
......@@ -336,7 +336,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, dmrs_length, harq_process->Qm,harq_process->Nl);
G = harq_process->G;
LOG_D(PHY,"DLSCH Decoding, harq_pid %d TBS %d (%d) G %d nb_re_dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,A/8,G, nb_re_dmrs,harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb);
LOG_I(PHY,"DLSCH Decoding, harq_pid %d TBS %d (%d) G %d nb_re_dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,A/8,G, nb_re_dmrs,harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb);
if ((harq_process->R)<1024)
Coderate = (float) (harq_process->R) /(float) 1024;
......@@ -659,7 +659,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
if (err_flag == 1) {
//#if UE_DEBUG_TRACE
LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
phy_vars_ue->Mod_id, frame, nr_tti_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round);
//#endif
harq_process->harq_ack.ack = 0;
......@@ -682,7 +682,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
return((1 + dlsch->max_ldpc_iterations));
} else {
//#if UE_DEBUG_TRACE
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_tti_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for nr_tti_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
phy_vars_ue->Mod_id,nr_tti_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round);
//#endif
......@@ -748,7 +748,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
#endif
}
log_dump(PHY, harq_process->b, 8, LOG_DUMP_CHAR,"nrue pdsch rx frame %d %d: ", frame, nr_tti_rx );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_COMBINE_SEG, VCD_FUNCTION_OUT);
dlsch->last_iteration_cnt = ret;
......
......@@ -427,9 +427,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
#if UE_TIMING_TRACE
start_meas(&ue->generic_stat_bis[ue->current_thread_id[nr_tti_rx]][slot]);
#endif
if (first_symbol_flag==1) {
if (beamforming_mode==0){
if (dlsch0_harq->mimo_mode<NR_DUALSTREAM) {
//write_output("ch_estext_first.m","ch_estext",&pdsch_vars[eNB_id]->dl_ch_estimates_ext[0][1*16*12],5*16*12,1,13);
nr_dlsch_channel_level(pdsch_vars[eNB_id]->dl_ch_estimates_ext,
frame_parms,
avg,
......@@ -465,11 +469,11 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
}
}
//#ifdef UE_DEBUG_TRACE
LOG_D(PHY,"[DLSCH] AbsSubframe %d.%d log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n",
LOG_I(PHY,"[DLSCH] AbsSubframe %d.%d log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d), mimo_mode %d, symbol %d\n",
frame%1024,nr_tti_rx, pdsch_vars[eNB_id]->log2_maxh,
pdsch_vars[eNB_id]->log2_maxh0,
pdsch_vars[eNB_id]->log2_maxh1,
avg[0],avgs);
avg[0],avgs, dlsch0_harq->mimo_mode, symbol);
//LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode);
//#endif
......
......@@ -267,8 +267,8 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_IN);
LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers);
LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order);
LOG_I(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers);
LOG_I(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order);
// if (harq_process->Ndi == 1) { // this is a new packet
if (harq_process->round == 0) { // this is a new packet
......@@ -502,6 +502,9 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
}
LOG_I(PHY,"ULSCH coding C %d, A %d, G %d, E %d, Kb %d, F %d, Zc %d, Kr %d, BG %d\n", harq_process->C, A, G, E, Kb, F, *pz, Kr, BG);
LOG_I(PHY,"ULSCH coding Kr_bytes %d, encLen %d\n", Kr>>3, (3*Kr)+12);
memcpy(ulsch->g,harq_process->f,G); // g is the concatenated code block
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT);
......
......@@ -153,6 +153,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
unsigned int G = nr_get_G(nb_rb, number_of_symbols,
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl);
log_dump(PHY, harq_process_ul_ue->a, 8, LOG_DUMP_CHAR,"nrue pusch tx frame %d %d: ", frame, slot);
nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G);
///////////
......@@ -385,6 +387,59 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
}
}
}
#if 0 // LOG_PUSCH_FREQ_DATA
static int log_data_first_freq = 0;
if (log_data_first_freq == 0)
{
log_data_first_freq = 1;
LOG_M("txdataF_freq.m","txF",txdataF[0],frame_parms->ofdm_symbol_size *5,1,1);
}
#endif
#define LOG_PUSCH_PARAMES
#ifdef LOG_PUSCH_PARAMES
static int islog =0;
if(islog == 0)
{
//islog = 1;
LOG_I(MAC, "UE PUSCH PARAMS: rnti %d, bwpsize %d, bwpstart %d, subcarrier_spacing %d cyclic_prefix %d, Nid_cell %d\n",
pusch_pdu->rnti,
-1, //pusch_pdu->bwp_size,
-1, //pusch_pdu->bwp_start,
-1, //pusch_pdu->subcarrier_spacing,
-1, //pusch_pdu->cyclic_prefix
ulsch_ue->Nid_cell
);
LOG_I(MAC, "UE PUSCH PARAMS: target_code_rate %d, qam_mod_order %d, mcs_index %d, mcs_table %d , transform_precoding %d, data_scrambling_id %d\n",
-1, //code_rate,
mod_order,
-1,//harq_process_ul_ue->mcs,
0,
0,
ulsch_ue->Nid_cell); //harq_process_ul_ue->data_scrambling_id);
LOG_I(MAC, "UE PUSCH PARAMS: nrOfLayers %d, ul_dmrs_symb_pos %d dmrs_config_type %d, ul_dmrs_scrambling_id %d, scid %d, num_dmrs_cdm_grps_no_data %d\n",
pusch_pdu->nrOfLayers,
pusch_pdu->ul_dmrs_symb_pos,
pusch_pdu->dmrs_config_type,
-1, //harq_process_ul_ue->dmrs_scrambling_id[0],
-1, //pusch_pdu->scid,
pusch_pdu->num_dmrs_cdm_grps_no_data);
LOG_I(MAC, "UE PUSCH PARAMS: dmrs_ports %d, resource_alloc %d, rb_start %d, rb_size %d, vrb_to_prb_mapping %d, frequency_hopping %d, tx_direct_current_location %d, uplink_frequency_shift_7p5khz %d, start_symbol_index %d, nr_of_symbols %d\n",
1, //pusch_pdu->dmrs_ports,
1, //pusch_pdu->resource_alloc,
pusch_pdu->rb_start,
pusch_pdu->rb_size,
-1, //pusch_pdu->vrb_to_prb_mapping,
-1, //pusch_pdu->frequency_hopping,
-1, //pusch_pdu->tx_direct_current_location,
-1, //pusch_pdu->uplink_frequency_shift_7p5khz,
pusch_pdu->start_symbol_index,
pusch_pdu->nr_of_symbols);
}
#endif
}
NR_UL_UE_HARQ_t *harq_process_ulsch=NULL;
......
......@@ -235,7 +235,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
if (decodeSuccess) {
memcpy(ulsch_harq->b+rdata->offset,
ulsch_harq->c[r],
rdata->Kr_bytes- - (ulsch_harq->F>>3) -((ulsch_harq->C>1)?3:0));
rdata->Kr_bytes- - (ulsch_harq->F>>3) -((ulsch_harq->C>1)?3:0));
} else {
if ( rdata->nbSegments != ulsch_harq->processedSegments ) {
......@@ -253,7 +253,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
// if all segments are done
if (rdata->nbSegments == ulsch_harq->processedSegments) {
if (decodeSuccess) {
LOG_D(PHY,"[gNB %d] ULSCH: Setting ACK for nr_tti_rx %d TBS %d\n",
LOG_I(PHY,"[gNB %d] ULSCH: Setting ACK for nr_tti_rx %d TBS %d\n",
gNB->Mod_id,ulsch_harq->slot,ulsch_harq->TBS);
ulsch_harq->status = SCH_IDLE;
ulsch_harq->round = 0;
......@@ -261,8 +261,9 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
LOG_D(PHY, "ULSCH received ok \n");
nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0);
log_dump(PHY, ulsch_harq->b, 8, LOG_DUMP_CHAR,"gnb pusch rx frame %d %d: ", ulsch_harq->frame, ulsch_harq->slot);
} else {
LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n",
LOG_I(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n",
gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot,
rdata->harq_pid,ulsch_harq->status, ulsch_harq->round,ulsch_harq->TBS,r);
if (ulsch_harq->round >= ulsch->Mlimit) {
......
......@@ -1817,7 +1817,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if (dci_cnt > 0) {
LOG_D(PHY,"[UE %d] Frame %d, nr_tti_rx %d: found %d DCIs\n", ue->Mod_id, frame_rx, nr_tti_rx, dci_cnt);
LOG_I(PHY,"[UE %d] Frame %d, nr_tti_rx %d: found %d DCIs\n", ue->Mod_id, frame_rx, nr_tti_rx, dci_cnt);
NR_UE_DLSCH_t *dlsch = NULL;
if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active == 1){
......
......@@ -55,7 +55,8 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
if (rrc_inst) {
nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config);
if (IS_SOFTMODEM_NOS1){
// if (IS_SOFTMODEM_NOS1){
if (1) {
if (rlc_module_init(0) != 0) {
LOG_I(RLC, "Problem at RLC initiation \n");
}
......
......@@ -416,6 +416,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
//NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = mac->rach_ConfigDedicated;
int prach_genarate = 0;
// int32_t frame_diff = 0;
uint8_t sdu_lcids[NB_RB_MAX] = {0};
......@@ -510,8 +511,10 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
// Fill in preamble and PRACH resources
if (mac->generate_nr_prach == 1)
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
{
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 1, prach_resources, rach_ConfigDedicated);
prach_genarate = 1;
}
offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer
(uint8_t *) payload, // UL MAC pdu pointer
num_sdus, // num sdus
......@@ -556,7 +559,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
// Reset RA_active flag: it disables Msg3 retransmission (8.3 of TS 38.213)
// TbD Msg3 Retransmissions to be scheduled by DCI 0_0
mac->RA_active = 0;
//mac->RA_active = 0;
mac->RA_window_cnt = -1;
mac->ra_state = RA_SUCCEEDED;
mac->generate_nr_prach = 2;
......@@ -637,7 +640,10 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
// Fill in preamble and PRACH resources
if (mac->generate_nr_prach == 1)
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
{
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, prach_resources, rach_ConfigDedicated);
prach_genarate = 1;
}
} else {
......@@ -651,7 +657,10 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
// Fill in preamble and PRACH resources
if (mac->generate_nr_prach == 1)
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, prach_resources, prach_pdu, rach_ConfigDedicated);
{
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, prach_resources, rach_ConfigDedicated);
prach_genarate = 1;
}
}
}
......@@ -659,7 +668,8 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
LOG_D(MAC, "[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...", mod_id);
AssertFatal(1 == 0, "");
}
return mac->generate_nr_prach;
//return mac->generate_nr_prach;
return prach_genarate;
}
void nr_get_RA_window(NR_UE_MAC_INST_t *mac){
......
......@@ -287,7 +287,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
if (ss->searchSpaceType->choice.ue_Specific){
if(ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1){
// Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
if (get_softmodem_params()->phy_test == 1 && mac->crnti > 0) {
if (mac->ra_state == RA_SUCCEEDED && mac->crnti > 0) {
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n");
rel15->num_dci_options = 2;
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_1;
......@@ -326,5 +326,46 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
AssertFatal(1 == 0, "[DCI_CONFIG] Unrecognized search space type...");
break;
}
if (dl_config->number_pdus > 0)
{
#if 0 // LOG_PDCCH_PARAMES
static int log_first = 0;
if(log_first == 0)
{
//log_first =1;
LOG_I(MAC, "UE PDCCH PARAMS: frame %d %d, pdus %d, rnti %d, BWPSize %d, BWPStart %d, SubcarrierSpacing %d, CCE %d %d %d %d, L %d dci_length %d / %d, dci_format %d / %d, canditats %d\n",
frame,
slot,dl_config->number_pdus,
rel15->rnti,
rel15->BWPSize,
rel15->BWPStart,
rel15->SubcarrierSpacing,
rel15->CCE[0],rel15->CCE[1],rel15->CCE[2],rel15->CCE[3],
rel15->L[0],
rel15->dci_length_options[0],rel15->dci_length_options[1],
rel15->dci_format_options[0], rel15->dci_format_options[1],
rel15->number_of_candidates);
LOG_I(MAC, "UE PDCCH PARAMS: coreset:frequency_domain_resource %d %d %d %d %d %d\n", rel15->coreset.frequency_domain_resource[0],
rel15->coreset.frequency_domain_resource[1],
rel15->coreset.frequency_domain_resource[2],
rel15->coreset.frequency_domain_resource[3],
rel15->coreset.frequency_domain_resource[4],
rel15->coreset.frequency_domain_resource[5]);
LOG_I(MAC, "UE PDCCH PARAMS: coreset:StartSymbolIndex %d duration %d CceRegMappingType %d RegBundleSize %d InterleaverSize %d ShiftIndex %d CoreSetType %d precoder_granularity %d, pdcch_dmrs_scrambling_id %d, scrambling_rnti %d\n",
rel15->coreset.StartSymbolIndex,
rel15->coreset.duration,
rel15->coreset.CceRegMappingType,
rel15->coreset.RegBundleSize,
rel15->coreset.InterleaverSize,
rel15->coreset.ShiftIndex,
rel15->coreset.CoreSetType,
rel15->coreset.precoder_granularity,
rel15->coreset.pdcch_dmrs_scrambling_id,
rel15->coreset.scrambling_rnti);
}
#endif
}
}
}
......@@ -1450,9 +1450,15 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
*/
}
} else if (ul_info) {
if (get_softmodem_params()->phy_test && ul_info->slot_tx == 8) { // ULSCH is handled only in phy-test mode (consistently with OAI gNB)
NR_UE_MAC_INST_t *mac = get_mac_inst(ul_info->module_id);
//if (get_softmodem_params()->phy_test && ul_info->slot_tx == 8) { // ULSCH is handled only in phy-test mode (consistently with OAI gNB)
if ((mac->ra_state == RA_SUCCEEDED) && ( ul_info->slot_tx == 8)) {
static int skip_the_first = 0;
if (skip_the_first == 0)
{
skip_the_first = 1;
return UE_CONNECTION_OK;
}
uint8_t nb_dmrs_re_per_rb;
uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
uint8_t data_existing = 0;
......@@ -1487,6 +1493,14 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
uint8_t start_symbol_index = ulcfg_pdu->pusch_config_pdu.start_symbol_index;
uint8_t nrOfLayers = 1;
uint8_t mcs_index = ulcfg_pdu->pusch_config_pdu.mcs_index;
rb_size = 106;
rb_start = 0;
nr_of_symbols = 11;
start_symbol_index = 0;
mcs_index = 9;
uint8_t mcs_table = ulcfg_pdu->pusch_config_pdu.mcs_table;
uint8_t harq_process_id = ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id;
uint8_t rv_index = ulcfg_pdu->pusch_config_pdu.pusch_data.rv_index;
......@@ -1507,10 +1521,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
#ifdef DEBUG_DCI
LOG_I(MAC, " UL config params \n rnti: %x \n rb_size: %d \n",
rnti, rb_size);
LOG_I(MAC, "rb_start: %x \n nr_of_symbols: %d \n start_symbol_index: %d \n nrOfLayers: %d \n mcs_index: %d \n \
LOG_I(MAC, "rb_start: %d \n nr_of_symbols: %d \n start_symbol_index: %d \n nrOfLayers: %d \n mcs_index: %d \n \
mcs_table: %d \n harq_process_id: %d \n ndi: %d \n num_cb: %d \n rv_index: %d \n",
rb_start, nr_of_symbols, start_symbol_index, nrOfLayers, mcs_index,
mcs_table, harq_process_id, ndi, num_cb, rv_index);
mcs_table, harq_process_id, -1, -1, rv_index);
#endif
// PTRS ports configuration
......@@ -1673,7 +1687,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
}
//}
LOG_D(MAC, "[UE %d] Frame %d, Subframe %d Adding Msg3 UL Config Request for rnti: %x\n",
LOG_I(MAC, "[UE %d] Frame %d, Subframe %d Adding Msg3 UL Config Request for rnti: %x\n",
ul_info->module_id,
ul_info->frame_tx,
ul_info->slot_tx,
......
......@@ -194,6 +194,52 @@ void nr_config_Msg3_pdu(NR_UE_MAC_INST_t *mac,
0, // TBR to verify tb scaling
pusch_config_pdu->nrOfLayers)/8;
#define LOG_PUSCH_PARAMES
#ifdef LOG_PUSCH_PARAMES
static int islog =0;
if(islog == 0)
{
//islog = 1;
LOG_I(MAC, "UE PUSCH PARAMS: rnti %d, bwpsize %d, bwpstart %d, subcarrier_spacing %d cyclic_prefix %d, Nid_cell %d\n",
pusch_config_pdu->rnti,
pusch_config_pdu->bwp_size,
pusch_config_pdu->bwp_start,
pusch_config_pdu->subcarrier_spacing,
-1, //pusch_pdu->cyclic_prefix
*scc->physCellId
);
LOG_I(MAC, "UE PUSCH PARAMS: target_code_rate %d, qam_mod_order %d, mcs_index %d, mcs_table %d , transform_precoding %d, data_scrambling_id %d\n",
pusch_config_pdu->target_code_rate,
pusch_config_pdu->qam_mod_order,
pusch_config_pdu->mcs_index,
pusch_config_pdu->mcs_table,
pusch_config_pdu->transform_precoding,
pusch_config_pdu->data_scrambling_id);
LOG_I(MAC, "UE PUSCH PARAMS: nrOfLayers %d, ul_dmrs_symb_pos %d dmrs_config_type %d, ul_dmrs_scrambling_id %d, scid %d, num_dmrs_cdm_grps_no_data %d\n",
pusch_config_pdu->nrOfLayers,
pusch_config_pdu->ul_dmrs_symb_pos,
pusch_config_pdu->dmrs_config_type,
pusch_config_pdu->ul_dmrs_scrambling_id,
-1, //pusch_pdu->scid,
pusch_config_pdu->num_dmrs_cdm_grps_no_data);
LOG_I(MAC, "UE PUSCH PARAMS: dmrs_ports %d, resource_alloc %d, rb_start %d, rb_size %d, vrb_to_prb_mapping %d, frequency_hopping %d, tx_direct_current_location %d, uplink_frequency_shift_7p5khz %d, start_symbol_index %d, nr_of_symbols %d\n",
pusch_config_pdu->dmrs_ports,
pusch_config_pdu->resource_alloc,
pusch_config_pdu->rb_start,
pusch_config_pdu->rb_size,
pusch_config_pdu->vrb_to_prb_mapping,
-1, //pusch_pdu->frequency_hopping,
-1, //pusch_pdu->tx_direct_current_location,
pusch_config_pdu->uplink_frequency_shift_7p5khz,
pusch_config_pdu->start_symbol_index,
pusch_config_pdu->nr_of_symbols);
}
#endif
}
/////////////////////////////////////
......@@ -327,17 +373,17 @@ uint16_t nr_ue_process_rar(module_id_t mod_id,
// frequency hopping
freq_hopping = (unsigned char) (rar->UL_GRANT_1 >> 2);
#ifdef DEBUG_RAR
LOG_D(MAC, "[DEBUG_RAR] Received RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti %x \n",
//#ifdef DEBUG_RAR
LOG_I(MAC, "[DEBUG_RAR] Received RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti %x \n",
Msg3_t_alloc,
Msg3_f_alloc,
ta_command,
mcs,
freq_hopping,
tpc_command,
csi_req,
-1, //csi_req,
ue_mac->t_crnti);
#endif
//#endif
// Config Msg3 PDU
nr_config_Msg3_pdu(ue_mac, Msg3_f_alloc, Msg3_t_alloc, mcs, freq_hopping);
......
......@@ -710,6 +710,46 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
// calling function to fill rar message
nr_fill_rar(module_idP, ra, cc->RAR_pdu.payload, pusch_pdu);
#if 1 //#ifdef LOG_PUSCH_PARAMES
static int log_first = 0;
if (log_first == 0)
{
log_first = 1;
LOG_I(MAC, "pusch configure: rnti %d, bwpsize %d, bwpstart %d, subcarrier_spacing %d cyclic_prefix %d\n",
pusch_pdu->rnti,
pusch_pdu->bwp_size,
pusch_pdu->bwp_start,
pusch_pdu->subcarrier_spacing,
pusch_pdu->cyclic_prefix);
LOG_I(MAC, "pusch configure: target_code_rate %d, qam_mod_order %d, mcs_index %d, mcs_table %d , transform_precoding %d, data_scrambling_id %d\n",
pusch_pdu->target_code_rate,
pusch_pdu->qam_mod_order,
pusch_pdu->mcs_index,
pusch_pdu->mcs_table,
pusch_pdu->transform_precoding,
pusch_pdu->data_scrambling_id);
LOG_I(MAC, "pusch configure: nrOfLayers %d, ul_dmrs_symb_pos %d dmrs_config_type %d, ul_dmrs_scrambling_id %d, scid %d, num_dmrs_cdm_grps_no_data %d\n",
pusch_pdu->nrOfLayers,
pusch_pdu->ul_dmrs_symb_pos,
pusch_pdu->dmrs_config_type,
pusch_pdu->ul_dmrs_scrambling_id,
pusch_pdu->scid,
pusch_pdu->num_dmrs_cdm_grps_no_data);
LOG_I(MAC, "pusch configure: dmrs_ports %d, resource_alloc %d, rb_start %d, rb_size %d, vrb_to_prb_mapping %d, frequency_hopping %d, tx_direct_current_location %d, uplink_frequency_shift_7p5khz %d, start_symbol_index %d, nr_of_symbols %d\n",
pusch_pdu->dmrs_ports,
pusch_pdu->resource_alloc,
pusch_pdu->rb_start,
pusch_pdu->rb_size,
pusch_pdu->vrb_to_prb_mapping,
pusch_pdu->frequency_hopping,
pusch_pdu->tx_direct_current_location,
pusch_pdu->uplink_frequency_shift_7p5khz,
pusch_pdu->start_symbol_index,
pusch_pdu->nr_of_symbols);
}
#endif
}
// WIP
......@@ -790,7 +830,7 @@ void nr_generate_Msg2(module_id_t module_idP,
mcsIndex = 9;
else
mcsIndex = 0;
pdsch_pdu_rel15->pduBitmap = 0;
pdsch_pdu_rel15->rnti = RA_rnti;
pdsch_pdu_rel15->pduIndex = 0;
......@@ -824,7 +864,7 @@ void nr_generate_Msg2(module_id_t module_idP,
pdsch_pdu_rel15->dmrsPorts = 1;
pdsch_pdu_rel15->resourceAlloc = 1;
pdsch_pdu_rel15->rbStart = 0;
pdsch_pdu_rel15->rbSize = 6;
pdsch_pdu_rel15->rbSize = 16;
pdsch_pdu_rel15->VRBtoPRBMapping = 0; // non interleaved
for (int i=0; i<bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count; i++) {
......@@ -931,7 +971,54 @@ void nr_generate_Msg2(module_id_t module_idP,
uint16_t *vrb_map = cc[CC_id].vrb_map;
for (int rb = 0; rb < pdsch_pdu_rel15->rbSize; rb++)
vrb_map[rb + pdsch_pdu_rel15->rbStart] = 1;
#if 1 // LOG_PDSCH_PARAMES
static int log_first_pdsch_ra = 0;
if (log_first_pdsch_ra == 0)
{
//log_first_pdsch_ra = 1;
LOG_I(MAC, "NB PDSCH PARAMS: RA rnti %d, bwp (%d, %d), scs %d, codewords %d, coderate %d, mod %d, mcs (%d, %d), rv %d, dataScramId %d, layers %d, tm %d, refPoint %d \n ",
pdsch_pdu_rel15->rnti,
pdsch_pdu_rel15->BWPSize,
pdsch_pdu_rel15->BWPStart,
pdsch_pdu_rel15->SubcarrierSpacing,
pdsch_pdu_rel15->NrOfCodewords,
pdsch_pdu_rel15->targetCodeRate[0],
pdsch_pdu_rel15->qamModOrder[0],
pdsch_pdu_rel15->mcsIndex[0],
pdsch_pdu_rel15->mcsTable[0],
pdsch_pdu_rel15->rvIndex[0],
pdsch_pdu_rel15->dataScramblingId,
pdsch_pdu_rel15->nrOfLayers,
pdsch_pdu_rel15->transmissionScheme,
pdsch_pdu_rel15->refPoint
);
LOG_I(MAC, "NB PDSCH PARAMS: RA dlDmrsScramblingId %d, scid %d, numDmrsCdmGrpsNoData %d, dmrsPorts %d, resourceAlloc %d, rb (%d, %d), symb (%d, %d), dmrsType %d, dmrsPos %d, vrb2prb %d\n",
pdsch_pdu_rel15->dlDmrsScramblingId,
pdsch_pdu_rel15->SCID,
pdsch_pdu_rel15->numDmrsCdmGrpsNoData,
pdsch_pdu_rel15->dmrsPorts,
pdsch_pdu_rel15->resourceAlloc,
pdsch_pdu_rel15->rbStart,
pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->StartSymbolIndex,
pdsch_pdu_rel15->NrOfSymbols,
pdsch_pdu_rel15->dmrsConfigType,
pdsch_pdu_rel15->dlDmrsSymbPos,
pdsch_pdu_rel15->VRBtoPRBMapping
);
}
#endif
}
}
void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){
......
......@@ -498,6 +498,13 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
lcid,
0,
0);
sched_ctrl->rlc_status[lcid].bytes_in_buffer = 500;
LOG_I(MAC,
"%d.%d, DTCH%d->DLSCH, RLC status %d bytes\n",
frame,
slot,
lcid,
sched_ctrl->rlc_status[lcid].bytes_in_buffer);
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
if (sched_ctrl->num_total_bytes == 0
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
......@@ -742,6 +749,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
unsigned char sdu_lcids[NB_RB_MAX] = {0};
const int lcid = DL_SCH_LCID_DTCH;
if (sched_ctrl->num_total_bytes > 0) {
#if 1
LOG_D(MAC,
"[gNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting "
"%d bytes from RLC (lcid %d total hdr len %d), TBS: %d \n \n",
......@@ -753,7 +761,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
TBS);
sdu_lengths[num_sdus] = mac_rlc_data_req(module_id,
rnti,
0x1234,
module_id,
frame,
ENB_FLAG_YES,
......@@ -775,6 +783,20 @@ void nr_schedule_ue_spec(module_id_t module_id,
header_length_last = 1 + 1 + (sdu_lengths[num_sdus] >= 128);
header_length_total += header_length_last;
num_sdus++;
#else
LOG_D(MAC, "Configuring DL_TX in %d.%d: random data\n", frame, slot);
// fill dlsch_buffer with random data
for (int i = 0; i < TBS; i++)
mac_sdus[i] = (unsigned char) (lrand48()&0xff);
sdu_lcids[0] = 0x3f; // DRB
sdu_lengths[0] = TBS - ta_len - 3;
header_length_total += 2 + (sdu_lengths[0] >= 128);
sdu_length_total += sdu_lengths[0];
num_sdus +=1;
#endif
//ue_sched_ctl->uplane_inactivity_timer = 0;
}
else if (get_softmodem_params()->phy_test) {
LOG_D(MAC, "Configuring DL_TX in %d.%d: random data\n", frame, slot);
......
......@@ -529,7 +529,7 @@ void schedule_fapi_ul_pdu(int Mod_idP,
nfapi_nr_pusch_pdu_t *pusch_pdu = &pusch_sched->pusch_pdu;
memset(pusch_pdu,0,sizeof(nfapi_nr_pusch_pdu_t));
LOG_D(MAC, "Scheduling UE specific PUSCH\n");
LOG_I(MAC, "Scheduling UE specific PUSCH\n");
//UL_tti_req = &nr_mac->UL_tti_req[CC_id];
int dci_formats[2];
......@@ -766,7 +766,7 @@ void schedule_fapi_ul_pdu(int Mod_idP,
UL_dci_req->numPdus+=1;
LOG_D(MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frameP,slotP);
LOG_I(MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frameP,slotP);
uint8_t nr_of_candidates, aggregation_level;
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss);
......@@ -803,6 +803,52 @@ void schedule_fapi_ul_pdu(int Mod_idP,
fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pusch_pdu->bwp_size,bwp_id);
free(dci_pdu_rel15);
}
#define LOG_PUSCH_PARAMES
#ifdef LOG_PUSCH_PARAMES
static int islog =0;
if(islog == 0)
{
//islog = 1;
LOG_I(MAC, "UE PUSCH PARAMS: frame %d, %d , rnti %d, bwpsize %d, bwpstart %d, subcarrier_spacing %d cyclic_prefix %d, Nid_cell %d, num_slots_per_tdd %d\n",
pusch_sched->frame,
pusch_sched->slot,
pusch_pdu->rnti,
pusch_pdu->bwp_size,
pusch_pdu->bwp_start,
pusch_pdu->subcarrier_spacing,
-1, //pusch_pdu->cyclic_prefix
*scc->physCellId,
num_slots_per_tdd
);
LOG_I(MAC, "UE PUSCH PARAMS: target_code_rate %d, qam_mod_order %d, mcs_index %d, mcs_table %d , transform_precoding %d, data_scrambling_id %d\n",
pusch_pdu->target_code_rate,
pusch_pdu->qam_mod_order,
pusch_pdu->mcs_index,
pusch_pdu->mcs_table,
pusch_pdu->transform_precoding,
pusch_pdu->data_scrambling_id);
LOG_I(MAC, "UE PUSCH PARAMS: nrOfLayers %d, ul_dmrs_symb_pos %d dmrs_config_type %d, ul_dmrs_scrambling_id %d, scid %d, num_dmrs_cdm_grps_no_data %d\n",
pusch_pdu->nrOfLayers,
pusch_pdu->ul_dmrs_symb_pos,
pusch_pdu->dmrs_config_type,
pusch_pdu->ul_dmrs_scrambling_id,
-1, //pusch_pdu->scid,
pusch_pdu->num_dmrs_cdm_grps_no_data);
LOG_I(MAC, "UE PUSCH PARAMS: dmrs_ports %d, resource_alloc %d, rb_start %d, rb_size %d, vrb_to_prb_mapping %d, frequency_hopping %d, tx_direct_current_location %d, uplink_frequency_shift_7p5khz %d, start_symbol_index %d, nr_of_symbols %d\n",
pusch_pdu->dmrs_ports,
pusch_pdu->resource_alloc,
pusch_pdu->rb_start,
pusch_pdu->rb_size,
pusch_pdu->vrb_to_prb_mapping,
-1, //pusch_pdu->frequency_hopping,
-1, //pusch_pdu->tx_direct_current_location,
pusch_pdu->uplink_frequency_shift_7p5khz,
pusch_pdu->start_symbol_index,
pusch_pdu->nr_of_symbols);
}
#endif
}
}
......@@ -621,6 +621,84 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
TBS);
dl_req->nPDUs += 2;
#if 1 // LOG_PDCCH_PARAMES
static int log_first = 0;
if(log_first == 0)
{
//log_first =1;
LOG_I(MAC, "NB PDCCH PARAMS: rnti %d, BWPSize %d, BWPStart %d, SubcarrierSpacing %d, CCE %d, L %d dci_length %d dci_format %d dci index %d\n",
pdcch_pdu_rel15->dci_pdu.RNTI[0],
pdcch_pdu_rel15->BWPSize,
pdcch_pdu_rel15->BWPStart,
pdcch_pdu_rel15->SubcarrierSpacing,
pdcch_pdu_rel15->dci_pdu.CceIndex[pdcch_pdu_rel15->numDlDci-1],
pdcch_pdu_rel15->dci_pdu.AggregationLevel[pdcch_pdu_rel15->numDlDci-1],
pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[pdcch_pdu_rel15->numDlDci-1],
dci_formats[0], pdcch_pdu_rel15->numDlDci-1);
LOG_I(MAC, "NB PDCCH PARAMS: coreset:frequency_domain_resource %d %d %d %d %d %d\n", pdcch_pdu_rel15->FreqDomainResource[0],
pdcch_pdu_rel15->FreqDomainResource[1],
pdcch_pdu_rel15->FreqDomainResource[2],
pdcch_pdu_rel15->FreqDomainResource[3],
pdcch_pdu_rel15->FreqDomainResource[4],
pdcch_pdu_rel15->FreqDomainResource[5]);
LOG_I(MAC, "NB PDCCH PARAMS: coreset:StartSymbolIndex %d duration %d CceRegMappingType %d RegBundleSize %d InterleaverSize %d ShiftIndex %d CoreSetType %d precoder_granularity %d, pdcch_dmrs_scrambling_id %d,scrambling_rnti %d\n",
pdcch_pdu_rel15->StartSymbolIndex,
pdcch_pdu_rel15->DurationSymbols,
pdcch_pdu_rel15->CceRegMappingType,
pdcch_pdu_rel15->RegBundleSize,
pdcch_pdu_rel15->InterleaverSize,
pdcch_pdu_rel15->ShiftIndex,
pdcch_pdu_rel15->CoreSetType,
pdcch_pdu_rel15->precoderGranularity,
pdcch_pdu_rel15->dci_pdu.ScramblingId[0],
pdcch_pdu_rel15->dci_pdu.ScramblingRNTI[0]);
}
#endif
#if 1 // LOG_PDSCH_PARAMES
static int log_first_pdsch = 0;
if (log_first_pdsch == 0)
{
//log_first_pdsch = 1;
LOG_I(MAC, "NB PDSCH PARAMS: rnti %d, bwp (%d, %d), scs %d, codewords %d, coderate %d, mod %d, mcs (%d, %d), rv %d, dataScramId %d, layers %d, tm %d, refPoint %d \n ",
pdsch_pdu_rel15->rnti,
pdsch_pdu_rel15->BWPSize,
pdsch_pdu_rel15->BWPStart,
pdsch_pdu_rel15->SubcarrierSpacing,
pdsch_pdu_rel15->NrOfCodewords,
pdsch_pdu_rel15->targetCodeRate[0],
pdsch_pdu_rel15->qamModOrder[0],
pdsch_pdu_rel15->mcsIndex[0],
pdsch_pdu_rel15->mcsTable[0],
pdsch_pdu_rel15->rvIndex[0],
pdsch_pdu_rel15->dataScramblingId,
pdsch_pdu_rel15->nrOfLayers,
pdsch_pdu_rel15->transmissionScheme,
pdsch_pdu_rel15->refPoint
);
LOG_I(MAC, "NB PDSCH PARAMS: dlDmrsScramblingId %d, scid %d, numDmrsCdmGrpsNoData %d, dmrsPorts %d, resourceAlloc %d, rb (%d, %d), symb (%d, %d), dmrsType %d, dmrsPos %d, vrb2prb %d\n",
pdsch_pdu_rel15->dlDmrsScramblingId,
pdsch_pdu_rel15->SCID,
pdsch_pdu_rel15->numDmrsCdmGrpsNoData,
pdsch_pdu_rel15->dmrsPorts,
pdsch_pdu_rel15->resourceAlloc,
pdsch_pdu_rel15->rbStart,
pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->StartSymbolIndex,
pdsch_pdu_rel15->NrOfSymbols,
pdsch_pdu_rel15->dmrsConfigType,
pdsch_pdu_rel15->dlDmrsSymbPos,
pdsch_pdu_rel15->VRBtoPRBMapping
);
}
#endif
}
void nr_configure_pdcch(gNB_MAC_INST *nr_mac,
......
......@@ -232,7 +232,7 @@ void nr_process_mac_pdu(
}
else{
mac_rlc_data_ind(module_idP,
rnti,
0x1234,
module_idP,
frameP,
ENB_FLAG_YES,
......
......@@ -94,7 +94,7 @@ void mac_top_init_gNB(void)
// These should be out of here later
pdcp_layer_init();
if(IS_SOFTMODEM_NOS1)
// if(IS_SOFTMODEM_NOS1)
nr_DRB_preconfiguration();
rrc_init_nr_global_param();
......
......@@ -21,17 +21,18 @@
#ifndef _NR_PDCP_ENTITY_H_
#define _NR_PDCP_ENTITY_H_
#include "platform_types.h"
typedef struct nr_pdcp_entity_t {
/* functions provided by the PDCP module */
void (*recv_pdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size);
void (*recv_pdu)(protocol_ctxt_t *ctxt_pP,struct nr_pdcp_entity_t *entity, char *buffer, int size);
void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size,
int sdu_id);
void (*delete)(struct nr_pdcp_entity_t *entity);
void (*set_integrity_key)(struct nr_pdcp_entity_t *entity, char *key);
/* callbacks provided to the PDCP module */
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
void (*deliver_sdu)(protocol_ctxt_t *ctxt_pP,void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
char *buf, int size);
void *deliver_sdu_data;
void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity,
......
......@@ -25,13 +25,13 @@
#include <stdlib.h>
#include <string.h>
void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int size)
void nr_pdcp_entity_drb_am_recv_pdu( protocol_ctxt_t *ctxt_pP , nr_pdcp_entity_t *_entity, char *buffer, int size)
{
nr_pdcp_entity_drb_am_t *entity = (nr_pdcp_entity_drb_am_t *)_entity;
if (size < 3) abort();
if (!(buffer[0] & 0x80)) { printf("%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); exit(1); }
entity->common.deliver_sdu(entity->common.deliver_sdu_data,
entity->common.deliver_sdu(ctxt_pP, entity->common.deliver_sdu_data,
(nr_pdcp_entity_t *)entity, buffer+3, size-3);
}
......
......@@ -23,13 +23,14 @@
#define _NR_PDCP_ENTITY_DRB_AM_H_
#include "nr_pdcp_entity.h"
#include "platform_types.h"
typedef struct {
nr_pdcp_entity_t common;
int rb_id;
} nr_pdcp_entity_drb_am_t;
void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *entity, char *buffer, int size);
void nr_pdcp_entity_drb_am_recv_pdu(protocol_ctxt_t *ctxt_pP,nr_pdcp_entity_t *entity, char *buffer, int size);
void nr_pdcp_entity_drb_am_recv_sdu(nr_pdcp_entity_t *entity, char *buffer, int size,
int sdu_id);
void nr_pdcp_entity_drb_am_set_integrity_key(nr_pdcp_entity_t *entity, char *key);
......
......@@ -92,6 +92,65 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con
const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list);
//------------------------------------------------------------------------------
void
nr_rrc_data_ind(
const protocol_ctxt_t *const ctxt_pP,
const rb_id_t Srb_id,
const sdu_size_t sdu_sizeP,
const uint8_t *const buffer_pP
)
//------------------------------------------------------------------------------
{
rb_id_t DCCH_index = Srb_id;
LOG_I(RRC, "[UE %x] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from eNB %d\n",
ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP, ctxt_pP->eNB_index);
{
MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
uint8_t *message_buffer;
message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, sdu_sizeP);
memcpy (message_buffer, buffer_pP, sdu_sizeP);
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, NR_RRC_DCCH_DATA_IND);
NR_RRC_DCCH_DATA_IND (message_p).frame = ctxt_pP->frame;
NR_RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
NR_RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP;
NR_RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer;
NR_RRC_DCCH_DATA_IND (message_p).rnti = ctxt_pP->rnti;
NR_RRC_DCCH_DATA_IND (message_p).module_id = ctxt_pP->module_id;
NR_RRC_DCCH_DATA_IND (message_p).gNB_index = ctxt_pP->eNB_index;
itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, ctxt_pP->instance, message_p);
}
}
//------------------------------------------------------------------------------
void
nr_rrc_data_ind_ccch(
const protocol_ctxt_t *const ctxt_pP,
const rb_id_t Srb_id,
const sdu_size_t sdu_sizeP,
const uint8_t *const buffer_pP
)
//------------------------------------------------------------------------------
{
rb_id_t DCCH_index = Srb_id;
LOG_I(RRC, "[UE %x] Frame %d: received a CCCH %ld message on SRB 0 with Size %d from gNB %d\n",
ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP, ctxt_pP->eNB_index);
{
MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, NR_RRC_MAC_CCCH_DATA_IND);
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = ctxt_pP->frame;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_sizeP;
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = 0x1234;
memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu,buffer_pP,sdu_sizeP);
itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_GNB : TASK_RRC_NRUE, ctxt_pP->instance, message_p);
}
}
static void *rlc_data_req_thread(void *_)
{
int i;
......@@ -236,9 +295,9 @@ printf("\n\n\n########## nas_sock_fd read returns len %d\n", len);
ctxt.rnti = rnti;
pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
// pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
// RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
// PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
}
return NULL;
......@@ -280,9 +339,9 @@ printf("\n\n\n########## nas_sock_fd read returns len %d\n", len);
ctxt.rnti = rnti;
pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
// pdcp_data_req(&ctxt, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED,
// RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf,
// PDCP_TRANSMISSION_MODE_DATA, NULL, NULL);
}
return NULL;
......@@ -394,8 +453,8 @@ uint64_t pdcp_module_init(uint64_t _pdcp_optmask)
}
return pdcp_optmask ;
}
static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
static int liuyu=0;
static void deliver_sdu_drb(protocol_ctxt_t *ctxt_pP,void *_ue, nr_pdcp_entity_t *entity,
char *buf, int size)
{
extern int nas_sock_fd[];
......@@ -406,12 +465,34 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity,
int rb_id;
int i;
if(IS_SOFTMODEM_NOS1){
if (1) { //(IS_SOFTMODEM_NOS1){
#if 1
log_dump(PDCP,buf,size,LOG_DUMP_CHAR," PDCP Received SDU:\n");
if (size > 4700)
{
LOG_I(PDCP,"maybe ip data \n");
}
else
{
LOG_I(PDCP,"send to gNB RRC \n");
if(liuyu==2)
liuyu=1;
if(liuyu==0)
nr_rrc_data_ind_ccch( ctxt_pP, 1, size, buf);
if(liuyu==1)
nr_rrc_data_ind( ctxt_pP, 1, size, buf);
liuyu++;
}
#else
len = write(nas_sock_fd[0], buf, size);
if (len != size) {
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
#endif
}
else{
for (i = 0; i < 5; i++) {
......@@ -528,7 +609,7 @@ boolean_t pdcp_data_ind(
}
if (rb != NULL) {
rb->recv_pdu(rb, (char *)sdu_buffer->data, sdu_buffer_size);
rb->recv_pdu(ctxt_pP,rb, (char *)sdu_buffer->data, sdu_buffer_size);
} else {
LOG_E(PDCP, "%s:%d:%s: fatal: no RB found (rb_id %ld, srb_flag %d)\n",
__FILE__, __LINE__, __FUNCTION__, rb_id, srb_flagP);
......@@ -970,7 +1051,7 @@ boolean_t pdcp_data_req(
#endif
)
{
if (srb_flagP) { TODO; }
//if (srb_flagP) { TODO; }
return pdcp_data_req_drb(ctxt_pP, rb_id, muiP, confirmP, sdu_buffer_size,
sdu_buffer);
}
......
......@@ -402,6 +402,32 @@ rrc_gNB_generate_RRCSetup(
ue_context_pP->ue_context.ue_release_timer_thres = 1000;
/* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
printf("--------------------------------gnb send rrc setup to ue ----------liuyu---------------");
MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
uint8_t *message_buffer;
message_buffer = itti_malloc(
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
ue_p->Srb0.Tx_buffer.payload_size);
memcpy(message_buffer,ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size);
message_p = itti_alloc_new_message(ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
RRC_DCCH_DATA_REQ(message_p).frame = ctxt_pP->frame;
RRC_DCCH_DATA_REQ(message_p).enb_flag = ctxt_pP->enb_flag;
RRC_DCCH_DATA_REQ(message_p).rb_id = 1;
RRC_DCCH_DATA_REQ(message_p).muip = 1;
RRC_DCCH_DATA_REQ(message_p).confirmp = SDU_CONFIRM_NO;
RRC_DCCH_DATA_REQ(message_p).sdu_size = ue_p->Srb0.Tx_buffer.payload_size;
RRC_DCCH_DATA_REQ(message_p).sdu_p = message_buffer;
RRC_DCCH_DATA_REQ(message_p).mode = PDCP_TRANSMISSION_MODE_CONTROL;
RRC_DCCH_DATA_REQ(message_p).module_id = ctxt_pP->module_id;
RRC_DCCH_DATA_REQ(message_p).rnti = 0x1234;//ctxt_pP->rnti;
RRC_DCCH_DATA_REQ(message_p).eNB_index = ctxt_pP->eNB_index;
itti_send_msg_to_task(
TASK_PDCP_ENB,
ctxt_pP->instance,
message_p);
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
......@@ -734,6 +760,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
return -1;
}
xer_fprint(stdout,&asn_DEF_NR_UL_CCCH_Message,(void *)ul_ccch_msg);
if (ul_ccch_msg->message.present == NR_UL_CCCH_MessageType_PR_c1) {
switch (ul_ccch_msg->message.choice.c1->present) {
......
......@@ -161,7 +161,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
*secondaryCellGroup->spCellConfig->servCellIndex = servCellIndex;
secondaryCellGroup->spCellConfig->reconfigurationWithSync=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->reconfigurationWithSync));
secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon=servingcellconfigcommon;
secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity=(get_softmodem_params()->phy_test==1) ? 0x1234 : (taus()&0xffff);
secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity=0x1234;//(get_softmodem_params()->phy_test==1) ? 0x1234 : (taus()&0xffff);
secondaryCellGroup->spCellConfig->reconfigurationWithSync->t304=NR_ReconfigurationWithSync__t304_ms2000;
secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = NULL;
secondaryCellGroup->spCellConfig->reconfigurationWithSync->ext1 = NULL;
......
......@@ -91,7 +91,7 @@ rrc_data_req_ue(
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
RRC_DCCH_DATA_REQ (message_p).rb_id = 1;
RRC_DCCH_DATA_REQ (message_p).muip = muiP;
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP;
......
......@@ -1755,11 +1755,11 @@ void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, cons
}
LOG_T(NR_RRC,"\n");
// NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size =
// do_RRCSetupRequest(
// ctxt_pP->module_id,
// (uint8_t *)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,
// rv);
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size =
do_RRCSetupRequest(
ctxt_pP->module_id,
(uint8_t *)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,
rv);
LOG_I(NR_RRC,"[UE %d] : Frame %d, Logical Channel UL-CCCH (SRB0), Generating RRCSetupRequest (bytes %d, eNB %d)\n",
ctxt_pP->module_id, ctxt_pP->frame, NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size, gNB_index);
......@@ -1771,6 +1771,17 @@ void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, cons
/*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff;
UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */
log_dump(RRC,NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size,
LOG_DUMP_CHAR," Received bytes:\n");
rrc_data_req_ue (
ctxt_pP,
DCCH,
nr_rrc_mui++,
SDU_CONFIRM_NO,
NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size,
(uint8_t *)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload,
PDCP_TRANSMISSION_MODE_CONTROL);
#ifdef ITTI_SIM
MessageDef *message_p;
uint8_t *message_buffer;
......
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