Commit 6d5e60f3 authored by Matthieu Kanj's avatar Matthieu Kanj

UL indication for NPRACH

parent 30f1443a
...@@ -405,7 +405,7 @@ void filtering_signal(int16_t *input_buffer, int16_t *filtered_buffer, uint32_t ...@@ -405,7 +405,7 @@ void filtering_signal(int16_t *input_buffer, int16_t *filtered_buffer, uint32_t
} }
uint32_t process_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame){ uint32_t process_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame, uint8_t subframe, uint32_t *rnti, uint16_t *preamble_index, uint16_t *timing_advance){
//uint32_t estimated_TA_coarse=0; //uint32_t estimated_TA_coarse=0;
...@@ -476,7 +476,10 @@ uint32_t process_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame){ ...@@ -476,7 +476,10 @@ uint32_t process_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame){
//}*/ //}*/
printf("\ndetection !!! at frame %i \n",frame); printf("\ndetection !!! at frame %i \n",frame);
eNB->preamble_index_NB_IoT = subcarrier_estimation(Rx_sub_sampled_buffer_128); // c'est un uint16_t //eNB->preamble_index_NB_IoT = subcarrier_estimation(Rx_sub_sampled_buffer_128); // c'est un uint16_t
*preamble_index = subcarrier_estimation(Rx_sub_sampled_buffer_128);
*timing_advance = 0;
*rnti = 1 + frame/4;
printf("estimated subaccier = %i\n",eNB->preamble_index_NB_IoT); printf("estimated subaccier = %i\n",eNB->preamble_index_NB_IoT);
return 1;//estimated_TA; return 1;//estimated_TA;
}else{ }else{
......
...@@ -378,7 +378,7 @@ void lte_idft_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_P ...@@ -378,7 +378,7 @@ void lte_idft_NB_IoT(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_P
void extract_CQI_NB_IoT(void *o,UCI_format_NB_IoT_t uci_format,NB_IoT_eNB_UE_stats *stats,uint8_t N_RB_DL, uint16_t * crnti, uint8_t * access_mode); void extract_CQI_NB_IoT(void *o,UCI_format_NB_IoT_t uci_format,NB_IoT_eNB_UE_stats *stats,uint8_t N_RB_DL, uint16_t * crnti, uint8_t * access_mode);
//*****************Vincent part for nprach ******************// //*****************Vincent part for nprach ******************//
uint32_t process_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame); uint32_t process_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame, uint8_t subframe,uint32_t *rnti, uint16_t *preamble_index, uint16_t *timing_advance);
uint32_t TA_estimation_NB_IoT(PHY_VARS_eNB *eNB, uint32_t TA_estimation_NB_IoT(PHY_VARS_eNB *eNB,
int16_t *Rx_sub_sampled_buffer, int16_t *Rx_sub_sampled_buffer,
......
...@@ -520,7 +520,7 @@ NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT[NUMBER_OF_UE_MAX+1]; ...@@ -520,7 +520,7 @@ NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT[NUMBER_OF_UE_MAX+1];
IF_Module_NB_IoT_t *if_inst; // should be replaced by if_inst_NB_IoT; to avoid conflict during the merge with develop branch IF_Module_NB_IoT_t *if_inst; // should be replaced by if_inst_NB_IoT; to avoid conflict during the merge with develop branch
UL_IND_NB_IoT_t UL_INFO; // should be replaced by UL_INFO_NB_IoT; UL_IND_NB_IoT_t UL_INFO; // should be replaced by UL_INFO_NB_IoT;
pthread_mutex_t UL_INFO_mutex; pthread_mutex_t UL_INFO_mutex;
/// NFAPI NPRACH information /// NFAPI NPRACH information
//nfapi_preamble_pdu_t preamble_list_NB_IoT[MAX_NUM_RX_PRACH_PREAMBLES]; // MAX_NUM_RX_PRACH_PREAMBLES in PHY/defs_eNB.h //nfapi_preamble_pdu_t preamble_list_NB_IoT[MAX_NUM_RX_PRACH_PREAMBLES]; // MAX_NUM_RX_PRACH_PREAMBLES in PHY/defs_eNB.h
//nfapi_preamble_pdu_t preamble_list_NB_IoT[4]; //nfapi_preamble_pdu_t preamble_list_NB_IoT[4];
......
...@@ -48,7 +48,7 @@ uint32_t is_SIB1_NB_IoT(const frame_t frameP, ...@@ -48,7 +48,7 @@ uint32_t is_SIB1_NB_IoT(const frame_t frameP,
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1 NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1
); );
uint32_t rx_nprach_NB_IoT(PHY_VARS_eNB *eNB); uint32_t rx_nprach_NB_IoT(PHY_VARS_eNB *eNB,int frame, uint8_t subframe, uint16_t *rnti, uint16_t *preamble_index, uint16_t *timing_advance);
#endif #endif
......
...@@ -2883,67 +2883,67 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *eNB, ...@@ -2883,67 +2883,67 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *eNB,
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////// NB-IoT //////////////////////////////////////////////////////// ////////////////////////////////////////////////////// NB-IoT testing ////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void prach_procedures_NB_IoT(PHY_VARS_eNB *eNB) { void prach_procedures_NB_IoT(PHY_VARS_eNB *eNB) {
// LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; // LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
// uint16_t preamble_energy_list[64],preamble_delay_list[64]; // uint16_t preamble_energy_list[64],preamble_delay_list[64];
// uint16_t preamble_max,preamble_energy_max; // uint16_t preamble_max,preamble_energy_max;
// uint16_t preamble_max=0; // uint16_t preamble_max=0;
// uint16_t i; // uint16_t i;
// int8_t UE_id; // int8_t UE_id;
int subframe = eNB->proc.subframe_prach; uint16_t rnti[4],preamble_index[4],timing_advance_preamble[4];
// uint16_t i;
// int frame,subframe;
uint8_t subframe = eNB->proc.subframe_prach;
int frame = eNB->proc.frame_prach; int frame = eNB->proc.frame_prach;
// uint8_t CC_id = eNB->CC_id; // uint8_t CC_id = eNB->CC_id;
uint32_t detection=0; uint32_t detection=0;
uint16_t estimated_TA=2; //uint16_t estimated_TA=2;
if (eNB->abstraction_flag == 0) { if (eNB->abstraction_flag == 0) {
/*LOG_D(PHY,"[eNB %d][RAPROC] Frame %d, Subframe %d : PRACH RX Signal Power : %d dBm\n",eNB->Mod_id, /* rx_prach(eNB,
frame,subframe,dB_fixed(signal_energy(&eNB->common_vars.rxdata[0][0][subframe*fp->samples_per_tti],512)) - eNB->rx_total_gain_dB); preamble_energy_list,
preamble_delay_list,
rx_prach(eNB, frame,
preamble_energy_list, 0);*/
preamble_delay_list, detection = rx_nprach_NB_IoT(eNB,frame,subframe,rnti,preamble_index,timing_advance_preamble);
frame,
0);*/
//usleep(100);
detection = rx_nprach_NB_IoT(eNB);
/* } else {
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
LOG_D(PHY,"[RAPROC] UE_id %d (%p), generate_prach %d, UE RSI %d, eNB RSI %d preamble index %d\n",
UE_id,PHY_vars_UE_g[UE_id][CC_id],PHY_vars_UE_g[UE_id][CC_id]->generate_prach,
PHY_vars_UE_g[UE_id][CC_id]->frame_parms.prach_config_common.rootSequenceIndex,
fp->prach_config_common.rootSequenceIndex,
PHY_vars_UE_g[UE_id][CC_id]->prach_PreambleIndex);
if ((PHY_vars_UE_g[UE_id][CC_id]->generate_prach==1) &&
(PHY_vars_UE_g[UE_id][CC_id]->frame_parms.prach_config_common.rootSequenceIndex ==
fp->prach_config_common.rootSequenceIndex) ) {
preamble_energy_list[PHY_vars_UE_g[UE_id][CC_id]->prach_PreambleIndex] = 800;
preamble_delay_list[PHY_vars_UE_g[UE_id][CC_id]->prach_PreambleIndex] = 5;
}
} */
} }
if(detection == 1) if(detection == 1) ////////////////////////// to be moved to handle_rach_NB_IoT
{ {
mac_xface->initiate_ra_proc(eNB->Mod_id, /* initiate_ra_proc(UL_info->module_id,
eNB->CC_id, UL_info->CC_id,
frame, NFAPI_SFNSF2SFN(UL_info->rach_ind.sfn_sf),
eNB->preamble_index_NB_IoT, NFAPI_SFNSF2SF(UL_info->rach_ind.sfn_sf),
estimated_TA, UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.preamble,
0,subframe,0); UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance,
UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti);*/
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.nrach_ind.number_of_initial_scs_detected = 1; // should be set to zero in every call of UL_indication
eNB->UL_INFO.nrach_ind.nrach_pdu_list[0].nrach_indication_rel13.rnti = rnti[0];
eNB->UL_INFO.nrach_ind.nrach_pdu_list[0].nrach_indication_rel13.initial_sc = preamble_index[0];
eNB->UL_INFO.nrach_ind.nrach_pdu_list[0].nrach_indication_rel13.timing_advance = timing_advance_preamble[0];
eNB->UL_INFO.nrach_ind.nrach_pdu_list[0].nrach_indication_rel13.nrach_ce_level = 2;
} eNB->UL_INFO.frame = frame;
eNB->UL_INFO.subframe = subframe;
//eNB->UL_INFO.hypersfn = ;
} pthread_mutex_unlock(&eNB->UL_INFO_mutex);
mac_xface->initiate_ra_proc(eNB->Mod_id,
eNB->CC_id,
frame,
preamble_index[0],
(int16_t) timing_advance_preamble[0],
0,subframe,0);
}
}
//////////////////////////////////////////////////////////// END /////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// END ///////////////////////////////////////////////////////////
void prach_procedures(PHY_VARS_eNB *eNB) { void prach_procedures(PHY_VARS_eNB *eNB) {
...@@ -2976,7 +2976,10 @@ void prach_procedures(PHY_VARS_eNB *eNB) { ...@@ -2976,7 +2976,10 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
frame, frame,
0);*/ 0);*/
//usleep(100); //usleep(100);
detection = rx_nprach_NB_IoT(eNB);
//detection = rx_nprach_NB_IoT(eNB);
// detection = rx_nprach_NB_IoT(eNB,frame,subframe,rnti,preamble_index,timing_advance_preamble);
/* } else { /* } else {
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) { for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
......
...@@ -1516,22 +1516,22 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -1516,22 +1516,22 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
} }
uint32_t rx_nprach_NB_IoT(PHY_VARS_eNB *eNB) { uint32_t rx_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame, uint8_t subframe, uint16_t *rnti, uint16_t *preamble_index, uint16_t *timing_advance) {
uint32_t estimated_TA; uint32_t estimated_TA;
int frame,frame_mod; // subframe, //int frame,frame_mod; // subframe,
// subframe = eNB->proc.subframe_prach; // subframe = eNB->proc.subframe_prach;
frame = eNB->proc.frame_prach; // frame = eNB->proc.frame_prach;
//printf("frame = %i \n sf = %i\n",frame,subframe); //printf("frame = %i \n sf = %i\n",frame,subframe);
frame_mod = 0;//(frame)%32; // frame_mod = 0;//(frame)%32;
//if (subframe==1 && frame_mod==0 && frame!=0){ //if (subframe==1 && frame_mod==0 && frame!=0){
if (frame_mod==0 && frame!=0){ //if (frame_mod==0 && frame!=0){
//printf("\n frame_in = %i\n",frame); //printf("\n frame_in = %i\n",frame);
estimated_TA = process_nprach_NB_IoT(eNB,frame); estimated_TA = process_nprach_NB_IoT(eNB,frame,subframe,rnti,preamble_index,timing_advance);
//printf("estim = %i\n",estimated_TA); //printf("estim = %i\n",estimated_TA);
} // }
return estimated_TA; return estimated_TA;
} }
\ No newline at end of file
...@@ -13,19 +13,19 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -13,19 +13,19 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
/* Disable uplink RX function for now /* Disable uplink RX function for now
//If there is a preamble, do the initiate RA procedure //If there is a preamble, do the initiate RA procedure
if(UL_INFO->NRACH.number_of_initial_scs_detected>0) if(UL_INFO->nrach_ind.number_of_initial_scs_detected>0)
{ {
for(i=0;i<UL_INFO->NRACH.number_of_initial_scs_detected;i++) for(i=0;i<UL_INFO->nrach_ind.number_of_initial_scs_detected;i++)
{ {
// initiate_ra here, some useful inforamtion : // initiate_ra here, some useful inforamtion :
//(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc //(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc
//(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance //(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance
init_RA_NB_IoT(mac_inst, init_RA_NB_IoT(mac_inst,
(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc, (UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc,
(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.nrach_ce_level, (UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.nrach_ce_level,
UL_INFO->frame, UL_INFO->frame,
//timing_offset = Timing_advance * 16 //timing_offset = Timing_advance * 16
(UL_INFO->NRACH.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance*16 (UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance*16
); );
......
...@@ -136,8 +136,10 @@ typedef struct{ ...@@ -136,8 +136,10 @@ typedef struct{
uint32_t hypersfn; uint32_t hypersfn;
/*preamble part*/ /*preamble part*/
/// RACH indication list
//nfapi_rach_indication_t rach_ind; ?????
nfapi_nrach_indication_body_t NRACH; nfapi_nrach_indication_body_t nrach_ind;
/*Uplink data part*/ /*Uplink data part*/
......
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