Commit bd903cfe authored by Nick Ho's avatar Nick Ho

Modify IF Module to fit the FAPI Specification

parent 28991862
......@@ -128,12 +128,6 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
//if ((fp->frame_type == TDD) && (subframe_select(fp,subframe)!=SF_UL)) return;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC+offset, 1 );
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d] Frame %d: Doing phy_procedures_eNB_uespec_RX(%d)\n",eNB->Mod_id,frame, subframe);
LOG_D(PHY,"[eNB %d] Frame %d: Set the Common part in UL_IND\n",eNB->Mod_id,frame);
#endif
//check if any RB using in this UL subframe
eNB->rb_mask_ul[0]=0;
......@@ -149,21 +143,22 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
// delete the srs
/*Loop over the UE, i is the UE ID */
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
for (i=0; i<NUMBER_OF_UE_MAX; i++)
{
// delete srs
// delete Pucch procedure
// check for Msg3
if (eNB->mac_enabled==1) {
if (eNB->UE_stats[i].mode == RA_RESPONSE) {
if (eNB->mac_enabled==1)
{
if (eNB->UE_stats[i].mode == RA_RESPONSE)
{
/*Process Msg3 TODO*/
//process_Msg3(eNB,proc,i,harq_pid);
}
}
eNB->pusch_stats_rb[i][(frame*10)+subframe] = -63;
eNB->pusch_stats_round[i][(frame*10)+subframe] = 0;
eNB->pusch_stats_mcs[i][(frame*10)+subframe] = -63;
......@@ -171,153 +166,68 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
/*Check if this UE is has ULSCH scheduling*/
if ((eNB->ulsch[i]) &&
(eNB->ulsch[i]->rnti>0) &&
(eNB->ulsch[i]->harq_processes[harq_pid]->subframe_scheduling_flag==1)) {
(eNB->ulsch[i]->harq_processes[harq_pid]->subframe_scheduling_flag==1))
{
// UE is has ULSCH scheduling
round = eNB->ulsch[i]->harq_processes[harq_pid]->round;
/*NB-IoT The nb_rb always set to 1 */
for (int rb=0;
rb<=eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb;
rb++)
for (int rb=0;rb<=eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb;rb++)
{
int rb2 = rb+eNB->ulsch[i]->harq_processes[harq_pid]->first_rb;
eNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31));
}
/*Log for what kind of the ULSCH Reception*/
if (eNB->ulsch[i]->Msg3_flag == 1) {
LOG_D(PHY,"[eNB %d] frame %d, subframe %d: Scheduling ULSCH Reception for Msg3 in Sector %d\n",
eNB->Mod_id,
frame,
subframe,
eNB->UE_stats[i].sector);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_MSG3,1);
} else {
LOG_D(PHY,"[eNB %d] frame %d, subframe %d: Scheduling ULSCH Reception for UE %d Mode %s\n",
eNB->Mod_id,
frame,
subframe,
i,
mode_string[eNB->UE_stats[i].mode]);
}
/*Calculate for LTE C-RS*/
//nPRS = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe<<1];
//eNB->ulsch[i]->cyclicShift = (eNB->ulsch[i]->harq_processes[harq_pid]->n_DMRS2 + fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +nPRS)%12;
if (fp->frame_type == FDD ) {
if (fp->frame_type == FDD )
{
int sf = (subframe<4) ? (subframe+6) : (subframe-4);
/*After Downlink Data transmission, simply have a notice to received ACK from PUCCH, I think it's not use for now */
if (eNB->dlsch[i][0]->subframe_tx[sf]>0) { // we have downlink transmission
if (eNB->dlsch[i][0]->subframe_tx[sf]>0) // we have downlink transmission
{
eNB->ulsch[i]->harq_processes[harq_pid]->O_ACK = 1;
} else {
}
else
{
eNB->ulsch[i]->harq_processes[harq_pid]->O_ACK = 0;
}
}
LOG_D(PHY,
"[eNB %d][PUSCH %d] Frame %d Subframe %d Demodulating PUSCH: dci_alloc %d, rar_alloc %d, round %d, first_rb %d, nb_rb %d, mcs %d, TBS %d, rv %d, cyclic_shift %d (n_DMRS2 %d, cyclicShift_common %d), O_ACK %d \n",
eNB->Mod_id,harq_pid,frame,subframe,
eNB->ulsch[i]->harq_processes[harq_pid]->dci_alloc,
eNB->ulsch[i]->harq_processes[harq_pid]->rar_alloc,
eNB->ulsch[i]->harq_processes[harq_pid]->round,
eNB->ulsch[i]->harq_processes[harq_pid]->first_rb,
eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb,
eNB->ulsch[i]->harq_processes[harq_pid]->mcs,
eNB->ulsch[i]->harq_processes[harq_pid]->TBS,
eNB->ulsch[i]->harq_processes[harq_pid]->rvidx,
eNB->ulsch[i]->cyclicShift,
eNB->ulsch[i]->harq_processes[harq_pid]->n_DMRS2,
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift,
eNB->ulsch[i]->harq_processes[harq_pid]->O_ACK);
eNB->pusch_stats_rb[i][(frame*10)+subframe] = eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb;
eNB->pusch_stats_round[i][(frame*10)+subframe] = eNB->ulsch[i]->harq_processes[harq_pid]->round;
eNB->pusch_stats_mcs[i][(frame*10)+subframe] = eNB->ulsch[i]->harq_processes[harq_pid]->mcs;
start_meas(&eNB->ulsch_demodulation_stats);
if (eNB->abstraction_flag==0) {
rx_ulsch(eNB,proc,
eNB->UE_stats[i].sector, // this is the effective sector id
i,
eNB->ulsch,
0);
}
#ifdef PHY_ABSTRACTION
else {
rx_ulsch_emul(eNB,proc,
eNB->UE_stats[i].sector, // this is the effective sector id
i);
}
#endif
stop_meas(&eNB->ulsch_demodulation_stats);
start_meas(&eNB->ulsch_decoding_stats);
if (eNB->abstraction_flag == 0) {
ret = ulsch_decoding(eNB,proc,
i,
0, // control_only_flag
eNB->ulsch[i]->harq_processes[harq_pid]->V_UL_DAI,
eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb>20 ? 1 : 0);
}
#ifdef PHY_ABSTRACTION
else {
ret = ulsch_decoding_emul(eNB,
proc,
i,
&rnti);
}
#endif
stop_meas(&eNB->ulsch_decoding_stats);
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) RSSI (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d\n",
eNB->Mod_id,harq_pid,
frame,subframe,
eNB->ulsch[i]->rnti,
dB_fixed(eNB->pusch_vars[i]->ulsch_power[0]),
dB_fixed(eNB->pusch_vars[i]->ulsch_power[1]),
eNB->UE_stats[i].UL_rssi[0],
eNB->UE_stats[i].UL_rssi[1],
eNB->measurements->n0_power_dB[0],
eNB->measurements->n0_power_dB[1],
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[0],
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[1],
ret);
//compute the expected ULSCH RX power (for the stats)
eNB->ulsch[(uint32_t)i]->harq_processes[harq_pid]->delta_TF =
get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered
eNB->ulsch[(uint32_t)i]->harq_processes[harq_pid]->delta_TF = get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered
eNB->UE_stats[i].ulsch_decoding_attempts[harq_pid][eNB->ulsch[i]->harq_processes[harq_pid]->round]++;
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d harq_pid %d Clearing subframe_scheduling_flag\n",
eNB->Mod_id,harq_pid,frame,subframe,i,harq_pid);
#endif
eNB->ulsch[i]->harq_processes[harq_pid]->subframe_scheduling_flag=0;
if (eNB->ulsch[i]->harq_processes[harq_pid]->cqi_crc_status == 1) {
#ifdef DEBUG_PHY_PROC
//if (((frame%10) == 0) || (frame < 50))
print_CQI(eNB->ulsch[i]->harq_processes[harq_pid]->o,eNB->ulsch[i]->harq_processes[harq_pid]->uci_format,0,fp->N_RB_DL);
#endif
if (eNB->ulsch[i]->harq_processes[harq_pid]->cqi_crc_status == 1)
{
extract_CQI(eNB->ulsch[i]->harq_processes[harq_pid]->o,
eNB->ulsch[i]->harq_processes[harq_pid]->uci_format,
&eNB->UE_stats[i],
fp->N_RB_DL,
&rnti, &access_mode);
eNB->UE_stats[i].rank = eNB->ulsch[i]->harq_processes[harq_pid]->o_RI[0];
}
if (eNB->ulsch[i]->Msg3_flag == 1)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_MSG3,0);
if (ret == (1+MAX_TURBO_ITERATIONS))
{
T(T_ENB_PHY_ULSCH_UE_NACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(i), T_INT(eNB->ulsch[i]->rnti),
......@@ -332,66 +242,28 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
if (eNB->ulsch[i]->Msg3_flag == 1)
{
LOG_D(PHY,"[eNB %d/%d][RAPROC] frame %d, subframe %d, UE %d: Error receiving ULSCH (Msg3), round %d/%d\n",
eNB->Mod_id,
eNB->CC_id,
frame,subframe, i,
eNB->ulsch[i]->harq_processes[harq_pid]->round-1,
fp->maxHARQ_Msg3Tx-1);
/*dump_ulsch(eNB,proc,i);
exit(-1);*/
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) RSSI (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d\n",
eNB->Mod_id,harq_pid,
frame,subframe,
eNB->ulsch[i]->rnti,
dB_fixed(eNB->pusch_vars[i]->ulsch_power[0]),
dB_fixed(eNB->pusch_vars[i]->ulsch_power[1]),
eNB->UE_stats[i].UL_rssi[0],
eNB->UE_stats[i].UL_rssi[1],
eNB->measurements->n0_power_dB[0],
eNB->measurements->n0_power_dB[1],
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[0],
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[1],
ret);
/*In NB-IoT MSG3 */
// activate retransmission for Msg3 (signalled to UE PHY by DCI
eNB->ulsch[(uint32_t)i]->Msg3_active = 1;
/* Need to check the procedure for NB-IoT retransmission
/* Need to check the procedure for NB-IoT (MSG3) retransmission
get_Msg3_alloc_ret(fp,subframe,frame,&eNB->ulsch[i]->Msg3_frame,&eNB->ulsch[i]->Msg3_subframe);
mac_xface->set_msg3_subframe(eNB->Mod_id, eNB->CC_id, frame, subframe, eNB->ulsch[i]->rnti,eNB->ulsch[i]->Msg3_frame, eNB->ulsch[i]->Msg3_subframe);
*/
T(T_ENB_PHY_MSG3_ALLOCATION, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
T_INT(i), T_INT(eNB->ulsch[i]->rnti), T_INT(0 /* 0 is for retransmission*/),
T_INT(eNB->ulsch[i]->Msg3_frame), T_INT(eNB->ulsch[i]->Msg3_subframe));
LOG_D(PHY,"[eNB] Frame %d, Subframe %d: Msg3 in error, i = %d \n", frame,subframe,i);
} // This is Msg3 error
else
{ //normal ULSCH
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)\n",
eNB->Mod_id,harq_pid,
frame,subframe, i,
eNB->ulsch[i]->harq_processes[harq_pid]->round-1,
eNB->ulsch[i]->Mlimit,
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[0],
eNB->ulsch[i]->harq_processes[harq_pid]->o_ACK[1]);
if (eNB->ulsch[i]->harq_processes[harq_pid]->round== eNB->ulsch[i]->Mlimit)
{
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d ULSCH Mlimit %d reached\n",
eNB->Mod_id,harq_pid,
frame,subframe, i,
eNB->ulsch[i]->Mlimit);
eNB->ulsch[i]->harq_processes[harq_pid]->round=0;
eNB->ulsch[i]->harq_processes[harq_pid]->phich_active=0;
eNB->UE_stats[i].ulsch_errors[harq_pid]++;
eNB->UE_stats[i].ulsch_consecutive_errors++;
/*if (eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb > 20) {
dump_ulsch(eNB,proc,i);
exit(-1);
......@@ -399,8 +271,8 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
// indicate error to MAC
if (eNB->mac_enabled == 1)
{
//instead rx_sdu to report NAK to MAC
UL_Info.UL_SPEC_Info[i].rntiP= eNB->ulsch[i]->rnti;
//instead rx_sdu to report The Uplink data not received successfully to MAC
UL_Info.UL_SPEC_Info[i].RNTI= eNB->ulsch[i]->rnti;
UL_Info.UL_SPEC_Info[i].sdu = NULL;
UL_Info.UL_SPEC_Info[i].sdu_lenP = 0;
UL_Info.UL_SPEC_Info[i].harq_pidP = harq_pid;
......@@ -412,9 +284,8 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
}
}
} // ulsch in error
else {
else
{
T(T_ENB_PHY_ULSCH_UE_ACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(i), T_INT(eNB->ulsch[i]->rnti),
T_INT(harq_pid));
......@@ -423,7 +294,6 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
for (j=0; j<fp->nb_antennas_rx; j++)
//this is the RSSI per RB
eNB->UE_stats[i].UL_rssi[j] =
dB_fixed(eNB->pusch_vars[i]->ulsch_power[j]*
(eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb*12)/
fp->ofdm_symbol_size) -
......@@ -440,13 +310,12 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
{
if (eNB->mac_enabled==1)
{
LOG_I(PHY,"[eNB %d][RAPROC] Frame %d Terminating ra_proc for harq %d, UE %d\n",
eNB->Mod_id,frame,harq_pid,i);
if (eNB->mac_enabled)
{
// store successful MSG3 in UL_Info instead rx_sdu
UL_Info.UL_SPEC_Info[i].rntiP= eNB->ulsch[i]->rnti;
UL_Info.UL_SPEC_Info[i].RNTI= eNB->ulsch[i]->rnti;
UL_Info.UL_SPEC_Info[i].sdu = eNB->ulsch[i]->harq_processes[harq_pid]->b;
UL_Info.UL_SPEC_Info[i].sdu_lenP = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3;
UL_Info.UL_SPEC_Info[i].harq_pidP = harq_pid;
......@@ -474,8 +343,10 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
LOG_D(PHY,"[eNB %d][RAPROC] Frame %d : RX Subframe %d Setting UE %d mode to PUSCH\n",eNB->Mod_id,frame,subframe,i);
/*Init HARQ parameters, need to check*/
for (k=0; k<8; k++) { //harq_processes
for (j=0; j<eNB->dlsch[i][0]->Mlimit; j++) {
for (k=0; k<8; k++)
{ //harq_processes
for (j=0; j<eNB->dlsch[i][0]->Mlimit; j++)
{
eNB->UE_stats[i].dlsch_NAK[k][j]=0;
eNB->UE_stats[i].dlsch_ACK[k][j]=0;
eNB->UE_stats[i].dlsch_trials[k][j]=0;
......@@ -485,7 +356,8 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
eNB->UE_stats[i].ulsch_errors[k]=0;
eNB->UE_stats[i].ulsch_consecutive_errors=0;
for (j=0; j<eNB->ulsch[i]->Mlimit; j++) {
for (j=0; j<eNB->ulsch[i]->Mlimit; j++)
{
eNB->UE_stats[i].ulsch_decoding_attempts[k][j]=0;
eNB->UE_stats[i].ulsch_decoding_attempts_last[k][j]=0;
eNB->UE_stats[i].ulsch_round_errors[k][j]=0;
......@@ -497,59 +369,28 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
eNB->UE_stats[i].dlsch_NAK_round0=0;
eNB->UE_stats[i].dlsch_mcs_offset=0;
} // Msg3_flag==1
else { // Msg3_flag == 0
#ifdef DEBUG_PHY_PROC
#ifdef DEBUG_ULSCH
LOG_D(PHY,"[eNB] Frame %d, Subframe %d : ULSCH SDU (RX harq_pid %d) %d bytes:",frame,subframe,
harq_pid,eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3);
for (j=0; j<eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3; j++)
LOG_T(PHY,"%x.",eNB->ulsch[i]->harq_processes[harq_pid]->b[j]);
LOG_T(PHY,"\n");
#endif
#endif
else
{ // Msg3_flag == 0
if (eNB->mac_enabled==1)
{
// store successful Uplink data in UL_Info instead rx_sdu
UL_Info.UL_SPEC_Info[i].rntiP= eNB->ulsch[i]->rnti;
UL_Info.UL_SPEC_Info[i].RNTI= eNB->ulsch[i]->rnti;
UL_Info.UL_SPEC_Info[i].sdu = eNB->ulsch[i]->harq_processes[harq_pid]->b;
UL_Info.UL_SPEC_Info[i].sdu_lenP = eNB->ulsch[i]->harq_processes[harq_pid]->TBS>>3;
UL_Info.UL_SPEC_Info[i].harq_pidP = harq_pid;
UL_Info.UL_SPEC_Info[i].msg3_flagP = NULL;
UL_Info.UE_NUM++;
} // mac_enabled==1
} // Msg3_flag == 0
// estimate timing advance for MAC
if (eNB->abstraction_flag == 0)
{
sync_pos = lte_est_timing_advance_pusch(eNB,i);
eNB->UE_stats[i].timing_advance_update = sync_pos - fp->nb_prefix_samples/4; //to check
}
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d] frame %d, subframe %d: user %d: timing advance = %d\n",
eNB->Mod_id,
frame, subframe,
i,
eNB->UE_stats[i].timing_advance_update);
#endif
} // ulsch not in error
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d][PDSCH %x] Frame %d subframe %d, Processing HARQ feedback for UE %d (after PUSCH)\n",eNB->Mod_id,
eNB->dlsch[i][0]->rnti,
frame,subframe,
i);
#endif
// Process HARQ only in NPUSCH
/*process_HARQ_feedback(i,
eNB,proc,
......@@ -565,57 +406,13 @@ void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,con
// update ULSCH statistics for tracing
if ((frame % 100 == 0) && (subframe == 4)) {
for (harq_idx=0; harq_idx<8; harq_idx++) {
for (round=0; round<eNB->ulsch[i]->Mlimit; round++) {
if ((eNB->UE_stats[i].ulsch_decoding_attempts[harq_idx][round] -
eNB->UE_stats[i].ulsch_decoding_attempts_last[harq_idx][round]) != 0) {
eNB->UE_stats[i].ulsch_round_fer[harq_idx][round] =
(100*(eNB->UE_stats[i].ulsch_round_errors[harq_idx][round] -
eNB->UE_stats[i].ulsch_round_errors_last[harq_idx][round]))/
(eNB->UE_stats[i].ulsch_decoding_attempts[harq_idx][round] -
eNB->UE_stats[i].ulsch_decoding_attempts_last[harq_idx][round]);
} else {
eNB->UE_stats[i].ulsch_round_fer[harq_idx][round] = 0;
}
eNB->UE_stats[i].ulsch_decoding_attempts_last[harq_idx][round] =
eNB->UE_stats[i].ulsch_decoding_attempts[harq_idx][round];
eNB->UE_stats[i].ulsch_round_errors_last[harq_idx][round] =
eNB->UE_stats[i].ulsch_round_errors[harq_idx][round];
}
}
}
if ((frame % 100 == 0) && (subframe==4)) {
eNB->UE_stats[i].dlsch_bitrate = (eNB->UE_stats[i].total_TBS -
eNB->UE_stats[i].total_TBS_last);
eNB->UE_stats[i].total_TBS_last = eNB->UE_stats[i].total_TBS;
}
} // loop i=0 ... NUMBER_OF_UE_MAX-1
if (eNB->abstraction_flag == 0) {
lte_eNB_I0_measurements(eNB,
subframe,
0,
eNB->first_run_I0_measurements);
eNB->first_run_I0_measurements = 0;
}
#ifdef PHY_ABSTRACTION
else {
lte_eNB_I0_measurements_emul(eNB,
0);
}
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC+offset, 0 );
stop_meas(&eNB->phy_proc_rx);
/*Exact not here, but use to debug*/
UL_indication(UL_Info);
......@@ -634,7 +431,7 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched
// In NB-IoT, there is no DCI for SI, we might use the scheduling infomation from SIB1-NB to get the phyical layer configuration.
if (Sched_Rsp->NB_DCI.DCI_Format == DCIFormatN1_RAR) // This is format 1A allocation for RA
if (Sched_Rsp->NB_DL.NB_DCI.DCI_Format == DCIFormatN1_RAR) // This is format 1A allocation for RA
{
// configure dlsch parameters and CCE index
LOG_D(PHY,"Generating dlsch params for RA_RNTI\n");
......@@ -644,11 +441,11 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched
//eNB->dlsch_ra->nCCE[subframe] = dci_alloc->firstCCE;
/*Log for common DCI*/
}
else if ((Sched_Rsp->NB_DCI.DCI_Format != DCIFormatN0)&&(Sched_Rsp->NB_DCI.DCI_Format != DCIFormatN2_Ind)&&(Sched_Rsp->NB_DCI.DCI_Format != DCIFormatN2_Pag))
else if ((Sched_Rsp->NB_DL.NB_DCI.DCI_Format != DCIFormatN0)&&(Sched_Rsp->NB_DL.NB_DCI.DCI_Format != DCIFormatN2_Ind)&&(Sched_Rsp->NB_DL.NB_DCI.DCI_Format != DCIFormatN2_Pag))
{ // this is a normal DLSCH allocation
if (UE_id>=0)
{
LOG_D(PHY,"Generating dlsch params for RNTI %x\n",Sched_Rsp->NB_DCI.RNTI);
LOG_D(PHY,"Generating dlsch params for RNTI %x\n",Sched_Rsp->NB_DL.NB_DCI.RNTI);
//NB_generate_eNB_dlsch_params_from_dci();
/*Log for remaining DCI*/
......@@ -660,7 +457,7 @@ void NB_generate_eNB_dlsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,Sched
else
{
LOG_D(PHY,"[eNB %"PRIu8"][PDSCH] Frame %d : No UE_id with corresponding rnti %"PRIx16", dropping DLSCH\n",
eNB->Mod_id,frame,Sched_Rsp->NB_DCI.RNTI);
eNB->Mod_id,frame,Sched_Rsp->NB_DL.NB_DCI.RNTI);
}
}
......@@ -676,7 +473,7 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_
//LOG for ULSCH DCI Resource allocation
if ((Sched_Rsp->NB_DCI.RNTI >= CBA_RNTI) && (Sched_Rsp->NB_DCI.RNTI < P_RNTI))
if ((Sched_Rsp->NB_DL.NB_DCI.RNTI >= CBA_RNTI) && (Sched_Rsp->NB_DL.NB_DCI.RNTI < P_RNTI))
eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->subframe_cba_scheduling_flag = 1;
else
eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
......@@ -776,9 +573,9 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
/*Loop over all the dci to generate DLSCH allocation, there is only 1 or 2 DCIs for NB-IoT in the same time*/
/*Also Packed the DCI here*/
if (Sched_Rsp->NB_DCI.RNTI<= P_RNTI)
if (Sched_Rsp->NB_DL.NB_DCI.RNTI<= P_RNTI)
{
UE_id = find_ue((int16_t)Sched_Rsp->NB_DCI.RNTI,eNB);
UE_id = find_ue((int16_t)Sched_Rsp->NB_DL.NB_DCI.RNTI,eNB);
}
else
UE_id=0;
......@@ -791,16 +588,16 @@ void NB_phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
//dci_alloc = &DCI_pdu->dci_alloc[i];
if (Sched_Rsp->NB_DCI.DCI_Format == DCIFormatN0) // this is a ULSCH allocation
if (Sched_Rsp->NB_DL.NB_DCI.DCI_Format == DCIFormatN0) // this is a ULSCH allocation
{
UE_id = find_ue((int16_t)Sched_Rsp->NB_DCI.RNTI,eNB);
UE_id = find_ue((int16_t)Sched_Rsp->NB_DL.NB_DCI.RNTI,eNB);
NB_generate_eNB_ulsch_params(eNB,proc,Sched_Rsp,UE_id);
}
/*If we have DCI to generate do it now TODO : have a generate dci top for NB_IoT */
NB_generate_dci_top();
if(Sched_Rsp->NB_DLSCH.ndlsch_pdu_payload||Sched_Rsp->NB_DLSCH.nbcch_pdu_payload)
if(Sched_Rsp->NB_DL.NB_DLSCH.ndlsch_pdu_payload||Sched_Rsp->NB_DL.NB_DLSCH.nbcch_pdu_payload)
{
/*TODO: MPDSCH procedures for NB-IoT*/
//npdsch_procedures();
......
......@@ -9,19 +9,29 @@ void UL_indication(UL_IND_t UL_INFO)
if(UL_INFO.test == 1)
{
/*If there is a preamble, do the initiate RA procedure*/
if(UL_INFO.preamble_index && UL_INFO.timing_offset)
NB_initiate_ra_proc(UL_INFO.module_id,UL_INFO.CC_id,UL_INFO.frame,UL_INFO.preamble_index,UL_INFO.timing_offset,UL_INFO.subframe);
if(UL_INFO.Number_SC>0)
{
for(i=0;i<UL_INFO.Number_SC;i++)
{
NB_initiate_ra_proc(UL_INFO.module_id,
UL_INFO.CC_id,
UL_INFO.frame,
UL_INFO.Preamble_list[UL_INFO.Number_SC].preamble_index,
UL_INFO.Preamble_list[UL_INFO.Number_SC].timing_offset,
UL_INFO.subframe
);
}
}
/*If there is a Uplink SDU (even MSG3, NAK) need to send to MAC*/
for(i=0;i<UL_INFO.UE_NUM;i++)
{
/*For MSG3, Normal Uplink Data, NAK*/
if(UL_INFO.UL_SPEC_Info[i].rntiP)
if(UL_INFO.UL_SPEC_Info[i].RNTI)
NB_rx_sdu(UL_INFO.module_id,
UL_INFO.CC_id,
UL_INFO.frame,
UL_INFO.subframe,
UL_INFO.UL_SPEC_Info[i].rntiP,
UL_INFO.UL_SPEC_Info[i].RNTI,
UL_INFO.UL_SPEC_Info[i].sdu,
UL_INFO.UL_SPEC_Info[i].sdu_lenP,
UL_INFO.UL_SPEC_Info[i].harq_pidP,
......
......@@ -15,14 +15,33 @@
// uplink subframe P7
typedef struct{
//index of the preamble, detected initial subcarrier (0-47)
uint16_t preamble_index;
//timing offset by PHY
int16_t timing_offset;
//Indicates the NRACH CE level as configured in CONFIG (0,1,2 = CE level 0,1,2)
uint8_t NRACH_CE_Level;
//RA-RNTI
uint16_t RNTI;
//Timing Advance
uint16_t TA;
}NRACH_t;
/*UL_SPEC_t:
* A struture mainly describes the UE specific information. (for NB_rx_sdu)
* Corresponding to thhe RX_ULSCH.indication, CRC.inidcation, NB_HARQ.indication in FAPI
* Corresponding to the RX_ULSCH.indication, CRC.inidcation, NB_HARQ.indication in FAPI
*/
typedef struct{
// 0 = format 1 (data), 1 = formaat 2 (ACK/NACK)
uint8_t NPUSCH_format;
//An opaque handling returned in the RX.indication
uint32_t OPA_handle;
//rnti
rnti_t rntiP;
uint16_t RNTI;
//Pointer to sdu
uint8_t *sdu;
//Pointer to sdu length
......@@ -34,11 +53,12 @@ typedef struct{
//CRC indication for the message is corrected or not for the Uplink HARQ
uint8_t crc_ind;
//This ACK NACK is for the Downlink HARQ received by the NPUSCH from UE
//This ACK NACK is for the Downlink HARQ feedback received by the NPUSCH from UE
uint8_t NAK;
}UL_SPEC_t;
/*UL_IND_t:
* A structure handles all the uplink information.
*/
......@@ -47,6 +67,7 @@ typedef struct{
/*Start at the common part*/
int test;
//Module ID
module_id_t module_id;
//CC ID
......@@ -55,25 +76,26 @@ typedef struct{
frame_t frame;
//subframe
sub_frame_t subframe;
//Number of availble UE
int UE_NUM;
/*preamble part*/
//index of the preamble
uint16_t preamble_index;
//timing offset by PHY
int16_t timing_offset;
//number of the subcarrier detected in the same time
uint8_t Number_SC;
//NRACH Indication parameters list
NRACH_t Preamble_list[48];
/*UE specific part*/
//Number of availble UE for Uplink
int UE_NUM;
//Uplink Schedule information
UL_SPEC_t UL_SPEC_Info[NUMBER_OF_UE_MAX];
}UL_IND_t;
// Downlink subframe P7
typedef union{
typedef struct{
//The length (in bytes)
uint16_t Length;
......@@ -88,7 +110,7 @@ typedef struct{
}npbch_t;
typedef union{
typedef struct{
//The length (in bytes)
uint16_t Length;
......@@ -107,7 +129,7 @@ typedef struct{
}npdsch_t;
typedef union{
typedef struct{
// The length (in bytes)
uint16_t Length;
......@@ -136,6 +158,16 @@ typedef struct{
}npdcch_t;
typedef union{
npdcch_t NB_DCI;
npdsch_t NB_DLSCH;
npbch_t NB_BCH;
}NB_DL_u;
typedef struct{
......@@ -150,11 +182,7 @@ typedef struct{
//subframe
sub_frame_t subframeP;
npdcch_t NB_DCI;
npdsch_t NB_DLSCH;
npbch_t NB_BCH;
NB_DL_u NB_DL;
}Sched_Rsp_t;
......
......@@ -80,3 +80,7 @@ Comment: Complete the TX part, add the NB_generate_eNB_dlsch_params and NB_gener
Comment: Complete the dci_tools the part configuring the PHY and do the pack of dci at the same times.
Add DCI packed format in dci_nb_iot.h
6/6
Comment: Update the IF Module header file to fit the FAPI structure and types.
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