Commit c337e5d5 authored by Nick Ho's avatar Nick Ho

clean code and waring step 1

parent fc08fd10
...@@ -1572,7 +1572,6 @@ break; ...@@ -1572,7 +1572,6 @@ break;
#ifdef NB_IOT_CRC_REVOVERY #ifdef NB_IOT_CRC_REVOVERY
unsigned char auth_rsp[5] = {0x30, 0x0b, 0x07, 0x53, 0x08}; unsigned char auth_rsp[5] = {0x30, 0x0b, 0x07, 0x53, 0x08};
unsigned char attach_complete[8] = {0x01, 0x07, 0x43, 0x00, 0x03, 0x52, 0x00, 0xc2}; unsigned char attach_complete[8] = {0x01, 0x07, 0x43, 0x00, 0x03, 0x52, 0x00, 0xc2};
unsigned char security_complte[3] = {0x30, 0x08, 0x47}; unsigned char security_complte[3] = {0x30, 0x08, 0x47};
int cnt = 0; int cnt = 0;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* \author R. Knopp * \author R. Knopp
* \date 2011 * \date 2011
* \version 0.1 * \version 0.1
* \company Eurecom * \company Eurecom, B-COM
* \email: knopp@eurecom.fr * \email: knopp@eurecom.fr
* \note * \note
* \warning * \warning
...@@ -35,20 +35,9 @@ ...@@ -35,20 +35,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#endif #endif
//#include "PHY/defs.h"
//#include "PHY/LTE_TRANSPORT/proto_NB_IoT.h"
//#include "PHY/CODING/defs_NB_IoT.h"
#include "PHY/defs_NB_IoT.h" // /LTE_TRANSPORT/defs_NB_IoT.h #include "PHY/defs_NB_IoT.h" // /LTE_TRANSPORT/defs_NB_IoT.h
//#include "PHY/LTE_REFSIG/defs_NB_IoT.h"
//#include "PHY/extern.h"
//////////#include "PHY/extern_NB_IoT.h"
//#include "SCHED/defs.h"
/////////////////////////////#include "SCHED/defs_nb_iot.h"
//#include "SIMULATION/TOOLS/defs.h" // for taus
//#include "PHY/sse_intrin.h"
//#include "assertions.h"
//#include "T.h"
/////////////////////////////////////////////////////////////////////
//static uint8_t d[2][3*(MAX_DCI_SIZE_BITS_NB_IoT + 16) + 96]; //static uint8_t d[2][3*(MAX_DCI_SIZE_BITS_NB_IoT + 16) + 96];
//static uint8_t w[2][3*3*(MAX_DCI_SIZE_BITS_NB_IoT+16)]; //static uint8_t w[2][3*3*(MAX_DCI_SIZE_BITS_NB_IoT+16)];
......
...@@ -19,22 +19,19 @@ ...@@ -19,22 +19,19 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file PHY/LTE_TRANSPORT/dci.h /*! \file PHY/LTE_TRANSPORT/dci_NB_IoT.h
* \brief typedefs for LTE DCI structures from 36-212, V8.6 2009-03. Limited to 5 MHz formats for the moment.Current LTE compliance V8.6 2009-03. * \brief typedefs for NB-IoT DCI structures (DCI N0, N1 and N2) from 36-212, V13.2 Follow the spec V13.2
* \author R. Knopp * \author Nick Ho
* \date 2011 * \date 2019
* \version 0.1 * \version 0.1
* \company Eurecom * \company NTUST
* \email: knopp@eurecom.fr * \email: nick133371@gmail.com
* \note * \note
* \warning * \warning
*/ */
#ifndef __DCI_NB_IOT_H__ #ifndef __DCI_NB_IOT_H__
#define __DCI_NB_IOT_H__ #define __DCI_NB_IOT_H__
//#ifndef USER_MODE
//#include "PHY/types.h"
//#else
#include <stdint.h> #include <stdint.h>
//#endif //#endif
......
...@@ -20,66 +20,19 @@ ...@@ -20,66 +20,19 @@
#include "openair2/COMMON/platform_types.h" #include "openair2/COMMON/platform_types.h"
//#include "dci.h" //#include "dci.h"
#include "PHY/LTE_TRANSPORT/uci_NB_IoT.h" #include "PHY/LTE_TRANSPORT/uci_NB_IoT.h"
//#include "dci.h"
//#include "uci.h"
//#ifndef STANDALONE_COMPILE
//#include "UTIL/LISTS/list.h"
//#endif
//#include "dci_nb_iot.h"
//#define MOD_TABLE_QPSK_OFFSET 1
//#define MOD_TABLE_16QAM_OFFSET 5
//#define MOD_TABLE_64QAM_OFFSET 21
//#define MOD_TABLE_PSS_OFFSET 85
//
//// structures below implement 36-211 and 36-212
//
//#define NSOFT 1827072
#define LTE_NULL_NB_IoT 2 #define LTE_NULL_NB_IoT 2
//
//// maximum of 3 segments before each coding block if data length exceeds 6144 bits.
//
#define MAX_NUM_DLSCH_SEGMENTS_NB_IoT 16 #define MAX_NUM_DLSCH_SEGMENTS_NB_IoT 16
#define MAX_NUM_ULSCH_SEGMENTS_NB_IoT MAX_NUM_DLSCH_SEGMENTS_NB_IoT #define MAX_NUM_ULSCH_SEGMENTS_NB_IoT MAX_NUM_DLSCH_SEGMENTS_NB_IoT
#define MAX_NUM_BITS_IN_DL_PER_SF_NB_IoT 284 // case one NB-IoT antenna && one LTE antenna #define MAX_NUM_BITS_IN_DL_PER_SF_NB_IoT 284 // case one NB-IoT antenna && one LTE antenna
//#define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768)
//#define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768)
//
//#define MAX_NUM_CHANNEL_BITS_NB_IOT (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE
//#define MAX_NUM_RE (14*1200)
//
//#if !defined(SI_RNTI)
//#define SI_RNTI (rnti_t)0xffff
//#endif
//#if !defined(M_RNTI)
//#define M_RNTI (rnti_t)0xfffd
//#endif
//#if !defined(P_RNTI)
//#define P_RNTI (rnti_t)0xfffe
//#endif
//#if !defined(CBA_RNTI)
//#define CBA_RNTI (rnti_t)0xfff4
//#endif
//#if !defined(C_RNTI)
//#define C_RNTI (rnti_t)0x1234
//#endif
//
//#define PMI_2A_11 0
//#define PMI_2A_1m1 1
//#define PMI_2A_1j 2
//#define PMI_2A_1mj 3
//
//// for NB-IoT //// for NB-IoT
#define MAX_NUM_CHANNEL_BITS_NB_IoT 3360 //14 symbols * 12 sub-carriers * 10 SF * 2bits/RE // to check during real tests #define MAX_NUM_CHANNEL_BITS_NB_IoT 3360 //14 symbols * 12 sub-carriers * 10 SF * 2bits/RE // to check during real tests
#define MAX_NUM_DL_CHANNEL_BITS_NB_IoT 2840 //284* 10 SF // case In-band operation mode witn 1 NB-IoT antenna && 1 LTE antenna // #define MAX_NUM_DL_CHANNEL_BITS_NB_IoT 2840 //284* 10 SF // case In-band operation mode witn 1 NB-IoT antenna && 1 LTE antenna //
#define MAX_TBS_DL_SIZE_BITS_NB_IoT 680 // in release 13 // in release 14 = 2048 // ??? **** not sure #define MAX_TBS_DL_SIZE_BITS_NB_IoT 680 // in release 13 // in release 14 = 2048 // ??? **** not sure
////#define MAX_NUM_CHANNEL_BITS_NB_IOT 3*680 /// ??? ****not sure
//
//// to be created LTE_eNB_DLSCH_t --> is duplicated for each number of UE and then indexed in the table
//
typedef enum { typedef enum {
......
...@@ -194,7 +194,7 @@ NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB_IoT(uint8_t type, LTE_DL_FRAME_PARMS* fram ...@@ -194,7 +194,7 @@ NB_IoT_eNB_NDLSCH_t *new_eNB_dlsch_NB_IoT(uint8_t type, LTE_DL_FRAME_PARMS* fram
{ {
NB_IoT_eNB_NDLSCH_t *dlsch; NB_IoT_eNB_NDLSCH_t *dlsch;
unsigned char exit_flag = 0,r; unsigned char exit_flag = 0;
dlsch = (NB_IoT_eNB_NDLSCH_t *)malloc16(sizeof(NB_IoT_eNB_NDLSCH_t)); dlsch = (NB_IoT_eNB_NDLSCH_t *)malloc16(sizeof(NB_IoT_eNB_NDLSCH_t));
......
...@@ -170,6 +170,7 @@ int rx_nsss_NB_IoT(PHY_VARS_UE_NB_IoT *ue,int32_t *tot_metric) ...@@ -170,6 +170,7 @@ int rx_nsss_NB_IoT(PHY_VARS_UE_NB_IoT *ue,int32_t *tot_metric)
// this could be changed in further version // this could be changed in further version
for (l=0;l<11;l++){ for (l=0;l<11;l++){
toto = nsss_extract_NB_IoT(ue,frame_parms,nsss_ext,l); toto = nsss_extract_NB_IoT(ue,frame_parms,nsss_ext,l);
LOG_D(PHY,"toto is %d\n",toto);
} }
// now do the Cell ID estimation based on the precomputed sequences in PHY/LTE_TRANSPORT/nsss_NB_IoT.h // now do the Cell ID estimation based on the precomputed sequences in PHY/LTE_TRANSPORT/nsss_NB_IoT.h
......
...@@ -194,18 +194,6 @@ int scrambling_npbch_REs_rel_14(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -194,18 +194,6 @@ int scrambling_npbch_REs_rel_14(LTE_DL_FRAME_PARMS *frame_parms,
*/ */
// Functions below implement 36-211 and 36-212 // Functions below implement 36-211 and 36-212
/*Function to pack the DCI*/
// newly added function for NB-IoT , does not exist for LTE
void add_dci_NB_IoT(DCI_PDU_NB_IoT *DCI_pdu,
void *pdu,
rnti_t rnti,
unsigned char dci_size_bytes,
unsigned char aggregation,
unsigned char dci_size_bits,
unsigned char dci_fmt,
uint8_t npdcch_start_symbol);
/*Use the UL DCI Information to configure PHY and also Pack the DCI*/ /*Use the UL DCI Information to configure PHY and also Pack the DCI*/
int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB *eNB, int generate_eNB_ulsch_params_from_dci_NB_IoT(PHY_VARS_eNB *eNB,
int frame, int frame,
......
...@@ -62,14 +62,10 @@ void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -62,14 +62,10 @@ void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB *eNB,
NB_IoT_DL_eNB_HARQ_t *ndlsch_harq23; NB_IoT_DL_eNB_HARQ_t *ndlsch_harq23;
nfapi_dl_config_ndlsch_pdu_rel13_t *rel13 = &dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13; nfapi_dl_config_ndlsch_pdu_rel13_t *rel13 = &dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13;
int UE_id= -1; int UE_id= -1;
int flag_malloc = 0;
ndlsch= eNB->ndlsch_SIB1; ndlsch= eNB->ndlsch_SIB1;
ndlsch23= eNB->ndlsch_SIB23; ndlsch23= eNB->ndlsch_SIB23;
// if(flag_malloc) free (ndlsch->harq_process);
// ndlsch->harq_process = (NB_IoT_DL_eNB_HARQ_t*) malloc (sizeof(NB_IoT_DL_eNB_HARQ_t));
flag_malloc = 1 ;
//Check for SI PDU since in NB-IoT there is no DCI for that //Check for SI PDU since in NB-IoT there is no DCI for that
//SIB1 (type 0), other DLSCH data (type 1) (include the SI messages) based on our ASSUMPTIONs //SIB1 (type 0), other DLSCH data (type 1) (include the SI messages) based on our ASSUMPTIONs
...@@ -105,21 +101,12 @@ void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -105,21 +101,12 @@ void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB *eNB,
//LOG_I(PHY,"B content_sib1:%d\n",sdu); //LOG_I(PHY,"B content_sib1:%d\n",sdu);
/////ndlsch->content_sib1.pdu = sdu; /////ndlsch->content_sib1.pdu = sdu;
ndlsch_harq->pdu = sdu; ndlsch_harq->pdu = sdu;
//LOG_I(PHY,"A content_sib1:%d\n",ndlsch->content_sib1.pdu);
//should be from 1 to 8
ndlsch->resource_assignment_SIB1 = rel13->number_of_subframes_for_resource_assignment;//maybe we don't care about it since a fixed schedule ndlsch->resource_assignment_SIB1 = rel13->number_of_subframes_for_resource_assignment;//maybe we don't care about it since a fixed schedule
ndlsch->repetition_number_SIB1 = rel13->repetition_number; //is the schedulingInfoSIB1 (value 1-15) of MIB that is mapped into value 4-8-16 (see NDLSCH fapi specs Table 4-47) ndlsch->repetition_number_SIB1 = rel13->repetition_number; //is the schedulingInfoSIB1 (value 1-15) of MIB that is mapped into value 4-8-16 (see NDLSCH fapi specs Table 4-47)
ndlsch->modulation = rel13->modulation; ndlsch->modulation = rel13->modulation;
ndlsch->status = ACTIVE_NB_IoT; ndlsch->status = ACTIVE_NB_IoT;
//ndlsch->
//SI information in reality have no feedback (so there is no retransmission from the HARQ view point since no ack and nack)
// ndlsch_harq->frame = frame;
// ndlsch_harq->subframe = subframe;
ndlsch->nrs_antenna_ports = rel13->nrs_antenna_ports_assumed_by_the_ue; ndlsch->nrs_antenna_ports = rel13->nrs_antenna_ports_assumed_by_the_ue;
ndlsch->scrambling_sequence_intialization = rel13->scrambling_sequence_initialization_cinit; ndlsch->scrambling_sequence_intialization = rel13->scrambling_sequence_initialization_cinit;
...@@ -256,7 +243,6 @@ void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -256,7 +243,6 @@ void handle_nfapi_dlsch_pdu_NB_IoT(PHY_VARS_eNB *eNB,
ndlsch_harq->TBS = rel13->length; ndlsch_harq->TBS = rel13->length;
ndlsch_harq->pdu = sdu; ndlsch_harq->pdu = sdu;
printf("sdu after handling MSG4 or ue-spec data : %u********\n", sdu);
} }
} }
...@@ -533,9 +519,7 @@ void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO) ...@@ -533,9 +519,7 @@ void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO)
//XXX problem: although we may have nothing to transmit this function should be always triggered in order to allow the PHY layer to complete the repetitions //XXX problem: although we may have nothing to transmit this function should be always triggered in order to allow the PHY layer to complete the repetitions
//of previous Transport Blocks //of previous Transport Blocks
//phy_procedures_eNB_TX_NB_IoT(eNB,proc,NULL);
//phy_procedures_eNB_TX_NB_IoT(eNB,proc,0); // check if 0 or NULL ?!
LOG_D(PHY,"Schedule response has been done\n"); LOG_D(PHY,"Schedule response has been done\n");
} }
......
...@@ -24,8 +24,8 @@ void process_schedule_rsp_NB_IoT(Sched_Rsp_NB_IoT_t *sched_rsp, ...@@ -24,8 +24,8 @@ void process_schedule_rsp_NB_IoT(Sched_Rsp_NB_IoT_t *sched_rsp,
/*Processing the ue-specific resources for uplink in NB-IoT*/ /*Processing the ue-specific resources for uplink in NB-IoT*/
void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc); // UL_IND_NB_IoT_t *UL_INFO); void phy_procedures_eNB_uespec_RX_NB_IoT(PHY_VARS_eNB *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*/ /* For NB-IoT, we put NPBCH in later part, since it would be scheduled by MAC scheduler,this generates all the Downlink message*/
void common_signal_procedures_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc); void NB_IoT_TX_procedure(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc);
/*Generate the ulsch params and do the mapping for the FAPI style parameters to OAI, and then do the packing*/ /*Generate the ulsch params and do the mapping for the FAPI style parameters to OAI, and then do the packing*/
void generate_eNB_ulsch_params_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu); void generate_eNB_ulsch_params_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu);
...@@ -33,9 +33,6 @@ void generate_eNB_ulsch_params_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nf ...@@ -33,9 +33,6 @@ void generate_eNB_ulsch_params_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,nf
/*Generate the dlsch params and do the mapping for the FAPI style parameters to OAI, and then do the packing*/ /*Generate the dlsch params and do the mapping for the FAPI style parameters to OAI, and then do the packing*/
void generate_eNB_dlsch_params_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi_dl_config_request_pdu_t *dl_config_pdu); void generate_eNB_dlsch_params_NB_IoT(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t * proc,nfapi_dl_config_request_pdu_t *dl_config_pdu);
/*Process all the scheduling result from MAC and also common signals.*/
void phy_procedures_eNB_TX_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_t *proc,int do_meas);
int8_t find_ue_NB_IoT(uint16_t rnti, PHY_VARS_eNB *eNB); int8_t find_ue_NB_IoT(uint16_t rnti, PHY_VARS_eNB *eNB);
NB_IoT_DL_FRAME_PARMS *get_NB_IoT_frame_parms(module_id_t Mod_id, uint8_t CC_id); NB_IoT_DL_FRAME_PARMS *get_NB_IoT_frame_parms(module_id_t Mod_id, uint8_t CC_id);
......
This diff is collapsed.
...@@ -196,7 +196,7 @@ rrc_mac_config_req( ...@@ -196,7 +196,7 @@ rrc_mac_config_req(
} }
else { else {
if (UE_id == -1) { if (UE_id == -1) {
LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__); LOG_D(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__);
} else { } else {
if (logicalChannelConfig) if (logicalChannelConfig)
UE_list->UE_template[CC_idP][UE_id].lcgidmap[logicalChannelIdentity] = *logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup; UE_list->UE_template[CC_idP][UE_id].lcgidmap[logicalChannelIdentity] = *logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup;
...@@ -301,7 +301,7 @@ rrc_mac_config_req( ...@@ -301,7 +301,7 @@ rrc_mac_config_req(
if (physicalConfigDedicated != NULL) { if (physicalConfigDedicated != NULL) {
if (eNB_flagP==1) { if (eNB_flagP==1) {
if (UE_id == -1) if (UE_id == -1)
LOG_E(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__); LOG_D(MAC,"%s:%d:%s: ERROR, UE_id == -1\n", __FILE__, __LINE__, __FUNCTION__);
else else
mac_xface->phy_config_dedicated_eNB(Mod_idP, CC_idP, UE_RNTI(Mod_idP, UE_id), physicalConfigDedicated); mac_xface->phy_config_dedicated_eNB(Mod_idP, CC_idP, UE_RNTI(Mod_idP, UE_id), physicalConfigDedicated);
} else { } else {
......
...@@ -62,10 +62,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -62,10 +62,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
sched_temp_UL_NB_IoT_t *NPUSCH_info = (sched_temp_UL_NB_IoT_t*)malloc(sizeof(sched_temp_UL_NB_IoT_t)); sched_temp_UL_NB_IoT_t *NPUSCH_info = (sched_temp_UL_NB_IoT_t*)malloc(sizeof(sched_temp_UL_NB_IoT_t));
//DCIFormatN0_t *DCI_N0 = (DCIFormatN0_t*)malloc(sizeof(DCIFormatN0_t));
//available_resource_DL_t *node;
// setting of the NDI // setting of the NDI
/* /*
if(UE_info->HARQ_round == 0) if(UE_info->HARQ_round == 0)
...@@ -78,17 +74,10 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -78,17 +74,10 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
ndi = 1; ndi = 1;
for (i = 0; i < candidate; i++) for (i = 0; i < candidate; i++)
{ {
/*step 1 : Check DL resource is available for DCI N0 or not*/ /*step 1 : Check DL resource is available for DCI N0 or not*/
check_DCI_result = check_resource_NPDCCH_NB_IoT(mac_inst,H_SFN, frame, subframe, NPDCCH_info, i, UE_sched_ctrl_info->R_dci); check_DCI_result = check_resource_NPDCCH_NB_IoT(mac_inst,H_SFN, frame, subframe, NPDCCH_info, i, UE_sched_ctrl_info->R_dci);
//node = check_resource_DL(mac_inst,);
//just use to check when there is no DL function
//NPDCCH_info->sf_start = H_SFN*10240+frame*10 +subframe + i * UE_sched_ctrl_info->R_dci;
//NPDCCH_info->sf_end = NPDCCH_info->sf_start + (i+1) * UE_sched_ctrl_info->R_dci;
//LOG_D(MAC,"UE : %5d, NPDCCH result: %d ,NPDCCH start: %d,NPDCCH end : %d\n",UE_info->rnti,check_DCI_result,NPDCCH_info->sf_start,NPDCCH_info->sf_end);
if( check_DCI_result != -1) if( check_DCI_result != -1)
{ {
/*step 2 : Determine MCS / TBS / REP / RU number*/ /*step 2 : Determine MCS / TBS / REP / RU number*/
...@@ -114,7 +103,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -114,7 +103,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
} }
//LOG_D(MAC,"TBS : %d MCS %d I_RU %d\n", TBS, UE_info->ul_total_buffer, mcs, Iru); LOG_D(MAC,"TBS : %d MCS %d I_RU %d\n", TBS, UE_info->ul_total_buffer, mcs, Iru);
Nru = RU_table[Iru]; Nru = RU_table[Iru];
DL_end = NPDCCH_info->sf_end; DL_end = NPDCCH_info->sf_end;
...@@ -124,8 +113,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -124,8 +113,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
LOG_D(MAC,"[%04d][ULSchedulerUSS][UE:%05d] Multi-tone:%d,MCS:%d,TBS:%d,UL_buffer:%d,DL_start:%d,DL_end:%d,N_rep:%d,N_ru:%d,Total_ru:%d,Iru:%d\n", mac_inst->current_subframe,UE_info->rnti,UE_info->multi_tone,mcs,TBS,UE_info->ul_total_buffer,NPDCCH_info->sf_start,DL_end,N_rep,Nru,total_ru,Iru); LOG_D(MAC,"[%04d][ULSchedulerUSS][UE:%05d] Multi-tone:%d,MCS:%d,TBS:%d,UL_buffer:%d,DL_start:%d,DL_end:%d,N_rep:%d,N_ru:%d,Total_ru:%d,Iru:%d\n", mac_inst->current_subframe,UE_info->rnti,UE_info->multi_tone,mcs,TBS,UE_info->ul_total_buffer,NPDCCH_info->sf_start,DL_end,N_rep,Nru,total_ru,Iru);
/*step 3 Check UL resource for Uplink data*/ /*step 3 Check UL resource for Uplink data, we will loop the scheduling delay here */
// we will loop the scheduling delay here
for(dly=0;dly<4;dly++) for(dly=0;dly<4;dly++)
{ {
uplink_time = DL_end +scheduling_delay[dly]+1; uplink_time = DL_end +scheduling_delay[dly]+1;
...@@ -146,11 +134,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -146,11 +134,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
maintain_resource_DL(mac_inst,NPDCCH_info,NULL); maintain_resource_DL(mac_inst,NPDCCH_info,NULL);
adjust_UL_resource_list(NPUSCH_info); adjust_UL_resource_list(NPUSCH_info);
/*
//Change the UE state to idle
UE_info->direction = -1;
return 0;
*/
//Fill result to Output structure //Fill result to Output structure
if(UE_info->ul_total_buffer==14) if(UE_info->ul_total_buffer==14)
{ {
...@@ -159,16 +143,15 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -159,16 +143,15 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
UE_sched_ctrl_info->NPUSCH_sf_end=NPUSCH_info->sf_end; UE_sched_ctrl_info->NPUSCH_sf_end=NPUSCH_info->sf_end;
UE_sched_ctrl_info->NPUSCH_sf_start=NPUSCH_info->sf_start; UE_sched_ctrl_info->NPUSCH_sf_start=NPUSCH_info->sf_start;
//UE_sched_ctrl_info->resent_flag = 1; //UE_sched_ctrl_info->resent_flag = 1;
LOG_N(MAC,"Key resent \n"); LOG_D(MAC,"Key resent \n");
UE_sched_ctrl_info->dci_n0_index_ndi=0; UE_sched_ctrl_info->dci_n0_index_ndi=0;
}else }else
{ {
UE_sched_ctrl_info->NPDCCH_sf_end=NPDCCH_info->sf_end; UE_sched_ctrl_info->NPDCCH_sf_end=NPDCCH_info->sf_end;
UE_sched_ctrl_info->NPDCCH_sf_start=NPDCCH_info->sf_start; UE_sched_ctrl_info->NPDCCH_sf_start=NPDCCH_info->sf_start;
UE_sched_ctrl_info->NPUSCH_sf_end=NPUSCH_info->sf_end; UE_sched_ctrl_info->NPUSCH_sf_end=NPUSCH_info->sf_end;
UE_sched_ctrl_info->NPUSCH_sf_start=NPUSCH_info->sf_start; UE_sched_ctrl_info->NPUSCH_sf_start=NPUSCH_info->sf_start;
UE_sched_ctrl_info->dci_n0_index_ndi=ndi; UE_sched_ctrl_info->dci_n0_index_ndi=ndi;
} }
UE_sched_ctrl_info->TBS=TBS; UE_sched_ctrl_info->TBS=TBS;
...@@ -178,8 +161,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -178,8 +161,6 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
UE_sched_ctrl_info->dci_n0_n_ru=Nru; UE_sched_ctrl_info->dci_n0_n_ru=Nru;
UE_sched_ctrl_info->dci_n0_index_delay=dly; UE_sched_ctrl_info->dci_n0_index_delay=dly;
UE_sched_ctrl_info->dci_n0_index_subcarrier=NPUSCH_info->subcarrier_indication; UE_sched_ctrl_info->dci_n0_index_subcarrier=NPUSCH_info->subcarrier_indication;
//UE_sched_ctrl_info->dci_n0_index_ndi=ndi;
//UE_sched_ctrl_info->dci_n0_index_R_dci=get_DCI_REP(UE_sched_ctrl_info->R_dci->R_dci,UE_info->R_max);
UE_sched_ctrl_info->dci_n0_index_R_data=I_rep; UE_sched_ctrl_info->dci_n0_index_R_data=I_rep;
LOG_D(MAC,"[%04d][ULSchedulerUSS][%d][Success] Finish UL USS scheduling \n", mac_inst->current_subframe, UE_info->rnti); LOG_D(MAC,"[%04d][ULSchedulerUSS][%d][Success] Finish UL USS scheduling \n", mac_inst->current_subframe, UE_info->rnti);
...@@ -222,7 +203,7 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t ...@@ -222,7 +203,7 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
// note: if lcid < 25 this is sdu, otherwise this is CE // note: if lcid < 25 this is sdu, otherwise this is CE
payload_ptr = parse_ulsch_header_NB_IoT(sdu, &num_ce, &num_sdu,rx_ces, rx_lcids, rx_lengths, length); payload_ptr = parse_ulsch_header_NB_IoT(sdu, &num_ce, &num_sdu,rx_ces, rx_lcids, rx_lengths, length);
LOG_I(MAC,"num_CE= %d, num_sdu= %d, rx_ces[0] = %d, rx_lcids = %d, rx_lengths[0] = %d, length = %d\n",num_ce,num_sdu,rx_ces[0],rx_lcids[0],rx_lengths[0],length); LOG_D(MAC,"num_CE= %d, num_sdu= %d, rx_ces[0] = %d, rx_lcids = %d, rx_lengths[0] = %d, length = %d\n",num_ce,num_sdu,rx_ces[0],rx_lcids[0],rx_lengths[0],length);
for (i = 0; i < num_ce; i++) for (i = 0; i < num_ce; i++)
{ {
...@@ -261,7 +242,7 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t ...@@ -261,7 +242,7 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
PHR = ((payload_ptr[0] >> 5) & 0x01)*2+((payload_ptr[0]>>4) & 0x01); PHR = ((payload_ptr[0] >> 5) & 0x01)*2+((payload_ptr[0]>>4) & 0x01);
DVI_index = (payload_ptr[0] >>3 & 0x01)*8+ (payload_ptr[0] >>2 & 0x01)*4 + (payload_ptr[0] >>1 & 0x01)*2 +(payload_ptr[0] >>0 & 0x01); DVI_index = (payload_ptr[0] >>3 & 0x01)*8+ (payload_ptr[0] >>2 & 0x01)*4 + (payload_ptr[0] >>1 & 0x01)*2 +(payload_ptr[0] >>0 & 0x01);
ul_total_buffer = DV_table[DVI_index]; ul_total_buffer = DV_table[DVI_index];
LOG_I(MAC,"PHR = %d, ul_total_buffer = %d\n",PHR,ul_total_buffer); LOG_D(MAC,"PHR = %d, ul_total_buffer = %d\n",PHR,ul_total_buffer);
// go to payload // go to payload
payload_ptr+=1; payload_ptr+=1;
// Note that the first 6 byte (48 bits) of this CCCH SDU should be encoded in the MSG4 for contention resolution // Note that the first 6 byte (48 bits) of this CCCH SDU should be encoded in the MSG4 for contention resolution
...@@ -291,7 +272,7 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t ...@@ -291,7 +272,7 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
LOG_E(MAC,"Not available RA here\n"); LOG_E(MAC,"Not available RA here\n");
Valid_msg3 = 1; Valid_msg3 = 1;
} }
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]); LOG_D(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]);
break; break;
case DCCH0_NB_IoT: case DCCH0_NB_IoT:
case DCCH1_NB_IoT: case DCCH1_NB_IoT:
...@@ -300,11 +281,12 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t ...@@ -300,11 +281,12 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
{ {
block_RLC = 0; block_RLC = 0;
int x = 0; int x = 0;
LOG_N(MAC,"Length: %d\n",rx_lengths[i]); LOG_D(MAC,"Length: %d\n",rx_lengths[i]);
/*
for (x=0;x<rx_lengths[i];x++) for (x=0;x<rx_lengths[i];x++)
printf("%02x ",payload_ptr[x]); printf("%02x ",payload_ptr[x]);
printf("\n"); printf("\n");
*/
mac_rlc_data_ind( mac_rlc_data_ind(
module_id, module_id,
rnti, rnti,
...@@ -336,21 +318,19 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t ...@@ -336,21 +318,19 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
49, 49,
(char *)payload_ptr); (char *)payload_ptr);
RLC_RECEIVE_MSG5_FAILED = 0; RLC_RECEIVE_MSG5_FAILED = 0;
} }
if (UE_info != NULL) if (UE_info != NULL)
{ {
//UE_info->direction = 1; //1 for DL scheduler //UE_info->direction = 1; //1 for DL scheduler
LOG_I(MAC,"After receive Msg5, change the UE scheduling direction to DL\n"); LOG_D(MAC,"After receive Msg5, change the UE scheduling direction to DL\n");
} }
}else if (UE_state_machine == rach_for_auth_rsp || UE_state_machine == rach_for_TAU) }else if (UE_state_machine == rach_for_auth_rsp || UE_state_machine == rach_for_TAU)
{ {
LOG_N(MAC,"Here we are for the DCI N0 generating \n"); LOG_D(MAC,"Here we are for the DCI N0 generating \n");
if (UE_info != NULL) if (UE_info != NULL)
{ {
UE_info->direction = 0; //1 for DL scheduler UE_info->direction = 0; //1 for DL scheduler
LOG_I(MAC,"Change direction into 0\n"); LOG_D(MAC,"Change direction into 0\n");
} }
UE_state_machine = rach_for_next; UE_state_machine = rach_for_next;
} }
...@@ -448,5 +428,5 @@ void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT ...@@ -448,5 +428,5 @@ void fill_DCI_N0(DCIFormatN0_t *DCI_N0, UE_TEMPLATE_NB_IoT *UE_info, UE_SCHED_CT
DCI_N0->rv = 0; // rv will loop 0 & 2 DCI_N0->rv = 0; // rv will loop 0 & 2
DCI_N0->DCIRep = get_DCI_REP(UE_sched_ctrl_info->R_dci,UE_info->R_max); DCI_N0->DCIRep = get_DCI_REP(UE_sched_ctrl_info->R_dci,UE_info->R_max);
//DCI_N0->DCIRep = UE_sched_ctrl_info->dci_n0_index_R_dci; //DCI_N0->DCIRep = UE_sched_ctrl_info->dci_n0_index_R_dci;
LOG_I(MAC,"[fill_DCI_N0] Type %d scind %d I_ru %d I_mcs %d ndi %d I_delay %d I_rep %d RV %d I_dci %d\n", DCI_N0->type, DCI_N0->scind, DCI_N0->ResAssign, DCI_N0->mcs, DCI_N0->ndi, DCI_N0->Scheddly, DCI_N0->RepNum, DCI_N0->rv, DCI_N0->DCIRep); LOG_D(MAC,"[fill_DCI_N0] Type %d scind %d I_ru %d I_mcs %d ndi %d I_delay %d I_rep %d RV %d I_dci %d\n", DCI_N0->type, DCI_N0->scind, DCI_N0->ResAssign, DCI_N0->mcs, DCI_N0->ndi, DCI_N0->Scheddly, DCI_N0->RepNum, DCI_N0->rv, DCI_N0->DCIRep);
} }
...@@ -180,7 +180,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -180,7 +180,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.harq_ack_resource = ((DCIFormatN1_t *)DCI_pdu)->HARQackRes; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource = ((DCIFormatN1_t *)DCI_pdu)->HARQackRes;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = ((DCIFormatN1_t *)DCI_pdu)->orderIndicator; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = ((DCIFormatN1_t *)DCI_pdu)->orderIndicator;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN1_t *)DCI_pdu)->DCIRep; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN1_t *)DCI_pdu)->DCIRep;
LOG_I(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL DCI, res:%d, rep:%d\n",hypersfn,frame,subframe,dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.resource_assignment,((DCIFormatN1_t *)DCI_pdu)->RepNum); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL DCI, res:%d, rep:%d\n",hypersfn,frame,subframe,dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.resource_assignment,((DCIFormatN1_t *)DCI_pdu)->RepNum);
}else if(schedule_result_list_DL->direction == UL) // DCI for uplink }else if(schedule_result_list_DL->direction == UL) // DCI for uplink
{ {
...@@ -227,7 +227,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -227,7 +227,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill SIBs\n",hypersfn,frame,subframe); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill SIBs\n",hypersfn,frame,subframe);
}else }else
LOG_I(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL Data, length = %d number of sf for a data = %d\n",hypersfn,frame,subframe,dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.length,dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment); LOG_D(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL Data, length = %d number of sf for a data = %d\n",hypersfn,frame,subframe,dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.length,dl_config_pdu->ndlsch_pdu.ndlsch_pdu_rel13.number_of_subframes_for_resource_assignment);
break; break;
default: default:
break; break;
......
...@@ -80,7 +80,6 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -80,7 +80,6 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
{ {
int i=0; int i=0;
uint32_t abs_subframe; uint32_t abs_subframe;
Sched_Rsp_NB_IoT_t *SCHED_info = &mac_inst->Sched_INFO;
UE_TEMPLATE_NB_IoT *ue_info = (UE_TEMPLATE_NB_IoT *)0; UE_TEMPLATE_NB_IoT *ue_info = (UE_TEMPLATE_NB_IoT *)0;
uint16_t tmp_rnti; uint16_t tmp_rnti;
...@@ -169,7 +168,7 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -169,7 +168,7 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
ue_info->direction=0; ue_info->direction=0;
}else }else
{ {
LOG_I(MAC,"This UE get the response of HARQ DL : ACK, update the UL buffer for next message\n"); LOG_I(MAC,"This UE get the response of HARQ DL : ACK\n");
ue_info->direction=-1; ue_info->direction=-1;
//ue_info->ul_total_buffer = 11; //ue_info->ul_total_buffer = 11;
UE_state_machine = rach_for_auth_rsp; UE_state_machine = rach_for_auth_rsp;
......
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