Commit 8109b45a authored by Michele Paffetti's avatar Michele Paffetti

comit before sinchronize with nick work

parent 6f4d5db7
......@@ -287,8 +287,8 @@ typedef struct {
} LTE_eNB_DLSCH_t;
//NB-IoT new structure for NPDCCH
//----------------------------------------------------------------------------------------------------
//new structure for NPDCCH
typedef struct
{
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
......@@ -334,6 +334,52 @@ typedef struct
}NB_IoT_eNB_NPDCCH_t;
typedef struct {
/// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding)
int32_t *txdataF[8];
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
int32_t **ue_spec_bf_weights[4];
/// dl channel estimates (estimated from ul channel estimates)
int32_t **calib_dl_ch_estimates;
/// Allocated RNTI (0 means DLSCH_t is not currently used)
uint16_t rnti;
/// Active flag for baseband transmitter processing
uint8_t active;
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
uint8_t subframe_tx[10];
/// First CCE of last PDSCH scheduling per subframe. Again used during PUCCH detection for ACK/NAK.
uint8_t nCCE[10];
/*in NB-IoT there is only 1 HARQ process for each UE therefore no pid is required*/
/// Current HARQ process id
//uint8_t current_harq_pid;
/// Process ID's per subframe. Used to associate received ACKs on PUSCH/PUCCH to DLSCH harq process ids
//uint8_t harq_ids[10];
/// Window size (in outgoing transport blocks) for fine-grain rate adaptation
uint8_t ra_window_size;
/// First-round error threshold for fine-grain rate adaptation
uint8_t error_threshold;
/// The only HARQ processes for the DLSCH
LTE_DL_eNB_HARQ_t harq_process;
/// Number of soft channel bits
uint32_t G;
/// Codebook index for this dlsch (0,1,2,3)
uint8_t codebook_index;
/// Maximum number of HARQ processes (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Mdlharq;
/// Maximum number of HARQ rounds
uint8_t Mlimit;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
uint8_t Kmimo;
/// Nsoft parameter related to UE Category
uint32_t Nsoft;
/// amplitude of PDSCH (compared to RS) in symbols without pilots
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
} NB_IoT_eNB_DLSCH_t;
//---------------------------------------------------------------------------------------
#define PUSCH_x 2
#define PUSCH_y 3
......
......@@ -479,6 +479,7 @@ typedef struct PHY_VARS_eNB_s {
//NB-IoT------------------------
NB_IoT_eNB_NPBCH npbch;
NB_IoT_eNB_NPDCCH_t *npdcch[NUMBER_OF_UE_MAC_NB_IoT]; //check the max size of this array
NB_DL_FRAME_PARMS frame_parms_nb_iot;
/// cell-specific reference symbols
uint32_t lte_gold_table[20][2][14];
......
......@@ -70,7 +70,6 @@ extern int rx_sig_fifo;
* It generates NRS/NPSS/NSSS
*
*/
void NB_common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
{
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
......@@ -127,7 +126,6 @@ void NB_common_signal_procedures (PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
}
void NB_phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
{
//RX processing for ue-specific resources (i
......@@ -578,6 +576,281 @@ void NB_generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,Sched_
}
}
/*
* for NB-IoT
* this function is called by the PHy procedure TX in 3 possible occasion:
* 1) we manage BCCH pdu
* 2) we manage RA dlsch pdu (to be checked if needed in our case)
* 3) UE specific dlsch pdu
* ** we need to know if exist and which value has the eutracontrolRegionSize (TS 36.213 ch 16.4.1.4) whenever we are in In-band mode
* ** CQI and PMI are not present in NB-IoT
* ** redundancy version exist only in UL for NB-IoT and not in DL
*/
void pdsch_procedures_NB(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc, //Context data structure for RX/TX portion of subframe processing
NB_IoT_eNB_DLSCH_t *dlsch,
NB_IoT_eNB_DLSCH_t *dlsch1,//this is the second colum of the UE specific LTE_eNB_DLSCH_t (see the PHY/defs.h line 471)
LTE_eNB_UE_stats *ue_stats,
int ra_flag,// set to 1 only in case of RA
int num_pdcch_symbols,
uint32_t segment_length, //lenght of the DLSCH PDU from the Sched_rsp (FAPI nomenclature)
uint8_t* segment_data // the DLSCH PDU itself from the Sched_rsp (FAPI nomenclature)
)
{
int frame=proc->frame_tx;
int subframe=proc->subframe_tx;
//int harq_pid = dlsch->current_harq_pid;
LTE_DL_eNB_HARQ_t dlsch_harq=dlsch->harq_process; //TODO: review the HARQ process for NB_IoT
int input_buffer_length = dlsch_harq->TBS/8; // get in byte //to be changed for NB_IoT????
NB_DL_FRAME_PARMS *fp=&eNB->frame_parms_nb_iot;
uint8_t *DLSCH_pdu=NULL;
uint8_t DLSCH_pdu_tmp[input_buffer_length+4]; //[768*8];
uint8_t DLSCH_pdu_rar[256];
int i;
LOG_D(PHY,
"[eNB %"PRIu8"][PDSCH rnti%"PRIx16"/HARQ proc%"PRIu8"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8"(round %"PRIu8")\n",
eNB->Mod_id,
dlsch->rnti,
harq_pid,
frame, subframe, input_buffer_length,
get_G(fp,dlsch_harq->nb_rb,dlsch_harq->rb_alloc,get_Qm(dlsch_harq->mcs),dlsch_harq->Nl, num_pdcch_symbols, frame, subframe, dlsch_harq->mimo_mode==TM7?7:0),
dlsch_harq->nb_rb, //in NB_IoT we not need it???
dlsch_harq->mcs, //why MCS is inside the harq???
dlsch_harq->round);
#if defined(MESSAGE_CHART_GENERATOR_PHY)
MSC_LOG_TX_MESSAGE(
MSC_PHY_ENB,MSC_PHY_UE,
NULL,0,
"%05u:%02u PDSCH/DLSCH input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8", pmi_alloc %"PRIx16", rv %"PRIu8" (round %"PRIu8")",
frame, subframe,
input_buffer_length,
get_G(fp,
dlsch_harq->nb_rb,
dlsch_harq->rb_alloc,
get_Qm(dlsch_harq->mcs),
dlsch_harq->Nl,
num_pdcch_symbols,
frame,
subframe,
dlsch_harq->mimo_mode==TM7?7:0),
dlsch_harq->nb_rb,
dlsch_harq->mcs,
pmi2hex_2Ar1(dlsch_harq->pmi_alloc),
dlsch_harq->rvidx,
dlsch_harq->round);
#endif
if (ue_stats) ue_stats->dlsch_sliding_cnt++;
if (dlsch_harq->round == 0) {
if (ue_stats)
ue_stats->dlsch_trials[harq_pid][0]++;
if (eNB->mac_enabled==1) { // set in lte-softmodem - main line 1646
if (ra_flag == 0) {
DLSCH_pdu =segment_data;
}
else { // XXX decide what should be done for NB-IoT
/*
* In FAPI style we don-t need to process the RAR because we have all the parameters for getting the MSG3 given by the
* UL_CONFIG.request
* 1) this data are given at the same time with the DLSCH PDU containing the RAR???
* 2) wee need to do a mapping of this parameters OAI->FAPI
*/
int16_t crnti = mac_xface->fill_rar(eNB->Mod_id,
eNB->CC_id,
frame,
DLSCH_pdu_rar,
fp->N_RB_UL,
input_buffer_length);
DLSCH_pdu = DLSCH_pdu_rar;
int UE_id;
if (crnti!=0)
UE_id = add_ue(crnti,eNB);
else
UE_id = -1;
if (UE_id==-1) {
LOG_W(PHY,"[eNB] Max user count reached.\n");
mac_xface->cancel_ra_proc(eNB->Mod_id,
eNB->CC_id,
frame,
crnti);
} else {
eNB->UE_stats[(uint32_t)UE_id].mode = RA_RESPONSE;
// Initialize indicator for first SR (to be cleared after ConnectionSetup is acknowledged)
eNB->first_sr[(uint32_t)UE_id] = 1;
generate_eNB_ulsch_params_from_rar(DLSCH_pdu,
frame,
subframe,
eNB->ulsch[(uint32_t)UE_id],
fp);
LOG_D(PHY,"[eNB][RAPROC] Frame %d subframe %d, Activated Msg3 demodulation for UE %"PRId8" in frame %"PRIu32", subframe %"PRIu8"\n",
frame,
subframe,
UE_id,
eNB->ulsch[(uint32_t)UE_id]->Msg3_frame,
eNB->ulsch[(uint32_t)UE_id]->Msg3_subframe);
/* TODO: get rid of this hack. The problem is that the eNodeB may
* sometimes wrongly generate PHICH because somewhere 'phich_active' was
* not reset to 0, due to an unidentified reason. When adding this
* resetting here the problem seems to disappear completely.
*/
LOG_D(PHY, "hack: set phich_active to 0 for UE %d fsf %d %d all HARQs\n", UE_id, frame, subframe);
for (i = 0; i < 8; i++)
eNB->ulsch[(uint32_t)UE_id]->harq_processes[i]->phich_active = 0;
mac_xface->set_msg3_subframe(eNB->Mod_id, eNB->CC_id, frame, subframe, (uint16_t)crnti,
eNB->ulsch[UE_id]->Msg3_frame, eNB->ulsch[UE_id]->Msg3_subframe);
T(T_ENB_PHY_MSG3_ALLOCATION, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
T_INT(UE_id), T_INT((uint16_t)crnti), T_INT(1 /* 1 is for initial transmission*/),
T_INT(eNB->ulsch[UE_id]->Msg3_frame), T_INT(eNB->ulsch[UE_id]->Msg3_subframe));
}
if (ue_stats) ue_stats->total_TBS_MAC += dlsch_harq->TBS;
}// ra_flag = 1
} //mac_eabled = 1
else { //XXX we should change taus function???
DLSCH_pdu = DLSCH_pdu_tmp;
for (i=0; i<input_buffer_length; i++)
DLSCH_pdu[i] = (unsigned char)(taus()&0xff);
}
#if defined(SMBV)
// Configures the data source of allocation (allocation is configured by DCI)
if (smbv_is_config_frame(frame) && (smbv_frame_cnt < 4)) {
LOG_D(PHY,"[SMBV] Frame %3d, Configuring PDSCH payload in SF %d alloc %"PRIu8"\n",frame,(smbv_frame_cnt*10) + (subframe),smbv_alloc_cnt);
// smbv_configure_datalist_for_user(smbv_fname, find_ue(dlsch->rnti,eNB)+1, DLSCH_pdu, input_buffer_length);
}
#endif
#ifdef DEBUG_PHY_PROC
#ifdef DEBUG_DLSCH
LOG_T(PHY,"eNB DLSCH SDU: \n");
//eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe] = DCI_pdu->dci_alloc[i].firstCCE;
LOG_D(PHY,"[eNB %"PRIu8"] Frame %d subframe %d : CCE resource for ue DCI (PDSCH %"PRIx16") => %"PRIu8"/%u\n",eNB->Mod_id,eNB->proc[sched_subframe].frame_tx,subframe,
DCI_pdu->dci_alloc[i].rnti,eNB->dlsch[(uint8_t)UE_id][0]->nCCE[subframe],DCI_pdu->dci_alloc[i].firstCCE);
for (i=0; i<dlsch_harq->TBS>>3; i++)
LOG_T(PHY,"%"PRIx8".",DLSCH_pdu[i]);
LOG_T(PHY,"\n");
#endif
#endif
} //harq round == 0
else {
//We are doing a retransmission
ue_stats->dlsch_trials[harq_pid][dlsch_harq->round]++;
#ifdef DEBUG_PHY_PROC
#ifdef DEBUG_DLSCH
LOG_D(PHY,"[eNB] This DLSCH is a retransmission\n");
#endif
#endif
}
if (eNB->abstraction_flag==0) { // used for simulation of the PHY??
LOG_D(PHY,"Generating NDLSCH/NPDSCH %d\n",ra_flag);
// 36-212
//encoding---------------------------
start_meas(&eNB->dlsch_encoding_stats);
LOG_I(PHY, "NB-IoT Encoding step\n");
eNB->te(eNB,
DLSCH_pdu,
num_pdcch_symbols,
dlsch,
frame,subframe,
&eNB->dlsch_rate_matching_stats,
&eNB->dlsch_turbo_encoding_stats,
&eNB->dlsch_interleaving_stats);
stop_meas(&eNB->dlsch_encoding_stats);
//scrambling-------------------------------------------
// 36-211
start_meas(&eNB->dlsch_scrambling_stats);
LOG_I(PHY, "NB-IoT Scrambling step\n");
dlsch_scrambling(fp,
0,
dlsch,
get_G(fp,
dlsch_harq->nb_rb,
dlsch_harq->rb_alloc,
get_Qm(dlsch_harq->mcs),
dlsch_harq->Nl,
num_pdcch_symbols,
frame,subframe,
0),
0,
subframe<<1);
stop_meas(&eNB->dlsch_scrambling_stats);
//modulation-------------------------------------------
start_meas(&eNB->dlsch_modulation_stats);
LOG_I(PHY, "NB-IoT Modulation step\n");
dlsch_modulation(eNB,
eNB->common_vars.txdataF[0],
AMP,
subframe,
num_pdcch_symbols,
dlsch,
dlsch1);
stop_meas(&eNB->dlsch_modulation_stats);
}
#ifdef PHY_ABSTRACTION
else {
start_meas(&eNB->dlsch_encoding_stats);
dlsch_encoding_emul(eNB,
DLSCH_pdu,
dlsch);
stop_meas(&eNB->dlsch_encoding_stats);
}
#endif
dlsch->active = 0;
}
extern int oai_exit;
......
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