Commit 30f1443a authored by Matthieu Kanj's avatar Matthieu Kanj

preparing UL_indication

parent ef3e40df
......@@ -405,7 +405,7 @@ void filtering_signal(int16_t *input_buffer, int16_t *filtered_buffer, uint32_t
}
uint32_t RX_NPRACH_NB_IoT(PHY_VARS_eNB *eNB, int frame){
uint32_t process_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame){
//uint32_t estimated_TA_coarse=0;
......@@ -443,12 +443,12 @@ uint32_t RX_NPRACH_NB_IoT(PHY_VARS_eNB *eNB, int frame){
if (NPRACH_detection_NB_IoT(Rx_sub_sampled_buffer_128,*length_ouput)){
/*estimated_TA_coarse = TA_estimation_NB_IoT(eNB,
Rx_sub_sampled_buffer_128,
sub_sampling_rate,
FRAME_LENGTH_COMPLEX_SUB_SAMPLES,
estimated_TA_coarse,
coarse);
/* estimated_TA_coarse = TA_estimation_NB_IoT(eNB,
Rx_sub_sampled_buffer_128,
sub_sampling_rate,
FRAME_LENGTH_COMPLEX_SUB_SAMPLES,
estimated_TA_coarse,
coarse);
// 2. Fine TA estimation using sub sampling rate = 16, i.e. fs = 1.92 MHz
......
......@@ -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);
//*****************Vincent part for nprach ******************//
uint32_t RX_NPRACH_NB_IoT(PHY_VARS_eNB *eNB, int frame);
uint32_t process_nprach_NB_IoT(PHY_VARS_eNB *eNB, int frame);
uint32_t TA_estimation_NB_IoT(PHY_VARS_eNB *eNB,
int16_t *Rx_sub_sampled_buffer,
......
......@@ -507,7 +507,6 @@ typedef struct PHY_VARS_eNB_s {
/// Pointer for ifdevice buffer struct
if_buffer_t ifbuffer;
/////////////// NB-IoT testing ////////////////////////////
volatile uint16_t preamble_index_NB_IoT;
NB_IoT_eNB_NPBCH_t npbch;
......@@ -519,12 +518,15 @@ NB_IoT_eNB_NPDCCH_temp_t npdcch_tmp;
NB_IoT_eNB_NULSCH_t *ulsch_NB_IoT[NUMBER_OF_UE_MAX+1];
////////////// For IF Module /////////////////////////////
IF_Module_NB_IoT_t *if_inst;
UL_IND_NB_IoT_t UL_INFO;
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;
pthread_mutex_t UL_INFO_mutex;
/// 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[4];
uint8_t msg3_pdu[6];
//////////////////// END /////////////////////////////////
} PHY_VARS_eNB;
#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
......
......@@ -203,6 +203,11 @@ void phy_procedures_eNB_S_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,re
*/
void prach_procedures(PHY_VARS_eNB *eNB);
///////// NB_IoT testing ///////////////////////////
void prach_procedures_NB_IoT(PHY_VARS_eNB *eNB);
///////////////////////////////////////////////////
/*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index.
@param frame_parms Pointer to DL frame parameter descriptor
@param subframe Subframe index
......
......@@ -48,7 +48,7 @@ uint32_t is_SIB1_NB_IoT(const frame_t frameP,
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1
);
uint32_t nprach_procedures_NB_IoT(PHY_VARS_eNB *eNB);
uint32_t rx_nprach_NB_IoT(PHY_VARS_eNB *eNB);
#endif
......
......@@ -2882,6 +2882,70 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *eNB,
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////// NB-IoT ////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void prach_procedures_NB_IoT(PHY_VARS_eNB *eNB) {
// LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
// uint16_t preamble_energy_list[64],preamble_delay_list[64];
// uint16_t preamble_max,preamble_energy_max;
// uint16_t preamble_max=0;
// uint16_t i;
// int8_t UE_id;
int subframe = eNB->proc.subframe_prach;
int frame = eNB->proc.frame_prach;
// uint8_t CC_id = eNB->CC_id;
uint32_t detection=0;
uint16_t estimated_TA=2;
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,
frame,subframe,dB_fixed(signal_energy(&eNB->common_vars.rxdata[0][0][subframe*fp->samples_per_tti],512)) - eNB->rx_total_gain_dB);
rx_prach(eNB,
preamble_energy_list,
preamble_delay_list,
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)
{
mac_xface->initiate_ra_proc(eNB->Mod_id,
eNB->CC_id,
frame,
eNB->preamble_index_NB_IoT,
estimated_TA,
0,subframe,0);
}
}
//////////////////////////////////////////////////////////// END ///////////////////////////////////////////////////////////
void prach_procedures(PHY_VARS_eNB *eNB) {
// LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
......@@ -2912,7 +2976,7 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
frame,
0);*/
//usleep(100);
detection = nprach_procedures_NB_IoT(eNB);
detection = rx_nprach_NB_IoT(eNB);
/* } else {
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
......
......@@ -1516,7 +1516,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
}
uint32_t nprach_procedures_NB_IoT(PHY_VARS_eNB *eNB) {
uint32_t rx_nprach_NB_IoT(PHY_VARS_eNB *eNB) {
uint32_t estimated_TA;
int frame,frame_mod; // subframe,
......@@ -1530,7 +1530,7 @@ uint32_t nprach_procedures_NB_IoT(PHY_VARS_eNB *eNB) {
//if (subframe==1 && frame_mod==0 && frame!=0){
if (frame_mod==0 && frame!=0){
//printf("\n frame_in = %i\n",frame);
estimated_TA = RX_NPRACH_NB_IoT(eNB,frame);
estimated_TA = process_nprach_NB_IoT(eNB,frame);
//printf("estim = %i\n",estimated_TA);
}
return estimated_TA;
......
......@@ -1602,7 +1602,11 @@ static void* eNB_thread_prach( void* param ) {
if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break;
prach_procedures(eNB);
//prach_procedures(eNB);
////// NB_IoT testing ///////
prach_procedures_NB_IoT(eNB);
/////////////////////////////
if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break;
}
......
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