Commit cca638e2 authored by chenhsunyang0922's avatar chenhsunyang0922

fix error in MAC layer

parent e753e773
......@@ -370,6 +370,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
# define LOG_N(c, x...) /* */
# define VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
......@@ -387,6 +388,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_E(c, x...) /* */
# define LOG_D(c, x...) /* */
# define LOG_T(c, x...) /* */
# define LOG_N(c, x...) /* */
# define LOG_DUMPMSG(c, b, s, x...) /* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
......
......@@ -44,10 +44,8 @@
#include "fapi_l1.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "assertions.h"
#include "msc.h"
#include <time.h>
#include "intertask_interface.h"
......@@ -2005,3 +2003,4 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
}
......@@ -218,7 +218,7 @@ int16_t get_target_pucch_rx_power(module_id_t module_idP, uint8_t CC_id);
int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx);
void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset);
void release_rnti_of_phy(module_id_t mod_id);
/*@}*/
......
......@@ -29,7 +29,6 @@
* \note
* \warning
*/
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
#include "PHY/defs_L1_NB_IoT.h"
......@@ -83,7 +82,7 @@
#endif
extern eNB_MAC_INST_NB_IoT *eNB_mac_inst; // For NB-IoT branch
//extern eNB_MAC_INST_NB_IoT *eNB_mac_inst; // For NB-IoT branch
/*
......@@ -1239,14 +1238,14 @@ void phy_procedures_emos_eNB_RX(unsigned char subframe,PHY_VARS_eNB_NB_IoT *eNB)
#endif
void common_signal_procedures (PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *proc) {
void common_signal_procedures_nbiot (PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *proc) {
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
int **txdataF = eNB->common_vars.txdataF[0];
//////////////////////////////////////////////////////// to uncomment for LTE, uint8_t *pbch_pdu=&eNB->pbch_pdu[0];
int subframe = proc->subframe_tx;
int frame = proc->frame_tx;
RA_TEMPLATE_NB_IoT *RA_template = (RA_TEMPLATE_NB_IoT *)&eNB_mac_inst[eNB->Mod_id].RA_template[0];
RA_TEMPLATE_NB_IoT *RA_template = (RA_TEMPLATE_NB_IoT *)&eNB_mac_inst[eNB->Mod_id].common_channels[eNB->CC_id].RA_template[0];
//int With_NSSS=0;
int framerx = proc->frame_rx;
int subframerx = proc->subframe_rx;
......@@ -2477,7 +2476,7 @@ void cba_procedures(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *proc,int UE
print_CQI(eNB->ulsch[UE_id]->harq_processes[harq_pid]->o,eNB->ulsch[UE_id]->harq_processes[harq_pid]->uci_format,0,fp->N_RB_DL);
#endif
access_mode = UNKNOWN_ACCESS;
extract_CQI(eNB->ulsch[UE_id]->harq_processes[harq_pid]->o,
extract_CQI_NB_IoT(eNB->ulsch[UE_id]->harq_processes[harq_pid]->o,
eNB->ulsch[UE_id]->harq_processes[harq_pid]->uci_format,
&eNB->UE_stats[UE_id],
fp->N_RB_DL,
......@@ -2804,7 +2803,7 @@ void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_
//if (((frame%10) == 0) || (frame < 50))
print_CQI(eNB->ulsch[i]->harq_processes[harq_pid]->o,eNB->ulsch[i]->harq_processes[harq_pid]->uci_format,0,fp->N_RB_DL);
#endif
extract_CQI(eNB->ulsch[i]->harq_processes[harq_pid]->o,
extract_CQI_NB_IoT(eNB->ulsch[i]->harq_processes[harq_pid]->o,
eNB->ulsch[i]->harq_processes[harq_pid]->uci_format,
&eNB->UE_stats[i],
fp->N_RB_DL,
......
......@@ -54,7 +54,6 @@
#include "common/config/config_userapi.h"
#include "RRC_config_tools.h"
#include "enb_paramdef.h"
#include "enb_paramdef_NB_IoT.h"
#include "proto_agent.h"
extern uint16_t sf_ahead;
......@@ -290,9 +289,6 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) {
ccparams_lte_t ccparams_lte;
ccparams_sidelink_t SLconfig;
ccparams_eMTC_t eMTCconfig;
// for NB-IoT
ccparams_NB_IoT_t NBconfig;
memset((void *)&NBconfig,0,sizeof(ccparams_NB_IoT_t));
memset((void *)&ccparams_lte,0,sizeof(ccparams_lte_t));
memset((void *)&SLconfig,0,sizeof(ccparams_sidelink_t));
......@@ -310,8 +306,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) {
memset((void *)&srb1_params,0,sizeof(srb1_params_t));
paramdef_t SRB1Params[] = SRB1PARAMS_DESC(srb1_params);
paramdef_t SLParams[] = CCPARAMS_SIDELINK_DESC(SLconfig);
// for NB-IoT
paramdef_t NBIOTParams[] = CCPARAMS_NB_IOT_DESC(NBconfig);
/* map parameter checking array instances to parameter definition array instances */
for (int I=0; I< ( sizeof(CCsParams)/ sizeof(paramdef_t) ) ; I++) {
......@@ -1656,15 +1651,6 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) {
if (eMTCconfig.eMTC_configured > 0) fill_eMTC_configuration(msg_p,&eMTCconfig, i,j,RC.config_file_name,brparamspath);
else printf("No eMTC configuration, skipping it\n");
// NB-IoT configuration
char NBparamspath[MAX_OPTNAME_SIZE*2 + 16];
sprintf(NBparamspath,"%s.%s", ccspath, ENB_CONFIG_STRING_NB_IoT_PARAMETERS);
config_get(NBIOTParams, sizeof(NBIOTParams)/sizeof(paramdef_t), NBparamspath);
NBIOTRRC_CONFIGURATION_REQ(msg_p).NB_IoT_configured = NBconfig.NB_IoT_configured&1;
if (NBconfig.NB_IoT_configured > 0) fill_NB_IoT_configuration(msg_p,&NBconfig, i,j,RC.config_file_name,NBparamspath);
else printf("No NB-IoT configuration, skipping it\n");
// Sidelink configuration
char SLparamspath[MAX_OPTNAME_SIZE*2 + 16];
sprintf(SLparamspath,"%s.%s", ccspath, ENB_CONFIG_STRING_SL_PARAMETERS);
......
......@@ -48,6 +48,7 @@
#include "enb_paramdef.h"
#define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\
struct in_addr inp;\
if ( inet_aton(AdDr_StR, &inp ) < 0 ) {\
......@@ -169,7 +170,6 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i);
void fill_SL_configuration(MessageDef *msg_p, ccparams_sidelink_t *SLconfig,int cell_idx,int cc_idx,char *config_fname);
void fill_eMTC_configuration(MessageDef *msg_p, ccparams_eMTC_t *eMTCconfig, int cell_idx,int cc_idx,char *config_fname,char *brparamspath);
int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i);
void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp);
......
......@@ -101,7 +101,7 @@ void config_mib_fapi_NB_IoT(int physCellId,
{
nfapi_config_request_t *cfg = &mac_inst->config;
nfapi_config_request_t *cfg = &eNB_mac_inst->config;
cfg->sch_config.physical_cell_id.value = physCellId;
cfg->nfapi_config.rf_bands.rf_band[0] = eutra_band;
......@@ -169,7 +169,7 @@ void config_sib2_fapi_NB_IoT(
)
{
nfapi_config_request_t *cfg = &mac_inst->config;
nfapi_config_request_t *cfg = &eNB_mac_inst->config;
/*
* Following the FAPI like approach:
* 1) fill the PHY_Config_t structure (PHY_INTERFACE/IF_Module_NB_IoT.h)
......@@ -306,7 +306,7 @@ void rrc_mac_config_req_NB_IoT(
mac_top_init_eNB_NB_IoT();
mac_config = &mac_inst->rrc_config;
mac_config = &eNB_mac_inst->rrc_config;
long schedulingInfoSIB1 = carrier->mib_NB_IoT.message.schedulingInfoSIB1_r13;
......@@ -401,10 +401,10 @@ void rrc_mac_config_req_NB_IoT(
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[0].mac_npdcch_Offset_RA_NB_IoT = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
mac_inst->npdcch_config_common[0].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_inst->npdcch_config_common[0].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_inst->npdcch_config_common[0].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH CE 0 setting: Rmax: %lu G: %lf a: %lf\n",mac_inst->npdcch_config_common[0].R_max,mac_inst->npdcch_config_common[0].G,mac_inst->npdcch_config_common[0].a_offset);
eNB_mac_inst->npdcch_config_common[0].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
eNB_mac_inst->npdcch_config_common[0].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
eNB_mac_inst->npdcch_config_common[0].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH CE 0 setting: Rmax: %lu G: %lf a: %lf\n",eNB_mac_inst->npdcch_config_common[0].R_max,eNB_mac_inst->npdcch_config_common[0].G,eNB_mac_inst->npdcch_config_common[0].a_offset);
}
//CE level 1
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[1] != NULL)
......@@ -415,10 +415,10 @@ void rrc_mac_config_req_NB_IoT(
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[1].mac_npdcch_Offset_RA_NB_IoT = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
mac_inst->npdcch_config_common[1].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_inst->npdcch_config_common[1].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_inst->npdcch_config_common[1].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH CE 1 setting: Rmax: %lu G: %lf a: %lf\n",mac_inst->npdcch_config_common[1].R_max,mac_inst->npdcch_config_common[1].G,mac_inst->npdcch_config_common[1].a_offset);
eNB_mac_inst->npdcch_config_common[1].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
eNB_mac_inst->npdcch_config_common[1].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
eNB_mac_inst->npdcch_config_common[1].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH CE 1 setting: Rmax: %lu G: %lf a: %lf\n",eNB_mac_inst->npdcch_config_common[1].R_max,eNB_mac_inst->npdcch_config_common[1].G,eNB_mac_inst->npdcch_config_common[1].a_offset);
}
//CE level 2
if ( radioResourceConfigCommon->nprach_Config_r13.nprach_ParametersList_r13.list.array[2] != NULL)
......@@ -429,10 +429,10 @@ void rrc_mac_config_req_NB_IoT(
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_NumRepetitions_RA_NB_IoT = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_StartSF_CSS_RA_NB_IoT = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_config->mac_NPRACH_ConfigSIB[2].mac_npdcch_Offset_RA_NB_IoT = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
mac_inst->npdcch_config_common[2].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
mac_inst->npdcch_config_common[2].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
mac_inst->npdcch_config_common[2].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH CE 2 setting: Rmax: %lu G: %lf a: %lf\n",mac_inst->npdcch_config_common[2].R_max,mac_inst->npdcch_config_common[2].G,mac_inst->npdcch_config_common[2].a_offset);
eNB_mac_inst->npdcch_config_common[2].R_max = rmax[nprach_parameter->npdcch_NumRepetitions_RA_r13];
eNB_mac_inst->npdcch_config_common[2].G = gvalue[nprach_parameter->npdcch_StartSF_CSS_RA_r13];
eNB_mac_inst->npdcch_config_common[2].a_offset = pdcchoffset[nprach_parameter->npdcch_Offset_RA_r13];
LOG_I(MAC,"NPRACH CE 2 setting: Rmax: %lu G: %lf a: %lf\n",eNB_mac_inst->npdcch_config_common[2].R_max,eNB_mac_inst->npdcch_config_common[2].G,eNB_mac_inst->npdcch_config_common[2].a_offset);
}
config_sib2_fapi_NB_IoT(carrier->physCellId,radioResourceConfigCommon);
......@@ -465,24 +465,24 @@ void rrc_mac_config_req_NB_IoT(
}
}
if(mac_inst->if_inst_NB_IoT!=NULL)
if(eNB_mac_inst->if_inst_NB_IoT!=NULL)
{
if (radioResourceConfigCommon!=NULL)
{
AssertFatal( mac_inst->if_inst_NB_IoT->PHY_config_req != NULL, "rrc_mac_config_req_eNB_NB_IoT: PHY_config_req pointer function is NULL\n");
AssertFatal( eNB_mac_inst->if_inst_NB_IoT->PHY_config_req != NULL, "rrc_mac_config_req_eNB_NB_IoT: PHY_config_req pointer function is NULL\n");
PHY_Config_NB_IoT_t phycfg;
phycfg.mod_id = Mod_idP;
phycfg.cfg = &mac_inst->config;
phycfg.cfg = &eNB_mac_inst->config;
if (mac_inst->if_inst_NB_IoT->PHY_config_req)
mac_inst->if_inst_NB_IoT->PHY_config_req(&phycfg);
if (eNB_mac_inst->if_inst_NB_IoT->PHY_config_req)
eNB_mac_inst->if_inst_NB_IoT->PHY_config_req(&phycfg);
}
}else
{
LOG_E(MAC,"NB-IoT IF INST is NULL, need to fix\n");
}
init_mac_NB_IoT(mac_inst);
init_mac_NB_IoT(eNB_mac_inst);
LOG_I(MAC,"[NB-IoT] Init_MAC done\n");
}
......@@ -851,6 +851,7 @@ typedef struct {
uint8_t dl_cqi[NFAPI_CC_MAX];
} UE_sched_ctrl;
/*! \brief eNB template for the Random access information */
/*
typedef struct {
/// Flag to indicate this process is active
boolean_t RA_active;
......@@ -1121,7 +1122,7 @@ typedef struct eNB_MAC_INST_s {
time_stats_t schedule_mch;
/// processing time of eNB ULSCH reception
time_stats_t rx_ulsch_sdu; // include rlc_data_ind
} eNB_MAC_INST_nb_iot;
} eNB_MAC_INST_NB_IoT;
*/
/*
* UE part
......
......@@ -80,6 +80,15 @@
#define SHORT_PADDING 31
/*!\brief DCI PDU filled by MAC for the PHY */
typedef struct {
uint8_t Num_ue_spec_dci ;
uint8_t Num_common_dci ;
// uint32_t nCCE;
uint32_t num_pdcch_symbols;
DCI_ALLOC_t dci_alloc[NUM_DCI_MAX] ;
} DCI_PDU;
typedef enum tone_type_e
{
sixtone = 0,
......@@ -527,6 +536,7 @@ typedef struct{
/*! \brief top level eNB MAC structure */
/*
typedef struct eNB_MAC_INST_NB_IoT_s{
/// Ethernet parameters for northbound midhaul interface
......@@ -585,6 +595,262 @@ typedef struct eNB_MAC_INST_NB_IoT_s{
Sched_Rsp_NB_IoT_t Sched_INFO;
} eNB_MAC_INST_NB_IoT;
*/
/*! \brief eNB template for the Random access information */
typedef struct {
/// Flag to indicate this process is active
boolean_t RA_active;
/// Size of DCI for RA-Response (bytes)
uint8_t RA_dci_size_bytes1;
/// Size of DCI for RA-Response (bits)
uint8_t RA_dci_size_bits1;
/// Actual DCI to transmit for RA-Response
uint8_t RA_alloc_pdu1[(MAX_DCI_SIZE_BITS>>3)+1];
/// DCI format for RA-Response (should be 1A)
uint8_t RA_dci_fmt1;
/// Size of DCI for Msg4/ContRes (bytes)
uint8_t RA_dci_size_bytes2;
/// Size of DCI for Msg4/ContRes (bits)
uint8_t RA_dci_size_bits2;
/// Actual DCI to transmit for Msg4/ContRes
uint8_t RA_alloc_pdu2[(MAX_DCI_SIZE_BITS>>3)+1];
/// DCI format for Msg4/ContRes (should be 1A)
uint8_t RA_dci_fmt2;
/// Flag to indicate the eNB should generate RAR. This is triggered by detection of PRACH
volatile uint8_t generate_rar;
/// Subframe where preamble was received
uint8_t preamble_subframe;
/// Subframe where Msg2 is to be sent
uint8_t Msg2_subframe;
/// Frame where Msg2 is to be sent
frame_t Msg2_frame;
/// Subframe where Msg3 is to be sent
sub_frame_t Msg3_subframe;
/// Frame where Msg3 is to be sent
frame_t Msg3_frame;
/// Subframe where Msg4 is to be sent
sub_frame_t Msg4_subframe;
/// Frame where Msg4 is to be sent
frame_t Msg4_frame;
/// Flag to indicate the eNB should generate Msg4 upon reception of SDU from RRC. This is triggered by first ULSCH reception at eNB for new user.
uint8_t generate_Msg4;
/// Flag to indicate that eNB is waiting for ACK that UE has received Msg3.
uint8_t wait_ack_Msg4;
/// harq_pid used for Msg4 transmission
uint8_t harq_pid;
/// UE RNTI allocated during RAR
rnti_t rnti;
/// RA RNTI allocated from received PRACH
volatile uint16_t RA_rnti;
/// Received preamble_index
volatile uint8_t preamble_index;
/// Received UE Contention Resolution Identifier
uint8_t cont_res_id[6];
/// Timing offset indicated by PHY
int16_t timing_offset;
/// Timeout for RRC connection
int16_t RRC_timer;
/// Msg3 first RB
uint8_t msg3_first_rb;
/// Msg3 number of RB
uint8_t msg3_nb_rb;
/// Msg3 MCS
uint8_t msg3_mcs;
/// Msg3 TPC command
uint8_t msg3_TPC;
/// Msg3 ULdelay command
uint8_t msg3_ULdelay;
/// Msg3 cqireq command
uint8_t msg3_cqireq;
/// Round of Msg3 HARQ
uint8_t msg3_round;
/// TBS used for Msg4
int msg4_TBsize;
/// MCS used for Msg4
int msg4_mcs;
/// size off piggybacked RRC SDU
uint8_t msg4_rrc_sdu_length;
uint32_t msg4_delay;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint8_t rach_resource_type;
uint8_t msg2_mpdcch_repetition_cnt;
uint8_t msg2_mpdcch_done;
uint8_t msg4_mpdcch_repetition_cnt;
uint8_t msg4_mpdcch_done;
uint8_t msg2_narrowband;
uint32_t msg34_narrowband;
#endif
} RA_TEMPLATE;
/*! \brief eNB common channels */
typedef struct {
/// Outgoing DCI for PHY generated by eNB scheduler
DCI_PDU DCI_pdu;
/// Outgoing BCCH pdu for PHY
BCCH_PDU BCCH_pdu;
/// Outgoing BCCH DCI allocation
uint32_t BCCH_alloc_pdu;
/// Outgoing CCCH pdu for PHY
CCCH_PDU CCCH_pdu;
RA_TEMPLATE RA_template[NB_RA_PROC_MAX];
/// VRB map for common channels
uint8_t vrb_map[100];
/// MBSFN SubframeConfig
struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8];
/// number of subframe allocation pattern available for MBSFN sync area
uint8_t num_sf_allocation_pattern;
#if defined(Rel10) || defined(Rel14)
/// MBMS Flag
uint8_t MBMS_flag;
/// Outgoing MCCH pdu for PHY
MCCH_PDU MCCH_pdu;
/// MCCH active flag
uint8_t msi_active;
/// MCCH active flag
uint8_t mcch_active;
/// MTCH active flag
uint8_t mtch_active;
/// number of active MBSFN area
uint8_t num_active_mbsfn_area;
/// MBSFN Area Info
struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA];
/// PMCH Config
struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN];
/// MBMS session info list
struct MBMS_SessionInfoList_r9 *mbms_SessionList[MAX_PMCH_perMBSFN];
/// Outgoing MCH pdu for PHY
MCH_PDU MCH_pdu;
#endif
#ifdef CBA
/// number of CBA groups
uint8_t num_active_cba_groups;
/// RNTI for each CBA group
uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
/// MCS for each CBA group
uint8_t group_mcs[NUM_MAX_CBA_GROUP];
#endif
} COMMON_channels_NB_IoT_t;
/*! \brief top level eNB MAC structure */
typedef struct eNB_MAC_INST_NB_IoT_s {
/// Ethernet parameters for northbound midhaul interface
eth_params_t eth_params_n;
/// Ethernet parameters for fronthaul interface
eth_params_t eth_params_s;
// System
uint32_t hyper_system_frame;
uint32_t system_frame;
uint32_t sub_frame;
uint32_t current_subframe;
// RA
RA_template_list_t RA_msg2_list;
RA_template_list_t RA_msg3_list;
RA_template_list_t RA_msg4_list;
RA_TEMPLATE_NB_IoT RA_template[MAX_NUMBER_OF_UE_MAX_NB_IoT];
//int32_t last_tx_subframe;
// for tool
int32_t sib1_flag[64];
int32_t sib1_count[64];
int32_t sib1_period;
uint16_t dlsf_table[64];
int32_t sibs_table[256];
///
module_id_t Mod_id;
/// frame counter
frame_t frame;
/// subframe counter
sub_frame_t subframe;
/// Pointer to IF module instance for PHY
IF_Module_t *if_inst;
/// Common cell resources
COMMON_channels_NB_IoT_t common_channels[MAX_NUM_CCs];
/// current PDU index (BCH,MCH,DLSCH)
uint16_t pdu_index[MAX_NUM_CCs];
/// NFAPI Config Request Structure
nfapi_config_request_t config[MAX_NUM_CCs];
/// Preallocated DL pdu list
nfapi_dl_config_request_pdu_t dl_config_pdu_list[MAX_NUM_CCs][MAX_NUM_DL_PDU];
/// NFAPI DL Config Request Structure
nfapi_dl_config_request_t DL_req[MAX_NUM_CCs];
/// Preallocated UL pdu list
nfapi_ul_config_request_pdu_t ul_config_pdu_list[MAX_NUM_CCs][MAX_NUM_UL_PDU];
/// Preallocated UL pdu list for ULSCH (n+k delay)
nfapi_ul_config_request_pdu_t ul_config_pdu_list_tmp[MAX_NUM_CCs][10][MAX_NUM_UL_PDU];
/// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place
nfapi_ul_config_request_t UL_req[MAX_NUM_CCs];
/// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests
nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10];
/// Preallocated HI_DCI0 pdu list
nfapi_hi_dci0_request_pdu_t hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU];
/// NFAPI HI/DCI0 Config Request Structure
nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs];
/// Prealocated TX pdu list
nfapi_tx_request_pdu_t tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU];
/// NFAPI DL PDU structure
nfapi_tx_request_t TX_req[MAX_NUM_CCs];
/// UL handle
uint32_t ul_handle;
UE_list_t UE_list;
///subband bitmap configuration
SBMAP_CONF sbmap_conf;
/// CCE table used to build DCI scheduling information
int CCE_table[MAX_NUM_CCs][800];
/// active flag for Other lcid
uint8_t lcid_active[NB_RB_MAX];
/// eNB stats
eNB_STATS eNB_stats[MAX_NUM_CCs];
// MAC function execution peformance profiler
/// processing time of eNB scheduler
time_stats_t eNB_scheduler;
/// processing time of eNB scheduler for SI
time_stats_t schedule_si;
/// processing time of eNB scheduler for Random access
time_stats_t schedule_ra;
/// processing time of eNB ULSCH scheduler
time_stats_t schedule_ulsch;
/// processing time of eNB DCI generations
time_stats_t fill_DLSCH_dci;
/// processing time of eNB MAC preprocessor
time_stats_t schedule_dlsch_preprocessor;
/// processing time of eNB DLSCH scheduler
time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor
/// processing time of eNB MCH scheduler
time_stats_t schedule_mch;
/// processing time of eNB ULSCH reception
time_stats_t rx_ulsch_sdu; // include rlc_data_ind
IF_Module_NB_IoT_t *if_inst_NB_IoT;
Sched_Rsp_NB_IoT_t Sched_INFO;
//USS list
//Number of USS period is used
int num_uss_list;
UE_list_NB_IoT_t *UE_list_spec;
scheduling_flag_t scheduling_flag;
uint32_t schedule_subframe_DL;
//uint32_t schedule_subframe_UL;
NPDCCH_config_common_NB_IoT_t npdcch_config_common[3];
rrc_config_NB_IoT_t rrc_config;
} eNB_MAC_INST_NB_IoT;
// actually not here, but for now put it here
typedef struct {
......
......@@ -379,18 +379,18 @@ void msg4_do_retransmit_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, rnti_t c_rnti){
return ;
}
void receive_msg3_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, rnti_t c_rnti, uint32_t phr, uint32_t ul_total_buffer, uint8_t* ccch_sdu, uint8_t* msg4_rrc_sdu){
void receive_msg3_NB_IoT(eNB_MAC_INST_NB_IoT *eNB_mac_inst, rnti_t c_rnti, uint32_t phr, uint32_t ul_total_buffer, uint8_t* ccch_sdu, uint8_t* msg4_rrc_sdu){
// since successful receive msg3, tc-rnti become c-rnti.
RA_TEMPLATE_NB_IoT *msg3_nodes = mac_inst->RA_msg3_list.head;
RA_TEMPLATE_NB_IoT *msg3_nodes = eNB_mac_inst->RA_msg3_list.head;
RA_TEMPLATE_NB_IoT *migrate_node;
if((RA_TEMPLATE_NB_IoT *)0 != msg3_nodes)
while((RA_TEMPLATE_NB_IoT *)0 != msg3_nodes){
if(msg3_nodes->ue_rnti == c_rnti){
LOG_D(MAC,"add ue in\n");
add_ue_NB_IoT(mac_inst, c_rnti, msg3_nodes->ce_level, phr, ul_total_buffer);// rnti, ce level
LOG_D(MAC,"[%04d][RA scheduler][MSG3][CE%d] Receive MSG3 T-CRNTI %d Preamble Index %d \n", mac_inst->current_subframe, msg3_nodes->ce_level, msg3_nodes->ue_rnti, msg3_nodes->preamble_index);
add_ue_NB_IoT(eNB_mac_inst, c_rnti, msg3_nodes->ce_level, phr, ul_total_buffer);// rnti, ce level
LOG_D(MAC,"[%04d][RA scheduler][MSG3][CE%d] Receive MSG3 T-CRNTI %d Preamble Index %d \n", eNB_mac_inst->current_subframe, msg3_nodes->ce_level, msg3_nodes->ue_rnti, msg3_nodes->preamble_index);
msg3_nodes->ccch_buffer = ccch_sdu;
msg3_nodes->msg4_rrc_buffer = msg4_rrc_sdu;
migrate_node = msg3_nodes;
......@@ -398,14 +398,14 @@ void receive_msg3_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, rnti_t c_rnti, uint32_t
// maintain list
if((RA_TEMPLATE_NB_IoT *)0 == migrate_node->prev){
// first node
mac_inst->RA_msg3_list.head = migrate_node->next; // including null
eNB_mac_inst->RA_msg3_list.head = migrate_node->next; // including null
}else{
// not first node
migrate_node->prev->next = migrate_node->next; // including null
}
if((RA_TEMPLATE_NB_IoT *)0 == migrate_node->next){
// last node
mac_inst->RA_msg3_list.tail = migrate_node->prev; // including null
eNB_mac_inst->RA_msg3_list.tail = migrate_node->prev; // including null
}else{
// not last node
migrate_node->next->prev = migrate_node->prev; // including null
......@@ -415,14 +415,14 @@ void receive_msg3_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, rnti_t c_rnti, uint32_t
// insert to end of list
migrate_node->next = (RA_TEMPLATE_NB_IoT *)0;
migrate_node->prev = (RA_TEMPLATE_NB_IoT *)0;
if((RA_TEMPLATE_NB_IoT *)0 == mac_inst->RA_msg4_list.head){
mac_inst->RA_msg4_list.head = migrate_node;
if((RA_TEMPLATE_NB_IoT *)0 == eNB_mac_inst->RA_msg4_list.head){
eNB_mac_inst->RA_msg4_list.head = migrate_node;
}else{
// not empty
mac_inst->RA_msg4_list.tail->next = migrate_node;
migrate_node->prev = mac_inst->RA_msg4_list.tail;
eNB_mac_inst->RA_msg4_list.tail->next = migrate_node;
migrate_node->prev = eNB_mac_inst->RA_msg4_list.tail;
}
mac_inst->RA_msg4_list.tail = migrate_node;
eNB_mac_inst->RA_msg4_list.tail = migrate_node;
return ;
}
......@@ -430,7 +430,7 @@ void receive_msg3_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, rnti_t c_rnti, uint32_t
}
if((RA_TEMPLATE_NB_IoT *)0 == msg3_nodes){
LOG_D(MAC,"[%04d][RA scheduler][MSG3] receive msg3.. can't found the ue from crnti %x\n", mac_inst->current_subframe, c_rnti);
LOG_D(MAC,"[%04d][RA scheduler][MSG3] receive msg3.. can't found the ue from crnti %x\n", eNB_mac_inst->current_subframe, c_rnti);
return;
}
}
......
......@@ -21,7 +21,7 @@ extern int extend_alpha_offset[num_flags];
uint32_t get_SIB23_size(void)
{
rrc_config_NB_IoT_t *mac_config = &mac_inst->rrc_config;
rrc_config_NB_IoT_t *mac_config = &eNB_mac_inst->rrc_config;
uint32_t size_SIB23_in_MAC = 0;
switch(mac_config->sibs_NB_IoT_sched[0].si_tb)
......
......@@ -36,7 +36,7 @@
#include "LAYER2/MAC/mac.h"
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/extern_NB_IoT.h"
#include "LAYER2/MAC/mac_proto.h"
#include "common/utils/LOG/log.h"
#include "nfapi/oai_integration/vendor_ext.h"
......@@ -64,9 +64,9 @@ extern uint16_t frame_cnt;
#include "SCHED/sched_common.h"
extern RAN_CONTEXT_t RC;
extern eNB_MAC_INST_NB_IoT *eNB_mac_inst;
//------------------------------------------------------------------------------
int
choose(int n,
......
......@@ -36,7 +36,7 @@
unsigned char str20[] = "DCI_uss";
unsigned char str21[] = "DATA_uss";
extern eNB_MAC_INST_NB_IoT *eNB_mac_inst;
// scheduling UL
int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info,uint32_t subframe, uint32_t frame, uint32_t H_SFN, UE_SCHED_CTRL_NB_IoT_t *UE_sched_ctrl_info){
int i,ndi = 0,check_DCI_result = 0,check_UL_result = 0,candidate;
......@@ -214,7 +214,7 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
case SHORT_BSR:
// update BSR here
LOG_I(MAC,"Update BSR, rnti : %d\n",rnti);
UE_info = get_ue_from_rnti(mac_inst, rnti);
UE_info = get_ue_from_rnti(eNB_mac_inst, rnti);
BSR_index = payload_ptr[0] & 0x3f;
if(UE_info != NULL)
{
......@@ -262,7 +262,7 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
0);
LOG_D(MAC,"rx_lengths : %d\n", rx_lengths[i]);
msg4_rrc_pdu = mac_rrc_msg3_ind_NB_IoT(payload_ptr,rnti,rx_lengths[i]);
receive_msg3_NB_IoT(mac_inst,rnti,PHR,ul_total_buffer,first_6,msg4_rrc_pdu);
receive_msg3_NB_IoT(eNB_mac_inst,rnti,PHR,ul_total_buffer,first_6,msg4_rrc_pdu);
LOG_I(MAC,"Contention resolution ID = %02x %02x %02x %02x %02x %02x\n",first_6[0],first_6[1],first_6[2],first_6[3],first_6[4],first_6[5]);
//NB_IoT_mac_rrc_data_ind(payload_ptr,mac_inst,rnti);
//NB_IoT_receive_msg3(mac_inst,rnti,PHR,ul_total_buffer);
......
......@@ -31,7 +31,7 @@
#define __MAC_EXTERN_NB_IOT_H__
#include "openair2/PHY_INTERFACE/defs_NB_IoT.h"
#include "openair2/LAYER2/MAC/defs_NB_IoT.h"
extern uint8_t Is_rrc_registered;
......@@ -55,7 +55,7 @@ extern EMULATION_VARS *Emul_vars;
//NB-IoT---------------------------------
extern eNB_MAC_INST_NB_IoT *mac_inst;
extern eNB_MAC_INST_NB_IoT *eNB_mac_inst;
extern uint8_t Is_rrc_registered_NB_IoT;
extern available_resource_DL_t *available_resource_DL;
......
......@@ -1391,7 +1391,6 @@ typedef struct {
BCCH_PDU BCCH_MBMS_pdu;
uint8_t FeMBMS_flag;
#endif
LTE_eNB_PDCCH DCI_pdu;
} COMMON_channels_t;
/*! \brief top level eNB MAC structure */
typedef struct eNB_MAC_INST_s {
......
......@@ -34,7 +34,6 @@
//#include "PHY/defs_common.h"
#include "mac.h"
#include "RRC/LTE/rrc_defs.h"
extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE];
......@@ -58,7 +57,6 @@ extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES
#ifndef PHYSIM
#define NB_INST 1
#else
......
......@@ -56,7 +56,7 @@
#include "UTIL/OSA/osa_defs.h"
#include "openair2/RRC/NAS/nas_config.h"
# include "intertask_interface.h"
#include "ENB_APP/enb_paramdef_NB_IoT.h"
# include "gtpv1u_eNB_task.h"
# include "gtpv1u.h"
......
......@@ -77,7 +77,7 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
{
int i=0;
uint32_t abs_subframe;
Sched_Rsp_NB_IoT_t *SCHED_info = &mac_inst->Sched_INFO;
Sched_Rsp_NB_IoT_t *SCHED_info = &eNB_mac_inst->Sched_INFO;
enable_preamble_simulation(UL_INFO,0);
......@@ -92,7 +92,7 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
{
// initiate_ra here, some useful inforamtion :
LOG_D(MAC,"Init_RA_NB_IoT in, index of sc = %d\n",(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc);
init_RA_NB_IoT(mac_inst,
init_RA_NB_IoT(eNB_mac_inst,
(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc,
(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.nrach_ce_level,
UL_INFO->frame,
......@@ -113,7 +113,7 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
if((UL_INFO->crc_ind.crc_pdu_list+i)->crc_indication_rel8.crc_flag == 0)
{
//unsuccessfully received this UE PDU
//UE_info = get_ue_from_rnti(mac_inst,((UL_INFO->crc_ind.crc_pdu_list)+i)->rx_ue_information.rnti);
//UE_info = get_ue_from_rnti(eNB_mac_inst,((UL_INFO->crc_ind.crc_pdu_list)+i)->rx_ue_information.rnti);
//UE_info->HARQ_round++;
}
}
......@@ -123,7 +123,7 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
if(UL_INFO->nb_harq_ind.nb_harq_indication_body.number_of_harqs>0)
{
LOG_I(MAC,"Recieved Ack of DL Data, rnti : %x\n",UL_INFO->nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list[0].rx_ue_information.rnti);
receive_msg4_ack_NB_IoT(mac_inst,UL_INFO->nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list[0].rx_ue_information.rnti);
receive_msg4_ack_NB_IoT(eNB_mac_inst,UL_INFO->nb_harq_ind.nb_harq_indication_body.nb_harq_pdu_list[0].rx_ue_information.rnti);
}
UL_INFO->nb_harq_ind.nb_harq_indication_body.number_of_harqs = 0;
......@@ -160,8 +160,8 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
//scheduler here
//Schedule subframe should be next four subframe, means that UL_INFO->frame*10+UL_INFO->subframe + 4
eNB_dlsch_ulsch_scheduler_NB_IoT(mac_inst,abs_subframe);
mac_inst->if_inst_NB_IoT->schedule_response(&mac_inst->Sched_INFO);
eNB_dlsch_ulsch_scheduler_NB_IoT(eNB_mac_inst,abs_subframe);
eNB_mac_inst->if_inst_NB_IoT->schedule_response(&eNB_mac_inst->Sched_INFO);
LOG_D(MAC,"After scheduler & schedule response\n");
......
......@@ -37,9 +37,9 @@
//#include "LAYER2/MAC/extern.h"
#include "LAYER2/RLC/rlc.h"
#include "LTE_LogicalChannelConfig-NB-r13.h"
#include "LAYER2/MAC/defs_NB_IoT.h"
#include "LAYER2/MAC/defs.h"
extern eNB_MAC_INST_NB_IoT *mac_inst;
//MP: NOTE:XXX some of the parameters defined in vars_nb_iot are called by the extern.h file so not replicated here
......
......@@ -52,7 +52,6 @@
#endif
#define DEBUG_RRC 1
extern eNB_MAC_INST *eNB_mac_inst;
extern UE_MAC_INST *UE_mac_inst;
extern mui_t rrc_eNB_mui;
......
......@@ -155,7 +155,7 @@ void proc_tx_high0_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB+offset, proc->subframe_tx );
// issue here
phy_procedures_eNB_TX_NB_IoT(eNB,proc,1);
phy_procedures_eNB_TX_NB_IoT(eNB,proc,r_type,rn,1,1);
/* we're done, let the next one proceed */
if (pthread_mutex_lock(&sync_phy_proc.mutex_phy_proc_tx) != 0) {
......
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