Commit 828f97be authored by Ting-An Lin's avatar Ting-An Lin

Add L2 IF-Module

parent 8b5e70e0
...@@ -1418,7 +1418,7 @@ set(L2_SRC ...@@ -1418,7 +1418,7 @@ set(L2_SRC
${RRC_DIR}/rrc_common.c ${RRC_DIR}/rrc_common.c
#${RRC_NB_DIR}/rrc_common_NB_IoT.c #${RRC_NB_DIR}/rrc_common_NB_IoT.c
${RRC_DIR}/L2_interface.c ${RRC_DIR}/L2_interface.c
#${RRC_NB_DIR}/L2_interface_NB_IoT.c ${RRC_NB_DIR}/L2_interface_NB_IoT.c
${RRC_DIR}/L2_interface_common.c ${RRC_DIR}/L2_interface_common.c
${RRC_DIR}/L2_interface_ue.c ${RRC_DIR}/L2_interface_ue.c
) )
...@@ -1467,6 +1467,8 @@ set(L2_SRC_UE ...@@ -1467,6 +1467,8 @@ set(L2_SRC_UE
set (MAC_SRC set (MAC_SRC
#${PHY_INTERFACE_DIR}/phy_stub_UE.c #${PHY_INTERFACE_DIR}/phy_stub_UE.c
${PHY_INTERFACE_DIR}/IF_Module.c ${PHY_INTERFACE_DIR}/IF_Module.c
${PHY_INTERFACE_DIR}/IF_Module_NB_IoT.c
${PHY_INTERFACE_DIR}/IF_Module_L2_primitives_NB_IoT.c
${MAC_DIR}/main.c ${MAC_DIR}/main.c
${MAC_DIR}/main_NB_IoT.c ${MAC_DIR}/main_NB_IoT.c
#${MAC_DIR}/main_ue.c #${MAC_DIR}/main_ue.c
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "COMMON/platform_types.h" #include "COMMON/platform_types.h"
#include "COMMON/platform_constants.h" #include "COMMON/platform_constants.h"
#include "openair2/RRC/LTE/rrc_defs.h"
#include "LTE_RadioResourceConfigCommonSIB.h" #include "LTE_RadioResourceConfigCommonSIB.h"
#include "LTE_RadioResourceConfigDedicated.h" #include "LTE_RadioResourceConfigDedicated.h"
#include "LTE_MeasGapConfig.h" #include "LTE_MeasGapConfig.h"
......
...@@ -78,6 +78,13 @@ ...@@ -78,6 +78,13 @@
/*!\brief LCID of padding LCID for DLSCH */ /*!\brief LCID of padding LCID for DLSCH */
#define SHORT_PADDING 31 #define SHORT_PADDING 31
typedef enum rach_state_e
{
initial_access = 0,
rach_for_auth_rsp,
rach_for_TAU,
rach_for_next
}rach_state_t;
typedef enum tone_type_e typedef enum tone_type_e
{ {
......
...@@ -140,8 +140,15 @@ int extend_alpha_offset[2] = {10, 10}; ...@@ -140,8 +140,15 @@ int extend_alpha_offset[2] = {10, 10};
int uss_space = 320; int uss_space = 320;
int uss_alpha_offset = 10; int uss_alpha_offset = 10;
rach_state_t UE_state_machine = initial_access;
const int si_repetition_pattern[4] = {20, 40, 80, 160}; const int si_repetition_pattern[4] = {20, 40, 80, 160};
int waiting_flag_from_RLC = 0;
int block_RLC = 0;
int Valid_msg3 = 1;
int RLC_RECEIVE_MSG5_FAILED = 0;
#endif #endif
...@@ -73,7 +73,12 @@ typedef struct { ...@@ -73,7 +73,12 @@ typedef struct {
pdcp_data_ind_func_t pdcp_data_ind_func; pdcp_data_ind_func_t pdcp_data_ind_func;
} pdcp_params_t; } pdcp_params_t;
/*
* SN size
*/
#define PDCP_SN_5BIT 5
#define PDCP_SN_7BIT 7
#define PDCP_SN_12BIT 12
#define PDCP_USE_NETLINK ( get_pdcp_optmask() & PDCP_USE_NETLINK_BIT) #define PDCP_USE_NETLINK ( get_pdcp_optmask() & PDCP_USE_NETLINK_BIT)
#define LINK_ENB_PDCP_TO_IP_DRIVER ( get_pdcp_optmask() & LINK_ENB_PDCP_TO_IP_DRIVER_BIT) #define LINK_ENB_PDCP_TO_IP_DRIVER ( get_pdcp_optmask() & LINK_ENB_PDCP_TO_IP_DRIVER_BIT)
...@@ -200,6 +205,7 @@ typedef struct pdcp_s { ...@@ -200,6 +205,7 @@ typedef struct pdcp_s {
*/ */
pdcp_hfn_t tx_hfn; pdcp_hfn_t tx_hfn;
pdcp_hfn_t rx_hfn; pdcp_hfn_t rx_hfn;
pdcp_hfn_offset_t rx_hfn_offset; // related to sn mismatch
/* /*
* SN of the last PDCP SDU delivered to upper layers * SN of the last PDCP SDU delivered to upper layers
......
...@@ -135,6 +135,16 @@ typedef struct rlc_am_entity_s { ...@@ -135,6 +135,16 @@ typedef struct rlc_am_entity_s {
uint16_t poll_pdu; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to trigger a poll for every pollPDU PDUs. */ uint16_t poll_pdu; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to trigger a poll for every pollPDU PDUs. */
uint32_t poll_byte; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to trigger a poll for every pollByte bytes. */ uint32_t poll_byte; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to trigger a poll for every pollByte bytes. */
//----------------------------------------------------
// NB-IOT RLC Parameters
//----------------------------------------------------
//DL-AM-RLC Config NB-IoT parameter
uint32_t *enableStatusReportSN_Gap_NB_IoT;
//UL-AM-RLC Config. NB-IoT parameter
uint16_t max_retx_threshold_NB_IoT;
rlc_am_timer_t t_poll_retransmit_NB_IoT; //TIMER
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// STATISTICS // STATISTICS
//--------------------------------------------------------------------- //---------------------------------------------------------------------
......
...@@ -55,6 +55,14 @@ typedef volatile struct { ...@@ -55,6 +55,14 @@ typedef volatile struct {
uint32_t t_status_prohibit; /*!< \brief t-StatusProhibit timer initial value. */ uint32_t t_status_prohibit; /*!< \brief t-StatusProhibit timer initial value. */
} rlc_am_info_t; } rlc_am_info_t;
typedef volatile struct {
//UL-AM-RLC Configurations
uint16_t max_retx_threshold_NB_IoT;
uint32_t t_poll_retransmit_NB_IoT;
//DL-AM-RLC Configurations
uint32_t* enableStatusReportSN_Gap_NB_IoT; /*OPTIONAL*/
}rlc_am_info_NB_IoT_t;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/*! \fn void rlc_am_init (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP) /*! \fn void rlc_am_init (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP)
* \brief Initialize the RLC AM protocol instance, reset variables, allocate buffers, lists, then, the next step in order have a running RLC AM instance is to configure and set debug informations for this RLC instance. * \brief Initialize the RLC AM protocol instance, reset variables, allocate buffers, lists, then, the next step in order have a running RLC AM instance is to configure and set debug informations for this RLC instance.
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
# define __RLC_H__ # define __RLC_H__
# include "platform_types.h" # include "platform_types.h"
# include "platform_types_NB_IoT.h"
# include "platform_constants.h" # include "platform_constants.h"
# include "hashtable.h" # include "hashtable.h"
# include "rlc_am.h" # include "rlc_am.h"
...@@ -62,6 +63,45 @@ ...@@ -62,6 +63,45 @@
typedef uint64_t hash_key_t; typedef uint64_t hash_key_t;
#define HASHTABLE_NOT_A_KEY_VALUE ((uint64_t)-1) #define HASHTABLE_NOT_A_KEY_VALUE ((uint64_t)-1)
//-----------------------------------------------------------------------------
# ifdef RLC_MAC_C
# define private_rlc_mac(x) x
# define public_rlc_mac(x) x
# else
# define private_rlc_mac(x)
# define public_rlc_mac(x) extern x
# endif
# ifdef RLC_MPLS_C
# define private_rlc_mpls(x) x
# define public_rlc_mpls(x) x
# else
# define private_rlc_mpls(x)
# define public_rlc_mpls(x) extern x
# endif
# ifdef RLC_RRC_C
# define private_rlc_rrc(x) x
# define public_rlc_rrc(x) x
# else
# define private_rlc_rrc(x)
# define public_rlc_rrc(x) extern x
# endif
# ifdef RLC_C
# define private_rlc(x) x
# define protected_rlc(x) x
# define public_rlc(x) x
# else
# define private_rlc(x)
# if defined(RLC_MAC_C) || defined(RLC_MPLS_C) || defined(RLC_RRC_C) || defined(RLC_AM_C) || defined(RLC_TM_C) || defined(RLC_UM_C) || defined (PDCP_C)
# define protected_rlc(x) extern x
# else
# define protected_rlc(x)
# endif
# define public_rlc(x) extern x
# endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define RLC_OP_STATUS_OK 1 #define RLC_OP_STATUS_OK 1
#define RLC_OP_STATUS_BAD_PARAMETER 22 #define RLC_OP_STATUS_BAD_PARAMETER 22
...@@ -96,6 +136,7 @@ typedef volatile struct { ...@@ -96,6 +136,7 @@ typedef volatile struct {
rlc_mode_t rlc_mode; rlc_mode_t rlc_mode;
union { union {
rlc_am_info_t rlc_am_info; /*!< \sa rlc_am.h. */ rlc_am_info_t rlc_am_info; /*!< \sa rlc_am.h. */
rlc_am_info_NB_IoT_t rlc_am_info_NB_IoT; //integrate NB-IoT
rlc_tm_info_t rlc_tm_info; /*!< \sa rlc_tm.h. */ rlc_tm_info_t rlc_tm_info; /*!< \sa rlc_tm.h. */
rlc_um_info_t rlc_um_info; /*!< \sa rlc_um.h. */ rlc_um_info_t rlc_um_info; /*!< \sa rlc_um.h. */
} rlc; } rlc;
...@@ -160,6 +201,28 @@ typedef void (rrc_data_conf_cb_t)( ...@@ -160,6 +201,28 @@ typedef void (rrc_data_conf_cb_t)(
const rlc_tx_status_t statusP); const rlc_tx_status_t statusP);
//------------------------------------------------
// NB-IoT (may this stuff are no more used)
//------------------------------------------------
//pointer functions
protected_rlc(void (*rlc_rrc_data_ind_NB_IoT)(
const protocol_ctxt_t* const ctxtP,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
const uint8_t * const sduP,
const srb1bis_flag_t srb1bis_flag);)
typedef void (rrc_data_ind_cb_NB_IoT_t)(
const protocol_ctxt_t* const ctxtP,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
const uint8_t * const sduP,
const srb1bis_flag_t srb1bis_flag);
//------------------------------------------------
/*! \struct rlc_t /*! \struct rlc_t
* \brief Structure to be instanciated to allocate memory for RLC protocol instances. * \brief Structure to be instanciated to allocate memory for RLC protocol instances.
*/ */
......
#include "IF_Module_L2_primitives_NB_IoT.h" #include "IF_Module_L2_primitives_NB_IoT.h"
#include "LAYER2/MAC/proto_NB_IoT.h" #include "LAYER2/MAC/proto_NB_IoT.h"
#include "LAYER2/MAC/extern_NB_IoT.h" #include "LAYER2/MAC/extern_NB_IoT.h"
#include "openair2/LAYER2/MAC/vars_NB_IoT.h"
int tmp = 0; int tmp = 0;
//int block_rach = 0; //int block_rach = 0;
int first_msg4 = 0; int first_msg4 = 0;
int rach_count = 0;
void simulate_preamble(UL_IND_NB_IoT_t *UL_INFO, int CE, int sc) void simulate_preamble(UL_IND_NB_IoT_t *UL_INFO, int CE, int sc)
{ {
...@@ -79,7 +81,6 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -79,7 +81,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;
...@@ -118,6 +119,22 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -118,6 +119,22 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
); );
//block_rach = 2; //block_rach = 2;
}else if (UE_state_machine == rach_for_next || UE_state_machine == rach_for_TAU)
{
//rach_count++;
//if (rach_count%3==0)
//{
LOG_N(MAC,"It is the third time that this UE try to rach\n");
init_RA_NB_IoT(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,
//timing_offset = Timing_advance * 16
(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance*16
);
UE_state_machine = rach_for_TAU;
//}
} }
} }
} }
...@@ -152,7 +169,7 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -152,7 +169,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;
...@@ -178,6 +195,14 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -178,6 +195,14 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
{ {
for(i=0;i<UL_INFO->RX_NPUSCH.number_of_pdus;i++) for(i=0;i<UL_INFO->RX_NPUSCH.number_of_pdus;i++)
{ {
printf("The Receive MAC PDU:");
int x = 0;
for (x = 0; x < (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->rx_indication_rel8.length; x ++)
{
printf("%02x ", (UL_INFO->RX_NPUSCH.rx_pdu_list+i)->data[x]);
}
printf("\n");
//For MSG3, Normal Uplink Data, NAK //For MSG3, Normal Uplink Data, NAK
rx_sdu_NB_IoT(UL_INFO->module_id, rx_sdu_NB_IoT(UL_INFO->module_id,
UL_INFO->CC_id, UL_INFO->CC_id,
......
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" #include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "openair2/PHY_INTERFACE/IF_Module_L2_primitives_NB_IoT.h" #include "openair2/PHY_INTERFACE/IF_Module_L2_primitives_NB_IoT.h"
#include "openair1/SCHED/IF_Module_L1_primitives_NB_IoT.h" #include "openair1/SCHED_NBIOT/IF_Module_L1_primitives_NB_IoT.h"
#include "LAYER2/MAC/extern_NB_IoT.h" #include "LAYER2/MAC/extern_NB_IoT.h"
//#include "LAYER2/MAC/proto_NB_IoT.h" //#include "LAYER2/MAC/proto_NB_IoT.h"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file RRC/NBIOT/defs_NB_IoT.h /*! \file RRC/LITE/defs_NB_IoT.h
* \brief NB-IoT RRC struct definitions and function prototypes * \brief NB-IoT RRC struct definitions and function prototypes
* \author Navid Nikaein, Raymond Knopp and Michele Paffetti * \author Navid Nikaein, Raymond Knopp and Michele Paffetti
* \date 2010 - 2014, 2017 * \date 2010 - 2014, 2017
...@@ -44,19 +44,19 @@ ...@@ -44,19 +44,19 @@
#include "COMMON/platform_constants.h" #include "COMMON/platform_constants.h"
#include "COMMON/platform_types.h" #include "COMMON/platform_types.h"
//#include "COMMON/mac_rrc_primitives.h" #include "COMMON/mac_rrc_primitives.h"
//#include "LAYER2/MAC/defs.h" //#include "LAYER2/MAC/defs.h"
//#include "COMMON/openair_defs.h" //#include "COMMON/openair_defs.h"
//#ifndef USER_MODE // #ifndef USER_MODE
//#include <rtai.h> // #include <rtai.h>
//#endif // #endif
//-----NB-IoT #include files------- //-----NB-IoT #include files-------
//#include "SystemInformationBlockType1-NB.h" #include "LTE_SystemInformationBlockType1-NB.h"
//#include "SystemInformation-NB.h" #include "LTE_SystemInformation-NB.h"
#include "LTE_RRCConnectionReconfiguration-NB.h" #include "LTE_RRCConnectionReconfiguration-NB.h"
#include "LTE_RRCConnectionReconfigurationComplete-NB.h" #include "LTE_RRCConnectionReconfigurationComplete-NB.h"
#include "LTE_RRCConnectionSetup-NB.h" #include "LTE_RRCConnectionSetup-NB.h"
...@@ -68,6 +68,8 @@ ...@@ -68,6 +68,8 @@
#include "LTE_AS-Config-NB.h" #include "LTE_AS-Config-NB.h"
#include "LTE_AS-Context-NB.h" #include "LTE_AS-Context-NB.h"
#include "LTE_UE-Capability-NB-r13.h" //equivalent of UE-EUTRA-Capability.h #include "LTE_UE-Capability-NB-r13.h" //equivalent of UE-EUTRA-Capability.h
#include "LTE_PhysCellId.h"
#include "LTE_SRB-ToAddModList-NB-r13.h"
//------------------- //-------------------
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
...@@ -267,7 +269,7 @@ typedef struct eNB_RRC_UE_NB_IoT_s { ...@@ -267,7 +269,7 @@ typedef struct eNB_RRC_UE_NB_IoT_s {
LTE_DRB_ToAddModList_NB_r13_t* DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; //for the configured DRBs of a xid LTE_DRB_ToAddModList_NB_r13_t* DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; //for the configured DRBs of a xid
uint8_t DRB_active[2];//in LTE was 8 --> at most 2 for NB-IoT uint8_t DRB_active[2];//in LTE was 8 --> at most 2 for NB-IoT
struct LTE_PhysicalConfigDedicated_NB_r13* physicalConfigDedicated_NB_IoT; struct PhysicalConfigDedicated_NB_r13* physicalConfigDedicated_NB_IoT;
LTE_MAC_MainConfig_NB_r13_t* mac_MainConfig_NB_IoT; LTE_MAC_MainConfig_NB_r13_t* mac_MainConfig_NB_IoT;
//No SPS(semi-persistent scheduling) in NB-IoT //No SPS(semi-persistent scheduling) in NB-IoT
...@@ -443,7 +445,7 @@ typedef struct eNB_RRC_INST_NB_IoT_s { ...@@ -443,7 +445,7 @@ typedef struct eNB_RRC_INST_NB_IoT_s {
hash_table_t *s1ap_id2_s1ap_ids ; // key is content is rrc_ue_s1ap_ids_t hash_table_t *s1ap_id2_s1ap_ids ; // key is content is rrc_ue_s1ap_ids_t
//RRC configuration //RRC configuration
NbIoTRrcConfigurationReq configuration; //rrc_messages_types.h RrcConfigurationReq configuration; //rrc_messages_types.h
// other PLMN parameters // other PLMN parameters
/// Mobile country code /// Mobile country code
...@@ -476,7 +478,7 @@ typedef struct OAI_UECapability_NB_IoT_s { ...@@ -476,7 +478,7 @@ typedef struct OAI_UECapability_NB_IoT_s {
#define RRC_BUFFER_SIZE_MAX_NB_IoT 1024 #define RRC_BUFFER_SIZE_MAX_NB_IoT 1024
#if 0
typedef struct UE_RRC_INST_NB_IoT_s { typedef struct UE_RRC_INST_NB_IoT_s {
Rrc_State_NB_IoT_t RrcState; Rrc_State_NB_IoT_t RrcState;
...@@ -571,7 +573,7 @@ typedef struct UE_RRC_INST_NB_IoT_s { ...@@ -571,7 +573,7 @@ typedef struct UE_RRC_INST_NB_IoT_s {
*/ */
} UE_RRC_INST_NB_IoT; } UE_RRC_INST_NB_IoT;
#endif
#include "proto_NB_IoT.h" //should be put here otherwise compilation error #include "proto_NB_IoT.h" //should be put here otherwise compilation error
#endif #endif
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
//------------------------------------------------------------------------ //------------------------------------------------------------------------
//UE_RRC_INST_NB_IoT *UE_rrc_inst_NB_IoT; //MP: may not used for the moment UE_RRC_INST_NB_IoT *UE_rrc_inst_NB_IoT; //MP: may not used for the moment
#ifndef USER_MODE #ifndef USER_MODE
#ifndef NO_RRM #ifndef NO_RRM
......
This diff is collapsed.
This diff is collapsed.
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