Commit 82fbfae5 authored by Nick Ho's avatar Nick Ho

Fix NB-IoT Asn.1 configuration and initialization

parent 03c6604f
......@@ -136,6 +136,8 @@ static inline void* malloc16_clear( size_t size )
//#include "PHY/LTE_TRANSPORT/defs.h"
#include "PHY/LTE_TRANSPORT/defs_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include <pthread.h>
#include "targets/ARCH/COMMON/common_lib.h"
......@@ -758,7 +760,7 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
// DCI for at most 2 DCI pdus
DCI_PDU_NB_IoT *DCI_pdu;
UL_IND_NB_IoT_t UL_INFO;
} PHY_VARS_eNB_NB_IoT;
......@@ -1107,7 +1109,6 @@ static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *
//#include "PHY/LTE_TRANSPORT/proto.h"
#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
//#include "PHY/LTE_ESTIMATION/defs.h"
//#include "SIMULATION/ETH_TRANSPORT/defs.h"
//#endif
#endif // __PHY_DEFS__H__
......@@ -57,8 +57,6 @@ extern PHY_VARS_eNB_NB_IoT *PHY_vars_eNB_NB_IoT_g[MAX_eNB_NB_IoT][MAX_NUM_CCs];
//extern MAC_xface_NB_IoT *mac_xface_NB_IoT;
extern IF_Module_t *if_inst;
extern short primary_synch_NB_IoT[264];
/*
......
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "../SCHED/IF_Module_L1_primitives_NB_IoT.h"
//#include "../SCHED/defs.h"
#include "../SCHED/defs_NB_IoT.h"
......@@ -169,7 +169,7 @@ void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
// do the schedule response and trigger the TX
void schedule_response(Sched_Rsp_t *Sched_INFO)
void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO)
{
//XXX check if correct to take eNB like this
......@@ -316,24 +316,25 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
}
void PHY_config_req(PHY_Config_t* config_INFO){
void PHY_config_req_NB_IoT(PHY_Config_NB_IoT_t* config_INFO){
LOG_I(PHY,"[NB-IoT] PHY CONFIG REQ NB-IoT In\n");
if(config_INFO->get_MIB != 0){
//MIB-NB configuration
phy_config_mib_eNB_NB_IoT(config_INFO->mod_id,
config_INFO->CC_id,
config_INFO->CC_id,
config_INFO->cfg->nfapi_config.rf_bands.rf_band[0],//eutraband
config_INFO->cfg->sch_config.physical_cell_id.value,
config_INFO->cfg->subframe_config.dl_cyclic_prefix_type.value,
config_INFO->cfg->subframe_config.ul_cyclic_prefix_type.value,
config_INFO->cfg->rf_config.tx_antenna_ports.value,
config_INFO->cfg->nfapi_config.earfcn.value,
config_INFO->cfg->config_NB_IoT.prb_index.value,
config_INFO->cfg->config_NB_IoT.operating_mode.value,
config_INFO->cfg->config_NB_IoT.control_region_size.value,
config_INFO->cfg->config_NB_IoT.assumed_crs_aps.value); //defined only in in-band different PCI
config_INFO->cfg->nb_iot_config.prb_index.value,
config_INFO->cfg->nb_iot_config.operating_mode.value,
config_INFO->cfg->nb_iot_config.control_region_size.value,
config_INFO->cfg->nb_iot_config.assumed_crs_aps.value); //defined only in in-band different PCI
}
......@@ -341,8 +342,8 @@ void PHY_config_req(PHY_Config_t* config_INFO){
{
//Common Configuration included in SIB2-NB
phy_config_sib2_eNB_NB_IoT(config_INFO->mod_id,
config_INFO->CC_id,
&config_INFO->cfg->config_NB_IoT, // FIXME to be evaluated is should be passed a pointer
config_INFO->CC_id,
&config_INFO->cfg->nb_iot_config, // FIXME to be evaluated is should be passed a pointer
&config_INFO->cfg->rf_config,
&config_INFO->cfg->uplink_reference_signal_config,
&config_INFO->extra_phy_parms);
......@@ -359,5 +360,7 @@ void PHY_config_req(PHY_Config_t* config_INFO){
&config_INFO->extra_phy_parms);
}
LOG_I(PHY,"IF Module for PHY Configuration has been done\n");
}
......@@ -7,21 +7,13 @@
#ifndef __IF_MODULE_L1_PRIMITIVES_NB_IOT_H__
#define __IF_MODULE_L1_PRIMITIVES_NB_IOT_H__
//#include "openair2/PHY_INTERFACE/IF_Module_nb_iot.h"
#include "openair1/PHY/defs_NB_IoT.h"
//#include "LAYER2/MAC/extern.h"
//#include "LAYER2/MAC/proto_NB_IoT.h"
//#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
void schedule_response(Sched_Rsp_t *Sched_INFO);
/*Interface for PHY Configuration
* Trigger the phy_config_xxx functions using parameters from the shared PHY_Config structure
* */
void PHY_config_req(PHY_Config_t* config_INFO);
void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
eNB_rxtx_proc_NB_IoT_t *proc,
nfapi_dl_config_request_pdu_t *dl_config_pdu,
......
......@@ -17,12 +17,12 @@ enum openair_HARQ_TYPE_NB_IoT {
};
void process_schedule_rsp_NB_IoT(Sched_Rsp_t *sched_rsp,
void process_schedule_rsp_NB_IoT(Sched_Rsp_NB_IoT_t *sched_rsp,
PHY_VARS_eNB_NB_IoT *eNB,
eNB_rxtx_proc_t *proc);
/*Processing the ue-specific resources for uplink in NB-IoT*/
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc, UL_IND_t *UL_INFO);
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc, UL_IND_NB_IoT_t *UL_INFO);
/* For NB-IoT, we put NPBCH in later part, since it would be scheduled by MAC scheduler,this generates NRS/NPSS/NSSS*/
void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
......
......@@ -63,13 +63,7 @@
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
extern uint16_t hundred_times_log10_NPRB_NB_IoT[100];
extern Sched_Rsp_t* Sched_Rsp;
#endif /*__SCHED_EXTERN_H__ */
......@@ -270,7 +270,7 @@ void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
}
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc,UL_IND_t *UL_INFO)
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc,UL_IND_NB_IoT_t *UL_INFO)
{
//RX processing for ue-specific resources (i
......
This diff is collapsed.
......@@ -479,6 +479,8 @@ typedef struct RA_template_list_s{
/*! \brief top level eNB MAC structure */
typedef struct {
uint8_t Mod_id;
// System
uint32_t hyper_system_frame;
uint32_t system_frame;
......@@ -516,6 +518,11 @@ typedef struct {
rrc_config_NB_IoT_t rrc_config;
nfapi_config_request_t config;
IF_Module_NB_IoT_t *if_inst_NB_IoT;
} eNB_MAC_INST_NB_IoT;
// actually not here, but for now put it here
......@@ -531,6 +538,8 @@ typedef struct {
nprach_parameters_NB_IoT_t nprach_list[3];
nfapi_config_request_t config;
//DLSF Table
DLSF_INFO_t DLSF_information;
......
......@@ -13,6 +13,7 @@
#include "extern_NB_IoT.h"
unsigned char str[6][7] = { "SIBs_1", "SIBs_2", "SIBs_3", "SIBs_4", "SIBs_5", "SIBs_6" };
unsigned char si_repetition_pattern_table[4] = { 20, 40, 80, 160};
void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, int start_subframe1){
......@@ -22,18 +23,20 @@ void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, in
schedule_result_t *new_node;
DCIFormatN1_t *sibs_dci;
uint32_t j, i, k, num_subframe, last_subframe, residual_subframe;
num_subframe = mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_tb;
for(k=0, i=start_subframe1;i<(start_subframe1+mac_inst->rrc_config.si_window_length);i+=mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern, ++k){
num_subframe = mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_tb;
for(k=0, i=start_subframe1;i<(start_subframe1+mac_inst->rrc_config.si_window_length);i+=si_repetition_pattern_table[mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern], ++k){
//printf("[debug][sibs%d] subframe: %d, check %d", sibs_order, i, num_subframe);
pt[k] = (available_resource_DL_t *)check_sibs_resource(mac_inst, i, i+9, num_subframe, &residual_subframe, &last_subframe, &first_subframe[k]);
num_subframe = residual_subframe;
//printf("-- rest: %d, last: %d start: %d\n", num_subframe, last_subframe, start_subframe1);
if(0==residual_subframe){
sibs_dci = (DCIFormatN1_t *)malloc(sizeof(DCIFormatN1_t));
sibs_dci->type = 1;
sibs_dci->orderIndicator = 0;
......@@ -45,7 +48,8 @@ void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, in
sibs_dci->HARQackRes = 0;
sibs_dci->DCIRep = 0;
for(k=0, j=start_subframe1;j<=i;++k, j+=mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern){
for(k=0, j=start_subframe1;j<=i;++k, j+=si_repetition_pattern_table[mac_inst->rrc_config.sibs_NB_IoT_sched[sibs_order].si_repetition_pattern]){
if((available_resource_DL_t *)0 != pt[k]){
new_node = (schedule_result_t *)malloc(sizeof(schedule_result_t));
// fill new node
......@@ -65,6 +69,7 @@ void schedule_sibs_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t sibs_order, in
fill_resource_DL(mac_inst, pt[k], first_subframe[k], (j==i)?last_subframe:j+9, new_node);
}
}
return ;
}
}
......
......@@ -27,7 +27,7 @@
//#include "LAYER2/MAC/vars_NB_IoT.h"
//NB-IoT
extern IF_Module_t *if_inst;
extern eNB_MAC_INST_NB_IoT *mac_inst;
// //extern uint32_t EBSR_Level[63];
......
......@@ -48,6 +48,8 @@ int mac_init_global_param_NB_IoT(void)
void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
{
int32_t i, j, k;
LOG_I(MAC,"[NB-IoT] MAC start initialization\n");
for(i=0;i<64;++i)
{
......@@ -69,7 +71,6 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
sib1_NB_IoT_sched_t *config = &mac_inst->rrc_config.sib1_NB_IoT_sched_config;
// DLSF Table
init_dlsf_info(mac_inst, &DLSF_information);
......@@ -97,8 +98,8 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
}
}
//mac_inst->si_window_length = ms160;
//mac_inst->sibs_NB_IoT_sched[0].si_periodicity = rf64;
mac_inst->rrc_config.si_window_length = ms160;
mac_inst->rrc_config.sibs_NB_IoT_sched[0].si_periodicity = rf64;
for(i=0;i<256;++i){
mac_inst->sibs_table[i] = -1;
......@@ -136,12 +137,13 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
//3 CE level USS list
mac_inst->UE_list_spec = (UE_list_NB_IoT_t*)malloc(NUM_USS_PP*sizeof(UE_list_NB_IoT_t));
//initial UE list
printf("[init_mac_NB_IoT] Initial UE list\n");
LOG_I(MAC,"[NB-IoT] Initial UE list\n");
mac_inst->num_uss_list = NUM_USS_PP;
for(i=0;i<NUM_USS_PP;++i)
{
//rrc_mac_config_req_NB_IoT(&mac_inst->rrc_config, 0, 0, 1, i);
rrc_mac_config_req_NB_IoT(0,0,0,NULL,NULL,NULL,NULL,NULL,1,i);
(mac_inst->UE_list_spec+i)->head = -1;
(mac_inst->UE_list_spec+i)->tail = -1;
(mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max = mac_inst->rrc_config.npdcch_ConfigDedicated[i].R_max;
......@@ -159,7 +161,8 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
(mac_inst->UE_list_spec+i)->UE_template_NB_IoT[j].direction = -1;
}
//SCHEDULE_LOG("[%04d][init_mac_NB_IoT] List_number %d R_max %d G %.1f a_offset %.1f T %d SS_start %d\n", mac_inst->current_subframe, i, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.T, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.ss_start_uss);
printf("[init_mac_NB_IoT] List_number %d R_max %d G %.1f a_offset %.1f T %d SS_start %d\n", i, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.T, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.ss_start_uss);
LOG_I(MAC,"[NB-IoT] List_number %d R_max %d G %.1f a_offset %.1f T %d SS_start %d\n", i, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.R_max, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.G, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.a_offset, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.T, (mac_inst->UE_list_spec+i)->NPDCCH_config_dedicated.ss_start_uss);
}
/*
......@@ -199,14 +202,46 @@ void init_mac_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst)
//Initialize uplink resource from nprach configuration
Initialize_Resource();
//add_UL_Resource(mac_inst);
extend_available_resource_DL(mac_inst, mac_inst->current_subframe + 1 + 160);
extend_available_resource_DL(mac_inst, mac_inst->current_subframe + 1 + 160);
}
void mac_top_init_eNB_NB_IoT(void)
{
// can be an input of this function, but now fix to 0
module_id_t i = 0;
//UE_list_t *UE_list;
//eNB_MAC_INST_NB_IoT *mac;
int nb_inst_NB_IOT_MAC= 1;
LOG_I(MAC,"[NB-IoT MAIN] Init function start:nb_nbiot_macrlc_inst=%d\n",nb_inst_NB_IOT_MAC);
if (nb_inst_NB_IOT_MAC>0) {
// only one inst exit in legacy OAI
mac_inst->Mod_id = i;
// IF Module Initialization linking
mac_inst->if_inst_NB_IoT = IF_Module_init_NB_IoT(i);
mac_inst->if_inst_NB_IoT->PHY_config_req = PHY_config_req_NB_IoT;
mac_inst->if_inst_NB_IoT->schedule_response = schedule_response_NB_IoT;
//reserve for fapi structure initializati
} else {
mac_inst = NULL;
}
// for NB-IoT UE list initialization will be in init_mac_NB_IoT
}
int l2_init_eNB_NB_IoT(void)
{
LOG_I(MAC,"[MAIN] Mapping L2 IF-Module functions\n");
IF_Module_init_L2();
LOG_I(MAC,"[MAIN] MAC_INIT_GLOBAL_PARAM NB-IoT IN...\n");
......
......@@ -23,10 +23,10 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
uint8_t MIB_size = 0;
uint8_t SIB1_size = 0, i = 0;
Sched_Rsp_t *SCHED_info = (Sched_Rsp_t*) malloc(sizeof(Sched_Rsp_t));
Sched_Rsp_NB_IoT_t *SCHED_info = (Sched_Rsp_NB_IoT_t*) malloc(sizeof(Sched_Rsp_NB_IoT_t));
nfapi_dl_config_request_pdu_t *dl_config_pdu;
nfapi_hi_dci0_request_pdu_t* hi_dci0_pdu;
nfapi_ul_config_request_pdu_t* ul_config_pdu;
nfapi_ul_config_request_pdu_t* ul_config_pdu = NULL;
schedule_result_t *tmp;
int DL_empty = 0, UL_empty = 0;
//uint32_t current_time = 0;
......@@ -63,6 +63,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
// fill MIB PDU
//SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->NB_IoTch_pdu.NB_IoTch_pdu_rel13.pdu_index].segments[0].segment_data = MIB;
LOG_I(MAC,"NB-IoT fill MIB\n");
//dl_scheduled(mac_inst->current_subframe, _NPBCH, 0, "MIB");
}
else if(SIB1_flag == 1)
......@@ -78,7 +79,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.modulation = 2;
//SCHED_info->TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.pdu_index].segments[0].segment_data = SIB1;
LOG_I(MAC,"NB-IoT fill SIB1\n");
//start symbol, Resource assignment, Repetition number, Number of subframe Resource assignment lost for now
//dl_scheduled(mac_inst->current_subframe, _NPDSCH, SI_RNTI, "SIB1");
}
......@@ -114,6 +115,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
if(schedule_result_list_DL->direction == DL)
{
LOG_I(MAC,"NB-IoT fill DL_DCI\n");
//printf("Sched Info DL DCI here\n");
SCHED_info->DL_req->dl_config_request_body.number_dci = 1;
DCI_pdu = schedule_result_list_DL->DCI_pdu;
......@@ -137,6 +139,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN1_t *)DCI_pdu)->DCIRep;
}else if(schedule_result_list_DL->direction == UL)
{
LOG_I(MAC,"NB-IoT fill DL_DCI\n");
SCHED_info->HI_DCI0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t));
SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)malloc(sizeof(nfapi_hi_dci0_request_pdu_t));
hi_dci0_pdu = SCHED_info->HI_DCI0_req->hi_dci0_request_body.hi_dci0_pdu_list;
......@@ -158,7 +161,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
}
break;
case NPDSCH:
LOG_I(MAC,"NB-IoT fill DL Data\n");
DCI_pdu = schedule_result_list_DL-> DCI_pdu;
SCHED_info->DL_req->dl_config_request_body.number_pdu = 1;
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE;
......@@ -221,7 +224,8 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
{
if(schedule_result_list_UL->channel == NPUSCH)
{
printf("first UL \n");
//printf("first UL \n");
LOG_I(MAC,"NB-IoT fill ul_config_pdu\n");
SCHED_info->UL_req->ul_config_request_body.number_of_pdus ++;
//SCHED_info->UL_req.sfn_sf = ;
(ul_config_pdu + i) ->pdu_type = NFAPI_UL_CONFIG_NULSCH_PDU_TYPE;
......
......@@ -38,6 +38,7 @@
* @{
*/
void mac_top_init_eNB_NB_IoT(void);
int l2_init_eNB_NB_IoT(void);
// main schedule functions
......@@ -104,7 +105,6 @@ uint32_t from_earfcn_NB_IoT(int eutra_bandP,uint32_t dl_earfcn, float m_dl);
int32_t get_uldl_offset_NB_IoT(int eutra_band);
void config_mib_fapi_NB_IoT(
int rntiP,
int physCellId,
uint8_t eutra_band,
int Ncp,
......@@ -131,7 +131,6 @@ void rrc_mac_config_req_NB_IoT(
RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon,
PhysicalConfigDedicated_NB_r13_t *physicalConfigDedicated,
LogicalChannelConfig_NB_r13_t *logicalChannelConfig, //FIXME: decide how to use it
rrc_config_NB_IoT_t *mac_config,
uint8_t ded_flag,
uint8_t ue_list_ded_num);
......
......@@ -21,8 +21,6 @@
//#include "COMMON/mac_rrc_primitives.h"
IF_Module_t *if_inst;
//NB-IoT--------------------------------------
eNB_MAC_INST_NB_IoT *mac_inst;
......
......@@ -3,7 +3,7 @@
// Sched_INFO as a input for the scheduler
void UL_indication(UL_IND_t *UL_INFO)
void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
{
int i=0;
//UE_TEMPLATE_NB_IoT *UE_info;
......
......@@ -6,8 +6,4 @@
#ifndef __IF_MODULE_L2_PRIMITIVES_NB_IOT_H__
#define __IF_MODULE_L2_PRIMITIVES_NB_IOT_H__
/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler)
*/
void UL_indication(UL_IND_t *UL_INFO);
#endif
......@@ -5,23 +5,25 @@
//#include "LAYER2/MAC/proto_NB_IoT.h"
//called at initialization of L2
void IF_Module_init_L2(void) // northbound IF-Module Interface
{
//mapping the IF-Module function to L2 definition
if_inst->UL_indication = UL_indication;
#define MAX_IF_MODULES_NB_IoT 1
//return if_inst;
}
IF_Module_NB_IoT_t *if_inst_NB_IoT[MAX_IF_MODULES_NB_IoT];
//#include "LAYER2/MAC/proto_NB_IoT.h"
//called at initialization of L1 (phy_init_lte_eNB)
void IF_Module_init_L1(void) //southbound IF-Module Interface
{
//mapping the IF-module function to L1 definition
if_inst->schedule_response = schedule_response;
if_inst->PHY_config_req = PHY_config_req;
IF_Module_NB_IoT_t *IF_Module_init_NB_IoT(int Mod_id){
//return if_inst;
}
AssertFatal(Mod_id<MAX_MODULES,"Asking for Module %d > %d\n",Mod_id,MAX_IF_MODULES_NB_IoT);
if (if_inst_NB_IoT[Mod_id]==NULL) {
if_inst_NB_IoT[Mod_id] = (IF_Module_NB_IoT_t*)malloc(sizeof(IF_Module_NB_IoT_t));
memset((void*)if_inst_NB_IoT[Mod_id],0,sizeof(IF_Module_NB_IoT_t));
//if_inst[Mod_id]->CC_mask=0;
if_inst_NB_IoT[Mod_id]->UL_indication = UL_indication_NB_IoT;
/*AssertFatal(pthread_mutex_init(&if_inst[Mod_id]->if_mutex,NULL)==0,
"allocation of if_inst[%d]->if_mutex fails\n",Mod_id);*/
}
return if_inst_NB_IoT[Mod_id];
}
......@@ -13,6 +13,7 @@
#include "PhysicalConfigDedicated-NB-r13.h"
//#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "openair2/COMMON/platform_types.h"
//#include "openair1/SCHED/IF_Module_L1_primitives_NB_IoT.h"
//#define SCH_PAYLOAD_SIZE_MAX 4096
#define BCCH_PAYLOAD_SIZE_MAX_NB_IoT 128
......@@ -106,7 +107,7 @@ typedef struct{
/*MP: MISSED COMMON CONFIG. of SIB2-NB in FAPI SPECS (may non needed)*/
extra_phyConfig_t extra_phy_parms;
}PHY_Config_t;
}PHY_Config_NB_IoT_t;
......@@ -147,7 +148,7 @@ typedef struct{
/*crc_indication*/
nfapi_crc_indication_body_t crc_ind;
}UL_IND_t;
}UL_IND_NB_IoT_t;
// Downlink subframe P7
......@@ -178,25 +179,34 @@ typedef struct{
/// Pointers to DL SDUs
//uint8_t **sdu;
}Sched_Rsp_t;
}Sched_Rsp_NB_IoT_t;
/*IF_Module_t a group for gathering the Interface
It should be allocated at the main () in lte-softmodem.c*/
typedef struct IF_Module_s{
//define the function pointer
void (*UL_indication)(UL_IND_t *UL_INFO);
void (*schedule_response)(Sched_Rsp_t *Sched_INFO);
void (*PHY_config_req)(PHY_Config_t* config_INFO);
void (*UL_indication)(UL_IND_NB_IoT_t *UL_INFO);
void (*schedule_response)(Sched_Rsp_NB_IoT_t *Sched_INFO);
void (*PHY_config_req)(PHY_Config_NB_IoT_t* config_INFO);
}IF_Module_t;
}IF_Module_NB_IoT_t;
/*Initial */
/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO);
//int IF_Module_init(IF_Module_t *if_inst);
/*Interface for PHY Configuration
* Trigger the phy_config_xxx functions using parameters from the shared PHY_Config structure
* */
void PHY_config_req_NB_IoT(PHY_Config_NB_IoT_t* config_INFO);
/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler)
*/
void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO);
void IF_Module_init_L1(void);
void IF_Module_init_L2(void);
/*Initial */
IF_Module_NB_IoT_t *IF_Module_init_NB_IoT(int Mod_id);
#endif
......@@ -1125,7 +1125,7 @@ typedef struct {
nfapi_emtc_config_t emtc_config;
nfapi_tdd_frame_structure_t tdd_frame_structure_config;
nfapi_l23_config_t l23_config;
nfapi_config_NB_IoT_t config_NB_IoT;
nfapi_config_NB_IoT_t nb_iot_config;
// addition nfapi tlvs as per table 2-16 in idle or configure
nfapi_nfapi_t nfapi_config;
......
......@@ -34,7 +34,7 @@
unsigned int mac_debug;
//MAC_xface *mac_xface;
IF_Module_t* if_inst;
//IF_Module_t* if_inst;
//MACPHY_PARAMS MACPHY_params;
......
......@@ -65,7 +65,8 @@
uint8_t do_MIB_NB_IoT(
rrc_eNB_carrier_data_NB_IoT_t *carrier,
uint32_t N_RB_DL,
uint32_t frame);
uint32_t frame,
uint32_t hyper_frame);
/**
......
......@@ -39,7 +39,6 @@
#include "LogicalChannelConfig-NB-r13.h"
#include "LAYER2/MAC/defs_NB_IoT.h"
extern IF_Module_t *if_inst;
extern eNB_MAC_INST_NB_IoT *mac_inst;
......@@ -48,7 +47,6 @@ extern eNB_MAC_INST_NB_IoT *mac_inst;
extern UE_RRC_INST_NB_IoT *UE_rrc_inst_NB_IoT;
extern eNB_RRC_INST_NB_IoT *eNB_rrc_inst_NB_IoT;
extern PHY_Config_t *config_INFO;
extern rlc_info_t Rlc_info_am_NB_IoT,Rlc_info_am_config_NB_IoT;
extern uint8_t DRB2LCHAN_NB_IoT[2];
......
......@@ -37,6 +37,10 @@
#include "LAYER2/MAC/defs_NB_IoT.h"
/*NOTE: no static function should be declared in this header file (e.g. init_SI_NB)*/
uint8_t *get_NB_IoT_MIB(void);
void init_testing_NB_IoT(uint8_t Mod_id, int CC_id, rrc_eNB_carrier_data_NB_IoT_t *carrier, RrcConfigurationReq *configuration, uint32_t frame, uint32_t hyper_frame);
/*------------------------common_nb_iot.c----------------------------------------*/
/** \brief configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
......
......@@ -45,7 +45,7 @@
//#include "rrc_eNB_UE_context.h"
//#include "proto_NB_IoT.h"
#include "RRC/LITE/defs_NB_IoT.h"
#include "RRC/LITE/vars_NB_IoT.h"
//#include "RRC/LITE/vars_NB_IoT.h"
#ifdef LOCALIZATION
#include <sys/time.h>
......
......@@ -31,7 +31,15 @@
#define RRC_ENB_C
#include "defs.h"
// NB-IoT Section
#include "defs_NB_IoT.h"
#include "vars_NB_IoT.h"
#include "extern.h"
#include "extern_NB_IoT.h"
#include "LAYER2/MAC/proto_NB_IoT.h"
#include "RRC/LITE/MESSAGES/asn1_msg_NB_IoT.h"
// NB-IoT end
#include "assertions.h"
#include "asn1_conversions.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
......@@ -111,6 +119,112 @@ extern uint16_t two_tier_hexagonal_cellIds[7];
mui_t rrc_eNB_mui = 0;
uint8_t *get_NB_IoT_MIB(void)
{
// CC_ID=0
return eNB_rrc_inst_NB_IoT->carrier[0].MIB_NB_IoT;
}
void init_testing_NB_IoT(uint8_t Mod_id, int CC_id, rrc_eNB_carrier_data_NB_IoT_t *carrier, RrcConfigurationReq *configuration, uint32_t frame, uint32_t hyper_frame)
{
//copy basic parameters
carrier[CC_id].physCellId = configuration->Nid_cell[CC_id];
carrier[CC_id].p_rx_eNB = 1;
carrier[CC_id].Ncp = configuration->prefix_type[CC_id]; //DL Cyclic prefix
carrier[CC_id].Ncp_UL = configuration->prefix_type_UL[CC_id];//UL cyclic prefix
carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id];
carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id];
//TODO: verify who allocate memory for sib1_NB_IoT, sib2_NB_IoT, sib3_NB and mib_nb in the carrier before being passed as parameter
carrier[CC_id].sizeof_SIB1_NB_IoT = 0;
carrier[CC_id].sizeof_SIB23_NB_IoT = 0;
carrier[CC_id].sizeof_MIB_NB_IoT = 0;
//MIB
carrier[CC_id].MIB_NB_IoT = (uint8_t*) malloc16(32); //MIB is 34 bits=5bytes needed
if (carrier[CC_id].MIB_NB_IoT)
{
carrier[CC_id].sizeof_MIB_NB_IoT =
do_MIB_NB_IoT(carrier,
configuration->N_RB_DL[CC_id],
0, //frame
0// hyper sfn
);
}
else {
LOG_E(RRC, " init_SI: FATAL, no memory for MIB_NB_IoT allocated\n");
//exit here
}
if (carrier[CC_id].sizeof_MIB_NB_IoT == 255) {
// exit here
}
//SIB1_NB_IoT
carrier[CC_id].SIB1_NB_IoT = (uint8_t*) malloc16(32);//allocation of buffer memory for SIB1_NB_IOT
if (carrier[CC_id].SIB1_NB_IoT)
carrier[CC_id].sizeof_SIB1_NB_IoT = do_SIB1_NB_IoT( //follow the new implementation
Mod_id,
CC_id,
carrier,
configuration,
0 //FIXME is correct to pass frame = 0??
);
else {
LOG_E(RRC, " init_SI: FATAL, no memory for SIB1_NB_IoT allocated\n");
//exit here
}
if (carrier[CC_id].sizeof_SIB1_NB_IoT == 255) {
//exit here
}
//SIB23_NB_IoT
carrier[CC_id].SIB23_NB_IoT = (uint8_t*) malloc16(64);
if (carrier[CC_id].SIB23_NB_IoT) {
carrier[CC_id].sizeof_SIB23_NB_IoT = do_SIB23_NB_IoT(
Mod_id,
CC_id,
carrier,
configuration
);
if (carrier[CC_id].sizeof_SIB23_NB_IoT == 255) {
//exit here
}
//Configure MAC
rrc_mac_config_req_NB_IoT(Mod_id,
CC_id,
0,
carrier,
(SystemInformationBlockType1_NB_t*) carrier[CC_id].sib1_NB_IoT,
(RadioResourceConfigCommonSIB_NB_r13_t *) &carrier[CC_id].sib2_NB_IoT->radioResourceConfigCommon_r13,
(struct PhysicalConfigDedicated_NB_r13 *)NULL,
(struct LogicalChannelConfig_NB_r13 *)NULL,
0,
0
);
} else {
LOG_E(RRC, " init_SI: FATAL, no memory for SIB23_NB_IoT allocated\n");
//exit here
}
}
//-----------------------------------------------------------------------------
static void
init_SI(
......@@ -129,6 +243,14 @@ init_SI(
int i;
#endif
/*Nick Start*/
// for NB-IoT Initialization configuration testing
if(eNB_rrc_inst_NB_IoT==NULL)
eNB_rrc_inst_NB_IoT = (eNB_RRC_INST_NB_IoT*) malloc (sizeof(eNB_RRC_INST_NB_IoT));
init_testing_NB_IoT(ctxt_pP->module_id,CC_id,&eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id],configuration,0,0);
/*Here will copy basic parameters and implement do_MIB, rrc_eNB_carrier_data_t will add some parameters in MIB*/
eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1 = 0;
......
......@@ -1599,7 +1599,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB_IoT(const protocol_
/*-----------------CONFIGURATION-------------------*/
/*
//-----------------------------------------------------------------------------
static void init_SI_NB_IoT(
const protocol_ctxt_t* const ctxt_pP,
......@@ -1608,9 +1608,7 @@ static void init_SI_NB_IoT(
)
//-----------------------------------------------------------------------------
{
/*WE should allocate memory for PHY_Config structure
* is declared in vars_nb_iot.c and put also in the extern_nb_iot
* */
config_INFO = malloc(sizeof(PHY_Config_t));
......@@ -1639,8 +1637,9 @@ static void init_SI_NB_IoT(
eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id].sizeof_MIB_NB_IoT =
do_MIB_NB_IoT(&eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id],
configuration->N_RB_DL[CC_id],
0 //FIXME is correct to pass frame = 0??
);
0, //FIXME is correct to pass frame = 0??
0
);
}
else {
LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for MIB_NB_IoT allocated\n",
......@@ -1693,7 +1692,7 @@ static void init_SI_NB_IoT(
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
/*FIXME: decide which parameter to show....*/
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" TODO: some parameter of SIB23-NB to show\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
......@@ -1729,7 +1728,7 @@ static void init_SI_NB_IoT(
//exit here
}
}
*/
//-----------------------------------------------------------------------------
//aka openair_rrc_eNB_init
char openair_rrc_eNB_configuration_NB_IoT(
......@@ -1780,7 +1779,7 @@ while ( eNB_rrc_inst_NB_IoT == NULL ) {
//init SI
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
init_SI_NB_IoT(&ctxt, CC_id,configuration);
//init_SI_NB_IoT(&ctxt, CC_id,configuration);
}
/*New implementation Raymond*/
......
......@@ -71,8 +71,6 @@ unsigned short Data_to_read;
eNB_RRC_INST_NB_IoT *eNB_rrc_inst_NB_IoT;
uint8_t DRB2LCHAN_NB_IoT[2];//max can be 2 DRBs for NB_IoT --> it used for saving the LCID of DRBs
//structure for FAPI-like configuration (memory for this is allocated in init_SI)
PHY_Config_t *config_INFO;
BOOLEAN_t logicalChannelSR_Prohibit = 1;
long priority =1;
......
......@@ -1914,10 +1914,7 @@ int main( int argc, char **argv ) {
int eMBMS_active=0;
if (node_function[0] <= NGFI_RAU_IF4p5) { // don't initialize L2 for RRU
// MP, Nick: Initialization of IF module for NB-IoT should be here
if_inst = malloc(sizeof(IF_Module_t));
LOG_I(PHY,"Allocate IF-Module for NB-IoT\n");
//---------------------------
......@@ -2042,9 +2039,9 @@ int main( int argc, char **argv ) {
} else {
#ifdef NB_IOT
printf("Initializing IF Module in PHY layer\n");
//printf("Initializing IF Module in PHY layer\n");
//register function
IF_Module_init_L1();
//IF_Module_init_L1();
#endif
printf("Initializing eNB threads\n");
......
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