Commit e59eba4d authored by Matthieu Kanj's avatar Matthieu Kanj

preparing msg2 implementation

parent d38f75b3
......@@ -48,7 +48,7 @@ uint32_t is_SIB1_NB_IoT(const frame_t frameP,
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1
);
void nprach_procedures_NB_IoT(PHY_VARS_eNB *eNB);
uint32_t nprach_procedures_NB_IoT(PHY_VARS_eNB *eNB);
#endif
......
......@@ -1250,15 +1250,15 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
}
/*
// Get scheduling info for next subframe
// This is called only for the CC_id = 0 and triggers scheduling for all CC_id's
if (eNB->mac_enabled==1) {
/* if (eNB->mac_enabled==1) {
if (eNB->CC_id == 0) {
mac_xface->eNB_dlsch_ulsch_scheduler(eNB->Mod_id,0,frame,subframe);//,1);
}
}
*/
}*/
// clear the transmit data array for the current subframe
if (eNB->abstraction_flag==0) {
for (aa=0; aa<fp->nb_antenna_ports_eNB; aa++) {
......@@ -1267,6 +1267,21 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
}
}
///////////////////////////////////////////////////////////////////////////////////
// test if there is detection,
//if yes proceed to setting flag to indicate that there is something to transmit
// another flag to indicate that DCI is transmitted
// flag to encode DCI
// store the PDU of DCI
// add two variable for frame and subframe , in order to know next transmission
// varible to indicate the remaining repetition to transmit
/////////////////////////////////////////////////////////////////////////////////////////////
// if (is_pmch_subframe(frame,subframe,fp)) {
// pmch_procedures(eNB,proc,rn,r_type);
// }
......@@ -2014,14 +2029,18 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *eNB,
void prach_procedures(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_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;
/*VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1);
memset(&preamble_energy_list[0],0,64*sizeof(uint16_t));
memset(&preamble_delay_list[0],0,64*sizeof(uint16_t));*/
......@@ -2037,11 +2056,11 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
frame,
0);*/
//usleep(100);
nprach_procedures_NB_IoT(eNB);
} else {
detection = nprach_procedures_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",
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,
......@@ -2053,8 +2072,8 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
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;
}*/
}
}
} */
}
/*preamble_energy_max = preamble_energy_list[0];
......@@ -2120,6 +2139,20 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
break;
}
*/
/////////////////////////////////////////// NB-IoT testing //////////////////////////
if(detection == 1)
{
mac_xface->initiate_ra_proc(eNB->Mod_id,
eNB->CC_id,
frame,
preamble_max,
estimated_TA,
0,subframe,0);
}
/////////////////////////////////////////////////////////////////////////////////////
/*
mac_xface->initiate_ra_proc(eNB->Mod_id,
eNB->CC_id,
frame,
......
......@@ -1516,7 +1516,7 @@ void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
}
void nprach_procedures_NB_IoT(PHY_VARS_eNB *eNB) {
uint32_t nprach_procedures_NB_IoT(PHY_VARS_eNB *eNB) {
uint32_t estimated_TA;
int subframe,frame,frame_mod;
......@@ -1533,4 +1533,5 @@ void nprach_procedures_NB_IoT(PHY_VARS_eNB *eNB) {
estimated_TA = RX_NPRACH_NB_IoT(eNB,frame);
//printf("estim = %i\n",estimated_TA);
}
return estimated_TA;
}
\ No newline at end of file
......@@ -33,6 +33,8 @@
#include "PHY/defs.h"
#include "PHY/extern.h"
//#include "PHY/LTE_TRANSPORT/dci_NB_IoT.h"
#include "SCHED/defs.h"
#include "SCHED/extern.h"
......@@ -217,11 +219,11 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
size_bytes = sizeof(DCI1A_1_5MHz_FDD_t);
size_bits = sizeof_DCI1A_1_5MHz_FDD_t;
break;
case 15:/*
((DCI1A_2_5MHz_FDD_t*)DLSCH_dci)->type = 1;
((DCI1A_2_5MHz_FDD_t*)DLSCH_dci)->rballoc = 31;
size_bytes = sizeof(DCI1A_1_5MHz_FDD_t);
size_bits = sizeof_DCI1A_1_5MHz_FDD_t;*/
case 15:
// ((DCI1A_2_5MHz_FDD_t*)DLSCH_dci)->type = 1;
// ((DCI1A_2_5MHz_FDD_t*)DLSCH_dci)->rballoc = 31;
// size_bytes = sizeof(DCI1A_1_5MHz_FDD_t);
// size_bits = sizeof_DCI1A_1_5MHz_FDD_t;
break;
case 25:
((DCI1A_5MHz_FDD_t*)DLSCH_dci)->type = 1;
......@@ -236,10 +238,10 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
size_bits = sizeof_DCI1A_10MHz_FDD_t;
break;
case 75:
/* ((DCI1A_15MHz_FDD_t*)DLSCH_dci)->type = 1;
((DCI1A_15MHz_FDD_t*)DLSCH_dci)->rballoc = 2047;
size_bytes = sizeof(DCI1A_10MHz_FDD_t);
size_bits = sizeof_DCI1A_10MHz_FDD_t;*/
// ((DCI1A_15MHz_FDD_t*)DLSCH_dci)->type = 1;
// ((DCI1A_15MHz_FDD_t*)DLSCH_dci)->rballoc = 2047;
// size_bytes = sizeof(DCI1A_10MHz_FDD_t);
// size_bits = sizeof_DCI1A_10MHz_FDD_t;
break;
case 100:
((DCI1A_20MHz_FDD_t*)DLSCH_dci)->type = 1;
......@@ -332,12 +334,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
#endif
/* #ifndef DISABLE_SF_TRIGGER */
/* //Send subframe trigger to the controller */
/* if (mac_agent_registered[module_idP]) { */
/* agent_mac_xface[module_idP]->flexran_agent_send_sf_trigger(module_idP); */
/* } */
/* #endif */
// #ifndef DISABLE_SF_TRIGGER //
// //Send subframe trigger to the controller //
// if (mac_agent_registered[module_idP]) { //
// agent_mac_xface[module_idP]->flexran_agent_send_sf_trigger(module_idP); //
// } //
// #endif //
//if (subframeP%5 == 0)
//#ifdef EXMIMO
......@@ -362,17 +364,17 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
#endif
// refresh UE list based on UEs dropped by PHY in previous subframe
/*
i=UE_list->head;
while (i>=0) {
next_i = UE_list->next[i];
LOG_T(MAC,"UE %d : rnti %x, stats %p\n",i,UE_RNTI(module_idP,i),mac_xface->get_eNB_UE_stats(module_idP,0,UE_RNTI(module_idP,i)));
if (mac_xface->get_eNB_UE_stats(module_idP,0,UE_RNTI(module_idP,i))==NULL) {
mac_remove_ue(module_idP,i,frameP);
}
i=next_i;
}
*/
//
// i=UE_list->head;
// while (i>=0) {
// next_i = UE_list->next[i];
// LOG_T(MAC,"UE %d : rnti %x, stats %p\n",i,UE_RNTI(module_idP,i),mac_xface->get_eNB_UE_stats(module_idP,0,UE_RNTI(module_idP,i)));
// if (mac_xface->get_eNB_UE_stats(module_idP,0,UE_RNTI(module_idP,i))==NULL) {
// mac_remove_ue(module_idP,i,frameP);
// }
// i=next_i;
//}
//
switch (subframeP) {
case 0:
......@@ -1095,32 +1097,30 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag,
#endif
#endif
/*
int dummy=0;
for (i=0;
i<DCI_pdu[CC_id]->Num_common_dci+DCI_pdu[CC_id]->Num_ue_spec_dci;
i++)
if (DCI_pdu[CC_id]->dci_alloc[i].rnti==2)
dummy=1;
//
// int dummy=0;
// for (i=0;
// i<DCI_pdu[CC_id]->Num_common_dci+DCI_pdu[CC_id]->Num_ue_spec_dci;
// i++)
// if (DCI_pdu[CC_id]->dci_alloc[i].rnti==2)
// dummy=1;
if (dummy==1)
for (i=0;
i<DCI_pdu[CC_id]->Num_common_dci+DCI_pdu[CC_id]->Num_ue_spec_dci;
i++)
LOG_I(MAC,"Frame %d, subframe %d: DCI %d/%d, format %d, rnti %x, NCCE %d(num_pdcch_symb %d)\n",
frameP,subframeP,i,DCI_pdu[CC_id]->Num_common_dci+DCI_pdu[CC_id]->Num_ue_spec_dci,
DCI_pdu[CC_id]->dci_alloc[i].format,
DCI_pdu[CC_id]->dci_alloc[i].rnti,
DCI_pdu[CC_id]->dci_alloc[i].firstCCE,
DCI_pdu[CC_id]->num_pdcch_symbols);
LOG_D(MAC,"frameP %d, subframeP %d\n",frameP,subframeP);
*/
// if (dummy==1)
// for (i=0;
// i<DCI_pdu[CC_id]->Num_common_dci+DCI_pdu[CC_id]->Num_ue_spec_dci;
// i++)
// LOG_I(MAC,"Frame %d, subframe %d: DCI %d/%d, format %d, rnti %x, NCCE %d(num_pdcch_symb %d)\n",
// frameP,subframeP,i,DCI_pdu[CC_id]->Num_common_dci+DCI_pdu[CC_id]->Num_ue_spec_dci,
// DCI_pdu[CC_id]->dci_alloc[i].format,
// DCI_pdu[CC_id]->dci_alloc[i].rnti,
// DCI_pdu[CC_id]->dci_alloc[i].firstCCE,
// DCI_pdu[CC_id]->num_pdcch_symbols);
// LOG_D(MAC,"frameP %d, subframeP %d\n",frameP,subframeP);
//
stop_meas(&eNB_mac_inst[module_idP].eNB_scheduler);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT);
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file eNB_scheduler_RA_NB_IoT.c
* \brief functions used in Random access scheduling
......@@ -8,6 +28,41 @@
*
*/
#include "assertions.h"
#include "platform_types.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "msc.h"
#include "SCHED/defs.h"
#include "SCHED/extern.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/proto.h"
#include "UTIL/LOG/log.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "OCG.h"
#include "OCG_extern.h"
#include "RRC/LITE/extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
#include "SIMULATION/TOOLS/defs.h" // for taus
#include "T.h"
///////////////////////////////////////////////////////////////////////////////////////////////////////
#include "defs_NB_IoT.h"
#include "proto_NB_IoT.h"
#include "extern_NB_IoT.h"
......@@ -946,5 +1001,53 @@ void fill_rar_NB_IoT(
rar[5] = (uint8_t)(ra_template->ue_rnti&0xff);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////// NB-IoT testing /////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
void initiate_ra_proc_NB_IoT(module_id_t module_idP, int CC_id,frame_t frameP, uint16_t preamble_index,int16_t timing_offset,uint8_t sect_id,sub_frame_t subframeP,
uint8_t f_id)
{
uint8_t i;
RA_TEMPLATE *RA_template = (RA_TEMPLATE *)&eNB_mac_inst[module_idP].common_channels[CC_id].RA_template[0];
for (i=0; i<NB_RA_PROC_MAX; i++) {
if (RA_template[i].RA_active==FALSE &&
RA_template[i].wait_ack_Msg4 == 0) {
int loop = 0;
RA_template[i].RA_active=TRUE;
RA_template[i].generate_rar=1;
RA_template[i].generate_Msg4=0;
RA_template[i].wait_ack_Msg4=0;
RA_template[i].timing_offset=timing_offset;
/* TODO: find better procedure to allocate RNTI */
do {
RA_template[i].rnti = taus();
loop++;
} while (loop != 100 &&
/* TODO: this is not correct, the rnti may be in use without
* being in the MAC yet. To be refined.
*/
!(find_UE_id(module_idP, RA_template[i].rnti) == -1 &&
/* 1024 and 60000 arbirarily chosen, not coming from standard */
RA_template[i].rnti >= 1024 && RA_template[i].rnti < 60000));
if (loop == 100) {
printf("%s:%d:%s: FATAL ERROR! contact the authors\n", __FILE__, __LINE__, __FUNCTION__); abort(); }
RA_template[i].RA_rnti = 1 + (frameP/4);
RA_template[i].preamble_index = preamble_index; /// preamble_index=000000;
LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Activating RAR generation for process %d, rnti %x, RA_active %d\n",
module_idP,CC_id,frameP,i,RA_template[i].rnti,
RA_template[i].RA_active);
return;
}
}
LOG_E(MAC,"[eNB %d][RAPROC] FAILURE: CC_id %d Frame %d Initiating RA procedure for preamble index %d\n",module_idP,CC_id,frameP,preamble_index);
}
......@@ -62,6 +62,12 @@
#endif //PHY_EMUL
#include "SCHED/defs.h"
///// NB-IoT testing
#include "proto_NB_IoT.h"
/* TODO: this abstraction_flag here is very hackish - find a proper solution */
extern uint8_t abstraction_flag;
void dl_phy_sync_success(module_id_t module_idP,
......@@ -458,7 +464,8 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer,ui
mac_xface->eNB_dlsch_ulsch_scheduler = eNB_dlsch_ulsch_scheduler;
mac_xface->get_dci_sdu = get_dci_sdu;
mac_xface->fill_rar = fill_rar;
mac_xface->initiate_ra_proc = initiate_ra_proc;
//mac_xface->initiate_ra_proc = initiate_ra_proc;
mac_xface->initiate_ra_proc = initiate_ra_proc_NB_IoT;
mac_xface->cancel_ra_proc = cancel_ra_proc;
mac_xface->set_msg3_subframe = set_msg3_subframe;
mac_xface->SR_indication = SR_indication;
......
......@@ -38,6 +38,9 @@
* @{
*/
void initiate_ra_proc_NB_IoT(module_id_t module_idP,int CC_id,frame_t frameP, uint16_t preamble_index,int16_t timing_offset,uint8_t sect_id,sub_frame_t subframe,uint8_t f_id);
void mac_top_init_eNB_NB_IoT(void);
int l2_init_eNB_NB_IoT(void);
......
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