+#endif
+
+//#include "COMMON/openair_defs.h"
+
+
+
+#include "PHY/defs.h"
+#include "PHY/LTE_TRANSPORT/defs.h"
+#include "COMMON/platform_constants.h"
+#include "BCCH-BCH-Message.h"
+#include "RadioResourceConfigCommon.h"
+#include "RadioResourceConfigDedicated.h"
+#include "MeasGapConfig.h"
+#include "SchedulingInfoList.h"
+#include "TDD-Config.h"
+#include "RACH-ConfigCommon.h"
+#include "MeasObjectToAddModList.h"
+#include "MobilityControlInfo.h"
+#if defined(Rel10) || defined(Rel14)
+#include "MBSFN-AreaInfoList-r9.h"
+#include "MBSFN-SubframeConfigList.h"
+#include "PMCH-InfoList-r9.h"
+#include "SCellToAddMod-r10.h"
+#endif
+#ifdef Rel14
+#include "SystemInformationBlockType1-v1310-IEs.h"
+#endif
+
+#include "nfapi_interface.h"
+#include "PHY_INTERFACE/IF_Module.h"
+
+/** @defgroup _mac MAC
+ * @ingroup _oai2
+ * @{
+ */
+
+#define BCCH_PAYLOAD_SIZE_MAX 128
+#define CCCH_PAYLOAD_SIZE_MAX 128
+#define PCCH_PAYLOAD_SIZE_MAX 128
+#define RAR_PAYLOAD_SIZE_MAX 128
+
+#define SCH_PAYLOAD_SIZE_MAX 4096
+/// Logical channel ids from 36-311 (Note BCCH is not specified in 36-311, uses the same as first DRB)
+
+#if defined(Rel10) || defined(Rel14)
+
+// Mask for identifying subframe for MBMS
+#define MBSFN_TDD_SF3 0x80// for TDD
+#define MBSFN_TDD_SF4 0x40
+#define MBSFN_TDD_SF7 0x20
+#define MBSFN_TDD_SF8 0x10
+#define MBSFN_TDD_SF9 0x08
+#define MBSFN_FDD_SF1 0x80// for FDD
+#define MBSFN_FDD_SF2 0x40
+#define MBSFN_FDD_SF3 0x20
+#define MBSFN_FDD_SF6 0x10
+#define MBSFN_FDD_SF7 0x08
+#define MBSFN_FDD_SF8 0x04
+
+#define MAX_MBSFN_AREA 8
+#define MAX_PMCH_perMBSFN 15
+/*!\brief MAX MCCH payload size */
+#define MCCH_PAYLOAD_SIZE_MAX 128
+//#define MCH_PAYLOAD_SIZE_MAX 16384// this value is using in case mcs and TBS index are high
+#endif
+
+#ifdef USER_MODE
+#define printk printf
+#endif //USER_MODE
+
+/*!\brief Maximum number of logical channl group IDs */
+#define MAX_NUM_LCGID 4
+/*!\brief logical channl group ID 0 */
+#define LCGID0 0
+/*!\brief logical channl group ID 1 */
+#define LCGID1 1
+/*!\brief logical channl group ID 2 */
+#define LCGID2 2
+/*!\brief logical channl group ID 3 */
+#define LCGID3 3
+/*!\brief Maximum number of logical chanels */
+#define MAX_NUM_LCID 11
+/*!\brief Maximum number od control elemenets */
+#define MAX_NUM_CE 5
+/*!\brief Maximum number of random access process */
+#define NB_RA_PROC_MAX 4
+/*!\brief size of buffer status report table */
+#define BSR_TABLE_SIZE 64
+/*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */
+#define PHR_MAPPING_OFFSET 23 // if ( x>= -23 ) val = floor (x + 23)
+/*!\brief maximum number of resource block groups */
+#define N_RBG_MAX 25 // for 20MHz channel BW
+/*!\brief minimum value for channel quality indicator */
+#define MIN_CQI_VALUE 0
+/*!\brief maximum value for channel quality indicator */
+#define MAX_CQI_VALUE 15
+/*!\briefmaximum number of supported bandwidth (1.4, 5, 10, 20 MHz) */
+#define MAX_SUPPORTED_BW 4
+/*!\brief CQI values range from 1 to 15 (4 bits) */
+#define CQI_VALUE_RANGE 16
+
+/*!\brief value for indicating BSR Timer is not running */
+#define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF)
+
+#define LCID_EMPTY 0
+#define LCID_NOT_EMPTY 1
+
+/*!\brief minimum RLC PDU size to be transmitted = min RLC Status PDU or RLC UM PDU SN 5 bits */
+#define MIN_RLC_PDU_SIZE (2)
+
+/*!\brief minimum MAC data needed for transmitting 1 min RLC PDU size + 1 byte MAC subHeader */
+#define MIN_MAC_HDR_RLC_SIZE (1 + MIN_RLC_PDU_SIZE)
+
+/*!\brief maximum number of slices / groups */
+#define MAX_NUM_SLICES 4
+
+/*
+ * eNB part
+ */
+
+
+/*
+ * UE/ENB common part
+ */
+/*!\brief MAC header of Random Access Response for Random access preamble identifier (RAPID) */
+typedef struct {
+ uint8_t RAPID:6;
+ uint8_t T:1;
+ uint8_t E:1;
+} __attribute__((__packed__))RA_HEADER_RAPID;
+
+/*!\brief MAC header of Random Access Response for backoff indicator (BI)*/
+typedef struct {
+ uint8_t BI:4;
+ uint8_t R:2;
+ uint8_t T:1;
+ uint8_t E:1;
+} __attribute__((__packed__))RA_HEADER_BI;
+/*
+typedef struct {
+ uint64_t padding:16;
+ uint64_t t_crnti:16;
+ uint64_t hopping_flag:1;
+ uint64_t rb_alloc:10;
+ uint64_t mcs:4;
+ uint64_t TPC:3;
+ uint64_t UL_delay:1;
+ uint64_t cqi_req:1;
+ uint64_t Timing_Advance_Command:11; // first/2nd octet LSB
+ uint64_t R:1; // octet MSB
+ } __attribute__((__packed__))RAR_PDU;
+
+typedef struct {
+ uint64_t padding:16;
+ uint64_t R:1; // octet MSB
+ uint64_t Timing_Advance_Command:11; // first/2nd octet LSB
+ uint64_t cqi_req:1;
+ uint64_t UL_delay:1;
+ uint64_t TPC:3;
+ uint64_t mcs:4;
+ uint64_t rb_alloc:10;
+ uint64_t hopping_flag:1;
+ uint64_t t_crnti:16;
+ } __attribute__((__packed__))RAR_PDU;
+
+#define sizeof_RAR_PDU 6
+*/
+/*!\brief MAC subheader short with 7bit Length field */
+typedef struct {
+ uint8_t LCID:5; // octet 1 LSB
+ uint8_t E:1;
+ uint8_t R:2; // octet 1 MSB
+ uint8_t L:7; // octet 2 LSB
+ uint8_t F:1; // octet 2 MSB
+} __attribute__((__packed__))SCH_SUBHEADER_SHORT;
+/*!\brief MAC subheader long with 15bit Length field */
+typedef struct {
+ uint8_t LCID:5; // octet 1 LSB
+ uint8_t E:1;
+ uint8_t R:2; // octet 1 MSB
+ uint8_t L_MSB:7;
+ uint8_t F:1; // octet 2 MSB
+ uint8_t L_LSB:8;
+ uint8_t padding;
+} __attribute__((__packed__))SCH_SUBHEADER_LONG;
+/*!\brief MAC subheader short without length field */
+typedef struct {
+ uint8_t LCID:5;
+ uint8_t E:1;
+ uint8_t R:2;
+} __attribute__((__packed__))SCH_SUBHEADER_FIXED;
+
+/*!\brief mac control element: short buffer status report for a specific logical channel group ID*/
+typedef struct {
+ uint8_t Buffer_size:6; // octet 1 LSB
+ uint8_t LCGID:2; // octet 1 MSB
+} __attribute__((__packed__))BSR_SHORT;
+
+typedef BSR_SHORT BSR_TRUNCATED;
+/*!\brief mac control element: long buffer status report for all logical channel group ID*/
+typedef struct {
+ uint8_t Buffer_size3:6;
+ uint8_t Buffer_size2:6;
+ uint8_t Buffer_size1:6;
+ uint8_t Buffer_size0:6;
+} __attribute__((__packed__))BSR_LONG;
+
+#define BSR_LONG_SIZE (sizeof(BSR_LONG))
+/*!\brief mac control element: timing advance */
+typedef struct {
+ uint8_t TA:6;
+ uint8_t R:2;
+} __attribute__((__packed__))TIMING_ADVANCE_CMD;
+/*!\brief mac control element: power headroom report */
+typedef struct {
+ uint8_t PH:6;
+ uint8_t R:2;
+} __attribute__((__packed__))POWER_HEADROOM_CMD;
+
+/*! \brief MIB payload */
+typedef struct {
+ uint8_t payload[3] ;
+} __attribute__((__packed__))MIB_PDU;
+/*! \brief CCCH payload */
+typedef struct {
+ uint8_t payload[CCCH_PAYLOAD_SIZE_MAX] ;
+} __attribute__((__packed__))CCCH_PDU;
+/*! \brief BCCH payload */
+typedef struct {
+ uint8_t payload[BCCH_PAYLOAD_SIZE_MAX] ;
+} __attribute__((__packed__))BCCH_PDU;
+/*! \brief RAR payload */
+typedef struct {
+ uint8_t payload[RAR_PAYLOAD_SIZE_MAX];
+} __attribute__ ((__packed__)) RAR_PDU;
+/*! \brief BCCH payload */
+typedef struct {
+ uint8_t payload[PCCH_PAYLOAD_SIZE_MAX] ;
+} __attribute__((__packed__))PCCH_PDU;
+
+#if defined(Rel10) || defined(Rel14)
+/*! \brief MCCH payload */
+typedef struct {
+ uint8_t payload[MCCH_PAYLOAD_SIZE_MAX] ;
+} __attribute__((__packed__))MCCH_PDU;
+/*!< \brief MAC control element for activation and deactivation of component carriers */
+typedef struct {
+ uint8_t C7:1;/*!< \brief Component carrier 7 */
+ uint8_t C6:1;/*!< \brief Component carrier 6 */
+ uint8_t C5:1;/*!< \brief Component carrier 5 */
+ uint8_t C4:1;/*!< \brief Component carrier 4 */
+ uint8_t C3:1;/*!< \brief Component carrier 3 */
+ uint8_t C2:1;/*!< \brief Component carrier 2 */
+ uint8_t C1:1;/*!< \brief Component carrier 1 */
+ uint8_t R:1;/*!< \brief Reserved */
+} __attribute__((__packed__))CC_ELEMENT;
+/*! \brief MAC control element: MCH Scheduling Information */
+typedef struct {
+ uint8_t stop_sf_MSB:3; // octet 1 LSB
+ uint8_t lcid:5; // octet 2 MSB
+ uint8_t stop_sf_LSB:8;
+} __attribute__((__packed__))MSI_ELEMENT;
+#endif
+/*! \brief Values of CCCH LCID for DLSCH */
+#define CCCH_LCHANID 0
+/*!\brief Values of BCCH logical channel (fake)*/
+#define BCCH 3 // SI
+/*!\brief Values of PCCH logical channel (fake)*/
+#define PCCH 4 // Paging
+/*!\brief Values of PCCH logical channel (fake) */
+#define MIBCH 5 // MIB
+/*!\brief Values of BCCH SIB1_BR logical channel (fake) */
+#define BCCH_SIB1_BR 6 // SIB1_BR
+/*!\brief Values of BCCH SIB_BR logical channel (fake) */
+#define BCCH_SI_BR 7 // SI-BR
+/*!\brief Value of CCCH / SRB0 logical channel */
+#define CCCH 0 // srb0
+/*!\brief DCCH / SRB1 logical channel */
+#define DCCH 1 // srb1
+/*!\brief DCCH1 / SRB2 logical channel */
+#define DCCH1 2 // srb2
+/*!\brief DTCH DRB1 logical channel */
+#define DTCH 3 // LCID
+/*!\brief MCCH logical channel */
+#define MCCH 4
+/*!\brief MTCH logical channel */
+#define MTCH 1
+// DLSCH LCHAN ID
+/*!\brief LCID of UE contention resolution identity for DLSCH*/
+#define UE_CONT_RES 28
+/*!\brief LCID of timing advance for DLSCH */
+#define TIMING_ADV_CMD 29
+/*!\brief LCID of discontinous reception mode for DLSCH */
+#define DRX_CMD 30
+/*!\brief LCID of padding LCID for DLSCH */
+#define SHORT_PADDING 31
+
+#if defined(Rel10) || defined(Rel14)
+// MCH LCHAN IDs (table6.2.1-4 TS36.321)
+/*!\brief LCID of MCCH for DL */
+#define MCCH_LCHANID 0
+/*!\brief LCID of MCH scheduling info for DL */
+#define MCH_SCHDL_INFO 3
+/*!\brief LCID of Carrier component activation/deactivation */
+#define CC_ACT_DEACT 27
+#endif
+
+// ULSCH LCHAN IDs
+/*!\brief LCID of extended power headroom for ULSCH */
+#define EXTENDED_POWER_HEADROOM 25
+/*!\brief LCID of power headroom for ULSCH */
+#define POWER_HEADROOM 26
+/*!\brief LCID of CRNTI for ULSCH */
+#define CRNTI 27
+/*!\brief LCID of truncated BSR for ULSCH */
+#define TRUNCATED_BSR 28
+/*!\brief LCID of short BSR for ULSCH */
+#define SHORT_BSR 29
+/*!\brief LCID of long BSR for ULSCH */
+#define LONG_BSR 30
+/*!\bitmaps for BSR Triggers */
+#define BSR_TRIGGER_NONE (0) /* No BSR Trigger */
+#define BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */
+#define BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */
+#define BSR_TRIGGER_PADDING (4) /* For Padding BSR Trigger */
+
+
+/*! \brief Downlink SCH PDU Structure */
+typedef struct {
+ uint8_t payload[8][SCH_PAYLOAD_SIZE_MAX];
+ uint16_t Pdu_size[8];
+} __attribute__ ((__packed__)) DLSCH_PDU;
+
+
+/*! \brief MCH PDU Structure */
+typedef struct {
+ int8_t payload[SCH_PAYLOAD_SIZE_MAX];
+ uint16_t Pdu_size;
+ uint8_t mcs;
+ uint8_t sync_area;
+ uint8_t msi_active;
+ uint8_t mcch_active;
+ uint8_t mtch_active;
+} __attribute__ ((__packed__)) MCH_PDU;
+
+/*! \brief Uplink SCH PDU Structure */
+typedef struct {
+ int8_t payload[SCH_PAYLOAD_SIZE_MAX]; /*!< \brief SACH payload */
+ uint16_t Pdu_size;
+} __attribute__ ((__packed__)) ULSCH_PDU;
+
+#include "PHY/impl_defs_top.h"
+
+/*!\brief UE ULSCH scheduling states*/
+typedef enum {
+ S_UL_NONE =0,
+ S_UL_WAITING,
+ S_UL_SCHEDULED,
+ S_UL_BUFFERED,
+ S_UL_NUM_STATUS
+} UE_ULSCH_STATUS;
+
+/*!\brief UE DLSCH scheduling states*/
+typedef enum {
+ S_DL_NONE =0,
+ S_DL_WAITING,
+ S_DL_SCHEDULED,
+ S_DL_BUFFERED,
+ S_DL_NUM_STATUS
+} UE_DLSCH_STATUS;
+
+/*!\brief scheduling policy for the contention-based access */
+typedef enum {
+ CBA_ES=0, /// equal share of RB among groups w
+ CBA_ES_S, /// equal share of RB among groups with small allocation
+ CBA_PF, /// proportional fair (kind of)
+ CBA_PF_S, /// proportional fair (kind of) with small RB allocation
+ CBA_RS /// random allocation
+} CBA_POLICY;
+
+
+/*! \brief temporary struct for ULSCH sched */
+typedef struct {
+ rnti_t rnti;
+ uint16_t subframe;
+ uint16_t serving_num;
+ UE_ULSCH_STATUS status;
+} eNB_ULSCH_INFO;
+/*! \brief temp struct for DLSCH sched */
+typedef struct {
+ rnti_t rnti;
+ uint16_t weight;
+ uint16_t subframe;
+ uint16_t serving_num;
+ UE_DLSCH_STATUS status;
+} eNB_DLSCH_INFO;
+/*! \brief eNB overall statistics */
+typedef struct {
+ /// num BCCH PDU per CC
+ uint32_t total_num_bcch_pdu;
+ /// BCCH buffer size
+ uint32_t bcch_buffer;
+ /// total BCCH buffer size
+ uint32_t total_bcch_buffer;
+ /// BCCH MCS
+ uint32_t bcch_mcs;
+
+ /// num CCCH PDU per CC
+ uint32_t total_num_ccch_pdu;
+ /// BCCH buffer size
+ uint32_t ccch_buffer;
+ /// total BCCH buffer size
+ uint32_t total_ccch_buffer;
+ /// BCCH MCS
+ uint32_t ccch_mcs;
+
+/// num active users
+ uint16_t num_dlactive_UEs;
+ /// available number of PRBs for a give SF
+ uint16_t available_prbs;
+ /// total number of PRB available for the user plane
+ uint32_t total_available_prbs;
+ /// aggregation
+ /// total avilable nccc : num control channel element
+ uint16_t available_ncces;
+ // only for a new transmission, should be extended for retransmission
+ // current dlsch bit rate for all transport channels
+ uint32_t dlsch_bitrate;
+ //
+ uint32_t dlsch_bytes_tx;
+ //
+ uint32_t dlsch_pdus_tx;
+ //
+ uint32_t total_dlsch_bitrate;
+ //
+ uint32_t total_dlsch_bytes_tx;
+ //
+ uint32_t total_dlsch_pdus_tx;
+
+ // here for RX
+ //
+ uint32_t ulsch_bitrate;
+ //
+ uint32_t ulsch_bytes_rx;
+ //
+ uint64_t ulsch_pdus_rx;
+
+ uint32_t total_ulsch_bitrate;
+ //
+ uint32_t total_ulsch_bytes_rx;
+ //
+ uint32_t total_ulsch_pdus_rx;
+
+
+ /// MAC agent-related stats
+ /// total number of scheduling decisions
+ int sched_decisions;
+ /// missed deadlines
+ int missed_deadlines;
+
+} eNB_STATS;
+/*! \brief eNB statistics for the connected UEs*/
+typedef struct {
+
+ /// CRNTI of UE
+ rnti_t crnti; ///user id (rnti) of connected UEs
+ // rrc status
+ uint8_t rrc_status;
+ /// harq pid
+ uint8_t harq_pid;
+ /// harq rounf
+ uint8_t harq_round;
+ /// total available number of PRBs for a new transmission
+ uint16_t rbs_used;
+ /// total available number of PRBs for a retransmission
+ uint16_t rbs_used_retx;
+ /// total nccc used for a new transmission: num control channel element
+ uint16_t ncce_used;
+ /// total avilable nccc for a retransmission: num control channel element
+ uint16_t ncce_used_retx;
+
+ // mcs1 before the rate adaptaion
+ uint8_t dlsch_mcs1;
+ /// Target mcs2 after rate-adaptation
+ uint8_t dlsch_mcs2;
+ // current TBS with mcs2
+ uint32_t TBS;
+ // total TBS with mcs2
+ // uint32_t total_TBS;
+ // total rb used for a new transmission
+ uint32_t total_rbs_used;
+ // total rb used for retransmission
+ uint32_t total_rbs_used_retx;
+
+ /// TX
+ /// Num pkt
+ uint32_t num_pdu_tx[NB_RB_MAX];
+ /// num bytes
+ uint32_t num_bytes_tx[NB_RB_MAX];
+ /// num retransmission / harq
+ uint32_t num_retransmission;
+ /// instantaneous tx throughput for each TTI
+ // uint32_t tti_throughput[NB_RB_MAX];
+
+ /// overall
+ //
+ uint32_t dlsch_bitrate;
+ //total
+ uint32_t total_dlsch_bitrate;
+ /// headers+ CE + padding bytes for a MAC PDU
+ uint64_t overhead_bytes;
+ /// headers+ CE + padding bytes for a MAC PDU
+ uint64_t total_overhead_bytes;
+ /// headers+ CE + padding bytes for a MAC PDU
+ uint64_t avg_overhead_bytes;
+ // MAC multiplexed payload
+ uint64_t total_sdu_bytes;
+ // total MAC pdu bytes
+ uint64_t total_pdu_bytes;
+
+ // total num pdu
+ uint32_t total_num_pdus;
+ //
+ // uint32_t avg_pdu_size;
+
+ /// RX
+
+ /// PUCCH1a/b power (dBm)
+ int32_t Po_PUCCH_dBm;
+ /// Indicator that Po_PUCCH has been updated by PHY
+ int32_t Po_PUCCH_update;
+ /// Uplink measured RSSI
+ int32_t UL_rssi;
+ /// preassigned mcs after rate adaptation
+ uint8_t ulsch_mcs1;
+ /// adjusted mcs
+ uint8_t ulsch_mcs2;
+
+ /// estimated average pdu inter-departure time
+ uint32_t avg_pdu_idt;
+ /// estimated average pdu size
+ uint32_t avg_pdu_ps;
+ ///
+ uint32_t aggregated_pdu_size;
+ uint32_t aggregated_pdu_arrival;
+
+ /// uplink transport block size
+ uint32_t ulsch_TBS;
+
+ /// total rb used for a new uplink transmission
+ uint32_t num_retransmission_rx;
+ /// total rb used for a new uplink transmission
+ uint32_t rbs_used_rx;
+ /// total rb used for a new uplink retransmission
+ uint32_t rbs_used_retx_rx;
+ /// total rb used for a new uplink transmission
+ uint32_t total_rbs_used_rx;
+ /// normalized rx power
+ int32_t normalized_rx_power;
+ /// target rx power
+ int32_t target_rx_power;
+
+ /// num rx pdu
+ uint32_t num_pdu_rx[NB_RB_MAX];
+ /// num bytes rx
+ uint32_t num_bytes_rx[NB_RB_MAX];
+ /// instantaneous rx throughput for each TTI
+ // uint32_t tti_goodput[NB_RB_MAX];
+ /// errors
+ uint32_t num_errors_rx;
+
+ uint64_t overhead_bytes_rx;
+ /// headers+ CE + padding bytes for a MAC PDU
+ uint64_t total_overhead_bytes_rx;
+ /// headers+ CE + padding bytes for a MAC PDU
+ uint64_t avg_overhead_bytes_rx;
+ //
+ uint32_t ulsch_bitrate;
+ //total
+ uint32_t total_ulsch_bitrate;
+ /// overall
+ /// MAC pdu bytes
+ uint64_t pdu_bytes_rx;
+ /// total MAC pdu bytes
+ uint64_t total_pdu_bytes_rx;
+ /// total num pdu
+ uint32_t total_num_pdus_rx;
+ /// num of error pdus
+ uint32_t total_num_errors_rx;
+
+} eNB_UE_STATS;
+/*! \brief eNB template for UE context information */
+typedef struct {
+ /// C-RNTI of UE
+ rnti_t rnti;
+ /// NDI from last scheduling
+ uint8_t oldNDI[8];
+ /// mcs1 from last scheduling
+ uint8_t oldmcs1[8];
+ /// mcs2 from last scheduling
+ uint8_t oldmcs2[8];
+ /// NDI from last UL scheduling
+ uint8_t oldNDI_UL[8];
+ /// mcs from last UL scheduling
+ uint8_t mcs_UL[8];
+ /// TBS from last UL scheduling
+ uint8_t TBS_UL[8];
+ /// CQI_req from last scheduling
+ uint8_t oldCQI_UL[8];
+ /// TPC from last scheduling
+ uint8_t oldTPC_UL[8];
+ /// Flag to indicate UL has been scheduled at least once
+ boolean_t ul_active;
+ /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received)
+ boolean_t configured;
+
+ /// MCS from last scheduling
+ uint8_t mcs[8];
+
+ /// TPC from last scheduling
+ uint8_t oldTPC[8];
+
+ // PHY interface info
+
+ /// Number of Allocated RBs for DL after scheduling (prior to frequency allocation)
+ uint16_t nb_rb[8]; // num_max_harq
+
+ /// Number of Allocated RBs for UL after scheduling
+ uint16_t nb_rb_ul[8]; // num_max_harq
+
+ /// Number of Allocated RBs for UL after scheduling
+ uint16_t first_rb_ul[8]; // num_max_harq
+
+ /// Cyclic shift for DMRS after scheduling
+ uint16_t cshift[8]; // num_max_harq
+
+ /// Number of Allocated RBs by the ulsch preprocessor
+ uint8_t pre_allocated_nb_rb_ul;
+
+ /// index of Allocated RBs by the ulsch preprocessor
+ int8_t pre_allocated_rb_table_index_ul;
+
+ /// total allocated RBs
+ int8_t total_allocated_rbs;
+
+ /// pre-assigned MCS by the ulsch preprocessor
+ uint8_t pre_assigned_mcs_ul;
+
+ /// assigned MCS by the ulsch scheduler
+ uint8_t assigned_mcs_ul;
+
+ /// DL DAI
+ uint8_t DAI;
+
+ /// UL DAI
+ uint8_t DAI_ul[10];
+
+ /// UL Scheduling Request Received
+ uint8_t ul_SR;
+
+ ///Resource Block indication for each sub-band in MU-MIMO
+ uint8_t rballoc_subband[8][50];
+
+ // Logical channel info for link with RLC
+
+ /// Last received UE BSR info for each logical channel group id
+ uint8_t bsr_info[MAX_NUM_LCGID];
+
+ /// LCGID mapping
+ long lcgidmap[11];
+
+ /// phr information
+ int8_t phr_info;
+
+ /// phr information
+ int8_t phr_info_configured;
+
+ ///dl buffer info
+ uint32_t dl_buffer_info[MAX_NUM_LCID];
+ /// total downlink buffer info
+ uint32_t dl_buffer_total;
+ /// total downlink pdus
+ uint32_t dl_pdus_total;
+ /// downlink pdus for each LCID
+ uint32_t dl_pdus_in_buffer[MAX_NUM_LCID];
+ /// creation time of the downlink buffer head for each LCID
+ uint32_t dl_buffer_head_sdu_creation_time[MAX_NUM_LCID];
+ /// maximum creation time of the downlink buffer head across all LCID
+ uint32_t dl_buffer_head_sdu_creation_time_max;
+ /// a flag indicating that the downlink head SDU is segmented
+ uint8_t dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID];
+ /// size of remaining size to send for the downlink head SDU
+ uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID];
+
+ /// total uplink buffer size
+ uint32_t ul_total_buffer;
+ /// uplink buffer creation time for each LCID
+ uint32_t ul_buffer_creation_time[MAX_NUM_LCGID];
+ /// maximum uplink buffer creation time across all the LCIDs
+ uint32_t ul_buffer_creation_time_max;
+ /// uplink buffer size per LCID
+ uint32_t ul_buffer_info[MAX_NUM_LCGID];
+
+ /// UE tx power
+ int32_t ue_tx_power;
+
+ /// stores the frame where the last TPC was transmitted
+ uint32_t pusch_tpc_tx_frame;
+ uint32_t pusch_tpc_tx_subframe;
+ uint32_t pucch_tpc_tx_frame;
+ uint32_t pucch_tpc_tx_subframe;
+
+#ifdef LOCALIZATION
+ eNB_UE_estimated_distances distance;
+#endif
+
+#ifdef Rel14
+ uint8_t rach_resource_type;
+
+ uint16_t mpdcch_repetition_cnt;
+ struct PhysicalConfigDedicated *physicalConfigDedicated;
+ frame_t Msg2_frame;
+ sub_frame_t Msg2_subframe;
+#endif
+} UE_TEMPLATE;
+
+/*! \brief scheduling control information set through an API (not used)*/
+typedef struct {
+ ///UL transmission bandwidth in RBs
+ uint8_t ul_bandwidth[MAX_NUM_LCID];
+ ///DL transmission bandwidth in RBs
+ uint8_t dl_bandwidth[MAX_NUM_LCID];
+
+ //To do GBR bearer
+ uint8_t min_ul_bandwidth[MAX_NUM_LCID];
+
+ uint8_t min_dl_bandwidth[MAX_NUM_LCID];
+
+ ///aggregated bit rate of non-gbr bearer per UE
+ uint64_t ue_AggregatedMaximumBitrateDL;
+ ///aggregated bit rate of non-gbr bearer per UE
+ uint64_t ue_AggregatedMaximumBitrateUL;
+ ///CQI scheduling interval in subframes.
+ uint16_t cqiSchedInterval;
+ ///Contention resolution timer used during random access
+ uint8_t mac_ContentionResolutionTimer;
+
+ uint16_t max_allowed_rbs[MAX_NUM_LCID];
+
+ uint8_t max_mcs[MAX_NUM_LCID];
+
+ uint16_t priority[MAX_NUM_LCID];
+
+ // resource scheduling information
+
+ /// Current DL harq round per harq_pid on each CC
+ uint8_t round[MAX_NUM_CCs][10];
+ /// Current Active TBs per harq_pid on each CC
+ uint8_t tbcnt[MAX_NUM_CCs][10];
+ /// Current UL harq round per harq_pid on each CC
+ uint8_t round_UL[MAX_NUM_CCs][8];
+ uint8_t dl_pow_off[MAX_NUM_CCs];
+ uint16_t pre_nb_available_rbs[MAX_NUM_CCs];
+ unsigned char rballoc_sub_UE[MAX_NUM_CCs][N_RBG_MAX];
+ uint16_t ta_timer;
+ int16_t ta_update;
+ uint16_t ul_consecutive_errors;
+ int32_t context_active_timer;
+ int32_t cqi_req_timer;
+ int32_t ul_inactivity_timer;
+ int32_t ul_failure_timer;
+ int32_t ul_scheduled;
+ int32_t ra_pdcch_order_sent;
+ int32_t ul_out_of_sync;
+ int32_t phr_received;
+ uint8_t periodic_ri_received[NFAPI_CC_MAX];
+ uint8_t aperiodic_ri_received[NFAPI_CC_MAX];
+ uint32_t pucch_tpc_accumulated[NFAPI_CC_MAX];
+ uint8_t pucch1_cqi_update[NFAPI_CC_MAX];
+ uint8_t pucch1_snr[NFAPI_CC_MAX];
+ uint8_t pucch2_cqi_update[NFAPI_CC_MAX];
+ uint8_t pucch2_snr[NFAPI_CC_MAX];
+ uint8_t pucch3_cqi_update[NFAPI_CC_MAX];
+ uint8_t pucch3_snr[NFAPI_CC_MAX];
+ uint8_t pusch_snr[NFAPI_CC_MAX];
+ uint16_t feedback_cnt[NFAPI_CC_MAX];
+ uint16_t timing_advance;
+ uint16_t timing_advance_r9;
+ uint8_t periodic_wideband_cqi[NFAPI_CC_MAX];
+ uint8_t periodic_wideband_spatial_diffcqi[NFAPI_CC_MAX];
+ uint8_t periodic_wideband_pmi[NFAPI_CC_MAX];
+ uint8_t periodic_subband_cqi[NFAPI_CC_MAX][16];
+ uint8_t periodic_subband_spatial_diffcqi[NFAPI_CC_MAX][16];
+ uint8_t aperiodic_subband_cqi0[NFAPI_CC_MAX][25];
+ uint8_t aperiodic_subband_pmi[NFAPI_CC_MAX][25];
+ uint8_t aperiodic_subband_diffcqi0[NFAPI_CC_MAX][25];
+ uint8_t aperiodic_subband_cqi1[NFAPI_CC_MAX][25];
+ uint8_t aperiodic_subband_diffcqi1[NFAPI_CC_MAX][25];
+ uint8_t aperiodic_wideband_cqi0[NFAPI_CC_MAX];
+ uint8_t aperiodic_wideband_pmi[NFAPI_CC_MAX];
+ uint8_t aperiodic_wideband_cqi1[NFAPI_CC_MAX];
+ uint8_t aperiodic_wideband_pmi1[NFAPI_CC_MAX];
+ 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;
+ /// 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
+ 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
+ uint16_t RA_rnti;
+ /// Received preamble_index
+ 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;
+
+#ifdef Rel14
+ 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 subband bitmap confguration (for ALU icic algo purpose), in test phase */
+typedef struct {
+ uint8_t sbmap[NUMBER_OF_SUBBANDS_MAX]; //13 = number of SB MAX for 100 PRB
+ uint8_t periodicity;
+ uint8_t first_subframe;
+ uint8_t sb_size;
+ uint8_t nb_active_sb;
+} SBMAP_CONF;
+/*! \brief UE list used by eNB to order UEs/CC for scheduling*/
+typedef struct {
+ /// Dedicated information for UEs
+ struct PhysicalConfigDedicated *physicalConfigDedicated[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+ /// DLSCH pdu
+ DLSCH_PDU DLSCH_pdu[MAX_NUM_CCs][2][NUMBER_OF_UE_MAX];
+ /// DCI template and MAC connection parameters for UEs
+ UE_TEMPLATE UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+ /// DCI template and MAC connection for RA processes
+ int pCC_id[NUMBER_OF_UE_MAX];
+ /// sorted downlink component carrier for the scheduler
+ int ordered_CCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+ /// number of downlink active component carrier
+ int numactiveCCs[NUMBER_OF_UE_MAX];
+ /// sorted uplink component carrier for the scheduler
+ int ordered_ULCCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+ /// number of uplink active component carrier
+ int numactiveULCCs[NUMBER_OF_UE_MAX];
+ /// number of downlink active component carrier
+ uint8_t dl_CC_bitmap[NUMBER_OF_UE_MAX];
+ /// eNB to UE statistics
+ eNB_UE_STATS eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+ /// scheduling control info
+ UE_sched_ctrl UE_sched_ctrl[NUMBER_OF_UE_MAX];
+ int next[NUMBER_OF_UE_MAX];
+ int head;
+ int next_ul[NUMBER_OF_UE_MAX];
+ int head_ul;
+ int avail;
+ int num_UEs;
+ boolean_t active[NUMBER_OF_UE_MAX];
+} UE_list_t;
+
+/*! \brief eNB common channels */
+typedef struct {
+ int physCellId;
+ int p_eNB;
+ int Ncp;
+ int eutra_band;
+ uint32_t dl_CarrierFreq;
+ BCCH_BCH_Message_t *mib;
+ RadioResourceConfigCommonSIB_t *radioResourceConfigCommon;
+#ifdef Rel14
+ RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR;
+#endif
+ TDD_Config_t *tdd_Config;
+ SchedulingInfoList_t *schedulingInfoList;
+ ARFCN_ValueEUTRA_t ul_CarrierFreq;
+ long ul_Bandwidth;
+ /// Outgoing MIB PDU for PHY
+ MIB_PDU MIB_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;
+ /// Outgoing RAR pdu for PHY
+ RAR_PDU RAR_pdu;
+ /// Template for RA computations
+ RA_TEMPLATE RA_template[NB_RA_PROC_MAX];
+ /// VRB map for common channels
+ uint8_t vrb_map[100];
+ /// VRB map for common channels and retransmissions by PHICH
+ uint8_t vrb_map_UL[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 Rel14
+ /// Rel13 parameters from SIB1
+ SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext;
+ /// Counter for SIB1-BR scheduling
+ int SIB1_BR_cnt;
+ /// Outgoing BCCH-BR pdu for PHY
+ BCCH_PDU BCCH_BR_pdu[20];
+#endif
+} COMMON_channels_t;
+/*! \brief top level eNB MAC structure */
+typedef struct eNB_MAC_INST_s {
+ /// Ethernet parameters for northbound midhaul interface
+ eth_params_t eth_params_n;
+ /// Ethernet parameters for fronthaul interface
+ eth_params_t eth_params_s;
+ ///
+ 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_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 generation
+ 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
+} eNB_MAC_INST;
+
+/*
+ * UE part
+ */
+
+typedef enum {
+ TYPE0,
+ TYPE1,
+ TYPE1A,
+ TYPE2,
+ TYPE2A,
+ TYPEUESPEC
+} MPDCCH_TYPES_t;
+
+/*!\brief UE layer 2 status */
+typedef enum {
+ CONNECTION_OK=0,
+ CONNECTION_LOST,
+ PHY_RESYNCH,
+ PHY_HO_PRACH
+} UE_L2_STATE_t;
+
+/*!\brief UE scheduling info */
+typedef struct {
+ /// buffer status for each lcgid
+ uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology
+ /// keep the number of bytes in rlc buffer for each lcgid
+ int32_t BSR_bytes[MAX_NUM_LCGID];
+ /// after multiplexing buffer remain for each lcid
+ int32_t LCID_buffer_remain[MAX_NUM_LCID];
+ /// sum of all lcid buffer size
+ uint16_t All_lcid_buffer_size_lastTTI;
+ /// buffer status for each lcid
+ uint8_t LCID_status[MAX_NUM_LCID];
+ /// SR pending as defined in 36.321
+ uint8_t SR_pending;
+ /// SR_COUNTER as defined in 36.321
+ uint16_t SR_COUNTER;
+ /// logical channel group ide for each LCID
+ uint8_t LCGID[MAX_NUM_LCID];
+ /// retxBSR-Timer, default value is sf2560
+ uint16_t retxBSR_Timer;
+ /// retxBSR_SF, number of subframe before triggering a regular BSR
+ uint16_t retxBSR_SF;
+ /// periodicBSR-Timer, default to infinity
+ uint16_t periodicBSR_Timer;
+ /// periodicBSR_SF, number of subframe before triggering a periodic BSR
+ uint16_t periodicBSR_SF;
+ /// default value is 0: not configured
+ uint16_t sr_ProhibitTimer;
+ /// sr ProhibitTime running
+ uint8_t sr_ProhibitTimer_Running;
+ /// default value to n5
+ uint16_t maxHARQ_Tx;
+ /// default value is false
+ uint16_t ttiBundling;
+ /// default value is release
+ struct DRX_Config *drx_config;
+ /// default value is release
+ struct MAC_MainConfig__phr_Config *phr_config;
+ ///timer before triggering a periodic PHR
+ uint16_t periodicPHR_Timer;
+ ///timer before triggering a prohibit PHR
+ uint16_t prohibitPHR_Timer;
+ ///DL Pathloss change value
+ uint16_t PathlossChange;
+ ///number of subframe before triggering a periodic PHR
+ int16_t periodicPHR_SF;
+ ///number of subframe before triggering a prohibit PHR
+ int16_t prohibitPHR_SF;
+ ///DL Pathloss Change in db
+ uint16_t PathlossChange_db;
+
+ /// default value is false
+ uint16_t extendedBSR_Sizes_r10;
+ /// default value is false
+ uint16_t extendedPHR_r10;
+
+ //Bj bucket usage per lcid
+ int16_t Bj[MAX_NUM_LCID];
+ // Bucket size per lcid
+ int16_t bucket_size[MAX_NUM_LCID];
+} UE_SCHEDULING_INFO;
+/*!\brief Top level UE MAC structure */
+typedef struct {
+ uint16_t Node_id;
+ /// RX frame counter
+ frame_t rxFrame;
+ /// RX subframe counter
+ sub_frame_t rxSubframe;
+ /// TX frame counter
+ frame_t txFrame;
+ /// TX subframe counter
+ sub_frame_t txSubframe;
+ /// C-RNTI of UE
+ uint16_t crnti;
+ /// C-RNTI of UE before HO
+ rnti_t crnti_before_ho; ///user id (rnti) of connected UEs
+ /// uplink active flag
+ uint8_t ul_active;
+ /// pointer to RRC PHY configuration
+ RadioResourceConfigCommonSIB_t *radioResourceConfigCommon;
+ /// pointer to RACH_ConfigDedicated (NULL when not active, i.e. upon HO completion or T304 expiry)
+ struct RACH_ConfigDedicated *rach_ConfigDedicated;
+ /// pointer to RRC PHY configuration
+ struct PhysicalConfigDedicated *physicalConfigDedicated;
+#if defined(Rel10) || defined(Rel14)
+ /// pointer to RRC PHY configuration SCEll
+ struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10;
+#endif
+ /// pointer to TDD Configuration (NULL for FDD)
+ TDD_Config_t *tdd_Config;
+ /// Number of adjacent cells to measure
+ uint8_t n_adj_cells;
+ /// Array of adjacent physical cell ids
+ uint32_t adj_cell_id[6];
+ /// Pointer to RRC MAC configuration
+ MAC_MainConfig_t *macConfig;
+ /// Pointer to RRC Measurement gap configuration
+ MeasGapConfig_t *measGapConfig;
+ /// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive.
+ LogicalChannelConfig_t *logicalChannelConfig[MAX_NUM_LCID];
+ /// Scheduling Information
+ UE_SCHEDULING_INFO scheduling_info;
+ /// Outgoing CCCH pdu for PHY
+ CCCH_PDU CCCH_pdu;
+ /// Outgoing RAR pdu for PHY
+ RAR_PDU RAR_pdu;
+ /// Incoming DLSCH pdu for PHY
+ DLSCH_PDU DLSCH_pdu[NUMBER_OF_UE_MAX][2];
+ /// number of attempt for rach
+ uint8_t RA_attempt_number;
+ /// Random-access procedure flag
+ uint8_t RA_active;
+ /// Random-access window counter
+ int8_t RA_window_cnt;
+ /// Random-access Msg3 size in bytes
+ uint8_t RA_Msg3_size;
+ /// Random-access prachMaskIndex
+ uint8_t RA_prachMaskIndex;
+ /// Flag indicating Preamble set (A,B) used for first Msg3 transmission
+ uint8_t RA_usedGroupA;
+ /// Random-access Resources
+ PRACH_RESOURCES_t RA_prach_resources;
+ /// Random-access PREAMBLE_TRANSMISSION_COUNTER
+ uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER;
+ /// Random-access backoff counter
+ int16_t RA_backoff_cnt;
+ /// Random-access variable for window calculation (frame of last change in window counter)
+ uint32_t RA_tx_frame;
+ /// Random-access variable for window calculation (subframe of last change in window counter)
+ uint8_t RA_tx_subframe;
+ /// Random-access Group B maximum path-loss
+ /// Random-access variable for backoff (frame of last change in backoff counter)
+ uint32_t RA_backoff_frame;
+ /// Random-access variable for backoff (subframe of last change in backoff counter)
+ uint8_t RA_backoff_subframe;
+ /// Random-access Group B maximum path-loss
+ uint16_t RA_maxPL;
+ /// Random-access Contention Resolution Timer active flag
+ uint8_t RA_contention_resolution_timer_active;
+ /// Random-access Contention Resolution Timer count value
+ uint8_t RA_contention_resolution_cnt;
+ /// power headroom reporitng reconfigured
+ uint8_t PHR_reconfigured;
+ /// power headroom state as configured by the higher layers
+ uint8_t PHR_state;
+ /// power backoff due to power management (as allowed by P-MPRc) for this cell
+ uint8_t PHR_reporting_active;
+ /// power backoff due to power management (as allowed by P-MPRc) for this cell
+ uint8_t power_backoff_db[NUMBER_OF_eNB_MAX];
+ /// BSR report falg management
+ uint8_t BSR_reporting_active;
+ /// retxBSR-Timer expires flag
+ uint8_t retxBSRTimer_expires_flag;
+ /// periodBSR-Timer expires flag
+ uint8_t periodBSRTimer_expires_flag;
+
+ /// MBSFN_Subframe Configuration
+ struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA?
+ /// number of subframe allocation pattern available for MBSFN sync area
+ uint8_t num_sf_allocation_pattern;
+#if defined(Rel10) || defined(Rel14)
+ /// 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];
+ /// MCCH status
+ uint8_t mcch_status;
+ /// MSI status
+ uint8_t msi_status;// could be an array if there are >1 MCH in one MBSFN area
+#endif
+ //#ifdef CBA
+ /// CBA RNTI for each group
+ uint16_t cba_rnti[NUM_MAX_CBA_GROUP];
+ /// last SFN for CBA channel access
+ uint8_t cba_last_access[NUM_MAX_CBA_GROUP];
+ //#endif
+ /// total UE scheduler processing time
+ time_stats_t ue_scheduler; // total
+ /// UE ULSCH tx processing time inlcuding RLC interface (rlc_data_req) and mac header generation
+ time_stats_t tx_ulsch_sdu;
+ /// UE DLSCH rx processing time inlcuding RLC interface (mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind) and mac header parser
+ time_stats_t rx_dlsch_sdu ;
+ /// UE query for MCH subframe processing time
+ time_stats_t ue_query_mch;
+ /// UE MCH rx processing time
+ time_stats_t rx_mch_sdu;
+ /// UE BCCH rx processing time including RLC interface (mac_rrc_data_ind)
+ time_stats_t rx_si;
+ /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind)
+ time_stats_t rx_p;
+} UE_MAC_INST;
+/*! \brief ID of the neighboring cells used for HO*/
+typedef struct {
+ uint16_t cell_ids[6];
+ uint8_t n_adj_cells;
+} neigh_cell_id_t;
+
+#include "proto.h"
+/*@}*/
+#endif /*__LAYER2_MAC_DEFS_H__ */
+
+
+
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index 8648fa5771..4ebe7313e8 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -443,6 +443,7 @@ clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP,
DL_req[CC_idP].dl_config_request_body.number_pdu = 0;
DL_req[CC_idP].dl_config_request_body.number_pdsch_rnti = 0;
DL_req[CC_idP].dl_config_request_body.transmission_power_pcfich = 6000;
+ DL_req[CC_idP].sfn_sf = subframeP + (frameP<<4);
HI_DCI0_req->hi_dci0_request_body.sfnsf = subframeP + (frameP<<4);
HI_DCI0_req->hi_dci0_request_body.number_of_dci = 0;
@@ -657,7 +658,6 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
}
// This schedules MIB
-
if ((subframeP == 0) && (frameP & 3) == 0)
schedule_mib(module_idP, frameP, subframeP);
if (get_softmodem_params()->phy_test == 0){
@@ -681,6 +681,10 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
schedule_SR(module_idP, frameP, subframeP);
// This schedules UCI_CSI in subframeP
schedule_CSI(module_idP, frameP, subframeP);
+#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ // This schedules DLSCH in subframeP
+ schedule_ue_spec_br(module_idP,frameP,subframeP);
+#endif
// This schedules DLSCH in subframeP
if (schedule_ue_spec_p != NULL) {
schedule_ue_spec_p(module_idP, frameP, subframeP, mbsfn_status);
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index 9ed785d0ff..ff4b1e6517 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -121,53 +121,40 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP,
ra->rnti);
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- if (ra->rach_resource_type > 0) {
- LOG_D(MAC,
- "[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d CE level %d is active, Msg3 in (%d,%d)\n",
- module_idP, frameP, subframeP, CC_id,
- ra->rach_resource_type - 1, ra->Msg3_frame,
- ra->Msg3_subframe);
- LOG_D(MAC,
- "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d)\n",
- frameP, subframeP, ra->Msg3_frame, ra->Msg3_subframe,
- ra->msg3_nb_rb, ra->msg3_round);
+ if (ra->rach_resource_type > 0) {
+ LOG_I (MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d CE level %d is active, Msg3 in (%d,%d)\n",
+ module_idP, frameP, subframeP, CC_id, ra->rach_resource_type - 1, ra->Msg3_frame, ra->Msg3_subframe);
+ LOG_I (MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d)\n",
+ frameP, subframeP, ra->Msg3_frame, ra->Msg3_subframe, ra->msg3_nb_rb, ra->msg3_round);
- ul_config_pdu =
- &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
+ ul_config_pdu = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
- memset((void *) ul_config_pdu, 0,
- sizeof(nfapi_ul_config_request_pdu_t));
- ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
- ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_ul_config_ulsch_pdu));
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.handle = mac->ul_handle++;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti = ra->rnti;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.resource_block_start = narrowband_to_first_rb(cc,
- ra->msg34_narrowband) + ra->msg3_first_rb;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks = ra->msg3_nb_rb;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 2;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms = 0;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag = 0;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits = 0;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.new_data_indication = 0;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.redundancy_version = rvseq[ra->msg3_round];
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.harq_process_number = ((10 * ra->Msg3_frame) + ra->Msg3_subframe) & 7;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode = 0;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb = 0;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs = 1;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size = get_TBS_UL(ra->msg3_mcs, ra->msg3_nb_rb);
- // Re13 fields
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type = ra->rach_resource_type > 2 ? 2 : 1;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions = 1;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number = 1;
- ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = (ra->Msg3_frame * 10) + ra->Msg3_subframe;
- ul_req_body->number_of_pdus++;
- ul_req_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
- ul_req->sfn_sf = ra->Msg3_frame<<4|ra->Msg3_subframe;
- ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
- } // if (ra->rach_resource_type>0) {
- else
+ memset ((void *) ul_config_pdu, 0, sizeof (nfapi_ul_config_request_pdu_t));
+ ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_ULSCH_PDU_TYPE;
+ ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_ul_config_ulsch_pdu));
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.handle = mac->ul_handle++;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti = ra->rnti;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.resource_block_start = narrowband_to_first_rb (cc, ra->msg34_narrowband) + ra->msg3_first_rb;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.number_of_resource_blocks = ra->msg3_nb_rb;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.modulation_type = 2;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.cyclic_shift_2_for_drms = 0;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_enabled_flag = 0;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.frequency_hopping_bits = 0;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.new_data_indication = 0;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.redundancy_version = rvseq[ra->msg3_round];
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.harq_process_number = 0;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode = 0;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb = 0;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs = 1;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size = get_TBS_UL (ra->msg3_mcs, ra->msg3_nb_rb);
+ // Re13 fields
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type = ra->rach_resource_type > 2 ? 2 : 1;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions = 1;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number = 1;
+ ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = (ra->Msg3_frame * 10) + ra->Msg3_subframe;
+ ul_req_body->number_of_pdus++;
+ } // if (ra->rach_resource_type>0) {
+ else
#endif
{
LOG_D(MAC,
@@ -257,247 +244,224 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
sub_frame_t subframeP, RA_t * ra)
{
- eNB_MAC_INST *mac = RC.mac[module_idP];
- COMMON_channels_t *cc = mac->common_channels;
-
- uint8_t *vrb_map;
- int first_rb;
- int N_RB_DL;
- nfapi_dl_config_request_pdu_t *dl_config_pdu;
- nfapi_tx_request_pdu_t *TX_req;
- nfapi_dl_config_request_body_t *dl_req;
-
- vrb_map = cc[CC_idP].vrb_map;
- dl_req = &mac->DL_req[CC_idP].dl_config_request_body;
- dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
- N_RB_DL = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
+ eNB_MAC_INST *mac = RC.mac[module_idP];
+ COMMON_channels_t *cc = mac->common_channels;
+
+ uint8_t *vrb_map;
+ int first_rb;
+ int N_RB_DL;
+ nfapi_dl_config_request_pdu_t *dl_config_pdu;
+ nfapi_tx_request_pdu_t *TX_req;
+ nfapi_dl_config_request_body_t *dl_req_body;
+
+ vrb_map = cc[CC_idP].vrb_map;
+ dl_req_body = &mac->DL_req[CC_idP].dl_config_request_body;
+ dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
+ N_RB_DL = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- int rmax = 0;
- int rep = 0;
- int reps = 0;
- int num_nb = 0;
+ int rmax = 0;
+ int rep = 0;
+ int reps = 0;
+ int num_nb = 0;
- first_rb = 0;
- struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach;
- LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
- LTE_PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL };
+ first_rb = 0;
+ struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach;
+ LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
+ LTE_PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL };
- uint16_t absSF = (10 * frameP) + subframeP;
- uint16_t absSF_Msg2 = (10 * ra->Msg2_frame) + ra->Msg2_subframe;
+ uint16_t absSF = (10 * frameP) + subframeP;
+ uint16_t absSF_Msg2 = (10 * ra->Msg2_frame) + ra->Msg2_subframe;
- LOG_D(MAC,"absSF:%d absSF_Msg2:%d ra->rach_resource_type:%d\n",absSF,absSF_Msg2,ra->rach_resource_type);
+ if (absSF > absSF_Msg2)
+ return; // we're not ready yet, need to be to start ==
- if (absSF < absSF_Msg2)
- return; // we're not ready yet, need to be to start ==
+ if (cc[CC_idP].mib->message.schedulingInfoSIB1_BR_r13 > 0 &&
+ cc[CC_idP].radioResourceConfigCommon_BR) {
- if (cc[CC_idP].radioResourceConfigCommon_BR) {
+ ext4_prach = cc[CC_idP].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+ prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
- ext4_prach = cc[CC_idP].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
- prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+ switch (prach_ParametersListCE_r13->list.count) {
+ case 4:
+ p[3] = prach_ParametersListCE_r13->list.array[3];
+ case 3:
+ p[2] = prach_ParametersListCE_r13->list.array[2];
+ case 2:
+ p[1] = prach_ParametersListCE_r13->list.array[1];
+ case 1:
+ p[0] = prach_ParametersListCE_r13->list.array[0];
+ break;
+ default:
+ AssertFatal (1 == 0, "Illegal count for prach_ParametersListCE_r13 %d\n", (int) prach_ParametersListCE_r13->list.count);
+ break;
- switch (prach_ParametersListCE_r13->list.count) {
- case 4:
- p[3] = prach_ParametersListCE_r13->list.array[3];
- case 3:
- p[2] = prach_ParametersListCE_r13->list.array[2];
- case 2:
- p[1] = prach_ParametersListCE_r13->list.array[1];
- case 1:
- p[0] = prach_ParametersListCE_r13->list.array[0];
- break;
- default:
- AssertFatal(1 == 0,
- "Illegal count for prach_ParametersListCE_r13 %d\n",
- (int) prach_ParametersListCE_r13->list.count);
- break;
- }
+ }
+ }
+
+ if (ra->rach_resource_type > 0) {
+
+ // This uses an MPDCCH Type 2 common allocation according to Section 9.1.5 36-213
+ // Parameters:
+ // p=2+4 PRB set (number of PRB pairs 3)
+ // rmax = mpdcch-NumRepetition-RA-r13 => Table 9.1.5-3
+ // if CELevel = 0,1 => Table 9.1.5-1b for MPDCCH candidates
+ // if CELevel = 2,3 => Table 9.1.5-2b for MPDCCH candidates
+ // distributed transmission
+
+ // rmax from SIB2 information
+ AssertFatal (rmax < 9, "rmax>8!\n");
+ rmax = 1 << p[ra->rach_resource_type - 1]->mpdcch_NumRepetition_RA_r13;
+ // choose r1 by default for RAR (Table 9.1.5-5)
+ rep = 0;
+ // get actual repetition count from Table 9.1.5-3
+ reps = (rmax <= 8) ? (1 << rep) : (rmax >> (3 - rep));
+ // get narrowband according to higher-layer config
+ num_nb = p[ra->rach_resource_type - 1]->mpdcch_NarrowbandsToMonitor_r13.list.count;
+ ra->msg2_narrowband = *p[ra->rach_resource_type - 1]->mpdcch_NarrowbandsToMonitor_r13.list.array[ra->preamble_index % num_nb]-1;
+ first_rb = narrowband_to_first_rb (&cc[CC_idP], ra->msg2_narrowband);
+
+ if ((ra->msg2_mpdcch_repetition_cnt == 0) && (mpdcch_sf_condition (mac, CC_idP, frameP, subframeP, rmax, TYPE2, -1) > 0)) {
+ ra->msg2_mpdcch_done = 0;
+ // MPDCCH configuration for RAR
+ LOG_I (MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2 for CE Level %d, Programming MPDCCH %d repetitions\n", module_idP, frameP, subframeP, ra->rach_resource_type-1,reps);
+
+
+ memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (ra->rach_resource_type > 1) ? 11 : 10;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = ra->msg2_narrowband;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space
+ AssertFatal (cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL, "cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 2; // RA-RNTI
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = ra->RA_rnti;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (ra->rach_resource_type < 3) ? 1 : 2;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_idP].physCellId;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV (6, 0, 6) | (ra->msg2_narrowband<<5);
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 0; // adjust according to size of RAR, 208 bits with N1A_PRB=3
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 0; // fix to 4 for now
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rep;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 1; // N1A_PRB=3 (36.212) => 56 bits
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0; // this is not needed by OAI L1, but should be filled in
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1;
+ ra->msg2_mpdcch_repetition_cnt++;
+ dl_req_body->number_pdu++;
+ ra->Msg2_subframe = (ra->Msg2_subframe + 9) % 10;
+
+ } //repetition_count==0 && SF condition met
+ if (ra->msg2_mpdcch_repetition_cnt > 0) { // we're in a stream of repetitions
+
+
+ if ((ra->msg2_mpdcch_repetition_cnt == reps)&&
+ (ra->msg2_mpdcch_done == 0)){ // this is the last mpdcch repetition
+ ra->msg2_mpdcch_done = 1;
+ if (cc[CC_idP].tdd_Config == NULL) { // FDD case
+ // wait 2 subframes for PDSCH transmission
+ if (subframeP > 7)
+ ra->Msg2_frame = (frameP + 1) & 1023;
+ else
+ ra->Msg2_frame = frameP;
+ ra->Msg2_subframe = (subframeP + 2) % 10; // +2 is the "n+x" from Section 7.1.11 in 36.213
+ LOG_I(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, programmed Msg2 for %d.%d\n", module_idP, frameP, subframeP, ra->Msg2_frame,ra->Msg2_subframe);
+ } else {
+ AssertFatal (1 == 0, "TDD case not done yet\n");
+ }
+ } // mpdcch_repetition_count == reps
+ else if (ra->msg2_mpdcch_done == 0) {
+ LOG_I (MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, MPDCCH repetition %d\n", module_idP, frameP, subframeP, ra->msg2_mpdcch_repetition_cnt);
+ ra->msg2_mpdcch_repetition_cnt++;
+ }
+
+
+ if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) {
+ // Program PDSCH
+ LOG_I (MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming PDSCH\n", module_idP, frameP, subframeP);
+
+ dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
+ memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_dlsch_pdu));
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = mac->pdu_index[CC_idP];
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = ra->RA_rnti;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV (N_RB_DL, first_rb, 6);
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc[CC_idP].p_eNB == 1) ? 0 : 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize (cc[CC_idP].mib->message.dl_Bandwidth); // ignored
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc[CC_idP].p_eNB == 1) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+
+ // Rel10 fields
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+ // Rel13 fields
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
+ dl_req_body->number_pdu++;
+
+ fill_rar_br (mac, CC_idP, ra, frameP, subframeP, cc[CC_idP].RAR_pdu.payload, ra->rach_resource_type - 1) ;
+// Program UL processing for Msg3, same as regular LTE
+ get_Msg3alloc (&cc[CC_idP], subframeP, frameP, &ra->Msg3_frame, &ra->Msg3_subframe);
+ add_msg3 (module_idP, CC_idP, ra, frameP, subframeP);
+ ra->state = WAITMSG3;
+ // DL request
+ LOG_I (MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming TX Req\n", module_idP, frameP, subframeP);
+ mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP;
+ TX_req = &mac->TX_req[CC_idP].tx_request_body.tx_pdu_list[mac->TX_req[CC_idP].tx_request_body.number_of_pdus];
+ TX_req->pdu_length = 7; // This should be changed if we have more than 1 preamble
+ TX_req->pdu_index = mac->pdu_index[CC_idP]++;
+ TX_req->num_segments = 1;
+ TX_req->segments[0].segment_length = 7;
+ TX_req->segments[0].segment_data = cc[CC_idP].RAR_pdu.payload;
+ mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
+ }
}
- if (ra->rach_resource_type > 0) {
+ } else
- // This uses an MPDCCH Type 2 common allocation according to Section 9.1.5 36-213
- // Parameters:
- // p=2+4 PRB set (number of PRB pairs 3)
- // rmax = mpdcch-NumRepetition-RA-r13 => Table 9.1.5-3
- // if CELevel = 0,1 => Table 9.1.5-1b for MPDCCH candidates
- // if CELevel = 2,3 => Table 9.1.5-2b for MPDCCH candidates
- // distributed transmission
-
- // rmax from SIB2 information
- AssertFatal(rmax < 9, "rmax>8!\n");
- rmax = 1 << p[ra->rach_resource_type-1]->mpdcch_NumRepetition_RA_r13;
- // choose r1 by default for RAR (Table 9.1.5-5)
- rep = 0;
- // get actual repetition count from Table 9.1.5-3
- reps = (rmax <= 8) ? (1 << rep) : (rmax >> (3 - rep));
- // get narrowband according to higher-layer config
- num_nb = p[ra->rach_resource_type-1]->mpdcch_NarrowbandsToMonitor_r13.list.count;
- ra->msg2_narrowband = *p[ra->rach_resource_type - 1]->mpdcch_NarrowbandsToMonitor_r13.list.array[ra->preamble_index % num_nb];
- first_rb = narrowband_to_first_rb(&cc[CC_idP], ra->msg2_narrowband);
-
- if ((ra->msg2_mpdcch_repetition_cnt == 0) &&
- (mpdcch_sf_condition(mac, CC_idP, frameP, subframeP, rmax, TYPE2, -1) > 0)) {
- // MPDCCH configuration for RAR
- LOG_D(MAC,
- "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming MPDCCH %d repetitions\n",
- module_idP, frameP, subframeP, reps);
-
-
- memset((void *) dl_config_pdu, 0,sizeof(nfapi_dl_config_request_pdu_t));
- dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
- dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_mpdcch_pdu));
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (ra->rach_resource_type > 1) ? 11 : 10;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = ra->msg2_narrowband;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space
- AssertFatal(cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13!= NULL,
- "cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 16; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 2; // RA-RNTI
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = ra->RA_rnti;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (ra->rach_resource_type < 3) ? 1 : 2;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_idP].physCellId;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV(6, 0, 6); // Note: still to be checked if it should not be (getRIV(N_RB_DL,first_rb,6)) : Check nFAPI specifications and what is done L1 with this parameter
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 4; // fix to 4 for now
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rep;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 1; // N1A_PRB=3 (36.212); => 208 bits for mcs=4, choose mcs according t message size TBD
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0; // this is not needed by OAI L1, but should be filled in
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1;
- ra->msg2_mpdcch_repetition_cnt++;
- dl_req->number_pdu++;
- dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
- ra->Msg2_subframe = (ra->Msg2_subframe + 9) % 10;
-
- mac->DL_req[CC_idP].sfn_sf = sfnsf_add_subframe(ra->Msg2_frame, ra->Msg2_subframe, 4); // nFAPI is runnning at TX SFN/SF - ie 4 ahead
- mac->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
- } //repetition_count==0 && SF condition met
- if (ra->msg2_mpdcch_repetition_cnt > 0) { // we're in a stream of repetitions
- LOG_D(MAC,
- "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, MPDCCH repetition %d\n",
- module_idP, frameP, subframeP,
- ra->msg2_mpdcch_repetition_cnt);
-
- if (ra->msg2_mpdcch_repetition_cnt == reps) { // this is the last mpdcch repetition
- if (cc[CC_idP].tdd_Config == NULL) { // FDD case
- // wait 2 subframes for PDSCH transmission
- if (subframeP > 7)
- ra->Msg2_frame = (frameP + 1) & 1023;
- else
- ra->Msg2_frame = frameP;
- ra->Msg2_subframe = (subframeP + 2) % 10; // +2 is the "n+x" from Section 7.1.11 in 36.213
- } else {
- AssertFatal(1 == 0, "TDD case not done yet\n");
- }
- } // mpdcch_repetition_count == reps
- ra->msg2_mpdcch_repetition_cnt++;
-
- if ((ra->Msg2_frame == frameP)
- && (ra->Msg2_subframe == subframeP)) {
- // Program PDSCH
- LOG_D(MAC,
- "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming PDSCH\n",
- module_idP, frameP, subframeP);
- ra->state = WAITMSG3;
- LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG3\n", module_idP, frameP, subframeP);
-
- dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
- memset((void *) dl_config_pdu, 0,sizeof(nfapi_dl_config_request_pdu_t));
- dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
- dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = mac->pdu_index[CC_idP];
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = ra->RA_rnti;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6);
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
-
- // Rel10 fields
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
- // Rel13 fields
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
- dl_req->number_pdu++;
-
- mac->DL_req[CC_idP].sfn_sf = (frameP<<4)+subframeP;
- mac->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
-
- LOG_D(MAC,"DL_CONFIG SFN/SF:%d/%d MESSAGE2\n", frameP, subframeP);
-
- // Program UL processing for Msg3, same as regular LTE
- get_Msg3alloc(&cc[CC_idP], subframeP, frameP,
- &ra->Msg3_frame, &ra->Msg3_subframe);
- add_msg3(module_idP, CC_idP, ra, frameP, subframeP);
- fill_rar_br(mac, CC_idP, ra, frameP, subframeP,
- cc[CC_idP].RAR_pdu.payload,
- ra->rach_resource_type - 1);
- // DL request
- mac->TX_req[CC_idP].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
- mac->TX_req[CC_idP].header.message_id = NFAPI_TX_REQUEST;
- mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP;
- TX_req =
- &mac->TX_req[CC_idP].tx_request_body.tx_pdu_list[mac->TX_req[CC_idP].tx_request_body.number_of_pdus];
- TX_req->pdu_length = 7; // This should be changed if we have more than 1 preamble
- TX_req->pdu_index = mac->pdu_index[CC_idP]++;
- TX_req->num_segments = 1;
- TX_req->segments[0].segment_length = 7;
- TX_req->segments[0].segment_data = cc[CC_idP].RAR_pdu.payload;
- mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
- if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
- set_dl_ue_select_msg2(CC_idP, 4, -1, ra->rnti);
- }
- }
- }
-
- } else
#endif
{
@@ -538,10 +502,10 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
LOG_D(MAC,
"Frame %d: Subframe %d : Adding common DCI for RA_RNTI %x\n",
frameP, subframeP, ra->RA_rnti);
- dl_req->number_dci++;
- dl_req->number_pdu++;
+ dl_req_body->number_dci++;
+ dl_req_body->number_pdu++;
- dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+ dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
@@ -568,7 +532,7 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
- dl_req->number_pdu++;
+ dl_req_body->number_pdu++;
mac->DL_req[CC_idP].sfn_sf = frameP<<4 | subframeP;
// Program UL processing for Msg3
@@ -612,15 +576,15 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
sub_frame_t subframeP, RA_t * ra)
{
-
- eNB_MAC_INST *mac = RC.mac[module_idP];
- COMMON_channels_t *cc = mac->common_channels;
- int16_t rrc_sdu_length;
- int UE_id = -1;
- uint16_t msg4_padding;
- uint16_t msg4_post_padding;
- uint16_t msg4_header;
-
+
+ eNB_MAC_INST *mac = RC.mac[module_idP];
+ COMMON_channels_t *cc = mac->common_channels;
+ int16_t rrc_sdu_length;
+ int UE_id = -1;
+ uint16_t msg4_padding;
+ uint16_t msg4_post_padding;
+ uint16_t msg4_header;
+
uint8_t *vrb_map;
int first_rb;
int N_RB_DL;
@@ -631,72 +595,70 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
nfapi_dl_config_request_t *dl_req;
nfapi_dl_config_request_body_t *dl_req_body;
nfapi_ul_config_request_body_t *ul_req_body;
- nfapi_ul_config_request_t *ul_req;
uint8_t lcid;
uint8_t offset;
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- int rmax = 0;
- int rep = 0;
- int reps = 0;
+ int rmax = 0;
+ int rep = 0;
+ int reps = 0;
- first_rb = 0;
- struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach;
- struct LTE_PUCCH_ConfigCommon_v1310 *ext4_pucch;
- LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
- struct LTE_N1PUCCH_AN_InfoList_r13 *pucch_N1PUCCH_AN_InfoList_r13;
- LTE_PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL };
- int pucchreps[4] = { 1, 1, 1, 1 };
- int n1pucchan[4] = { 0, 0, 0, 0 };
+ first_rb = 0;
+ struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach;
+ struct LTE_PUCCH_ConfigCommon_v1310 *ext4_pucch;
+ LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
+ struct LTE_N1PUCCH_AN_InfoList_r13 *pucch_N1PUCCH_AN_InfoList_r13;
+ LTE_PRACH_ParametersCE_r13_t *p[4] = { NULL, NULL, NULL, NULL };
+ int pucchreps[4] = { 1, 1, 1, 1 };
+ int n1pucchan[4] = { 0, 0, 0, 0 };
- if (cc[CC_idP].radioResourceConfigCommon_BR) {
+ if (cc[CC_idP].mib->message.schedulingInfoSIB1_BR_r13 > 0 &&
+ cc[CC_idP].radioResourceConfigCommon_BR) {
- ext4_prach = cc[CC_idP].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
- ext4_pucch = cc[CC_idP].radioResourceConfigCommon_BR->ext4->pucch_ConfigCommon_v1310;
- prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
- pucch_N1PUCCH_AN_InfoList_r13 = ext4_pucch->n1PUCCH_AN_InfoList_r13;
- AssertFatal(prach_ParametersListCE_r13 != NULL,"prach_ParametersListCE_r13 is null\n");
- AssertFatal(pucch_N1PUCCH_AN_InfoList_r13 != NULL,"pucch_N1PUCCH_AN_InfoList_r13 is null\n");
- // check to verify CE-Level compatibility in SIB2_BR
- AssertFatal(prach_ParametersListCE_r13->list.count == pucch_N1PUCCH_AN_InfoList_r13->list.count,
- "prach_ParametersListCE_r13->list.count!= pucch_N1PUCCH_AN_InfoList_r13->list.count\n");
+ ext4_prach = cc[CC_idP].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+ ext4_pucch = cc[CC_idP].radioResourceConfigCommon_BR->ext4->pucch_ConfigCommon_v1310;
+ prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+ pucch_N1PUCCH_AN_InfoList_r13 = ext4_pucch->n1PUCCH_AN_InfoList_r13;
+ AssertFatal (prach_ParametersListCE_r13 != NULL, "prach_ParametersListCE_r13 is null\n");
+ AssertFatal (pucch_N1PUCCH_AN_InfoList_r13 != NULL, "pucch_N1PUCCH_AN_InfoList_r13 is null\n");
+ // check to verify CE-Level compatibility in SIB2_BR
+ AssertFatal (prach_ParametersListCE_r13->list.count == pucch_N1PUCCH_AN_InfoList_r13->list.count, "prach_ParametersListCE_r13->list.count!= pucch_N1PUCCH_AN_InfoList_r13->list.count\n");
- switch (prach_ParametersListCE_r13->list.count) {
- case 4:
- p[3] = prach_ParametersListCE_r13->list.array[3];
- n1pucchan[3] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[3];
- AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13 != NULL,
- "pucch_NumRepetitionCE_Msg4_Level3 shouldn't be NULL\n");
- pucchreps[3] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13);
+ switch (prach_ParametersListCE_r13->list.count) {
+ case 4:
+ p[3] = prach_ParametersListCE_r13->list.array[3];
+ n1pucchan[3] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[3];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level3 shouldn't be NULL\n");
+ pucchreps[3] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13);
+
+ case 3:
+ p[2] = prach_ParametersListCE_r13->list.array[2];
+ n1pucchan[2] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[2];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level2 shouldn't be NULL\n");
+ pucchreps[2] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13);
+ case 2:
+ p[1] = prach_ParametersListCE_r13->list.array[1];
+ n1pucchan[1] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[1];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level1 shouldn't be NULL\n");
+ pucchreps[1] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13);
+ case 1:
+ p[0] = prach_ParametersListCE_r13->list.array[0];
+ n1pucchan[0] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[0];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level0 shouldn't be NULL\n");
+ pucchreps[0] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13);
+ break;
+ default:
+ AssertFatal (1 == 0, "Illegal count for prach_ParametersListCE_r13 %d\n", prach_ParametersListCE_r13->list.count);
- case 3:
- p[2] = prach_ParametersListCE_r13->list.array[2];
- n1pucchan[2] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[2];
- AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13!= NULL,
- "pucch_NumRepetitionCE_Msg4_Level2 shouldn't be NULL\n");
- pucchreps[2] =(int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13);
- case 2:
- p[1] = prach_ParametersListCE_r13->list.array[1];
- n1pucchan[1] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[1];
- AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13 != NULL,
- "pucch_NumRepetitionCE_Msg4_Level1 shouldn't be NULL\n");
- pucchreps[1] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13);
- case 1:
- p[0] = prach_ParametersListCE_r13->list.array[0];
- n1pucchan[0] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[0];
- AssertFatal(ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13 != NULL,
- "pucch_NumRepetitionCE_Msg4_Level0 shouldn't be NULL\n");
- pucchreps[0] =(int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13);
- default:
- AssertFatal(1 == 0,
- "Illegal count for prach_ParametersListCE_r13 %d\n",
- prach_ParametersListCE_r13->list.count);
- }
}
+ }
+
#endif
+
vrb_map = cc[CC_idP].vrb_map;
dl_req = &mac->DL_req[CC_idP];
@@ -705,7 +667,11 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
N_RB_DL = to_prb(cc[CC_idP].mib->message.dl_Bandwidth);
UE_id = find_UE_id(module_idP, ra->rnti);
- AssertFatal(UE_id >= 0, "Can't find UE for t-crnti\n");
+ if (UE_id < 0) {
+ LOG_E(MAC,"Can't find UE for t-crnti %x, kill RA procedure for this UE\n",ra->rnti);
+ cancel_ra_proc(module_idP, CC_idP, frameP, ra->rnti);
+ return;
+ }
// set HARQ process round to 0 for this UE
@@ -728,289 +694,240 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- if (ra->rach_resource_type > 0) {
+ if (ra->rach_resource_type > 0) {
- // Generate DCI + repetitions first
- // This uses an MPDCCH Type 2 allocation according to Section 9.1.5 36-213, Type2 common allocation according to Table 7.1-8 (36-213)
- // Parameters:
- // p=2+4 PRB set (number of PRB pairs 6)
- // rmax = mpdcch-NumRepetition-RA-r13 => Table 9.1.5-3
- // if CELevel = 0,1 => Table 9.1.5-1b for MPDCCH candidates
- // if CELevel = 2,3 => Table 9.1.5-2b for MPDCCH candidates
- // distributed transmission
+ ra->harq_pid = 0;
+ // Generate DCI + repetitions first
+ // This uses an MPDCCH Type 2 allocation according to Section 9.1.5 36-213, Type2 common allocation according to Table 7.1-8 (36-213)
+ // Parameters:
+ // p=2+4 PRB set (number of PRB pairs 6)
+ // rmax = mpdcch-NumRepetition-RA-r13 => Table 9.1.5-3
+ // if CELevel = 0,1 => Table 9.1.5-1b for MPDCCH candidates
+ // if CELevel = 2,3 => Table 9.1.5-2b for MPDCCH candidates
+ // distributed transmission
- // rmax from SIB2 information
- rmax = p[ra->rach_resource_type - 1]->mpdcch_NumRepetition_RA_r13;
- AssertFatal(rmax >= 4,
- "choose rmax>=4 for enough repeititions, or reduce rep to 1 or 2\n");
+ // rmax from SIB2 information
+ rmax = 1<rach_resource_type - 1]->mpdcch_NumRepetition_RA_r13;
+
- // choose r3 by default for Msg4 (this is ok from table 9.1.5-3 for rmax = >=4, if we choose rmax <4 it has to be less
- rep = 2;
- // get actual repetition count from Table 9.1.5-3
- reps = (rmax <= 8) ? (1 << rep) : (rmax >> (3 - rep));
- // get first narrowband
- first_rb =
- narrowband_to_first_rb(&cc[CC_idP], ra->msg34_narrowband);
+ // choose r3 by default for Msg4 (this is ok from table 9.1.5-3 for rmax = >=4, if we choose rmax <4 it has to be less
+ rep = 0;
+ // get actual repetition count from Table 9.1.5-3
+ reps = (rmax <= 8) ? (1 << rep) : (rmax >> (3 - rep));
+ // get first narrowband
+ first_rb = narrowband_to_first_rb (&cc[CC_idP], ra->msg34_narrowband);
- if ((ra->msg4_mpdcch_repetition_cnt == 0) &&
- (mpdcch_sf_condition
- (mac, CC_idP, frameP, subframeP, rmax, TYPE2, -1) > 0)) {
- // MPDCCH configuration for RAR
+ if ((ra->msg4_mpdcch_repetition_cnt == 0) && (mpdcch_sf_condition (mac, CC_idP, frameP, subframeP, rmax, TYPE2, -1) > 0)) {
+ // Get RRCConnectionSetup for Piggyback
+ ra->msg4_rrc_sdu_length = mac_rrc_data_req (module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block
+ &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case
+
+ AssertFatal (ra->msg4_rrc_sdu_length > 0, "[MAC][eNB Scheduler] CCCH not allocated\n");
+
+
+ LOG_I (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d, dl_req->num_pdu %d\n", module_idP, CC_idP, frameP, subframeP, UE_id, ra->msg4_rrc_sdu_length,dl_req_body->number_pdu);
+
+ // MPDCCH configuration for Msg4
+ ra->msg4_mpdcch_done=0;
+ memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (ra->rach_resource_type > 1) ? 11 : 10;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = ra->msg2_narrowband;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space
+ AssertFatal (cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL, "cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 0; // t-CRNTI
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = ra->rnti;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (ra->rach_resource_type < 3) ? 1 : 2;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_idP].physCellId;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV (6, 0, 6) | (ra->msg2_narrowband<<5);
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 0; // fix to 4 for now
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rep;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 3; // N1A_PRB=3 (36.212) => 56 bits
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0; // this is not needed by OAI L1, but should be filled in
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1;
- memset((void *) dl_config_pdu, 0,
- sizeof(nfapi_dl_config_request_pdu_t));
- dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
- dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_mpdcch_pdu));
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (ra->rach_resource_type > 1) ? 11 : 10;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = ra->msg34_narrowband;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1;
- AssertFatal(cc[CC_idP].
- sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13
- != NULL,
- "cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 16; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 0; // t-C-RNTI
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = ra->RA_rnti;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (ra->rach_resource_type < 3) ? 1 : 2;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_idP].physCellId; /// Check this is still N_id_cell for type2 common
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV(6, 0, 6); // check if not getRIV(N_RB_DL,first_rb,6);
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 4; // adjust according to size of Msg4, 208 bits with N1A_PRB=3
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 4; // fix to 4 for now
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = ra->harq_pid;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rep;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 1; // N1A_PRB=3; => 208 bits
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0;
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0; // this is not needed by OAI L1, but should be filled in
- dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1;
- ra->msg4_mpdcch_repetition_cnt++;
- dl_req_body->number_pdu++;
- dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
+ ra->msg4_mpdcch_repetition_cnt++;
+ dl_req_body->number_pdu++;
+ ra->msg4_TBsize = get_TBS_DL(dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs,
+ 6);
+ } //repetition_count==0 && SF condition met
+
+ if ((ra->msg4_mpdcch_repetition_cnt > 0)&&
+ (ra->msg4_mpdcch_done==0)) { // we're in a stream of repetitions
+ LOG_I(MAC,"SFN.SF %d.%d : msg4 mpdcch repetition number %d/%d\n",
+ frameP,subframeP,ra->msg4_mpdcch_repetition_cnt,reps);
+ if (ra->msg4_mpdcch_repetition_cnt == reps) { // this is the last mpdcch repetition
+ ra->msg4_mpdcch_done = 1;
+ if (cc[CC_idP].tdd_Config == NULL) { // FDD case
+ // wait 2 subframes for PDSCH transmission
+ if (subframeP > 7)
+ ra->Msg4_frame = (frameP + 1) & 1023;
+ else
+ ra->Msg4_frame = frameP;
+ ra->Msg4_subframe = (subframeP + 2) % 10;
+ LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Set Msg4 PDSCH in %d.%d\n",
+ module_idP, CC_idP, frameP, subframeP, ra->Msg4_frame,ra->Msg4_subframe);
+ } else {
+ AssertFatal (1 == 0, "TDD case not done yet\n");
+ }
+ }
+ else if (ra->msg4_mpdcch_done==0)
+ ra->msg4_mpdcch_repetition_cnt++;
+ }
+// mpdcch_repetition_count == reps
+ else if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) {
+
+ // Program PDSCH
+
+ LOG_I (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 BR with RRC Piggyback (ce_level %d RNTI %x)\n",
+ module_idP, CC_idP, frameP, subframeP, ra->rach_resource_type - 1, ra->rnti);
+
+
+ dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
+ memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_dlsch_pdu));
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = mac->pdu_index[CC_idP];
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = ra->rnti;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV (N_RB_DL, first_rb, 6); // check that this isn't getRIV(6,0,6)
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc[CC_idP].p_eNB == 1) ? 0 : 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize (cc[CC_idP].mib->message.dl_Bandwidth); // ignored
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc[CC_idP].p_eNB == 1) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
+ dl_req_body->number_pdu++;
+
- dl_req->sfn_sf = (ra->Msg4_frame<<4)+ra->Msg4_subframe;
- dl_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
-
- } //repetition_count==0 && SF condition met
- else if (ra->msg4_mpdcch_repetition_cnt > 0) { // we're in a stream of repetitions
- ra->msg4_mpdcch_repetition_cnt++;
- if (ra->msg4_mpdcch_repetition_cnt == reps) { // this is the last mpdcch repetition
- if (cc[CC_idP].tdd_Config == NULL) { // FDD case
- // wait 2 subframes for PDSCH transmission
- if (subframeP > 7)
- ra->Msg4_frame = (frameP + 1) & 1023;
- else
- ra->Msg4_frame = frameP;
- ra->Msg4_subframe = (subframeP + 2) % 10;
- } else {
- AssertFatal(1 == 0, "TDD case not done yet\n");
- }
- } // mpdcch_repetition_count == reps
- if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) {
-
- // Program PDSCH
-
- // Get RRCConnectionSetup for Piggyback
- /*rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block
- &cc[CC_idP].CCCH_pdu.payload[0], ENB_FLAG_YES, module_idP, 0); // not used in this case*/
-
- rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block
- &cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case
-
- LOG_D(MAC,
- "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: UE_id %d, rrc_sdu_length %d\n",
- module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length);
-
- AssertFatal(rrc_sdu_length > 0,
- "[MAC][eNB Scheduler] CCCH not allocated\n");
-
- LOG_D(MAC,
- "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 BR with RRC Piggyback (ce_level %d RNTI %x)\n",
- module_idP, CC_idP, frameP, subframeP,
- ra->rach_resource_type - 1, ra->rnti);
-
- AssertFatal(1 == 0,
- "Msg4 generation not finished for BL/CE UE\n");
- dl_config_pdu = &dl_req_body->dl_config_pdu_list[dl_req_body->number_pdu];
- memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
- dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
- dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = mac->pdu_index[CC_idP];
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = ra->rnti;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6); // check that this isn't getRIV(6,0,6)
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
-
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_idP].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
-
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
- dl_req_body->number_pdu++;
- dl_req_body->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
-
- mac->DL_req[CC_idP].sfn_sf = (frameP<<4)+subframeP;
- mac->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
-
- ra->state = WAITMSG4ACK;
- LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG4ACK\n", module_idP, frameP, subframeP);
-
- lcid = 0;
-
- UE_list->UE_sched_ctrl[UE_id].round[CC_idP][ra->harq_pid] = 0;
- msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header
-
- if ((ra->msg4_TBsize - rrc_sdu_length - msg4_header) <= 2) {
- msg4_padding = ra->msg4_TBsize - rrc_sdu_length - msg4_header;
- msg4_post_padding = 0;
- } else {
- msg4_padding = 0;
- msg4_post_padding = ra->msg4_TBsize - rrc_sdu_length - msg4_header - 1;
- }
-
- LOG_D(MAC,
- "[eNB %d][RAPROC] CC_id %d Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
- module_idP, CC_idP, frameP, subframeP,
- ra->msg4_TBsize, rrc_sdu_length, msg4_header,
- msg4_padding, msg4_post_padding);
- DevAssert(UE_id != UE_INDEX_INVALID); // FIXME not sure how to gracefully return
- // CHECK THIS: &cc[CC_idP].CCCH_pdu.payload[0]
- offset = generate_dlsch_header((unsigned char *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], 1, //num_sdus
- (unsigned short *) &rrc_sdu_length, //
- &lcid, // sdu_lcid
- 255, // no drx
- 31, // no timing advance
- ra->cont_res_id, // contention res id
- msg4_padding, // no padding
- msg4_post_padding);
-
- memcpy((void *) &mac->UE_list.
- DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0][(unsigned char)offset],
- &cc[CC_idP].CCCH_pdu.payload[0], rrc_sdu_length);
-
- // DL request
- mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP;
- mac->TX_req[CC_idP].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
- mac->TX_req[CC_idP].header.message_id = NFAPI_TX_REQUEST;
-
- TX_req =
- &mac->TX_req[CC_idP].tx_request_body.tx_pdu_list[mac->TX_req[CC_idP].tx_request_body.number_of_pdus];
- TX_req->pdu_length = rrc_sdu_length;
- TX_req->pdu_index = mac->pdu_index[CC_idP]++;
- TX_req->num_segments = 1;
- TX_req->segments[0].segment_length = rrc_sdu_length;
- TX_req->segments[0].segment_data = mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0];
- mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
-
- // Program ACK/NAK for Msg4 PDSCH
- int absSF = (ra->Msg3_frame * 10) + ra->Msg3_subframe;
- // see Section 10.2 from 36.213
- int ackNAK_absSF = absSF + reps + 4;
- AssertFatal(reps > 2,
- "Have to handle programming of ACK when PDSCH repetitions is > 2\n");
- ul_req = &mac->UL_req_tmp[CC_idP][ackNAK_absSF % 10];
- ul_req_body = &ul_req->ul_config_request_body;
- ul_config_pdu = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
-
- ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
- ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_ul_config_uci_harq_pdu));
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0; // don't know how to use this
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti = ra->rnti;
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.empty_symbols = 0;
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions = pucchreps[ra->rach_resource_type - 1];
- ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.repetition_number = 0;
-
- ul_req_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
- ul_req->sfn_sf = sfnsf_add_subframe(ra->Msg3_frame, ra->Msg3_subframe, 4);
- ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
- LOG_D(MAC,"UL_req_tmp[CC_idP:%d][ackNAK_absSF mod 10:%d] ra->Msg3_frame:%d ra->Msg3_subframe:%d + 4 sfn_sf:%d\n", CC_idP, ackNAK_absSF%10, ra->Msg3_frame, ra->Msg3_subframe, NFAPI_SFNSF2DEC(ul_req->sfn_sf));
-
- // Note need to keep sending this across reptitions!!!! Not really for PUCCH, to ask small-cell forum, we'll see for the other messages, maybe parameters change across repetitions and FAPI has to provide for that
- if (cc[CC_idP].tdd_Config == NULL) { // FDD case
- ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.tl.tag = NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG;
- ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.n_pucch_1_0 = n1pucchan[ra->rach_resource_type - 1];
- // NOTE: How to fill in the rest of the n_pucch_1_0 information 213 Section 10.1.2.1 in the general case
- // = N_ECCE_q + Delta_ARO + n1pucchan[ce_level]
- // higher in the MPDCCH configuration, N_ECCE_q is hard-coded to 0, and harq resource offset to 0 =>
- // Delta_ARO = 0 from Table 10.1.2.1-1
- ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.harq_size = 1; // 1-bit ACK/NAK
- } else {
- AssertFatal(1 == 0,
- "PUCCH configuration for ACK/NAK not handled yet for TDD BL/CE case\n");
- }
- ul_req_body->number_of_pdus++;
- T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP),
- T_INT(CC_idP), T_INT(ra->rnti), T_INT(frameP),
- T_INT(subframeP), T_INT(0 /*harq_pid always 0? */ ),
- T_BUFFER(&mac->UE_list.DLSCH_pdu[CC_idP][0][UE_id].
- payload[0], ra->msg4_TBsize));
-
- if (opt_enabled == 1) {
- trace_pdu(DIRECTION_DOWNLINK,
- (uint8_t *) mac->
- UE_list.DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0],
- rrc_sdu_length, UE_id, WS_C_RNTI,
- UE_RNTI(module_idP, UE_id), mac->frame,
- mac->subframe, 0, 0);
- LOG_D(OPT,
- "[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n",
- module_idP, CC_idP, frameP, UE_RNTI(module_idP,UE_id),
- rrc_sdu_length);
- }
- if(RC.mac[module_idP]->scheduler_mode == SCHED_MODE_FAIR_RR){
- set_dl_ue_select_msg4(CC_idP, 4, UE_id, ra->rnti);
- }
- } // Msg4 frame/subframe
- } // msg4_mpdcch_repetition_count
- } // rach_resource_type > 0
- else
+ ra->state = WAITMSG4ACK;
+
+ lcid = 0;
+
+ UE_list->UE_sched_ctrl[UE_id].round[CC_idP][ra->harq_pid] = 0;
+ msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header
+ AssertFatal((ra->msg4_TBsize - ra->msg4_rrc_sdu_length - msg4_header)>=0,
+ "msg4_TBS %d is too small, change mcs to increase by %d bytes\n",ra->msg4_TBsize,ra->msg4_rrc_sdu_length+msg4_header-ra->msg4_TBsize);
+ if ((ra->msg4_TBsize - ra->msg4_rrc_sdu_length - msg4_header) <= 2) {
+ msg4_padding = ra->msg4_TBsize - ra->msg4_rrc_sdu_length - msg4_header;
+ msg4_post_padding = 0;
+ } else {
+ msg4_padding = 0;
+ msg4_post_padding = ra->msg4_TBsize - ra->msg4_rrc_sdu_length - msg4_header - 1;
+ }
+
+ LOG_I (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d subframeP %d Msg4 : TBS %d, sdu_len %d, msg4_header %d, msg4_padding %d, msg4_post_padding %d\n",
+ module_idP, CC_idP, frameP, subframeP, ra->msg4_TBsize, ra->msg4_rrc_sdu_length, msg4_header, msg4_padding, msg4_post_padding);
+ DevAssert (UE_id != UE_INDEX_INVALID); // FIXME not sure how to gracefully return
+ // CHECK THIS: &cc[CC_idP].CCCH_pdu.payload[0]
+ offset = generate_dlsch_header ((unsigned char *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], 1, //num_sdus
+ (unsigned short *) &ra->msg4_rrc_sdu_length, //
+ &lcid, // sdu_lcid
+ 255, // no drx
+ 31, // no timing advance
+ ra->cont_res_id, // contention res id
+ msg4_padding, // no padding
+ msg4_post_padding);
+
+ memcpy ((void *) &mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0][(unsigned char) offset], &cc[CC_idP].CCCH_pdu.payload[0], ra->msg4_rrc_sdu_length);
+
+ // DL request
+ mac->TX_req[CC_idP].sfn_sf = (frameP << 4) + subframeP;
+ TX_req = &mac->TX_req[CC_idP].tx_request_body.tx_pdu_list[mac->TX_req[CC_idP].tx_request_body.number_of_pdus];
+ TX_req->pdu_length = ra->msg4_TBsize;
+ TX_req->pdu_index = mac->pdu_index[CC_idP]++;
+ TX_req->num_segments = 1;
+ TX_req->segments[0].segment_length = ra->msg4_TBsize;
+ TX_req->segments[0].segment_data = mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0];
+ mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
+
+ // Program ACK/NAK for Msg4 PDSCH
+ int absSF = (frameP * 10) + subframeP;
+ // see Section 10.2 from 36.213
+ int ackNAK_absSF = absSF + reps + 3;
+ AssertFatal (reps == 1, "Have to handle programming of ACK when PDSCH repetitions is > 1\n");
+ ul_req_body = &mac->UL_req_tmp[CC_idP][ackNAK_absSF % 10].ul_config_request_body;
+ ul_config_pdu = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
+
+ ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
+ ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_ul_config_uci_harq_pdu));
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0; // don't know how to use this
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti = ra->rnti;
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.ue_type = (ra->rach_resource_type < 3) ? 1 : 2;
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.empty_symbols = 0;
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions = pucchreps[ra->rach_resource_type - 1];
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.repetition_number = 0;
+ // Note need to keep sending this across reptitions!!!! Not really for PUCCH, to ask small-cell forum, we'll see for the other messages, maybe parameters change across repetitions and FAPI has to provide for that
+ if (cc[CC_idP].tdd_Config == NULL) { // FDD case
+ ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0 = n1pucchan[ra->rach_resource_type - 1];
+ // NOTE: How to fill in the rest of the n_pucch_1_0 information 213 Section 10.1.2.1 in the general case
+ // = N_ECCE_q + Delta_ARO + n1pucchan[ce_level]
+ // higher in the MPDCCH configuration, N_ECCE_q is hard-coded to 0, and harq resource offset to 0 =>
+ // Delta_ARO = 0 from Table 10.1.2.1-1
+ ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.harq_size = 1; // 1-bit ACK/NAK
+ ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.number_of_pucch_resources = 1;
+ } else {
+ AssertFatal (1 == 0, "PUCCH configuration for ACK/NAK not handled yet for TDD BL/CE case\n");
+ }
+ ul_req_body->number_of_pdus++;
+ T (T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT (module_idP), T_INT (CC_idP), T_INT (ra->rnti), T_INT (frameP), T_INT (subframeP),
+ T_INT (0 /*harq_pid always 0? */ ), T_BUFFER (&mac->UE_list.DLSCH_pdu[CC_idP][0][UE_id].payload[0], ra->msg4_TBsize));
+
+ if (opt_enabled == 1) {
+ trace_pdu (1, (uint8_t *) mac->UE_list.DLSCH_pdu[CC_idP][0][(unsigned char) UE_id].payload[0], ra->msg4_rrc_sdu_length, UE_id, 3, UE_RNTI (module_idP, UE_id), mac->frame, mac->subframe, 0, 0);
+ LOG_D (OPT, "[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n", module_idP, CC_idP, frameP, UE_RNTI (module_idP, UE_id), ra->msg4_rrc_sdu_length);
+ }
+ } // Msg4 frame/subframe
+ } // rach_resource_type > 0
+ else
#endif
{
// This is normal LTE case
@@ -1409,15 +1326,14 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
RA_t *ra;
uint8_t i;
- start_meas(&mac->schedule_ra);
+ start_meas(&mac->schedule_ra);
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
// skip UL component carriers if TDD
if (is_UL_sf(&cc[CC_id], subframeP) == 1)
continue;
-
for (i = 0; i < NB_RA_PROC_MAX; i++) {
ra = (RA_t *) & cc[CC_id].ra[i];
@@ -1436,6 +1352,7 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
} // CC_id
stop_meas(&mac->schedule_ra);
+
}
@@ -1457,18 +1374,20 @@ initiate_ra_proc(module_id_t module_idP,
COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
RA_t *ra = &cc->ra[0];
-
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+
struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach = NULL;
LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = NULL;
- static uint8_t failure_cnt = 0;
- if (cc->radioResourceConfigCommon_BR
- && cc->radioResourceConfigCommon_BR->ext4) {
- ext4_prach = cc->radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
- prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+
+ if (cc->mib->message.schedulingInfoSIB1_BR_r13>0) {
+ AssertFatal(cc->radioResourceConfigCommon_BR != NULL,"radioResourceConfigCommon_BR is null\n");
+ AssertFatal(cc->radioResourceConfigCommon_BR->ext4 != NULL, "radioResourceConfigCommon_BR->ext4 is null\n");
+ ext4_prach = cc->radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+ AssertFatal(ext4_prach!=NULL,"ext4_prach is null\n");
+ prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
}
#endif /* #if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) */
@@ -1486,6 +1405,8 @@ initiate_ra_proc(module_id_t module_idP,
uint16_t msg2_subframe = subframeP;
int offset;
+ static uint8_t failure_cnt = 0 ;
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
if (prach_ParametersListCE_r13 &&
@@ -1517,6 +1438,7 @@ initiate_ra_proc(module_id_t module_idP,
#endif
+
//TODO Fill in other TDD config. What about nfapi_mode?
if(cc->tdd_Config!=NULL){
switch(cc->tdd_Config->subframeAssignment){
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
index 460e4f42c9..339d4102aa 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
@@ -310,195 +310,189 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
- int8_t bcch_sdu_length;
- int CC_id;
- eNB_MAC_INST *eNB = RC.mac[module_idP];
- COMMON_channels_t *cc;
- uint8_t *vrb_map;
- int first_rb = -1;
- int N_RB_DL;
- nfapi_dl_config_request_pdu_t *dl_config_pdu;
- nfapi_tx_request_pdu_t *TX_req;
- nfapi_dl_config_request_body_t *dl_req;
- int i;
- int rvidx;
- int absSF = (frameP * 10) + subframeP;
- uint16_t sfn_sf = frameP << 4 | subframeP;
+
+ int8_t bcch_sdu_length;
+ int CC_id;
+ eNB_MAC_INST *eNB = RC.mac[module_idP];
+ COMMON_channels_t *cc;
+ uint8_t *vrb_map;
+ int first_rb = -1;
+ int N_RB_DL;
+ nfapi_dl_config_request_pdu_t *dl_config_pdu;
+ nfapi_tx_request_pdu_t *TX_req;
+ nfapi_dl_config_request_body_t *dl_req;
+ int i;
+ int rvidx;
+ int absSF = (frameP*10)+subframeP;
- for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+ for (CC_id=0; CC_idcommon_channels[CC_id];
- vrb_map = (void *) &cc->vrb_map;
- N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
- dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
+ cc = &eNB->common_channels[CC_id];
+ vrb_map = (void*)&cc->vrb_map;
+ N_RB_DL = to_prb(cc->mib->message.dl_Bandwidth);
+ dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
- // Time-domain scheduling
- if (cc->mib->message.schedulingInfoSIB1_BR_r13 == 0)
- continue;
- else {
- AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL,
- "sib_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
+ // Time-domain scheduling
+ if (cc->mib->message.schedulingInfoSIB1_BR_r13==0) continue;
+ else {
- LTE_SchedulingInfoList_BR_r13_t *schedulingInfoList_BR_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13;
- AssertFatal(schedulingInfoList_BR_r13 != NULL,
- "sib_v13ext->schedulingInfoList_BR_r13 is null\n");
- LTE_SchedulingInfoList_t *schedulingInfoList = cc->schedulingInfoList;
- AssertFatal(schedulingInfoList_BR_r13->list.count == schedulingInfoList->list.count,
- "schedulingInfolist_BR.r13->list.count %d != schedulingInfoList.list.count %d\n",
- schedulingInfoList_BR_r13->list.count,
- schedulingInfoList->list.count);
+ AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13!=NULL,
+ "sib_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
- AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13<=LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200,
- "si_WindowLength_BR_r13 %d > %d\n",
- (int) cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13,
- LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200);
+ LTE_SchedulingInfoList_BR_r13_t *schedulingInfoList_BR_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13;
+ AssertFatal(schedulingInfoList_BR_r13!=NULL,
+ "sib_v13ext->schedulingInfoList_BR_r13 is null\n");
- // check that SI frequency-hopping is disabled
- AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13 == LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_off,
- "Deactivate SI_HoppingConfigCommon_r13 in configuration file, not supported for now\n");
- long si_WindowLength_BR_r13 = si_WindowLength_BR_r13tab[cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13];
+ LTE_SchedulingInfoList_t *schedulingInfoList = cc->schedulingInfoList;
+ AssertFatal(schedulingInfoList_BR_r13->list.count==schedulingInfoList->list.count,
+ "schedulingInfolist_BR.r13->list.count %d != schedulingInfoList.list.count %d\n",
+ schedulingInfoList_BR_r13->list.count,schedulingInfoList->list.count);
- long si_RepetitionPattern_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13;
- AssertFatal(si_RepetitionPattern_r13<=LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF,
- "si_RepetitionPattern_r13 %d > %d\n",
- (int) si_RepetitionPattern_r13,
- LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF);
- // cycle through SIB list
+ AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13<=LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200,
+ "si_WindowLength_BR_r13 %d > %d\n",
+ (int)cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13,
+ LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms200);
- for (i = 0; i < schedulingInfoList_BR_r13->list.count; i++) {
- long si_Periodicity = schedulingInfoList->list.array[i]->si_Periodicity;
- long si_Narrowband_r13 = schedulingInfoList_BR_r13->list.array[i]->si_Narrowband_r13;
- long si_TBS_r13 = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13];
+ // check that SI frequency-hopping is disabled
+ AssertFatal(cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13==LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_off,
+ "Deactivate SI_HoppingConfigCommon_r13 in configuration file, not supported for now\n");
+ long si_WindowLength_BR_r13 = si_WindowLength_BR_r13tab[cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13];
- // check if the SI is to be scheduled now
- int period_in_sf = 80 << si_Periodicity; // 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms
- int sf_mod_period = absSF % period_in_sf;
- int k = sf_mod_period & 3;
- // Note: definition of k and rvidx from 36.321 section 5.3.1
- rvidx = (((3 * k) >> 1) + (k & 1)) & 3;
+ long si_RepetitionPattern_r13 = cc->sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13;
+ AssertFatal(si_RepetitionPattern_r13<=LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF,
+ "si_RepetitionPattern_r13 %d > %d\n",
+ (int)si_RepetitionPattern_r13,
+ LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_every8thRF);
+ // cycle through SIB list
- if ((sf_mod_period < si_WindowLength_BR_r13)
- && ((frameP & (((1 << si_RepetitionPattern_r13) - 1))) == 0)) { // this SIB is to be scheduled
+ for (i=0;ilist.count;i++) {
+ long si_Periodicity = schedulingInfoList->list.array[i]->si_Periodicity;
+ long si_Narrowband_r13 = schedulingInfoList_BR_r13->list.array[i]->si_Narrowband_r13;
+ long si_TBS_r13 = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13];
- bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 0); // not used in this case
+ // check if the SI is to be scheduled now
+ int period_in_sf = 80<>1) + (k&1))&3;
+
+ if ((sf_mod_period < si_WindowLength_BR_r13) &&
+ ((frameP&(((1< 0,
- "RRC returned 0 bytes for SI-BR %d\n", i);
+ bcch_sdu_length = mac_rrc_data_req(module_idP,
+ CC_id,
+ frameP,
+ BCCH_SI_BR+i,1,
+ &cc->BCCH_BR_pdu[i+1].payload[0],
+ 0); // not used in this case
+
+ AssertFatal(bcch_sdu_length>0,"RRC returned 0 bytes for SI-BR %d\n",i);
+
+ if (bcch_sdu_length > 0) {
+ AssertFatal(bcch_sdu_length <= (si_TBS_r13>>3),
+ "RRC provided bcch with length %d > %d (si_TBS_r13 %d)\n",
+ bcch_sdu_length,(int)(si_TBS_r13>>3),(int)schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13);
- if (bcch_sdu_length > 0) {
- AssertFatal(bcch_sdu_length <= (si_TBS_r13 >> 3),
- "RRC provided bcch with length %d > %d (si_TBS_r13 %d)\n",
- bcch_sdu_length,
- (int) (si_TBS_r13 >> 3),
- (int) schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13);
+ // allocate all 6 PRBs in narrowband for SIB1_BR
- // allocate all 6 PRBs in narrowband for SIB1_BR
+ // check that SIB1 didn't take this narrowband
+ if (vrb_map[first_rb] > 0) continue;
- // check that SIB1 didn't take this narrowband
- if (vrb_map[first_rb] > 0) continue;
+ first_rb = narrowband_to_first_rb(cc,si_Narrowband_r13-1);
+ vrb_map[first_rb] = 1;
+ vrb_map[first_rb+1] = 1;
+ vrb_map[first_rb+2] = 1;
+ vrb_map[first_rb+4] = 1;
+ vrb_map[first_rb+5] = 1;
- first_rb = narrowband_to_first_rb(cc,si_Narrowband_r13 - 1);
- vrb_map[first_rb] = 1;
- vrb_map[first_rb + 1] = 1;
- vrb_map[first_rb + 2] = 1;
- vrb_map[first_rb + 4] = 1;
- vrb_map[first_rb + 5] = 1;
-
- if ((frameP & 1023) < 200)
- LOG_D(MAC,
- "[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n",
- module_idP, frameP, subframeP, CC_id,
- (int) si_Narrowband_r13 - 1, rvidx,
- sf_mod_period,
- (int) si_WindowLength_BR_r13,
- (int) si_RepetitionPattern_r13,
- bcch_sdu_length);
+ if ((frameP&1023) < 200)
+ LOG_D(MAC,"[eNB %d] Frame %d Subframe %d: SI_BR->DLSCH CC_id %d, Narrowband %d rvidx %d (sf_mod_period %d : si_WindowLength_BR_r13 %d : si_RepetitionPattern_r13 %d) bcch_sdu_length %d\n",
+ module_idP,frameP,subframeP,CC_id,(int)si_Narrowband_r13-1,rvidx,
+ sf_mod_period,(int)si_WindowLength_BR_r13,(int)si_RepetitionPattern_r13,
+ bcch_sdu_length);
-
- dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
- memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
- dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
- dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dlsch_pdu));
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = si_TBS_r13 >> 3;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFF;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6);
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rvidx;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
- // Rel10 fields (for PDSCH starting symbol)
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
- // Rel13 fields
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1; // CEModeA UE
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1; // SI-BR
- dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period;
-
- // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
- dl_req->number_pdu++;
- dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
-
- // Program TX Request
- TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
- TX_req->pdu_length = bcch_sdu_length;
- TX_req->pdu_index = eNB->pdu_index[CC_id]++;
- TX_req->num_segments = 1;
- TX_req->segments[0].segment_length = bcch_sdu_length;
- TX_req->segments[0].segment_data = cc->BCCH_BR_pdu[i + 1].payload;
- eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
- eNB->TX_req[CC_id].sfn_sf = sfn_sf;
- eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
- eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
-
- if (opt_enabled == 1) {
- trace_pdu(DIRECTION_DOWNLINK,
- &cc->BCCH_BR_pdu[i + 1].payload[0],
- bcch_sdu_length,
- 0xffff,
- WS_SI_RNTI,
- 0xffff, eNB->frame, eNB->subframe, 0,
- 0);
- LOG_D(OPT,
- "[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
- module_idP, frameP, CC_id, 0xffff,
- bcch_sdu_length);
- }
- if (cc->tdd_Config != NULL) { //TDD
- LOG_D(MAC,
- "[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (TDD) for CC_id %d SI-BR %d bytes\n",
- frameP, i, CC_id, bcch_sdu_length);
- } else {
- LOG_D(MAC,
- "[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (FDD) for CC_id %d SI-BR %d bytes\n",
- frameP, i, CC_id, bcch_sdu_length);
- }
- }
- } // scheduling in current frame/subframe
- } //for SI List
- } // eMTC is activated
- } // CC_id
- return;
+
+ dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+ memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_dl_config_dlsch_pdu));
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.length = si_TBS_r13>>3;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = 0xFFFF;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL,first_rb,6);
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = rvidx;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1;// first block
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB==1 ) ? 0 : 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB==1 ) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+ // Rel10 fields (for PDSCH starting symbol)
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+ // Rel13 fields
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 1; // CEModeA UE
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 1; // SI-BR
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = absSF - sf_mod_period;
+
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+ dl_req->number_pdu++;
+
+ // Program TX Request
+ TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
+ TX_req->pdu_length = bcch_sdu_length;
+ TX_req->pdu_index = eNB->pdu_index[CC_id]++;
+ TX_req->num_segments = 1;
+ TX_req->segments[0].segment_length = bcch_sdu_length;
+ TX_req->segments[0].segment_data = cc->BCCH_BR_pdu[i+1].payload;
+ eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
+
+ if (opt_enabled == 1) {
+ trace_pdu(1,
+ &cc->BCCH_BR_pdu[i+1].payload[0],
+ bcch_sdu_length,
+ 0xffff,
+ 4,
+ 0xffff,
+ eNB->frame,
+ eNB->subframe,
+ 0,
+ 0);
+ LOG_D(OPT,"[eNB %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
+ module_idP, frameP, CC_id, 0xffff, bcch_sdu_length);
+ }
+ if (cc->tdd_Config!=NULL) { //TDD
+ LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (TDD) for CC_id %d SI-BR %d bytes\n",
+ frameP,i,
+ CC_id,
+ bcch_sdu_length);
+ } else {
+ LOG_D(MAC,"[eNB] Frame %d : Scheduling BCCH-BR %d->DLSCH (FDD) for CC_id %d SI-BR %d bytes\n",
+ frameP,i,
+ CC_id,
+ bcch_sdu_length);
+ }
+ }
+ } // scheduling in current frame/subframe
+ } //for SI List
+ } // eMTC is activated
+ } // CC_id
+ return;
}
#endif
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index 9a26460fa3..737f4dfe74 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -414,7 +414,1101 @@ schedule_dlsch(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, in
}
// changes to pre-processor for eMTC
+//------------------------------------------------------------------------------
+void getRepetition(UE_TEMPLATE * pue_template,unsigned int *maxRep , unsigned int *narrowBandindex){
+ LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11;
+
+ AssertFatal(pue_template->physicalConfigDedicated !=NULL, "no RRC physical configuration for this UE ") ;
+ AssertFatal(pue_template->physicalConfigDedicated->ext4 !=NULL, "no RRC physical configuration for this UE ") ;
+
+ AssertFatal(pue_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.count > 0 ,"epdcch config list is empty") ;
+
+ epdcch_setconfig_r11 = pue_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0] ;
+
+ AssertFatal(epdcch_setconfig_r11->ext2 !=NULL && epdcch_setconfig_r11->ext2->mpdcch_config_r13 !=NULL," mpdcch config not found") ;
+
+*maxRep = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_NumRepetition_r13 ;
+
+ *narrowBandindex = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 ;
+
+
+
+
+}
+
+
+
+/*void
+schedule_ue_spec_br(
+ module_id_t module_idP,
+ frame_t frameP,
+ sub_frame_t subframeP,
+ int* mbsfn_flag
+)
+//------------------------------------------------------------------------------
+{
+ uint8_t CC_id;
+ int UE_id;
+ unsigned char aggregation;
+ mac_rlc_status_resp_t rlc_status;
+ unsigned char header_len_dcch = 0, header_len_dcch_tmp = 0;
+ unsigned char header_len_dtch = 0, header_len_dtch_tmp = 0, header_len_dtch_last = 0;
+ unsigned char ta_len = 0;
+ unsigned char sdu_lcids[NB_RB_MAX], lcid, offset, num_sdus = 0;
+ uint16_t nb_rb, nb_rb_temp, nb_available_rb;
+ uint16_t TBS, j, sdu_lengths[NB_RB_MAX], rnti, padding = 0, post_padding = 0;
+ unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
+ unsigned char round = 0;
+ unsigned char harq_pid = 0;
+ eNB_UE_STATS *eNB_UE_stats = NULL;
+ uint16_t sdu_length_total = 0;
+
+ eNB_MAC_INST *eNB = RC.mac[module_idP];
+ COMMON_channels_t *cc = eNB->common_channels;
+ UE_list_t *UE_list = &eNB->UE_list;
+ int continue_flag = 0;
+ int32_t normalized_rx_power, target_rx_power;
+ int32_t tpc = 1;
+ static int32_t tpc_accumulated = 0;
+ UE_sched_ctrl *ue_sched_ctl;
+ int mcs;
+ int i;
+ int min_rb_unit[MAX_NUM_CCs];
+ int N_RB_DL[MAX_NUM_CCs];
+ int total_nb_available_rb[MAX_NUM_CCs];
+ int N_RBG[MAX_NUM_CCs];
+ nfapi_dl_config_request_body_t *dl_req;
+ nfapi_dl_config_request_pdu_t *dl_config_pdu;
+ nfapi_tx_request_pdu_t *TX_req;
+ int tdd_sfa;
+
+#if 0
+ if (UE_list->head == -1) {
+ return;
+ }
+#endif
+
+ uint8_t *vrb_map;
+ int first_rb;
+ start_meas(&eNB->schedule_dlsch);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_IN);
+
+
+
+ aggregation = 2;
+ for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+ N_RB_DL[CC_id] = to_prb(cc[CC_id].mib->message.dl_Bandwidth);
+ min_rb_unit[CC_id] = get_min_rb_unit(module_idP, CC_id);
+ // get number of PRBs less those used by common channels
+ total_nb_available_rb[CC_id] = N_RB_DL[CC_id];
+ for (i = 0; i < N_RB_DL[CC_id]; i++)
+ if (cc[CC_id].vrb_map[i] != 0)
+ total_nb_available_rb[CC_id]--;
+
+ N_RBG[CC_id] = to_rbg(cc[CC_id].mib->message.dl_Bandwidth);
+
+ // store the global enb stats:
+ eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs;
+ eNB->eNB_stats[CC_id].available_prbs = total_nb_available_rb[CC_id];
+ eNB->eNB_stats[CC_id].total_available_prbs += total_nb_available_rb[CC_id];
+ eNB->eNB_stats[CC_id].dlsch_bytes_tx = 0;
+ eNB->eNB_stats[CC_id].dlsch_pdus_tx = 0;
+ }
+
+ /// CALLING Pre_Processor for downlink scheduling (Returns estimation of RBs required by each UE and the allocation on sub-band)
+
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, VCD_FUNCTION_IN);
+ //start_meas(&eNB->schedule_dlsch_preprocessor);
+ //dlsch_scheduler_pre_processor(module_idP,
+ // frameP,
+ // subframeP,
+ // N_RBG,
+ // mbsfn_flag);
+ //stop_meas(&eNB->schedule_dlsch_preprocessor);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR, VCD_FUNCTION_OUT);
+
+
+ for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
+ {
+ vrb_map = cc[CC_id].vrb_map;
+
+ LOG_D(MAC, "doing schedule_ue_spec for CC_id %d\n", CC_id);
+
+ dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
+
+ if (mbsfn_flag[CC_id] > 0)
+ continue;
+
+ unsigned int rmax;
+ unsigned int narrowBandindex_index;
+ unsigned int first_rb, rep, reps;
+
+ // rmax from RRC connection setup
+ getRepetition(&UE_list->UE_template[CC_id][UE_id], &rmax, &narrowBandindex_index);
+
+ first_rb = narrowband_to_first_rb(cc,narrowBandindex_index);
+
+ if (vrb_map[first_rb] == 1) // skip scheduling emtc UEs if first RB is taken
+ continue ;
+
+ for (UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id])
+ {
+
+ if (UE_list->UE_template[CC_id][UE_id].rach_resource_type ==0 ) // do the following scheduling only if the UE is emtc
+ continue ;
+
+ //[khalid] ******** allocate here the vrb_map
+ // 1st check on the vrb_map[] and allocate the one that is next to them
+
+ // at the end of the scheduler make sure the right subbands coresponding to these RBs are allocated the UE in UE_template directely
+ // also check on the fill_DCI function
+
+
+
+ vrb_map[first_rb] = 1;
+ vrb_map[first_rb + 1] = 1;
+ vrb_map[first_rb + 2] = 1;
+ vrb_map[first_rb + 3] = 1;
+ vrb_map[first_rb + 4] = 1;
+ vrb_map[first_rb + 5] = 1;
+
+
+
+
+
+ continue_flag = 0; // reset the flag to allow allocation for the remaining UEs
+ rnti = UE_RNTI(module_idP, UE_id);
+ eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
+ ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
+
+ //[khalid] allocate the middle RB subbands in sf 1,5 for synch signals and PBCH
+
+
+
+
+ if (rnti == NOT_A_RNTI) {
+ LOG_D(MAC, "Cannot find rnti for UE_id %d (num_UEs %d)\n", UE_id, UE_list->num_UEs);
+ continue_flag = 1;
+ }
+
+ if (eNB_UE_stats == NULL) {
+ LOG_D(MAC, "[eNB] Cannot find eNB_UE_stats\n");
+ continue_flag = 1;
+ }
+
+ //if (continue_flag != 1) {
+ // switch (get_tmode(module_idP, CC_id, UE_id)) {
+ // case 1:
+ // case 2:
+ // case 7:
+ // aggregation = get_aggregation(get_bw_index(module_idP, CC_id),
+ // eNB_UE_stats->dl_cqi,
+ // format1);
+ // break;
+ // case 3:
+ // aggregation = get_aggregation(get_bw_index(module_idP, CC_id),
+ // eNB_UE_stats->dl_cqi,
+ // format2A);
+ // break;
+ // default:
+ // LOG_W(MAC, "Unsupported transmission mode %d\n", get_tmode(module_idP, CC_id, UE_id));
+ // aggregation = 2;
+ // }
+ //}
+
+ if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated
+ CCE_allocation_infeasible(module_idP, CC_id, 0, subframeP, aggregation, rnti)
+ ) {
+ LOG_D(MAC, "[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n",
+ module_idP, frameP, UE_id, CC_id);
+ continue_flag = 1; //to next user (there might be rbs availiable for other UEs in TM5
+ }
+
+ //if (cc[CC_id].tdd_Config != NULL) { //TDD
+ // set_ue_dai(subframeP,
+ // UE_id,
+ // CC_id,
+ // cc[CC_id].tdd_Config->subframeAssignment,
+ // UE_list);
+ // // update UL DAI after DLSCH scheduling
+ // set_ul_DAI(module_idP, UE_id, CC_id, frameP, subframeP);
+ //}
+
+ //if (continue_flag == 1) {
+ // add_ue_dlsch_info(module_idP,
+ // CC_id,
+ // UE_id,
+ // subframeP,
+ // S_DL_NONE);
+ // continue;
+ // }
+
+ nb_available_rb = 6; // to be checked
+ harq_pid = ue_sched_ctl->harq_pid[CC_id];
+ round = ue_sched_ctl->round[CC_id];
+ UE_list->eNB_UE_stats[CC_id][UE_id].crnti = rnti;
+ UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status = mac_eNB_get_rrc_status(module_idP, rnti);x
+ UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid;
+ UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round;
+
+ sdu_length_total = 0;
+ num_sdus = 0;
+
+
+ //DevCheck(((eNB_UE_stats->dl_cqi < MIN_CQI_VALUE) || (eNB_UE_stats->dl_cqi > MAX_CQI_VALUE)),
+ //eNB_UE_stats->dl_cqi, MIN_CQI_VALUE, MAX_CQI_VALUE);
+
+ eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->dl_cqi]; //to be checked
+ eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, 15);
+
+
+ // store stats
+ UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi = eNB_UE_stats->dl_cqi;
+
+ // initializing the rb allocation indicator for each UE
+ //to be checked
+ for (j = 0; j < N_RBG[CC_id]; j++) {
+ UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0;
+ }
+
+ LOG_D(MAC, "[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n",
+ module_idP, frameP, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb,
+ eNB_UE_stats->dl_cqi, eNB_UE_stats->dlsch_mcs1,
+ UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status);
+
+
+
+ // process retransmission
+
+ if (round > 0)
+ {
+
+
+ // choose r3 by default for RAR (Table 9.1.5-5)
+ rep = 2;
+ // get actual repetition count from Table 9.1.5-3
+ reps = (rmax <= 8) ? (1 << rep) : (rmax >> (3 - rep));
+
+
+ // get freq_allocation
+ nb_rb = 6;//UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid];
+
+ if (nb_rb <= nb_available_rb)
+ {
+
+
+ //if (nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
+ for (j = 0; j < N_RBG[CC_id]; j++) { // for indicating the rballoc for each sub-band
+ UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
+ }
+ //}
+ //else {
+ // nb_rb_temp = nb_rb;
+ // j = 0;
+
+ // while ((nb_rb_temp > 0) && (j < N_RBG[CC_id])) {
+ // if (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) {
+ // UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
+
+ // if ((j == N_RBG[CC_id] - 1) &&
+ // ((N_RB_DL[CC_id] == 25) ||
+ // (N_RB_DL[CC_id] == 50))) {
+ // nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id] + 1;
+ // }
+ // else {
+ // nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
+ // }
+ // }
+
+ // j = j + 1;
+ // }
+ //}
+
+ nb_available_rb -= nb_rb;
+
+ //eNB->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
+ //eNB->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id];
+
+ //for(j=0; jmu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
+ //}
+
+
+ switch (get_tmode(module_idP, CC_id, UE_id)) {
+ case 1:
+ case 2:
+ case 7:
+ default:
+ {
+
+ if ((UE_list->UE_template[CC_id][UE_id].mpdcch_repetition_cnt == 0) &&
+ (mpdcch_sf_condition(eNB, CC_id, frameP, subframeP, rmax, TYPEUESPEC,UE_id) > 0))
+ {
+ // MPDCCH configuration for RAR
+ dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+ memset((void*)dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t)(2 + sizeof(nfapi_dl_config_mpdcch_pdu));
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (UE_list->UE_template[CC_id][UE_id].rach_resource_type > 1) ? 11 : 10;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = narrowBandindex_index;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space
+ AssertFatal(cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL,
+ "cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 16; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 4; // other-RNTI
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = rnti;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (UE_list->UE_template[CC_id][UE_id].rach_resource_type < 3) ? 1 : 2;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_id].physCellId;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
+
+ //[khalid] missing DCI format should be 10 for 6-1A
+
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV(6, 0, 6); // Note: still to be checked if it should not be (getRIV(N_RB_DL,first_rb,6)) : Check nFAPI specifications and what is done L1 with this parameter
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid]; // adjust according to size of RAR, 208 bits with N1A_PRB=3
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 4; // fix to 4 for now
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = (round & 3);
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = harq_pid;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rep;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 1;// N1A_PRB=3 (36.212); => 208 bits for mcs=4, choose mcs according t message size TBD
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0; // this is not needed by OAI L1, but should be filled in
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1;
+ UE_list->UE_template[CC_id][UE_id].mpdcch_repetition_cnt++;
+ dl_req->number_pdu++;
+
+
+
+
+ //eNB_UE_stats->dlsch_trials[round]++;
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission += 1;
+ UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx = nb_rb;
+ UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx += nb_rb;
+ UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1;
+ UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = eNB_UE_stats->dlsch_mcs1;
+
+ add_ue_dlsch_info(module_idP,
+ CC_id,
+ UE_id,
+ subframeP,
+ S_DL_SCHEDULED);
+
+ } //repetition_count==0 && SF condition met
+ else if (UE_list->UE_template[CC_id][UE_id].mpdcch_repetition_cnt > 0)
+ {
+ // we're in a stream of repetitions
+ UE_list->UE_template[CC_id][UE_id].mpdcch_repetition_cnt++;
+ if (UE_list->UE_template[CC_id][UE_id].mpdcch_repetition_cnt == reps)
+ {
+ // this is the last mpdcch repetition
+ if (cc[CC_id].tdd_Config == NULL) { // FDD case
+ // wait 2 subframes for PDSCH transmission
+ if (subframeP > 7) UE_list->UE_template[CC_id][UE_id].Msg2_frame = (frameP + 1) & 1023;
+ else UE_list->UE_template[CC_id][UE_id].Msg2_frame = frameP;
+ UE_list->UE_template[CC_id][UE_id].Msg2_subframe = (subframeP + 2) % 10; // +2 is the "n+x" from Section 7.1.11 in 36.213
+ }
+ else {
+ AssertFatal(1 == 0, "TDD case not done yet\n");
+ }
+ } // mpdcch_repetition_count == reps
+ if ((UE_list->UE_template[CC_id][UE_id].Msg2_frame == frameP) && (UE_list->UE_template[CC_id][UE_id].Msg2_subframe == subframeP)) {
+ // Program PDSCH
+
+ dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+ memset((void*)dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t)(2 + sizeof(nfapi_dl_config_dlsch_pdu));
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = rnti;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 4; // format 6-1A
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6);
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = (round & 3);
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1;// first block
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (UE_list->UE_template[CC_id][UE_id].rach_resource_type < 3) ? 1 : 2;;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
+ dl_req->number_pdu++;
+
+
+ }
+ }
+
+ }
+
+
+
+
+ }
+
+
+
+
+ }
+ else {
+ LOG_D(MAC, "[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n",
+ module_idP, frameP, CC_id, UE_id);
+ }
+ }
+ else
+ {
+ // This is a potentially new SDU opportunity //
+
+ rlc_status.bytes_in_buffer = 0;
+ // Now check RLC information to compute number of required RBs
+ // get maximum TBS size for RLC request
+
+
+
+ TBS = 408;
+ // check first for RLC data on DCCH
+ // add the length for all the control elements (timing adv, drx, etc) : header + payload
+
+ ta_len = (ue_sched_ctl->ta_update != 0) ? 2 : 0;
+
+ header_len_dcch = 2; // 2 bytes DCCH SDU subheader
+
+ if (TBS - ta_len - header_len_dcch > 0) {
+ rlc_status = mac_rlc_status_ind(
+ module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH,
+ (TBS - ta_len - header_len_dcch)); // transport block set size
+
+ sdu_lengths[0] = 0;
+
+ if (rlc_status.bytes_in_buffer > 0) { // There is DCCH to transmit
+ LOG_D(MAC, "[eNB %d] Frame %d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
+ module_idP, frameP, CC_id, TBS - header_len_dcch);
+ sdu_lengths[0] = mac_rlc_data_req(
+ module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH,
+ TBS, //not used
+ (char *)&dlsch_buffer[0]);
+
+ T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
+ T_INT(harq_pid), T_INT(DCCH), T_INT(sdu_lengths[0]));
+
+ LOG_D(MAC, "[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n", module_idP, CC_id, sdu_lengths[0]);
+ sdu_length_total = sdu_lengths[0];
+ sdu_lcids[0] = DCCH;
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH] += 1;
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] += sdu_lengths[0];
+ num_sdus = 1;
+#ifdef DEBUG_eNB_SCHEDULER
+ LOG_T(MAC, "[eNB %d][DCCH] CC_id %d Got %d bytes :", module_idP, CC_id, sdu_lengths[0]);
+
+ for (j = 0; j < sdu_lengths[0]; j++) {
+ LOG_T(MAC, "%x ", dlsch_buffer[j]);
+ }
+
+ LOG_T(MAC, "\n");
+#endif
+ }
+ else {
+ header_len_dcch = 0;
+ sdu_length_total = 0;
+ }
+ }
+
+ // check for DCCH1 and update header information (assume 2 byte sub-header)
+ if (TBS - ta_len - header_len_dcch - sdu_length_total > 0) {
+ rlc_status = mac_rlc_status_ind(
+ module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH + 1,
+ (TBS - ta_len - header_len_dcch - sdu_length_total)); // transport block set size less allocations for timing advance and
+ // DCCH SDU
+ sdu_lengths[num_sdus] = 0;
+
+ if (rlc_status.bytes_in_buffer > 0) {
+ LOG_I(MAC, "[eNB %d], Frame %d, DCCH1->DLSCH, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
+ module_idP, frameP, CC_id, TBS - header_len_dcch - sdu_length_total);
+ sdu_lengths[num_sdus] += mac_rlc_data_req(
+ module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH + 1,
+ TBS, //not used
+ (char *)&dlsch_buffer[sdu_length_total]);
+
+ T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
+ T_INT(harq_pid), T_INT(DCCH + 1), T_INT(sdu_lengths[num_sdus]));
+
+ sdu_lcids[num_sdus] = DCCH1;
+ sdu_length_total += sdu_lengths[num_sdus];
+ header_len_dcch += 2;
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH1] += 1;
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH1] += sdu_lengths[num_sdus];
+ num_sdus++;
+#ifdef DEBUG_eNB_SCHEDULER
+ LOG_T(MAC, "[eNB %d][DCCH1] CC_id %d Got %d bytes :", module_idP, CC_id, sdu_lengths[num_sdus]);
+
+ for (j = 0; j < sdu_lengths[num_sdus]; j++) {
+ LOG_T(MAC, "%x ", dlsch_buffer[j]);
+ }
+
+ LOG_T(MAC, "\n");
+#endif
+
+ }
+ }
+
+ // assume the max dtch header size, and adjust it later
+ header_len_dtch = 0;
+ header_len_dtch_last = 0; // the header length of the last mac sdu
+ // lcid has to be sorted before the actual allocation (similar struct as ue_list).
+ for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) {
+ // TBD: check if the lcid is active
+
+ header_len_dtch += 3;
+ header_len_dtch_last = 3;
+ LOG_D(MAC, "[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n",
+ module_idP, frameP, lcid, TBS,
+ TBS - ta_len - header_len_dcch - sdu_length_total - header_len_dtch);
+
+ if (TBS - ta_len - header_len_dcch - sdu_length_total - header_len_dtch > 0) { // NN: > 2 ?
+ rlc_status = mac_rlc_status_ind(module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ lcid,
+ TBS - ta_len - header_len_dcch - sdu_length_total - header_len_dtch);
+
+
+ if (rlc_status.bytes_in_buffer > 0) {
+
+ LOG_D(MAC, "[eNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d)\n",
+ module_idP, frameP, TBS - header_len_dcch - sdu_length_total - header_len_dtch, lcid, header_len_dtch);
+ sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ lcid,
+ TBS, //not used
+ (char*)&dlsch_buffer[sdu_length_total]);
+ T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
+ T_INT(harq_pid), T_INT(lcid), T_INT(sdu_lengths[num_sdus]));
+
+ LOG_D(MAC, "[eNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n", module_idP, sdu_lengths[num_sdus], lcid);
+ sdu_lcids[num_sdus] = lcid;
+ sdu_length_total += sdu_lengths[num_sdus];
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1;
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[num_sdus];
+ if (sdu_lengths[num_sdus] < 128) {
+ header_len_dtch--;
+ header_len_dtch_last--;
+ }
+ num_sdus++;
+ } // no data for this LCID
+ else {
+ header_len_dtch -= 3;
+ }
+ } // no TBS left
+ else {
+ header_len_dtch -= 3;
+ break;
+ }
+ }
+ if (header_len_dtch == 0)
+ header_len_dtch_last = 0;
+ // there is at least one SDU
+ // if (num_sdus > 0 ){
+ if ((sdu_length_total + header_len_dcch + header_len_dtch) > 0) {
+
+ // Now compute number of required RBs for total sdu length
+ // Assume RAH format 2
+ // adjust header lengths
+ header_len_dcch_tmp = header_len_dcch;
+ header_len_dtch_tmp = header_len_dtch;
+ if (header_len_dtch == 0) {
+ header_len_dcch = (header_len_dcch > 0) ? 1 : 0;//header_len_dcch; // remove length field
+ }
+ else {
+ header_len_dtch_last -= 1; // now use it to find how many bytes has to be removed for the last MAC SDU
+ header_len_dtch = (header_len_dtch > 0) ? header_len_dtch - header_len_dtch_last : header_len_dtch; // remove length field for the last SDU
+ }
+
+ //mcs = eNB_UE_stats->dlsch_mcs1;
+ //if (mcs == 0) {
+ // nb_rb = 4; // don't let the TBS get too small
+ //}
+ //else {
+ // nb_rb = min_rb_unit[CC_id];
+ //}
+
+ //[khalid]: maximum MCS (7 or 15) depend on the DCI formate used from UE_list->UE_template[CC_id [UE_id].rach_resource_type
+
+ mcs = 4;
+ nb_rb = 6;
+
+
+ TBS = 408;//get_TBS_DL(mcs, nb_rb);
+
+ //while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) {
+ // nb_rb += min_rb_unit[CC_id]; //
+
+ // if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs
+ // // (can happen if N_RB_DL is odd)
+ // TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_available_rb);
+ // nb_rb = nb_available_rb;
+ // break;
+ // }
+
+ // TBS = get_TBS_DL(eNB_UE_stats->dlsch_mcs1, nb_rb);
+ //}
+
+ //if (nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) {
+ for (j = 0; j < N_RBG[CC_id]; j++) { // for indicating the rballoc for each sub-band
+ UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
+ }
+ //}
+ //else
+ //{
+ // nb_rb_temp = nb_rb;
+ // j = 0;
+
+ // while ((nb_rb_temp > 0) && (j < N_RBG[CC_id])) {
+ // if (ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) {
+ // UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j];
+
+ // if ((j == N_RBG[CC_id] - 1) &&
+ // ((N_RB_DL[CC_id] == 25) ||
+ // (N_RB_DL[CC_id] == 50))) {
+ // nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id] + 1;
+ // }
+ // else {
+ // nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id];
+ // }
+ // }
+
+ // j = j + 1;
+ // }
+ //}
+
+ //RC.eNB[module_idP][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb;
+ //RC.eNB[module_idP][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id];
+
+ //for(j=0; jmu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j];
+
+ //}
+ //
+ // decrease mcs until TBS falls below required length
+ //while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs > 0)) {
+ // mcs--;
+ // TBS = get_TBS_DL(mcs, nb_rb);
+ //}
+
+ // if we have decreased too much or we don't have enough RBs, increase MCS
+ //while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (((ue_sched_ctl->dl_pow_off[CC_id] > 0) && (mcs < 28))
+ // || ((ue_sched_ctl->dl_pow_off[CC_id] == 0) && (mcs <= 15)))) {
+ // mcs++;
+ // TBS = get_TBS_DL(mcs, nb_rb);
+ //}
+
+ LOG_D(MAC, "dlsch_mcs before and after the rate matching = (%d, %d)\n", eNB_UE_stats->dlsch_mcs1, mcs);
+
+#ifdef DEBUG_eNB_SCHEDULER
+ LOG_D(MAC, "[eNB %d] CC_id %d Generated DLSCH header (mcs %d, TBS %d, nb_rb %d)\n",
+ module_idP, CC_id, mcs, TBS, nb_rb);
+ // msg("[MAC][eNB ] Reminder of DLSCH with random data %d %d %d %d \n",
+ // TBS, sdu_length_total, offset, TBS-sdu_length_total-offset);
+#endif
+
+ if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) {
+ padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len);
+ post_padding = 0;
+ }
+ else {
+ padding = 0;
+
+ // adjust the header len
+ if (header_len_dtch == 0) {
+ header_len_dcch = header_len_dcch_tmp;
+ }
+ else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2)))
+ header_len_dtch = header_len_dtch_tmp;
+ }
+
+ post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len; // 1 is for the postpadding header
+ }
+
+
+ offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
+ num_sdus, //num_sdus
+ sdu_lengths, //
+ sdu_lcids,
+ 255, // no drx
+ ue_sched_ctl->ta_update, // timing advance
+ NULL, // contention res id
+ padding,
+ post_padding);
+
+ //#ifdef DEBUG_eNB_SCHEDULER
+ if (ue_sched_ctl->ta_update) {
+ LOG_I(MAC,
+ "[eNB %d][DLSCH] Frame %d Generate header for UE_id %d on CC_id %d: sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_dcch %d, header_dtch %d\n",
+ module_idP, frameP, UE_id, CC_id, sdu_length_total, num_sdus, sdu_lengths[0], sdu_lcids[0], offset,
+ ue_sched_ctl->ta_update, padding, post_padding, mcs, TBS, nb_rb, header_len_dcch, header_len_dtch);
+ }
+ //#endif
+#ifdef DEBUG_eNB_SCHEDULER
+ LOG_T(MAC, "[eNB %d] First 16 bytes of DLSCH : \n");
+
+ for (i = 0; i < 16; i++) {
+ LOG_T(MAC, "%x.", dlsch_buffer[i]);
+ }
+
+ LOG_T(MAC, "\n");
+#endif
+ // cycle through SDUs and place in dlsch_buffer
+ memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset], dlsch_buffer, sdu_length_total);
+ // memcpy(RC.mac[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]);
+
+ // fill remainder of DLSCH with random data
+ for (j = 0; j < (TBS - sdu_length_total - offset); j++) {
+ UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset + sdu_length_total + j] = (char)(taus() & 0xff);
+ }
+
+
+ if (opt_enabled == 1) {
+ trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
+ TBS, module_idP, 3, UE_RNTI(module_idP, UE_id),
+ eNB->frame, eNB->subframe, 0, 0);
+ LOG_D(OPT, "[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n",
+ module_idP, CC_id, frameP, UE_RNTI(module_idP, UE_id), TBS);
+ }
+
+ T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
+ T_INT(harq_pid), T_BUFFER(UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], TBS));
+
+ UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb;
+
+ add_ue_dlsch_info(module_idP,
+ CC_id,
+ UE_id,
+ subframeP,
+ S_DL_SCHEDULED);
+ // store stats
+ eNB->eNB_stats[CC_id].dlsch_bytes_tx += sdu_length_total;
+ eNB->eNB_stats[CC_id].dlsch_pdus_tx += 1;
+
+ UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
+ UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb;
+ UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = 4;//eNB_UE_stats->dlsch_mcs1;
+ UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = mcs;
+ UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS;
+
+ UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes = TBS - sdu_length_total;
+ UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes += sdu_length_total;
+ UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes += TBS;
+ UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus += 1;
+
+
+
+ // do PUCCH power control
+ // this is the normalized RX power
+ eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
+ normalized_rx_power = eNB_UE_stats->Po_PUCCH_dBm;
+ target_rx_power = get_target_pucch_rx_power(module_idP, CC_id) + 20;
+
+ // this assumes accumulated tpc
+ // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
+ //int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame * 10 + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe;
+ //if (((framex10psubframe + 10) <= (frameP * 10 + subframeP)) || //normal case
+ // ((framex10psubframe > (frameP * 10 + subframeP)) && (((10240 - framex10psubframe + frameP * 10 + subframeP) >= 10)))) //frame wrap-around
+ // if (eNB_UE_stats->Po_PUCCH_update == 1) {
+ // eNB_UE_stats->Po_PUCCH_update = 0;
+
+ // UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frameP;
+ // UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframeP;
+
+ // if (normalized_rx_power > (target_rx_power + 1)) {
+ // tpc = 0; //-1
+ // tpc_accumulated--;
+ // }
+ // else if (normalized_rx_power < (target_rx_power - 1)) {
+ // tpc = 2; //+1
+ // tpc_accumulated++;
+ // }
+ // else {
+ // tpc = 1; //0
+ // }
+ //
+ //
+
+ // } // Po_PUCCH has been updated
+ // else {
+ // tpc = 1; //0
+ // } // time to do TPC update
+ //else {
+ // tpc = 1; //0
+ //}
+
+ {
+
+ // choose r3 by default for RAR (Table 9.1.5-5)
+ rep = 2;
+ // get actual repetition count from Table 9.1.5-3
+ reps = (rmax <= 8) ? (1 << rep) : (rmax >> (3 - rep));
+
+
+
+ if ((UE_list->UE_template[CC_id][UE_id].mpdcch_repetition_cnt == 0) &&
+ (mpdcch_sf_condition(eNB, CC_id, frameP, subframeP, rmax, TYPEUESPEC,UE_id) > 0))
+ {
+ // MPDCCH configuration for RAR
+ dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+ memset((void*)dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t)(2 + sizeof(nfapi_dl_config_mpdcch_pdu));
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (UE_list->UE_template[CC_id][UE_id].rach_resource_type > 1) ? 11 : 10;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = narrowBandindex_index;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = 1; // imposed (9.1.5 in 213) for Type 2 Common search space
+ AssertFatal(cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 != NULL,
+ "cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13 is null\n");
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = cc[CC_id].sib1_v13ext->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 16; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 4; // other-RNTI
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = rnti;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (UE_list->UE_template[CC_id][UE_id].rach_resource_type < 3) ? 1 : 2;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = cc[CC_id].physCellId;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV(6, 0, 6); // Note: still to be checked if it should not be (getRIV(N_RB_DL,first_rb,6)) : Check nFAPI specifications and what is done L1 with this parameter
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 4; // fix to 4 for now
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = harq_pid;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = rep;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 1;// N1A_PRB=3 (36.212); => 208 bits for mcs=4, choose mcs according t message size TBD
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0; // this is not needed by OAI L1, but should be filled in
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1;
+ UE_list->UE_template[CC_id][UE_id].mpdcch_repetition_cnt++;
+ dl_req->number_pdu++;
+
+
+ // Toggle NDI for next time
+ LOG_D(MAC, "CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n",
+ CC_id, frameP, subframeP, UE_id,
+ UE_list->UE_template[CC_id][UE_id].rnti, harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]);
+
+ UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
+ UE_list->UE_template[CC_id][UE_id].oldmcs1[harq_pid] = mcs;
+ UE_list->UE_template[CC_id][UE_id].oldmcs2[harq_pid] = 0;
+
+ eNB->TX_req[CC_id].sfn_sf = (frameP << 3) + subframeP;
+ TX_req = &eNB->TX_req[CC_id].tx_request_body.tx_pdu_list[eNB->TX_req[CC_id].tx_request_body.number_of_pdus];
+ TX_req->pdu_length = TBS;
+ TX_req->pdu_index = eNB->pdu_index[CC_id]++;
+ TX_req->num_segments = 1;
+ TX_req->segments[0].segment_length = TBS;
+ TX_req->segments[0].segment_data = eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[harq_pid];
+ eNB->TX_req[CC_id].tx_request_body.number_of_pdus++;
+
+ } //repetition_count==0 && SF condition met
+ else if (UE_list->UE_template[CC_id][UE_id].mpdcch_repetition_cnt > 0)
+ {
+ // we're in a stream of repetitions
+ UE_list->UE_template[CC_id][UE_id].mpdcch_repetition_cnt++;
+ if (UE_list->UE_template[CC_id][UE_id].mpdcch_repetition_cnt == reps)
+ {
+ // this is the last mpdcch repetition
+ if (cc[CC_id].tdd_Config == NULL) { // FDD case
+ // wait 2 subframes for PDSCH transmission
+ if (subframeP > 7) UE_list->UE_template[CC_id][UE_id].Msg2_frame = (frameP + 1) & 1023;
+ else UE_list->UE_template[CC_id][UE_id].Msg2_frame = frameP;
+ UE_list->UE_template[CC_id][UE_id].Msg2_subframe = (subframeP + 2) % 10; // +2 is the "n+x" from Section 7.1.11 in 36.213
+ }
+ else {
+ AssertFatal(1 == 0, "TDD case not done yet\n");
+ }
+ } // mpdcch_repetition_count == reps
+ if ((UE_list->UE_template[CC_id][UE_id].Msg2_frame == frameP) && (UE_list->UE_template[CC_id][UE_id].Msg2_subframe == subframeP)) {
+ // Program PDSCH
+
+ dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+ memset((void*)dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t)(2 + sizeof(nfapi_dl_config_dlsch_pdu));
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = eNB->pdu_index[CC_id];
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = rnti;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 4; // format 6-1A
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 6);
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1;// first block
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc->p_eNB == 1) ? 0 : 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize(cc->mib->message.dl_Bandwidth); // ignored
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc->p_eNB == 1) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (UE_list->UE_template[CC_id][UE_id].rach_resource_type < 3) ? 1 : 2;;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
+ dl_req->number_pdu++;
+
+ // Program UL processing for Msg3, same as regular LTE
+ //get_Msg3alloc(&cc[CC_idP], subframeP, frameP, &RA_template->Msg3_frame, &RA_template->Msg3_subframe);
+
+
+ //fill_rar_br(eNB, CC_idP, RA_template, frameP, subframeP, cc[CC_idP].RAR_pdu.payload, RA_template->rach_resource_type - 1);
+ //// DL request
+ //eNB->TX_req[CC_idP].sfn_sf = (frameP << 3) + subframeP;
+ //TX_req = &eNB->TX_req[CC_idP].tx_request_body.tx_pdu_list[eNB->TX_req[CC_idP].tx_request_body.number_of_pdus];
+ //TX_req->pdu_length = 7; // This should be changed if we have more than 1 preamble
+ //TX_req->pdu_index = eNB->pdu_index[CC_idP]++;
+ //TX_req->num_segments = 1;
+ //TX_req->segments[0].segment_length = 7;
+ //TX_req->segments[0].segment_data = cc[CC_idP].RAR_pdu.payload;
+ //eNB->TX_req[CC_idP].tx_request_body.number_of_pdus++;
+ }
+ }
+
+ }
+
+ //dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+ //memset((void*)dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t));
+ //dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
+ //dl_config_pdu->pdu_size = (uint8_t)(2 + sizeof(nfapi_dl_config_dci_dl_pdu));
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1;
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = get_aggregation(get_bw_index(module_idP, CC_id), eNB_UE_stats->dl_cqi, format1);
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti = rnti;
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 1; // CRNTI : see Table 4-10 from SCF082 - nFAPI specifications
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power
+
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = harq_pid;
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = tpc; // dont adjust power when retransmitting
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = mcs;
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0;
+ ////deactivate second codeword
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_2 = 0;
+ //dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_2 = 1;
+
+ //dl_req->number_dci++;
+ //dl_req->number_pdu++;
+
+
+ }
+ else { // There is no data from RLC or MAC header, so don't schedule
+
+ }
+ }
+
+ if (cc[CC_id].tdd_Config != NULL) { // TDD
+ set_ul_DAI(module_idP, UE_id, CC_id, frameP, subframeP);
+ }
+
+ } // UE_id loop
+ } // CC_id loop
+
+
+ fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_flag);
+
+ stop_meas(&eNB->schedule_dlsch);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH, VCD_FUNCTION_OUT);
+
+}
+*/
+
+
//------------------------------------------------------------------------------
void
schedule_ue_spec(module_id_t module_idP, int slice_idxP,
@@ -583,6 +1677,8 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP,
continue_flag = 1;
}
+ if (UE_list->UE_template[CC_id][UE_id].rach_resource_type > 0) continue_flag=1;
+
if (eNB_UE_stats == NULL) {
LOG_D(MAC, "[eNB] Cannot find eNB_UE_stats\n");
continue_flag = 1;
@@ -613,7 +1709,7 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP,
break;
default:
- LOG_W(MAC, "Unsupported transmission mode %d\n", get_tmode(module_idP, CC_id, UE_id));
+ AssertFatal(1==0,"Unsupported transmission mode %d\n", get_tmode(module_idP, CC_id, UE_id));
aggregation = 2;
}
}
@@ -1595,6 +2691,606 @@ void dlsch_scheduler_qos_multiplexing(module_id_t Mod_id, int frameP, sub_frame_
}
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+//------------------------------------------------------------------------------
+void
+schedule_ue_spec_br(
+ module_id_t module_idP,
+ frame_t frameP,
+ sub_frame_t subframeP
+ ) {
+ int CC_id = 0,UE_id;
+ eNB_MAC_INST *mac = RC.mac[module_idP];
+ COMMON_channels_t *cc = mac->common_channels;
+ UE_list_t *UE_list = &mac->UE_list;
+ UE_TEMPLATE *UE_template;
+ UE_sched_ctrl *ue_sched_ctl;
+ int32_t tpc=1;
+ int rvseq[4] = {0,2,3,1};
+ mac_rlc_status_resp_t rlc_status;
+ unsigned char header_len_dcch=0, header_len_dcch_tmp=0;
+ unsigned char header_len_dtch=0, header_len_dtch_tmp=0, header_len_dtch_last=0;
+ unsigned char ta_len=0;
+ unsigned char sdu_lcids[NB_RB_MAX],lcid,offset,num_sdus=0;
+ uint16_t TBS,j,sdu_lengths[NB_RB_MAX],rnti,padding=0,post_padding=0;
+ unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES];
+ int round;
+ int ta_update;
+ uint16_t sdu_length_total = 0;
+ int mcs;
+ int32_t normalized_rx_power, target_rx_power;
+
+ nfapi_dl_config_request_pdu_t *dl_config_pdu;
+ nfapi_ul_config_request_pdu_t *ul_config_pdu;
+ nfapi_tx_request_pdu_t *TX_req;
+ nfapi_dl_config_request_body_t *dl_req;
+ nfapi_ul_config_request_body_t *ul_req;
+
+ struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach;
+ struct LTE_PUCCH_ConfigCommon_v1310 *ext4_pucch;
+ LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13;
+ struct LTE_N1PUCCH_AN_InfoList_r13 *pucch_N1PUCCH_AN_InfoList_r13;
+ int pucchreps[4] = { 1, 1, 1, 1 };
+ int n1pucchan[4] = { 0, 0, 0, 0 };
+ uint32_t ackNAK_absSF;
+ int first_rb;
+
+ dl_req = &mac->DL_req[CC_id].dl_config_request_body;
+ dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+
+ if ((frameP&1) == 0) return;
+
+ if (cc[CC_id].mib->message.schedulingInfoSIB1_BR_r13 ==0) return;
+
+ if (cc[CC_id].radioResourceConfigCommon_BR) {
+
+ ext4_prach = cc[CC_id].radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+ ext4_pucch = cc[CC_id].radioResourceConfigCommon_BR->ext4->pucch_ConfigCommon_v1310;
+ prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+ pucch_N1PUCCH_AN_InfoList_r13 = ext4_pucch->n1PUCCH_AN_InfoList_r13;
+ AssertFatal (prach_ParametersListCE_r13 != NULL, "prach_ParametersListCE_r13 is null\n");
+ AssertFatal (pucch_N1PUCCH_AN_InfoList_r13 != NULL, "pucch_N1PUCCH_AN_InfoList_r13 is null\n");
+ // check to verify CE-Level compatibility in SIB2_BR
+ AssertFatal (prach_ParametersListCE_r13->list.count == pucch_N1PUCCH_AN_InfoList_r13->list.count, "prach_ParametersListCE_r13->list.count!= pucch_N1PUCCH_AN_InfoList_r13->list.count\n");
+
+ switch (prach_ParametersListCE_r13->list.count) {
+ case 4:
+ n1pucchan[3] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[3];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level3 shouldn't be NULL\n");
+ pucchreps[3] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level3_r13);
+
+ case 3:
+ n1pucchan[2] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[2];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level2 shouldn't be NULL\n");
+ pucchreps[2] = (int) (4 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level2_r13);
+ case 2:
+ n1pucchan[1] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[1];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level1 shouldn't be NULL\n");
+ pucchreps[1] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level1_r13);
+ case 1:
+ n1pucchan[0] = *pucch_N1PUCCH_AN_InfoList_r13->list.array[0];
+ AssertFatal (ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13 != NULL, "pucch_NumRepetitionCE_Msg4_Level0 shouldn't be NULL\n");
+ pucchreps[0] = (int) (1 << *ext4_pucch->pucch_NumRepetitionCE_Msg4_Level0_r13);
+ break;
+ default:
+ AssertFatal (1 == 0, "Illegal count for prach_ParametersListCE_r13 %d\n", prach_ParametersListCE_r13->list.count);
+ }
+ }
+
+ for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
+
+ int harq_pid = 0;
+
+ rnti = UE_RNTI(module_idP,UE_id);
+ if (rnti==NOT_A_RNTI) continue;
+
+ ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
+ UE_template = &UE_list->UE_template[CC_id][UE_id];
+
+ if (UE_template->rach_resource_type == 0) continue;
+ uint8_t rrc_status = mac_eNB_get_rrc_status(module_idP, rnti);
+
+ if (rrc_status < RRC_CONNECTED) continue;
+
+ round = ue_sched_ctl->round[CC_id][harq_pid];
+
+ AssertFatal (UE_template->physicalConfigDedicated != NULL,
+ "UE_template->physicalConfigDedicated is null\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL,
+ "UE_template->physicalConfigDedicated->ext4 is null\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n");
+
+ LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0];
+
+ AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n");
+ AssertFatal(epdcch_setconfig_r11->ext2!=NULL, "epdcch_setconfig_r11->ext2 is null\n");
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13!=NULL,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13!=NULL,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present==LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n");
+ AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310!=NULL,
+ "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null");
+ AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present==LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup,
+ "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n");
+
+
+ // simple scheduler for 1 repetition, 1 HARQ
+ if (subframeP == 5) { // MPDCCH
+
+ if (round == 8) {
+ rlc_status.bytes_in_buffer = 0;
+ // Now check RLC information to compute number of required RBs
+ // get maximum TBS size for RLC request
+ TBS = get_TBS_DL(9,6);
+ // check first for RLC data on DCCH
+ // add the length for all the control elements (timing adv, drx, etc) : header + payload
+
+ if (ue_sched_ctl->ta_timer == 0) {
+ ta_update = ue_sched_ctl->ta_update;
+ /* if we send TA then set timer to not send it for a while */
+ if (ta_update != 31)
+ ue_sched_ctl->ta_timer = 20;
+ /* reset ta_update */
+ ue_sched_ctl->ta_update = 31;
+ } else {
+ ta_update = 31;
+ }
+
+ ta_len = (ta_update != 31) ? 2 : 0;
+
+ header_len_dcch = 2; // 2 bytes DCCH SDU subheader
+
+ if ( TBS-ta_len-header_len_dcch > 0 ) {
+ LOG_I(MAC,"Calling mac_rlc_status_ind for DCCH\n");
+ rlc_status = mac_rlc_status_ind(
+ module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH,
+ (TBS-ta_len-header_len_dcch)
+ ,0, 0
+ ); // transport block set size
+
+ sdu_lengths[0]=0;
+
+ if (rlc_status.bytes_in_buffer > 0) { // There is DCCH to transmit
+ LOG_I(MAC,"[eNB %d] Frame %d, DL-DCCH->DLSCH CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
+ module_idP,frameP,CC_id,TBS-header_len_dcch);
+ sdu_lengths[0] = mac_rlc_data_req(
+ module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH,
+ TBS, //not used
+ (char *)&dlsch_buffer[0]
+ ,0, 0
+);
+
+ T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
+ T_INT(harq_pid), T_INT(DCCH), T_INT(sdu_lengths[0]));
+
+ LOG_I(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",module_idP,CC_id,sdu_lengths[0]);
+ sdu_length_total = sdu_lengths[0];
+ sdu_lcids[0] = DCCH;
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH]+=1;
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH]+=sdu_lengths[0];
+ num_sdus = 1;
+ } else {
+ header_len_dcch = 0;
+ sdu_length_total = 0;
+ }
+ }
+
+ // check for DCCH1 and update header information (assume 2 byte sub-header)
+ if (TBS-ta_len-header_len_dcch-sdu_length_total > 0 ) {
+ rlc_status = mac_rlc_status_ind(
+ module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH+1,
+ (TBS-ta_len-header_len_dcch-sdu_length_total)
+ ,0, 0); // transport block set size less allocations for timing advance and
+ // DCCH SDU
+ sdu_lengths[num_sdus] = 0;
+
+ if (rlc_status.bytes_in_buffer > 0) {
+ LOG_I(MAC,"[eNB %d], Frame %d, DCCH1->DLSCH, CC_id %d, Requesting %d bytes from RLC (RRC message)\n",
+ module_idP,frameP,CC_id,TBS-header_len_dcch-sdu_length_total);
+ sdu_lengths[num_sdus] += mac_rlc_data_req(
+ module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ DCCH+1,
+ TBS, //not used
+ (char *)&dlsch_buffer[sdu_length_total]
+ ,0, 0
+ );
+
+ T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
+ T_INT(harq_pid), T_INT(DCCH+1), T_INT(sdu_lengths[num_sdus]));
+
+ sdu_lcids[num_sdus] = DCCH1;
+ sdu_length_total += sdu_lengths[num_sdus];
+ header_len_dcch += 2;
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH1]+=1;
+ UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH1]+=sdu_lengths[num_sdus];
+ num_sdus++;
+ }
+ }
+
+ // assume the max dtch header size, and adjust it later
+ header_len_dtch=0;
+ header_len_dtch_last=0; // the header length of the last mac sdu
+ // lcid has to be sorted before the actual allocation (similar struct as ue_list).
+ for (lcid=NB_RB_MAX-1; lcid>=DTCH ; lcid--){
+ // TBD: check if the lcid is active
+
+ header_len_dtch+=3;
+ header_len_dtch_last=3;
+ LOG_D(MAC,"[eNB %d], Frame %d, DTCH%d->DLSCH, Checking RLC status (tbs %d, len %d)\n",
+ module_idP,frameP,lcid,TBS,
+ TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch);
+
+ if (TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { // NN: > 2 ?
+ rlc_status = mac_rlc_status_ind(module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ subframeP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ lcid,
+ TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch
+ ,0, 0);
+
+
+ if (rlc_status.bytes_in_buffer > 0) {
+
+ LOG_I(MAC,"[eNB %d][USER-PLANE DEFAULT DRB] Frame %d : DTCH->DLSCH, Requesting %d bytes from RLC (lcid %d total hdr len %d)\n",
+ module_idP,frameP,TBS-header_len_dcch-sdu_length_total-header_len_dtch,lcid, header_len_dtch);
+ sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
+ rnti,
+ module_idP,
+ frameP,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ lcid,
+ TBS, //not used
+ (char*)&dlsch_buffer[sdu_length_total]
+ ,0, 0);
+ T(T_ENB_MAC_UE_DL_SDU, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
+ T_INT(harq_pid), T_INT(lcid), T_INT(sdu_lengths[num_sdus]));
+
+ LOG_I(MAC,"[eNB %d][USER-PLANE DEFAULT DRB] Got %d bytes for DTCH %d \n",module_idP,sdu_lengths[num_sdus],lcid);
+ sdu_lcids[num_sdus] = lcid;
+ sdu_length_total += sdu_lengths[num_sdus];
+
+ if (sdu_lengths[num_sdus] < 128) {
+ header_len_dtch--;
+ header_len_dtch_last--;
+ }
+ num_sdus++;
+ } // no data for this LCID
+ else {
+ header_len_dtch-=3;
+ }
+ } // no TBS left
+ else {
+ header_len_dtch-=3;
+ break;
+ }
+ }
+ if (header_len_dtch == 0 )
+ header_len_dtch_last= 0;
+ // there is at least one SDU
+ // if (num_sdus > 0 ){
+ if ((sdu_length_total + header_len_dcch + header_len_dtch )> 0) {
+
+ // Now compute number of required RBs for total sdu length
+ // Assume RAH format 2
+ // adjust header lengths
+ header_len_dcch_tmp = header_len_dcch;
+ header_len_dtch_tmp = header_len_dtch;
+ if (header_len_dtch==0) {
+ header_len_dcch = (header_len_dcch >0) ? 1 : 0;//header_len_dcch; // remove length field
+ } else {
+ header_len_dtch_last-=1; // now use it to find how many bytes has to be removed for the last MAC SDU
+ header_len_dtch = (header_len_dtch > 0) ? header_len_dtch - header_len_dtch_last :header_len_dtch; // remove length field for the last SDU
+ }
+
+ mcs = 9;
+
+ // decrease mcs until TBS falls below required length
+ while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs>0)) {
+ mcs--;
+ TBS = get_TBS_DL(mcs,6);
+ }
+
+ // if we have decreased too much or we don't have enough RBs, increase MCS
+ while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) {
+ mcs++;
+ TBS = get_TBS_DL(mcs,6);
+ }
+
+ //#ifdef DEBUG_eNB_SCHEDULER
+ LOG_I(MAC,"[eNB %d] CC_id %d Generated DLSCH header (mcs %d, TBS %d, nb_rb %d)\n",
+ module_idP,CC_id,mcs,TBS,6);
+ // msg("[MAC][eNB ] Reminder of DLSCH with random data %d %d %d %d \n",
+ // TBS, sdu_length_total, offset, TBS-sdu_length_total-offset);
+
+
+ if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) {
+ padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len);
+ post_padding = 0;
+ } else {
+ padding = 0;
+
+ // adjust the header len
+ if (header_len_dtch==0) {
+ header_len_dcch = header_len_dcch_tmp;
+ } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2)))
+ header_len_dtch = header_len_dtch_tmp;
+ }
+
+ post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header
+ }
+
+
+ offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
+ num_sdus, //num_sdus
+ sdu_lengths, //
+ sdu_lcids,
+ 255, // no drx
+ ta_update, // timing advance
+ NULL, // contention res id
+ padding,
+ post_padding);
+
+
+ if (ta_update != 31) {
+ LOG_D(MAC,
+ "[eNB %d][DLSCH] Frame %d Generate header for UE_id %d on CC_id %d: sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d,timing advance value : %d, padding %d,post_padding %d,(mcs %d, TBS %d, nb_rb %d),header_dcch %d, header_dtch %d\n",
+ module_idP,frameP, UE_id, CC_id, sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],offset,
+ ta_update,padding,post_padding,mcs,TBS,6,header_len_dcch,header_len_dtch);
+ }
+
+
+
+ // cycle through SDUs and place in dlsch_buffer
+ memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],dlsch_buffer,sdu_length_total);
+ // memcpy(RC.mac[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]);
+
+ // fill remainder of DLSCH with random data
+ for (j=0; j<(TBS-sdu_length_total-offset); j++) {
+ UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset+sdu_length_total+j] = (char)(taus()&0xff);
+ }
+
+
+ if (opt_enabled == 1) {
+ trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0],
+ TBS, module_idP, 3, UE_RNTI(module_idP,UE_id),
+ mac->frame, mac->subframe,0,0);
+ LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n",
+ module_idP, CC_id, frameP, UE_RNTI(module_idP,UE_id), TBS);
+ }
+
+ T(T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP), T_INT(subframeP),
+ T_INT(harq_pid), T_BUFFER(UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], TBS));
+
+ // do PUCCH power control
+ // this is the normalized RX power
+
+ /* TODO: fix how we deal with power, unit is not dBm, it's special from nfapi */
+ normalized_rx_power = (5*ue_sched_ctl->pucch1_snr[CC_id]-640)/10+30;
+ target_rx_power = mac->puCch10xSnr/10+30;
+
+ // this assumes accumulated tpc
+ // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
+ int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame*10+UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe;
+ if (((framex10psubframe+10)<=(frameP*10+subframeP)) || //normal case
+ ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=10)))) //frame wrap-around
+ if (ue_sched_ctl->pucch1_cqi_update[CC_id] == 1) {
+ ue_sched_ctl->pucch1_cqi_update[CC_id] = 0;
+
+ UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frameP;
+ UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframeP;
+
+ if (normalized_rx_power>(target_rx_power+4)) {
+ tpc = 0; //-1
+ } else if (normalized_rx_power<(target_rx_power-4)) {
+ tpc = 2; //+1
+ } else {
+ tpc = 1; //0
+ }
+
+ LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, normalized/target rx power %d/%d\n",
+ module_idP,frameP, subframeP,harq_pid,tpc,
+ normalized_rx_power,target_rx_power);
+
+ } // Po_PUCCH has been updated
+ else {
+ tpc = 1; //0
+ } // time to do TPC update
+ else {
+ tpc = 1; //0
+ }
+
+ // Toggle NDI in first round
+ UE_template->oldNDI[harq_pid] = 1-UE_template->oldNDI[harq_pid];
+ ue_sched_ctl->round[CC_id][harq_pid] = 0;
+ round=0;
+ }
+
+ }
+
+ if (round < 8) {
+ // fill in MDPDCCH
+ memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 11 : 10;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_narrow_band = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_prb_pairs = 6;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mpdcch_tansmission_type = epdcch_setconfig_r11->transmissionType_r11;
+ AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11!=NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n");
+
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.aggregation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti_type = 4; // t-CRNTI
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.rnti = rnti;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.transmission_power = 6000; // 0dB
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.resource_block_coding = getRIV (6, 0, 6) | ((epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1)<<5);
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs = 9; // adjust according to size of RAR, 208 bits with N1A_PRB=3
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pdsch_reptition_levels = 0; // fix to 4 for now
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.redundancy_version = rvseq[round&3];
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.new_data_indicator = UE_template->oldNDI[harq_pid];
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_process = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.pmi = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.harq_resource_offset = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.dci_subframe_repetition_number = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.tpc = 3;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index_length = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.downlink_assignment_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.allocate_prach_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.preamble_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.prach_mask_index = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.starting_ce_level = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.srs_request = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.antenna_ports_and_scrambling_identity = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.frequency_hopping_enabled_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.paging_direct_indication_differentiation_flag = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.direct_indication = 0;
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.total_dci_length_including_padding = 0; // this is not needed by OAI L1, but should be filled in
+ dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.number_of_tx_antenna_ports = 1;
+ dl_req->number_pdu++;
+ UE_template->mcs[harq_pid] = dl_config_pdu->mpdcch_pdu.mpdcch_pdu_rel13.mcs;
+ }
+ }
+ else if ((subframeP == 7)&&(round<8)) { // DLSCH
+
+ int absSF = (frameP * 10) + subframeP;
+
+ // Have to check that MPDCCH was generated
+ LOG_I (MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating DLSCH (ce_level %d RNTI %x)\n",
+ module_idP, CC_id, frameP, subframeP, UE_template->rach_resource_type - 1,rnti);
+
+ first_rb = narrowband_to_first_rb (&cc[CC_id], epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1);
+ dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
+ memset ((void *) dl_config_pdu, 0, sizeof (nfapi_dl_config_request_pdu_t));
+ dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DLSCH_PDU_TYPE;
+ dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_dlsch_pdu));
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index = mac->pdu_index[CC_id];
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = rnti;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV (to_prb (cc[CC_id].mib->message.dl_Bandwidth), first_rb, 6); // check that this isn't getRIV(6,0,6)
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_block_to_codeword_swap_flag = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_scheme = (cc[CC_id].p_eNB == 1) ? 0 : 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_layers = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.number_of_subbands = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.codebook_index = ;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ue_category_capacity = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pa = 4; // 0 dB
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.delta_power_offset_index = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.ngap = 0;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.nprb = get_subbandsize (cc[CC_id].mib->message.dl_Bandwidth); // ignored
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transmission_mode = (cc[CC_id].p_eNB == 1) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
+ // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
+
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
+
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = (UE_template->rach_resource_type < 3) ? 1 : 2;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not SI message
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
+ dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
+ dl_req->number_pdu++;
+
+ // DL request
+ mac->TX_req[CC_id].sfn_sf = (frameP << 4) + subframeP;
+ TX_req = &mac->TX_req[CC_id].tx_request_body.tx_pdu_list[mac->TX_req[CC_id].tx_request_body.number_of_pdus];
+ TX_req->pdu_length = get_TBS_DL(UE_template->mcs[harq_pid],
+ 6);
+ TX_req->pdu_index = mac->pdu_index[CC_id]++;
+ TX_req->num_segments = 1;
+ TX_req->segments[0].segment_length = TX_req->pdu_length;
+ TX_req->segments[0].segment_data = mac->UE_list.DLSCH_pdu[CC_id][0][(unsigned char) UE_id].payload[0];
+ mac->TX_req[CC_id].tx_request_body.number_of_pdus++;
+
+ ackNAK_absSF = absSF + 4;
+ ul_req = &mac->UL_req_tmp[CC_id][ackNAK_absSF % 10].ul_config_request_body;
+ ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
+
+ ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
+ ul_config_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_ul_config_uci_harq_pdu));
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0; // don't know how to use this
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti = rnti;
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.ue_type = (UE_template->rach_resource_type < 3) ? 1 : 2;
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.empty_symbols = 0;
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions = pucchreps[UE_template->rach_resource_type - 1];
+ ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.repetition_number = 0;
+
+ if (cc[CC_id].tdd_Config == NULL) { // FDD case
+ ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.n_pucch_1_0 = n1pucchan[UE_template->rach_resource_type - 1];
+ // NOTE: How to fill in the rest of the n_pucch_1_0 information 213 Section 10.1.2.1 in the general case
+ // = N_ECCE_q + Delta_ARO + n1pucchan[ce_level]
+ // higher in the MPDCCH configuration, N_ECCE_q is hard-coded to 0, and harq resource offset to 0 =>
+ // Delta_ARO = 0 from Table 10.1.2.1-1
+ ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.harq_size = 1; // 1-bit ACK/NAK
+ ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel9_fdd.number_of_pucch_resources = 1;
+ } else {
+ AssertFatal (1 == 0, "PUCCH configuration for ACK/NAK not handled yet for TDD BL/CE case\n");
+ }
+ ul_req->number_of_pdus++;
+ T (T_ENB_MAC_UE_DL_PDU_WITH_DATA, T_INT (module_idP), T_INT (CC_id), T_INT (rnti), T_INT (frameP), T_INT (subframeP),
+ T_INT (0 /*harq_pid always 0? */ ), T_BUFFER (&mac->UE_list.DLSCH_pdu[CC_id][0][UE_id].payload[0], TX_req->pdu_length));
+
+ if (opt_enabled == 1) {
+ trace_pdu (1, (uint8_t *) mac->UE_list.DLSCH_pdu[CC_id][0][(unsigned char) UE_id].payload[0], TX_req->pdu_length , UE_id, 3, rnti, frameP, subframeP, 0, 0);
+ LOG_D (OPT, "[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n", module_idP, CC_id, frameP, rnti, TX_req->pdu_length );
+ }
+
+ }
+ }
+
+}
+#endif
+
//------------------------------------------------------------------------------
void
fill_DLSCH_dci(module_id_t module_idP,
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
index a8009d4551..c0fa4ddb1e 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
@@ -195,7 +195,7 @@ void dlsch_scheduler_pre_ue_select_fairRR(
// Initialization
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
- dlsch_ue_max_num[CC_id] = (uint16_t)RC.rrc[module_idP]->configuration.ue_multiple_max[CC_id];
+ dlsch_ue_max_num[CC_id] = (uint16_t)RC.rrc[module_idP]->configuration.radioresourceconfig[CC_id].ue_multiple_max;
// save origin DL PDU number
DL_req = &eNB->DL_req[CC_id].dl_config_request_body;
saved_dlsch_dci[CC_id] = DL_req->number_pdu;
@@ -1972,7 +1972,7 @@ void ulsch_scheduler_pre_ue_select_fairRR(
//save ulsch dci number
saved_ulsch_dci[CC_id] = eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body.number_of_dci;
// maximum multiplicity number
- ulsch_ue_max_num[CC_id] =RC.rrc[module_idP]->configuration.ue_multiple_max[CC_id];
+ ulsch_ue_max_num[CC_id] =RC.rrc[module_idP]->configuration.radioresourceconfig[CC_id].ue_multiple_max;
cc_id_flag[CC_id] = 0;
ue_first_num[CC_id] = 0;
ul_inactivity_num[CC_id] = 0;
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index cfeadb68f0..a8ce15e4a7 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -2317,7 +2317,8 @@ get_tmode(module_id_t module_idP,
{
eNB_MAC_INST *eNB = RC.mac[module_idP];
COMMON_channels_t *cc = &eNB->common_channels[CC_idP];
- LTE_PhysicalConfigDedicated_t *physicalConfigDedicated = eNB->UE_list.physicalConfigDedicated[CC_idP][UE_idP];
+
+ struct LTE_PhysicalConfigDedicated *physicalConfigDedicated = eNB->UE_list.UE_template[CC_idP][UE_idP].physicalConfigDedicated;
if (physicalConfigDedicated == NULL) { // RRCConnectionSetup not received by UE yet
AssertFatal(cc->p_eNB <= 2, "p_eNB is %d, should be <2\n", cc->p_eNB);
@@ -2325,12 +2326,14 @@ get_tmode(module_id_t module_idP,
}
AssertFatal(physicalConfigDedicated->antennaInfo != NULL,
- "antennaInfo is null for CCId %d, UEid %d\n", CC_idP, UE_idP);
+ "antennaInfo (mod_id %d) is null for CCId %d, UEid %d, physicalConfigDedicated %p\n",
+ module_idP, CC_idP, UE_idP,physicalConfigDedicated);
+
AssertFatal(physicalConfigDedicated->antennaInfo->present != LTE_PhysicalConfigDedicated__antennaInfo_PR_NOTHING,
"antennaInfo (mod_id %d, CC_id %d) is set to NOTHING\n", module_idP, CC_idP);
if (physicalConfigDedicated->antennaInfo->present == LTE_PhysicalConfigDedicated__antennaInfo_PR_explicitValue) {
- return (physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
+ return (1 + physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
}
if (physicalConfigDedicated->antennaInfo->present == LTE_PhysicalConfigDedicated__antennaInfo_PR_defaultValue) {
@@ -3641,6 +3644,9 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
harq_pid = ((10 * frameP) + subframeP + 10236) & 7;
LOG_D(MAC,"frame %d subframe %d harq_pid %d mode %d tmode[0] %d num_ack_nak %d round %d\n",frameP,subframeP,harq_pid,harq_indication_fdd->mode,tmode[0],num_ack_nak,sched_ctl->round[CC_idP][harq_pid]);
+ // use 1 HARQ proces of BL/CE UE for now
+ if (UE_list->UE_template[pCCid][UE_id].rach_resource_type > 0) harq_pid = 0;
+
switch (harq_indication_fdd->mode) {
case 0: // Format 1a/b (10.1.2.1)
AssertFatal(numCC == 1, "numCC %d > 1, should not be using Format1a/b\n", numCC);
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index e206ad6339..1fa47ac039 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -119,7 +119,6 @@ rx_sdu(const module_id_t enb_mod_idP,
int lcgid_updated[4] = {0, 0, 0, 0};
eNB_MAC_INST *mac = NULL;
UE_list_t *UE_list = NULL;
- RA_t *ra = NULL;
rrc_eNB_ue_context_t *ue_contextP = NULL;
/* Init */
@@ -128,7 +127,6 @@ rx_sdu(const module_id_t enb_mod_idP,
mac = RC.mac[enb_mod_idP];
harq_pid = subframe2harqpid(&mac->common_channels[CC_idP], frameP, subframeP);
UE_list = &mac->UE_list;
- ra = RC.mac[enb_mod_idP]->common_channels[CC_idP].ra;
memset(rx_ces, 0, MAX_NUM_CE * sizeof(unsigned char));
memset(rx_lcids, 0, NB_RB_MAX * sizeof(unsigned char));
memset(rx_lengths, 0, NB_RB_MAX * sizeof(unsigned short));
@@ -260,6 +258,15 @@ rx_sdu(const module_id_t enb_mod_idP,
}
// if UE_id == -1
} else if ((RA_id = find_RA_id(enb_mod_idP, CC_idP, current_rnti)) != -1) { // Check if this is an RA process for the rnti
+
+ RA_t *ra = (RA_t *) &(mac->common_channels[CC_idP].ra[RA_id]);
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ if (ra->rach_resource_type > 0) {
+ harq_pid = 0;
+ }
+#endif
+
AssertFatal(mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx > 1,
"maxHARQ %d should be greater than 1\n",
(int) mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
@@ -268,35 +275,36 @@ rx_sdu(const module_id_t enb_mod_idP,
enb_mod_idP,
harq_pid,
CC_idP,
- ra[RA_id].msg3_round,
+ ra->msg3_round,
current_rnti,
RA_id,
ul_cqi);
- first_rb = ra[RA_id].msg3_first_rb;
+ first_rb = ra->msg3_first_rb;
if (sduP == NULL) { // we've got an error on Msg3
- LOG_W(MAC, "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n",
+ LOG_D(MAC, "[eNB %d] CC_id %d, RA %d ULSCH in error in round %d/%d\n",
enb_mod_idP,
CC_idP,
RA_id,
- ra[RA_id].msg3_round,
+ ra->msg3_round,
(int) mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx);
- if (ra[RA_id].msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
- cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
+ if (ra->msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) {
+ cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
} else {
// first_rb = UE_list->UE_template[CC_idP][UE_id].first_rb_ul[harq_pid]; // UE_id = -1 !!!!
- ra[RA_id].msg3_round++;
+ ra->msg3_round++;
/* Prepare handling of retransmission */
get_Msg3allocret(&mac->common_channels[CC_idP],
- ra[RA_id].Msg3_subframe,
- ra[RA_id].Msg3_frame,
- &ra[RA_id].Msg3_frame,
- &ra[RA_id].Msg3_subframe);
-
- add_msg3(enb_mod_idP, CC_idP, &ra[RA_id], frameP, subframeP);
+ ra->Msg3_subframe,
+ ra->Msg3_frame,
+ &ra->Msg3_frame,
+ &ra->Msg3_subframe);
+ // prepare handling of retransmission
+
+ add_msg3(enb_mod_idP, CC_idP, ra, frameP, subframeP);
}
/* TODO: program NACK for PHICH? */
@@ -415,6 +423,8 @@ rx_sdu(const module_id_t enb_mod_idP,
RA_id = find_RA_id(enb_mod_idP, CC_idP, current_rnti);
if (RA_id != -1) {
+ RA_t *ra = &(mac->common_channels[CC_idP].ra[RA_id]);
+
mac_rrc_data_ind(enb_mod_idP,
CC_idP,
frameP, subframeP,
@@ -422,10 +432,14 @@ rx_sdu(const module_id_t enb_mod_idP,
DCCH,
(uint8_t *) payload_ptr,
rx_lengths[i],
- 0);
+ 0
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ ,ra->rach_resource_type > 0
+#endif
+ );
/* Prepare transmission of Msg4(RRCConnectionReconfiguration) */
- ra[RA_id].state = MSGCRNTI;
+ ra->state = MSGCRNTI;
LOG_I(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d : (rnti %x UE_id %d) RRCConnectionReconfiguration(Msg4)\n",
enb_mod_idP,
@@ -437,9 +451,9 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_id = old_UE_id;
current_rnti = old_rnti;
- ra[RA_id].rnti = old_rnti;
- ra[RA_id].crnti_rrc_mui = rrc_eNB_mui-1;
- ra[RA_id].crnti_harq_pid = -1;
+ ra->rnti = old_rnti;
+ ra->crnti_rrc_mui = rrc_eNB_mui-1;
+ ra->crnti_harq_pid = -1;
/* Clear timer */
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
@@ -634,16 +648,18 @@ rx_sdu(const module_id_t enb_mod_idP,
RA_id = find_RA_id(enb_mod_idP, CC_idP, current_rnti);
if (RA_id != -1) {
+ RA_t *ra = &(mac->common_channels[CC_idP].ra[RA_id]);
+
LOG_D(MAC, "[mac %d][RAPROC] CC_id %d Checking proc %d : rnti (%x, %x), state %d\n",
enb_mod_idP,
CC_idP,
RA_id,
- ra[RA_id].rnti,
+ ra->rnti,
current_rnti,
- ra[RA_id].state);
+ ra->state);
if (UE_id < 0) {
- memcpy(&(ra[RA_id].cont_res_id[0]), payload_ptr, 6);
+ memcpy(&(ra->cont_res_id[0]), payload_ptr, 6);
LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3: length %d, offset %ld\n",
enb_mod_idP,
@@ -652,9 +668,9 @@ rx_sdu(const module_id_t enb_mod_idP,
rx_lengths[i],
payload_ptr - sduP);
- if ((UE_id = add_new_ue(enb_mod_idP, CC_idP, mac->common_channels[CC_idP].ra[RA_id].rnti, harq_pid
+ if ((UE_id = add_new_ue(enb_mod_idP, CC_idP, mac->common_channels[CC_idP].ra->rnti, harq_pid
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- , mac->common_channels[CC_idP].ra[RA_id].rach_resource_type
+ , mac->common_channels[CC_idP].ra->rach_resource_type
#endif
)) == -1) {
LOG_E(MAC,"[MAC][eNB] Max user count reached\n");
@@ -662,13 +678,13 @@ rx_sdu(const module_id_t enb_mod_idP,
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); // send Connection Reject ???
break;
-
+ // kill RA proc
} else {
LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n",
enb_mod_idP,
CC_idP,
frameP,
- ra[RA_id].rnti,
+ ra->rnti,
UE_id);
}
} else {
@@ -679,6 +695,7 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_id,
rx_lengths[i],
payload_ptr - sduP);
+ // kill RA proc
}
mac_rrc_data_ind(enb_mod_idP,
@@ -688,20 +705,24 @@ rx_sdu(const module_id_t enb_mod_idP,
CCCH,
(uint8_t *) payload_ptr,
rx_lengths[i],
- 0);
+ 0
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ ,ra->rach_resource_type > 0
+#endif
+ );
if (num_ce > 0) { // handle msg3 which is not RRCConnectionRequest
// process_ra_message(msg3,num_ce,rx_lcids,rx_ces);
}
// prepare transmission of Msg4
- ra[RA_id].state = MSG4;
+ ra->state = MSG4;
if(mac->common_channels[CC_idP].tdd_Config != NULL) {
switch(mac->common_channels[CC_idP].tdd_Config->subframeAssignment) {
case 1:
- ra[RA_id].Msg4_frame = frameP + ((subframeP > 2) ? 1 : 0);
- ra[RA_id].Msg4_subframe = (subframeP + 7) % 10;
+ ra->Msg4_frame = frameP + ((subframeP > 2) ? 1 : 0);
+ ra->Msg4_subframe = (subframeP + 7) % 10;
break;
default:
@@ -713,8 +734,8 @@ rx_sdu(const module_id_t enb_mod_idP,
/* Program Msg4 PDCCH+DLSCH/MPDCCH transmission 4 subframes from now,
* Check if this is ok for BL/CE, or if the rule is different
*/
- ra[RA_id].Msg4_frame = frameP + ((subframeP > 5) ? 1 : 0);
- ra[RA_id].Msg4_subframe = (subframeP + 4) % 10;
+ ra->Msg4_frame = frameP + ((subframeP > 5) ? 1 : 0);
+ ra->Msg4_subframe = (subframeP + 4) % 10;
}
UE_list->UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0;
@@ -1093,10 +1114,6 @@ schedule_ulsch(module_id_t module_idP,
sched_frame = frameP;
cc = mac->common_channels;
- if (sched_subframe < subframeP) {
- sched_frame++;
- }
-
/* For TDD: check subframes where we have to act and return if nothing should be done now */
if (cc->tdd_Config) { // Done only for CC_id = 0, assume tdd_Config for all CC_id
int tdd_sfa = cc->tdd_Config->subframeAssignment;
@@ -1187,10 +1204,26 @@ schedule_ulsch(module_id_t module_idP,
}
}
+ if (sched_subframe < subframeP) {
+ sched_frame++;
+ }
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ int emtc_active[5];
+ memset(emtc_active, 0, 5 * sizeof(int));
+ schedule_ulsch_rnti_emtc(module_idP, frameP, subframeP, sched_subframe, emtc_active);
+#endif
+
/* Note: RC.nb_mac_CC[module_idP] should be lower than or equal to NFAPI_CC_MAX */
for (int CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++, cc++) {
first_rb[CC_id] = 1; // leave out first RB for PUCCH
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ first_rb[CC_id] = (emtc_active[CC_id] == 1) ? 7 : 1;
+#else
+ first_rb[CC_id] = 1;
+#endif
+
RA_t *ra_ptr = cc->ra;
/* From Louis-Adrien to François:
@@ -1856,3 +1889,429 @@ schedule_ulsch_rnti(module_id_t module_idP,
} // loop over all active CC_ids
} // loop over UE_ids
}
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+void schedule_ulsch_rnti_emtc(module_id_t module_idP,
+ frame_t frameP,
+ sub_frame_t subframeP,
+ unsigned char sched_subframeP,
+ int *emtc_active)
+{
+ int UE_id;
+ rnti_t rnti = -1;
+ uint8_t round = 0;
+ uint8_t harq_pid = 0;
+ uint8_t status = 0;
+ uint32_t cshift,ndi;
+ int32_t normalized_rx_power;
+ int32_t target_rx_power=-90;
+ int n;
+ int CC_id = 0;
+ int N_RB_UL;
+ eNB_MAC_INST *eNB = RC.mac[module_idP];
+ COMMON_channels_t *cc = eNB->common_channels;
+ UE_list_t *UE_list=&eNB->UE_list;
+ UE_TEMPLATE *UE_template;
+ UE_sched_ctrl *UE_sched_ctrl;
+ int sched_frame=frameP;
+ int rvidx_tab[4] = {0,2,3,1};
+ int tpc=0;
+ int cqi_req=0;
+
+ if (sched_subframePHI_DCI0_req[CC_id][subframeP].hi_dci0_request_body;
+ nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu;
+
+ nfapi_ul_config_request_body_t *ul_req_tmp = &eNB->UL_req_tmp[CC_id][sched_subframeP].ul_config_request_body;
+
+ // loop over all active UEs
+ if ((frameP&1) == 1) return;
+
+ for (UE_id=UE_list->head_ul; UE_id>=0; UE_id=UE_list->next_ul[UE_id]) {
+
+ if (UE_list->UE_template[UE_PCCID(module_idP,UE_id)][UE_id].rach_resource_type == 0) continue;
+
+ // don't schedule if Msg4 is not received yet
+ if (UE_list->UE_template[UE_PCCID(module_idP,UE_id)][UE_id].configured==FALSE) {
+ LOG_D(MAC,"[eNB %d] frame %d subfarme %d, UE %d: not configured, skipping UE scheduling \n",
+ module_idP,frameP,subframeP,UE_id);
+ continue;
+ }
+
+ rnti = UE_RNTI(module_idP,UE_id);
+
+ if (rnti==NOT_A_RNTI) {
+ LOG_W(MAC,"[eNB %d] frame %d subfarme %d, UE %d: no RNTI \n", module_idP,frameP,subframeP,UE_id);
+ continue;
+ }
+
+ // loop over all active UL CC_ids for this UE
+ for (n=0; nnumactiveULCCs[UE_id]; n++) {
+ // This is the actual CC_id in the list
+ CC_id = UE_list->ordered_ULCCids[n][UE_id];
+ N_RB_UL = to_prb(cc[CC_id].ul_Bandwidth);
+
+
+ UE_template = &UE_list->UE_template[CC_id][UE_id];
+ UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id];
+ harq_pid = 0;
+ round = UE_sched_ctrl->round_UL[CC_id][harq_pid];
+ AssertFatal(round<8,"round %d > 7 for UE %d/%x\n",round,UE_id,rnti);
+ LOG_D(MAC,"[eNB %d] frame %d subframe %d,Checking PUSCH %d for BL/CE UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n",
+ module_idP,frameP,subframeP,harq_pid,UE_id,rnti,CC_id, 24,N_RB_UL);
+
+ RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->estimated_ul_buffer;
+ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO,RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP]);
+ if ((UE_template->ul_SR >0 || round > 0 || status < RRC_CONNECTED)&&(subframeP==5))
+ // if there is information on bsr of DCCH, DTCH or if there is UL_SR, or if there is a packet to retransmit, or we want to schedule a periodic feedback every 10 frames
+ {
+ LOG_I(MAC,"[eNB %d][PUSCH %d] Frame %d subframe %d Scheduling UE %d/%x in round %d(SR %d,UL_inactivity timer %d,UL_failure timer %d,cqi_req_timer %d)\n",
+ module_idP,harq_pid,frameP,subframeP,UE_id,rnti,round,UE_template->ul_SR,
+ UE_sched_ctrl->ul_inactivity_timer,
+
+ UE_sched_ctrl->ul_failure_timer,
+
+ UE_sched_ctrl->cqi_req_timer);
+ // reset the scheduling request
+ emtc_active[CC_id]=1;
+ UE_template->ul_SR = 0;
+ status = mac_eNB_get_rrc_status(module_idP,rnti);
+
+ /*
+ if (status < RRC_CONNECTED)
+ cqi_req = 0;
+ else if (UE_sched_ctrl->cqi_req_timer>300) {
+ cqi_req = 1;
+ UE_sched_ctrl->cqi_req_timer=0;
+
+ }
+ else
+ cqi_req = 0;
+ */
+ cqi_req = 0;
+
+
+ //power control
+ //compute the expected ULSCH RX power (for the stats)
+
+ // this is the normalized RX power and this should be constant (regardless of mcs
+ normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id];
+ target_rx_power = 178;
+
+ // this assumes accumulated tpc
+ // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out
+ int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame*10+UE_template->pusch_tpc_tx_subframe;
+ if (((framex10psubframe+10)<=(frameP*10+subframeP)) || //normal case
+ ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=10)))) //frame wrap-around
+ {
+ UE_template->pusch_tpc_tx_frame=frameP;
+ UE_template->pusch_tpc_tx_subframe=subframeP;
+ if (normalized_rx_power>(target_rx_power+4)) {
+ tpc = 0; //-1
+ UE_sched_ctrl->tpc_accumulated[CC_id]--;
+ } else if (normalized_rx_power<(target_rx_power-4)) {
+ tpc = 2; //+1
+ UE_sched_ctrl->tpc_accumulated[CC_id]++;
+ } else {
+ tpc = 1; //0
+ }
+ } else {
+ tpc = 1; //0
+ }
+ //tpc = 1;
+
+
+ if (tpc!=1) {
+ LOG_D(MAC,"[eNB %d] ULSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n",
+ module_idP,frameP,subframeP,harq_pid,tpc,
+ UE_sched_ctrl->tpc_accumulated[CC_id],normalized_rx_power,target_rx_power);
+ }
+
+ // new transmission
+ if (round==0) {
+
+ ndi = 1-UE_template->oldNDI_UL[harq_pid];
+ UE_template->oldNDI_UL[harq_pid]=ndi;
+ UE_list->eNB_UE_stats[CC_id][UE_id].normalized_rx_power=normalized_rx_power;
+ UE_list->eNB_UE_stats[CC_id][UE_id].target_rx_power=target_rx_power;
+ UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=4;
+ UE_template->mcs_UL[harq_pid] = 4;
+
+
+ UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=UE_template->mcs_UL[harq_pid];
+ // buffer_occupancy = UE_template->ul_total_buffer;
+
+
+
+ UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],6);
+ UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx+=6;
+ UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=UE_template->TBS_UL[harq_pid];
+ // buffer_occupancy -= TBS;
+
+ T(T_ENB_MAC_UE_UL_SCHEDULE, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP),
+ T_INT(subframeP), T_INT(harq_pid), T_INT(UE_template->mcs_UL[harq_pid]), T_INT(0), T_INT(6),
+ T_INT(UE_template->TBS_UL[harq_pid]), T_INT(ndi));
+
+ // bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB)
+ //store for possible retransmission
+ UE_template->nb_rb_ul[harq_pid] = 6;
+
+
+ UE_sched_ctrl->ul_scheduled |= (1<head)
+ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SCHEDULED,UE_sched_ctrl->ul_scheduled);
+
+ // adjust total UL buffer status by TBS, wait for UL sdus to do final update
+ UE_template->scheduled_ul_bytes += UE_template->TBS_UL[harq_pid];
+
+ LOG_D(MAC, "scheduled_ul_bytes, new %d\n", UE_template->scheduled_ul_bytes);
+
+
+ // Cyclic shift for DM RS
+ cshift = 0;// values from 0 to 7 can be used for mapping the cyclic shift (36.211 , Table 5.5.2.1.1-1)
+ // save it for a potential retransmission
+ UE_template->cshift[harq_pid] = cshift;
+
+ AssertFatal (UE_template->physicalConfigDedicated != NULL,
+ "UE_template->physicalConfigDedicated is null\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL,
+ "UE_template->physicalConfigDedicated->ext4 is null\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n");
+ LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0];
+ AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n");
+ AssertFatal(epdcch_setconfig_r11->ext2!=NULL, "epdcch_setconfig_r11->ext2 is null\n");
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13!=NULL,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13!=NULL,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present==LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n");
+ AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310!=NULL,
+ "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null");
+ AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present==LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup,
+ "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n");
+
+ LOG_I(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL 6-0A MPDCCH for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d,UESS MPDCCH Narrowband %d\n",
+ harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,(int)epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1);
+
+ UE_template->first_rb_ul[harq_pid] = narrowband_to_first_rb (cc,
+ epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1);
+ hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi];
+ memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
+
+ hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE;
+ hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_narrowband = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1;
+
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted
+
+ AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11!=NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n");
+
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid];
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = 0;
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13==
+ LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_pdsch_HoppingConfig_r13_off,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n");
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.frequency_hopping_flag = 1-epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.redudency_version = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = UE_template->oldNDI_UL[harq_pid];
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1;
+
+ hi_dci0_req->number_of_dci++;
+
+
+ LOG_I(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d, UESS mpdcch narrowband %d\n",
+ harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,
+ (int)epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1);
+
+
+ fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
+ cqi_req,
+ cc,
+ UE_template->physicalConfigDedicated,
+ get_tmode(module_idP,CC_id,UE_id),
+ eNB->ul_handle,
+ rnti,
+ UE_template->first_rb_ul[harq_pid], // resource_block_start
+ UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks
+ UE_template->mcs_UL[harq_pid],
+ cshift, // cyclic_shift_2_for_drms
+ 0, // frequency_hopping_enabled_flag
+ 0, // frequency_hopping_bits
+ UE_template->oldNDI_UL[harq_pid], // new_data_indication
+ rvidx_tab[round&3], // redundancy_version
+ harq_pid, // harq_process_number
+ 0, // ul_tx_mode
+ 0, // current_tx_nb
+ 0, // n_srs
+ UE_template->TBS_UL[harq_pid]
+ );
+ fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
+ UE_template->rach_resource_type>2 ? 2 : 1,
+ 1, //total_number_of_repetitions
+ 1, //repetition_number
+ (frameP*10)+subframeP);
+
+
+ ul_req_tmp->number_of_pdus++;
+ eNB->ul_handle++;
+
+ add_ue_ulsch_info(module_idP,
+ CC_id,
+ UE_id,
+ subframeP,
+ S_UL_SCHEDULED);
+
+ LOG_D(MAC,"[eNB %d] CC_id %d Frame %d, subframeP %d: Generated ULSCH DCI for next UE_id %d, format 0\n", module_idP,CC_id,frameP,subframeP,UE_id);
+
+ }
+ else { // round > 0 => retransmission
+ T(T_ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP),
+ T_INT(subframeP), T_INT(harq_pid), T_INT(UE_template->mcs_UL[harq_pid]), T_INT(0), T_INT(6),
+ T_INT(round));
+
+ AssertFatal (UE_template->physicalConfigDedicated != NULL,
+ "UE_template->physicalConfigDedicated is null\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4 != NULL,
+ "UE_template->physicalConfigDedicated->ext4 is null\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 != NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11 is null\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present == LTE_EPDCCH_Config_r11__config_r11_PR_setup,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.present != setup\n");
+ AssertFatal (UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 != NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = NULL\n");
+ LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11->list.array[0];
+ AssertFatal(epdcch_setconfig_r11 != NULL, "epdcch_setconfig_r11 is null\n");
+ AssertFatal(epdcch_setconfig_r11->ext2!=NULL, "epdcch_setconfig_r11->ext2 is null\n");
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13!=NULL,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13!=NULL,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13 is null");
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->present==LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13->present is not setup\n");
+ AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310!=NULL,
+ "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 is null");
+ AssertFatal(epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present==LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup,
+ "epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present is not setup\n");
+
+ LOG_I(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL 6-0A MPDCCH for BL/CE UE %d/%x, ulsch_frame %d, ulsch_subframe %d,UESS MPDCCH Narrowband %d\n",
+ harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,(int)epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1);
+
+ UE_template->first_rb_ul[harq_pid] = narrowband_to_first_rb (cc,
+ epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1);
+ hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[hi_dci0_req->number_of_dci+hi_dci0_req->number_of_hi];
+ memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t));
+
+ hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE;
+ hi_dci0_pdu->pdu_size = (uint8_t) (2 + sizeof (nfapi_dl_config_mpdcch_pdu));
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_format = (UE_template->rach_resource_type > 1) ? 5 : 4;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type > 1) ? 2 : 1;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_narrowband = epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13-1;
+
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_prb_pairs = 6; // checked above that it has to be this
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_assignment = 0; // Note: this can be dynamic
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mpdcch_transmission_type = epdcch_setconfig_r11->transmissionType_r11; // distibuted
+
+ AssertFatal(UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11!=NULL,
+ "UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 is null\n");
+
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.start_symbol = *UE_template->physicalConfigDedicated->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ecce_index = 0; // Note: this should be dynamic
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.aggreagation_level = 24; // OK for CEModeA r1-3 (9.1.5-1b) or CEModeB r1-4
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti_type = 4; // other
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.rnti = rnti;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ce_mode = (UE_template->rach_resource_type < 3) ? 1 : 2;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.drms_scrambling_init = epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.initial_transmission_sf_io = (frameP * 10) + subframeP;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.transmission_power = 6000; // 0dB
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.resource_block_start = UE_template->first_rb_ul[harq_pid];
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_resource_blocks = 6;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.mcs = 4; // adjust according to size of RAR, 208 bits with N1A_PRB=3
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.pusch_repetition_levels = 0;
+ AssertFatal(epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13==
+ LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_pdsch_HoppingConfig_r13_off,
+ "epdcch_setconfig_r11->ext2->mpdcch_config_r13->mpdcch_pdsch_HoppingConfig_r13 is not off\n");
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.frequency_hopping_flag = 1-epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.redudency_version = rvidx_tab[round&3];
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.new_data_indication = UE_template->oldNDI_UL[harq_pid];
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.harq_process = harq_pid;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tpc = tpc;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.csi_request = cqi_req;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.ul_inex = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dai_presence_flag = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dl_assignment_index = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.srs_request = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.dci_subframe_repetition_number = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.tcp_bitmap = 0;
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.total_dci_length_include_padding = 29; // hard-coded for 10 MHz
+ hi_dci0_pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13.number_of_tx_antenna_ports = 1;
+
+ hi_dci0_req->number_of_dci++;
+ fill_nfapi_ulsch_config_request_rel8(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
+ cqi_req,
+ cc,
+ UE_template->physicalConfigDedicated,
+ get_tmode(module_idP,CC_id,UE_id),
+ eNB->ul_handle,
+ rnti,
+ UE_template->first_rb_ul[harq_pid], // resource_block_start
+ UE_template->nb_rb_ul[harq_pid], // number_of_resource_blocks
+ UE_template->mcs_UL[harq_pid],
+ cshift, // cyclic_shift_2_for_drms
+ 0, // frequency_hopping_enabled_flag
+ 0, // frequency_hopping_bits
+ UE_template->oldNDI_UL[harq_pid], // new_data_indication
+ rvidx_tab[round&3], // redundancy_version
+ harq_pid, // harq_process_number
+ 0, // ul_tx_mode
+ 0, // current_tx_nb
+ 0, // n_srs
+ UE_template->TBS_UL[harq_pid]
+ );
+ fill_nfapi_ulsch_config_request_emtc(&ul_req_tmp->ul_config_pdu_list[ul_req_tmp->number_of_pdus],
+ UE_template->rach_resource_type>2 ? 2 : 1,
+ 1, //total_number_of_repetitions
+ 1, //repetition_number
+ (frameP*10)+subframeP);
+
+ ul_req_tmp->number_of_pdus++;
+ eNB->ul_handle++;
+
+ }
+ } // UE_is_to_be_scheduled
+ } // ULCCs
+ } // loop over UE_id
+}
+#endif
diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h
index 60496424b5..5aefdf14e7 100644
--- a/openair2/LAYER2/MAC/mac.h
+++ b/openair2/LAYER2/MAC/mac.h
@@ -896,9 +896,6 @@ typedef struct {
uint32_t pucch_tpc_tx_frame;
uint32_t pucch_tpc_tx_subframe;
-#ifdef LOCALIZATION
- eNB_UE_estimated_distances distance;
-#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
uint8_t rach_resource_type;
@@ -978,6 +975,7 @@ typedef struct {
uint16_t feedback_cnt[NFAPI_CC_MAX];
uint16_t timing_advance;
uint16_t timing_advance_r9;
+ uint8_t tpc_accumulated[NFAPI_CC_MAX];
uint8_t periodic_wideband_cqi[NFAPI_CC_MAX];
uint8_t periodic_wideband_spatial_diffcqi[NFAPI_CC_MAX];
uint8_t periodic_wideband_pmi[NFAPI_CC_MAX];
@@ -1000,63 +998,66 @@ typedef struct {
/*! \brief eNB template for the Random access information */
typedef struct {
- /// Flag to indicate this process is active
- RA_state state;
- /// 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;
- /// harq_pid used for Msg4 transmission
- uint8_t harq_pid;
- /// UE RNTI allocated during RAR
- rnti_t rnti;
- /// RA RNTI allocated from received PRACH
- uint16_t RA_rnti;
- /// Received preamble_index
- 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;
+ /// Flag to indicate this process is active
+ RA_state state;
+ /// 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;
+ /// harq_pid used for Msg4 transmission
+ uint8_t harq_pid;
+ /// UE RNTI allocated during RAR
+ rnti_t rnti;
+ /// RA RNTI allocated from received PRACH
+ uint16_t RA_rnti;
+ /// Received preamble_index
+ 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;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- uint8_t rach_resource_type;
- uint8_t msg2_mpdcch_repetition_cnt;
- uint8_t msg4_mpdcch_repetition_cnt;
- uint8_t msg2_narrowband;
- uint8_t msg34_narrowband;
+ uint8_t rach_resource_type;
+ uint8_t msg2_mpdcch_repetition_cnt;
+ int msg2_mpdcch_done;
+ uint8_t msg4_mpdcch_repetition_cnt;
+ int msg4_mpdcch_done;
+ uint8_t msg2_narrowband;
+ uint8_t msg34_narrowband;
+ int msg4_rrc_sdu_length;
#endif
- int32_t crnti_rrc_mui;
- int8_t crnti_harq_pid;
+ int32_t crnti_rrc_mui;
+ int8_t crnti_harq_pid;
} RA_t;
@@ -1070,43 +1071,40 @@ typedef struct {
} SBMAP_CONF;
/*! \brief UE list used by eNB to order UEs/CC for scheduling*/
typedef struct {
- /// Dedicated information for UEs
- LTE_PhysicalConfigDedicated_t *physicalConfigDedicated[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
- /// DLSCH pdu
- DLSCH_PDU DLSCH_pdu[NFAPI_CC_MAX][2][MAX_MOBILES_PER_ENB];
- /// DCI template and MAC connection parameters for UEs
- UE_TEMPLATE UE_template[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
- /// DCI template and MAC connection for RA processes
- int pCC_id[MAX_MOBILES_PER_ENB];
- /// sorted downlink component carrier for the scheduler
- int ordered_CCids[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
- /// number of downlink active component carrier
- int numactiveCCs[MAX_MOBILES_PER_ENB];
- /// sorted uplink component carrier for the scheduler
- int ordered_ULCCids[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
- /// number of uplink active component carrier
- int numactiveULCCs[MAX_MOBILES_PER_ENB];
- /// number of downlink active component carrier
- uint8_t dl_CC_bitmap[MAX_MOBILES_PER_ENB];
- /// eNB to UE statistics
- eNB_UE_STATS eNB_UE_stats[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
- /// scheduling control info
- UE_sched_ctrl UE_sched_ctrl[MAX_MOBILES_PER_ENB];
- int next[MAX_MOBILES_PER_ENB];
- int head;
- int next_ul[MAX_MOBILES_PER_ENB];
- int head_ul;
- int avail;
- int num_UEs;
- boolean_t active[MAX_MOBILES_PER_ENB];
-
- /// Sorting criteria for the UE list in the MAC preprocessor
- uint16_t sorting_criteria[MAX_NUM_SLICES][CR_NUM];
- uint16_t first_rb_offset[NFAPI_CC_MAX][MAX_NUM_SLICES];
-
- int assoc_dl_slice_idx[MAX_MOBILES_PER_ENB];
- int assoc_ul_slice_idx[MAX_MOBILES_PER_ENB];
+ DLSCH_PDU DLSCH_pdu[NFAPI_CC_MAX][2][MAX_MOBILES_PER_ENB];
+ /// DCI template and MAC connection parameters for UEs
+ UE_TEMPLATE UE_template[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
+ /// DCI template and MAC connection for RA processes
+ int pCC_id[MAX_MOBILES_PER_ENB];
+ /// sorted downlink component carrier for the scheduler
+ int ordered_CCids[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
+ /// number of downlink active component carrier
+ int numactiveCCs[MAX_MOBILES_PER_ENB];
+ /// sorted uplink component carrier for the scheduler
+ int ordered_ULCCids[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
+ /// number of uplink active component carrier
+ int numactiveULCCs[MAX_MOBILES_PER_ENB];
+ /// number of downlink active component carrier
+ uint8_t dl_CC_bitmap[MAX_MOBILES_PER_ENB];
+ /// eNB to UE statistics
+ eNB_UE_STATS eNB_UE_stats[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB];
+ /// scheduling control info
+ UE_sched_ctrl UE_sched_ctrl[MAX_MOBILES_PER_ENB];
+ int next[MAX_MOBILES_PER_ENB];
+ int head;
+ int next_ul[MAX_MOBILES_PER_ENB];
+ int head_ul;
+ int avail;
+ int num_UEs;
+ boolean_t active[MAX_MOBILES_PER_ENB];
+
+ /// Sorting criteria for the UE list in the MAC preprocessor
+ uint16_t sorting_criteria[MAX_NUM_SLICES][CR_NUM];
+ uint16_t first_rb_offset[NFAPI_CC_MAX][MAX_NUM_SLICES];
+
+ int assoc_dl_slice_idx[MAX_MOBILES_PER_ENB];
+ int assoc_ul_slice_idx[MAX_MOBILES_PER_ENB];
} UE_list_t;
/*! \brief deleting control information*/
diff --git a/openair2/LAYER2/MAC/mac_proto.h b/openair2/LAYER2/MAC/mac_proto.h
index d64ce5a6f8..6824e1b056 100644
--- a/openair2/LAYER2/MAC/mac_proto.h
+++ b/openair2/LAYER2/MAC/mac_proto.h
@@ -113,6 +113,12 @@ void schedule_ulsch_rnti(module_id_t module_idP, int slice_idx, frame_t frameP,
unsigned char sched_subframe,
uint16_t * first_rb);
+void schedule_ulsch_rnti_emtc(module_id_t module_idP,
+ frame_t frameP,
+ sub_frame_t subframeP,
+ unsigned char sched_subframeP,
+ int *emtc_active);
+
/** \brief Second stage of DLSCH scheduling, after schedule_SI, schedule_RA and schedule_dlsch have been called. This routine first allocates random frequency assignments for SI and RA SDUs using distributed VRB allocations and adds the corresponding DCI SDU to the DCI buffer for PHY. It then loops over the UE specific DCIs previously allocated and fills in the remaining DCI fields related to frequency allocation. It assumes localized allocation of type 0 (DCI.rah=0). The allocation is done for tranmission modes 1,2,4.
@param Mod_id Instance of eNB
@param frame Frame index
@@ -133,7 +139,9 @@ void schedule_dlsch(module_id_t module_idP, frame_t frameP,
void schedule_ue_spec(module_id_t module_idP, int slice_idxP,
frame_t frameP,sub_frame_t subframe, int *mbsfn_flag);
-
+void schedule_ue_spec_br(module_id_t module_idP,
+ frame_t frameP,
+ sub_frame_t subframeP);
void schedule_ue_spec_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag);
void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP);
diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c
index 039c3318db..608321d71d 100644
--- a/openair2/LAYER2/MAC/pre_processor.c
+++ b/openair2/LAYER2/MAC/pre_processor.c
@@ -1652,7 +1652,7 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP,
// step 2: calculate the average rb per UE
LOG_D(MAC, "In ulsch_preprocessor: step2 \n");
for (UE_id = UE_list->head_ul; UE_id >= 0; UE_id = UE_list->next_ul[UE_id]) {
- // if (continueTable[UE_id]) continue;
+ if (UE_list->UE_template[CC_id][UE_id].rach_resource_type > 0) continue;
LOG_D(MAC, "In ulsch_preprocessor: handling UE %d/%x\n",
UE_id,
diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c
index 3414d7632f..2fa13fc98c 100644
--- a/openair2/LAYER2/MAC/rar_tools.c
+++ b/openair2/LAYER2/MAC/rar_tools.c
@@ -110,85 +110,101 @@ fill_rar(const module_id_t module_idP,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
//------------------------------------------------------------------------------
-unsigned short
-fill_rar_br(eNB_MAC_INST * eNB,
- int CC_id,
- RA_t * ra,
- const frame_t frameP,
- const sub_frame_t subframeP,
- uint8_t * const dlsch_buffer, const uint8_t ce_level)
+
+unsigned short fill_rar_br(eNB_MAC_INST *eNB,
+ int CC_id,
+ RA_t *ra,
+ const frame_t frameP,
+ const sub_frame_t subframeP,
+ uint8_t* const dlsch_buffer,
+ const uint8_t ce_level
+ )
//------------------------------------------------------------------------------
{
- RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer;
- COMMON_channels_t *cc = &eNB->common_channels[CC_id];
- uint8_t *rar = (uint8_t *) (dlsch_buffer + 1);
- // uint8_t nb,reps;
- uint8_t rballoc;
- uint8_t mcs, TPC, ULdelay, cqireq;
- int input_buffer_length;
+ RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)dlsch_buffer;
+ COMMON_channels_t *cc = &eNB->common_channels[CC_id];
+ uint8_t *rar = (uint8_t *)(dlsch_buffer+1);
+
+ uint32_t rballoc,reps;
+ uint32_t TPC,ULdelay,cqireq,mpdcch_nb_index;
+ int input_buffer_length;
- AssertFatal(ra != NULL, "RA is null \n");
+ AssertFatal(ra != NULL, "RA is null \n");
+
+ // subheader fixed
+ rarh->E = 0; // First and last RAR
+ rarh->T = 1; // 0 for E/T/R/R/BI subheader, 1 for E/T/RAPID subheader
+ rarh->RAPID = ra->preamble_index; // Respond to Preamble 0 only for the moment
+ ra->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps
+ rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4
+ rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4
+
+ int N_NB_index;
+
+ // Copy the Msg2 narrowband
+ ra->msg34_narrowband = ra->msg2_narrowband;
+ ra->msg3_first_rb = 0;
+ ra->msg3_nb_rb = 2;
- // subheader fixed
- rarh->E = 0; // First and last RAR
- rarh->T = 1; // 0 for E/T/R/R/BI subheader, 1 for E/T/RAPID subheader
- rarh->RAPID = ra->preamble_index; // Respond to Preamble 0 only for the moment
- ra->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps
- rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4
- rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4
- int N_NB_index;
+ if (ce_level < 2) { //CE Level 0,1, CEmodeA
+ input_buffer_length = 6;
+
+ N_NB_index = get_numnarrowbandbits(cc->mib->message.dl_Bandwidth);
- AssertFatal(1 == 0, "RAR for BL/CE Still to be finished ...\n");
+ rar[4] = (uint8_t)(ra->rnti>>8);
+ rar[5] = (uint8_t)(ra->rnti&0xff);
+ //cc->ra[ra_idx].timing_offset = 0;
+
+ reps = 0;
+ ra->msg3_mcs = 7;
+ TPC = 3; // no power increase
+ ULdelay = 0;
+ cqireq = 0;
+ mpdcch_nb_index = 0;
+ rballoc = mac_computeRIV(6,ra->msg3_first_rb,ra->msg3_nb_rb);
- // Copy the Msg2 narrowband
- ra->msg34_narrowband = ra->msg2_narrowband;
+ uint32_t buffer = 0;
+ buffer |= ra->msg34_narrowband << (16 + (4 - N_NB_index));
+ buffer |= ((rballoc & 0xFF) << (12 + (4 - N_NB_index)));
+ buffer |= ((reps & 0x03) << (10 + (4 - N_NB_index)));
+ buffer |= ((ra->msg3_mcs & 0x07) << (7 + (4 - N_NB_index)));
+ buffer |= ((TPC & 0x07) << (4 + (4 - N_NB_index)));
+ buffer |= ((cqireq & 0x01) << (3 + (4 - N_NB_index)));
+ buffer |= ((ULdelay & 0x01) << (2 + (4 - N_NB_index)));
+ buffer |= (mpdcch_nb_index << (4 - N_NB_index));
+ rar[1] = (buffer>>16) & 0x0F;
+ rar[2] = (buffer>>8) & 0xFF;
+ rar[3] = buffer&0xFF;
+ }
+ else { // CE level 2,3 => CEModeB
- if (ce_level < 2) { //CE Level 0,1, CEmodeA
- input_buffer_length = 6;
+ AssertFatal(1==0,"Shouldn't get here ...\n");
+ input_buffer_length =5;
- N_NB_index = get_numnarrowbandbits(cc->mib->message.dl_Bandwidth);
- rar[4] = (uint8_t) (ra->rnti >> 8);
- rar[5] = (uint8_t) (ra->rnti & 0xff);
- //cc->ra[ra_idx].timing_offset = 0;
- // nb = 0;
- rballoc = mac_computeRIV(6, 1 + ce_level, 1); // one PRB only for UL Grant in position 1+ce_level within Narrowband
- rar[1] |= (rballoc & 15) << (4 - N_NB_index); // Hopping = 0 (bit 3), 3 MSBs of rballoc
+ rar[3] = (uint8_t)(ra->rnti>>8);
+ rar[4] = (uint8_t)(ra->rnti&0xff);
+ }
+ LOG_I(MAC,"[RAPROC] Frame %d Subframe %d : Generating RAR BR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for ce_level %d, CRNTI %x,preamble %d/%d,TIMING OFFSET %d\n",
+ frameP,subframeP,
+ *(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
+ ce_level,
+ ra->rnti,
+ rarh->RAPID,ra->preamble_index,
+ ra->timing_offset);
- // reps = 4;
- mcs = 7;
- TPC = 3; // no power increase
- ULdelay = 0;
- cqireq = 0;
- rar[2] |= ((mcs & 0x8) >> 3); // mcs 10
- rar[3] =
- (((mcs & 0x7) << 5)) | ((TPC & 7) << 2) | ((ULdelay & 1) << 1)
- | (cqireq & 1);
- } else { // CE level 2,3 => CEModeB
+ if (opt_enabled) {
+ trace_pdu(DIRECTION_DOWNLINK , dlsch_buffer, input_buffer_length, eNB->Mod_id, WS_RA_RNTI , 1,
+ eNB->frame, eNB->subframe, 0, 0);
+ LOG_D(OPT,
+ "[RAPROC] RAR Frame %d trace pdu for rnti %x and rapid %d size %d\n",
+ frameP, ra->rnti, rarh->RAPID, input_buffer_length);
+ }
- input_buffer_length = 5;
-
- rar[3] = (uint8_t) (ra->rnti >> 8);
- rar[4] = (uint8_t) (ra->rnti & 0xff);
- }
- LOG_D(MAC,
- "[RAPROC] Frame %d Generating RAR BR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for ce_level %d, CRNTI %x,preamble %d/%d,TIMING OFFSET %d\n",
- frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2], rar[3],
- rar[4], rar[5], ce_level, ra->rnti, rarh->RAPID,
- ra->preamble_index, ra->timing_offset);
-
- if (opt_enabled) {
- trace_pdu(DIRECTION_DOWNLINK , dlsch_buffer, input_buffer_length, eNB->Mod_id, WS_RA_RNTI , 1,
- eNB->frame, eNB->subframe, 0, 0);
- LOG_D(OPT,
- "[RAPROC] RAR Frame %d trace pdu for rnti %x and rapid %d size %d\n",
- frameP, ra->rnti, rarh->RAPID, input_buffer_length);
- }
-
- return (ra->rnti);
+ return (ra->rnti);
}
#endif
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index 19765cff04..bca5ef0ae8 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -559,31 +559,34 @@ ue_send_sdu(module_id_t module_idP,
LOG_T(MAC, "\n");
#endif
- mac_rrc_data_ind_ue(module_idP,
- CC_id,
- frameP, subframeP,
- UE_mac_inst[module_idP].crnti,
- CCCH,
- (uint8_t *) payload_ptr,
- rx_lengths[i], eNB_index, 0);
+ mac_rrc_data_ind_ue(module_idP,
+ CC_id,
+ frameP,subframeP,
+ UE_mac_inst[module_idP].crnti,
+ CCCH,
+ (uint8_t*)payload_ptr,
+ rx_lengths[i],
+ eNB_index,
+ 0
+ );
- } else if ((rx_lcids[i] == DCCH) || (rx_lcids[i] == DCCH1)) {
- LOG_D(MAC,
- "[UE %d] Frame %d : DLSCH -> DL-DCCH%d, RRC message (eNB %d, %d bytes)\n",
- module_idP, frameP, rx_lcids[i], eNB_index,
- rx_lengths[i]);
- mac_rlc_data_ind(module_idP, UE_mac_inst[module_idP].crnti,
- eNB_index, frameP, ENB_FLAG_NO,
- MBMS_FLAG_NO, rx_lcids[i],
- (char *) payload_ptr, rx_lengths[i], 1,
- NULL);
-
- } else if ((rx_lcids[i] < NB_RB_MAX) && (rx_lcids[i] > DCCH1)) {
-
- LOG_D(MAC,
- "[UE %d] Frame %d : DLSCH -> DL-DTCH%d (eNB %d, %d bytes)\n",
- module_idP, frameP, rx_lcids[i], eNB_index,
- rx_lengths[i]);
+ } else if ((rx_lcids[i] == DCCH) || (rx_lcids[i] == DCCH1)) {
+ LOG_D(MAC,"[UE %d] Frame %d : DLSCH -> DL-DCCH%d, RRC message (eNB %d, %d bytes)\n", module_idP, frameP, rx_lcids[i],eNB_index,rx_lengths[i]);
+ mac_rlc_data_ind(module_idP,
+ UE_mac_inst[module_idP].crnti,
+ eNB_index,
+ frameP,
+ ENB_FLAG_NO,
+ MBMS_FLAG_NO,
+ rx_lcids[i],
+ (char *)payload_ptr,
+ rx_lengths[i],
+ 1,
+ NULL);
+
+ } else if ((rx_lcids[i] < NB_RB_MAX) && (rx_lcids[i] > DCCH1 )) {
+
+ LOG_D(MAC,"[UE %d] Frame %d : DLSCH -> DL-DTCH%d (eNB %d, %d bytes)\n", module_idP, frameP,rx_lcids[i], eNB_index,rx_lengths[i]);
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
int j;
@@ -622,6 +625,7 @@ ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].rx_si);
#endif
+
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_IN);
@@ -634,6 +638,7 @@ ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_OUT);
+
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].rx_si);
#endif
@@ -659,6 +664,7 @@ ue_decode_p(module_id_t module_idP, int CC_id, frame_t frameP,
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].rx_p);
#endif
+
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_IN);
@@ -672,6 +678,7 @@ ue_decode_p(module_id_t module_idP, int CC_id, frame_t frameP,
0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_OUT);
+
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].rx_p);
#endif
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
index e2911efcaf..33ab7965e5 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
@@ -25,9 +25,7 @@
#include "platform_types.h"
#include "platform_constants.h"
//-----------------------------------------------------------------------------
-#if ENABLE_ITTI
-# include "intertask_interface.h"
-#endif
+
#include "assertions.h"
#include "msc.h"
#include "hashtable.h"
@@ -46,171 +44,145 @@
//-----------------------------------------------------------------------------
uint32_t
rlc_am_get_status_pdu_buffer_occupancy(
- rlc_am_entity_t * const rlc_pP){
+ rlc_am_entity_t *const rlc_pP) {
+ //Compute Max Status PDU size according to what has been received and not received in the window [vrR vrMS[
+ // minimum header size in bits to be transmitted: D/C + CPT + ACK_SN + E1
+ uint32_t nb_bits_to_transmit = RLC_AM_PDU_D_C_BITS + RLC_AM_STATUS_PDU_CPT_LENGTH + RLC_AM_SN_BITS + RLC_AM_PDU_E_BITS;
+ mem_block_t *cursor_p = rlc_pP->receiver_buffer.head;
+ rlc_am_pdu_info_t *pdu_info_cursor_p = NULL;
+ int waited_so = 0;
+ rlc_sn_t sn_cursor = rlc_pP->vr_r;
+ rlc_sn_t sn_prev = rlc_pP->vr_r;
+ rlc_sn_t sn_end = rlc_pP->vr_ms;
+ boolean_t segment_loop_end = false;
- //Compute Max Status PDU size according to what has been received and not received in the window [vrR vrMS[
+ if (sn_prev != sn_end) {
+ while ((RLC_AM_DIFF_SN(sn_prev,rlc_pP->vr_r) < RLC_AM_DIFF_SN(sn_end,rlc_pP->vr_r)) && (cursor_p != NULL)) {
+ pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
+ sn_cursor = pdu_info_cursor_p->sn;
- // minimum header size in bits to be transmitted: D/C + CPT + ACK_SN + E1
- uint32_t nb_bits_to_transmit = RLC_AM_PDU_D_C_BITS + RLC_AM_STATUS_PDU_CPT_LENGTH + RLC_AM_SN_BITS + RLC_AM_PDU_E_BITS;
- mem_block_t *cursor_p = rlc_pP->receiver_buffer.head;
- rlc_am_pdu_info_t *pdu_info_cursor_p = NULL;
- int waited_so = 0;
+ // Add holes between sn_prev and sn_cursor
+ while ((sn_prev != sn_cursor) && (sn_prev != sn_end)) {
+ /* Add 1 NACK_SN + E1 + E2 */
+ nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1));
+ sn_prev = RLC_AM_NEXT_SN(sn_prev);
+ } //end while (sn_prev != sn_cursor)
- rlc_sn_t sn_cursor = rlc_pP->vr_r;
- rlc_sn_t sn_prev = rlc_pP->vr_r;
- rlc_sn_t sn_end = rlc_pP->vr_ms;
- boolean_t segment_loop_end = false;
+ /* Handle case sn_cursor is partially received */
+ /* Each gap will add NACK_SN + E1 + E2 + SOStart + SOEnd */
+ if ((((rlc_am_rx_pdu_management_t *)(cursor_p->data))->all_segments_received == 0) && (RLC_AM_DIFF_SN(sn_cursor,rlc_pP->vr_r) < RLC_AM_DIFF_SN(sn_end,rlc_pP->vr_r))) {
+ /* Check lsf */
+ segment_loop_end = (pdu_info_cursor_p->lsf == 1);
+ /* Fill for [0 SO[ if SO not null */
+ if (pdu_info_cursor_p->so) {
+ nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
+ waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
+ } else {
+ waited_so = pdu_info_cursor_p->payload_size;
+ }
- if (sn_prev != sn_end)
- {
- while ((RLC_AM_DIFF_SN(sn_prev,rlc_pP->vr_r) < RLC_AM_DIFF_SN(sn_end,rlc_pP->vr_r)) && (cursor_p != NULL))
- {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- sn_cursor = pdu_info_cursor_p->sn;
+ /* Go to next segment */
+ cursor_p = cursor_p->next;
- // Add holes between sn_prev and sn_cursor
- while ((sn_prev != sn_cursor) && (sn_prev != sn_end))
- {
- /* Add 1 NACK_SN + E1 + E2 */
- nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1));
- sn_prev = RLC_AM_NEXT_SN(sn_prev);
- } //end while (sn_prev != sn_cursor)
+ if (cursor_p != NULL) {
+ pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
+ }
- /* Handle case sn_cursor is partially received */
- /* Each gap will add NACK_SN + E1 + E2 + SOStart + SOEnd */
- if ((((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received == 0) && (RLC_AM_DIFF_SN(sn_cursor,rlc_pP->vr_r) < RLC_AM_DIFF_SN(sn_end,rlc_pP->vr_r)))
- {
- /* Check lsf */
- segment_loop_end = (pdu_info_cursor_p->lsf == 1);
+ /* Fill following gaps if any */
+ while (!segment_loop_end) {
+ if ((cursor_p != NULL) && (pdu_info_cursor_p->sn == sn_cursor)) {
+ /* Check lsf */
+ segment_loop_end = (pdu_info_cursor_p->lsf == 1);
- /* Fill for [0 SO[ if SO not null */
- if (pdu_info_cursor_p->so) {
- nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
- waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
- }
- else {
- waited_so = pdu_info_cursor_p->payload_size;
- }
+ if (waited_so < pdu_info_cursor_p->so) {
+ nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
+ } else {
+ /* contiguous segment: only update waited_so */
+ /* Assuming so and payload_size updated according to duplication removal done at reception ... */
+ waited_so += pdu_info_cursor_p->payload_size;
+ }
- /* Go to next segment */
- cursor_p = cursor_p->next;
- if (cursor_p != NULL)
- {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
+ /* Go to next received PDU or PDU Segment */
+ cursor_p = cursor_p->next;
- /* Fill following gaps if any */
- while (!segment_loop_end)
- {
- if ((cursor_p != NULL) && (pdu_info_cursor_p->sn == sn_cursor))
- {
- /* Check lsf */
- segment_loop_end = (pdu_info_cursor_p->lsf == 1);
+ if (cursor_p != NULL) {
+ pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
+ }
+ } else {
+ /* Fill last gap assuming LSF is not received */
+ nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
+ segment_loop_end = true;
+ }
+ } // end while (!segment_loop_end)
+ } // end if segments
+ else {
+ /* Go to next received PDU or PDU segment with different SN */
+ do {
+ cursor_p = cursor_p->next;
+ } while ((cursor_p != NULL) && (((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info.sn == sn_cursor));
+ }
- if (waited_so < pdu_info_cursor_p->so) {
- nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
- }
- else {
- /* contiguous segment: only update waited_so */
- /* Assuming so and payload_size updated according to duplication removal done at reception ... */
- waited_so += pdu_info_cursor_p->payload_size;
- }
-
- /* Go to next received PDU or PDU Segment */
- cursor_p = cursor_p->next;
- if (cursor_p != NULL)
- {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
- }
- else
- {
- /* Fill last gap assuming LSF is not received */
- nb_bits_to_transmit += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
- segment_loop_end = true;
- }
- } // end while (!segment_loop_end)
- } // end if segments
- else
- {
- /* Go to next received PDU or PDU segment with different SN */
- do
- {
- cursor_p = cursor_p->next;
- } while ((cursor_p != NULL) && (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.sn == sn_cursor));
- }
-
- sn_prev = RLC_AM_NEXT_SN(sn_cursor);
- }
- } // end if (sn_prev != sn_end)
-
- // round up to the greatest byte
- return ((nb_bits_to_transmit + 7) >> 3);
+ sn_prev = RLC_AM_NEXT_SN(sn_cursor);
+ }
+ } // end if (sn_prev != sn_end)
+ // round up to the greatest byte
+ return ((nb_bits_to_transmit + 7) >> 3);
}
//-----------------------------------------------------------------------------
uint32_t
rlc_am_get_buffer_occupancy_in_bytes (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP)
-{
+ const protocol_ctxt_t *const ctxt_pP,
+ rlc_am_entity_t *const rlc_pP) {
// priority of control trafic
rlc_pP->status_buffer_occupancy = 0;
+
if ((rlc_pP->status_requested) && !(rlc_pP->status_requested & RLC_AM_STATUS_NO_TX_MASK)) {
- rlc_pP->status_buffer_occupancy = rlc_am_get_status_pdu_buffer_occupancy(rlc_pP);
-#if TRACE_RLC_AM_BO
-
- LOG_D(RLC, PROTOCOL_CTXT_FMT RB_AM_FMT" BO : CONTROL PDU %d bytes \n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->status_buffer_occupancy);
-
-#endif
- }
-
-
-#if TRACE_RLC_AM_BO
-
- if ((rlc_pP->status_buffer_occupancy + rlc_pP->retrans_num_bytes_to_retransmit + rlc_pP->sdu_buffer_occupancy + max_li_overhead + header_overhead) > 0) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : STATUS BUFFER %d bytes \n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), rlc_pP->status_buffer_occupancy);
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : RETRANS BUFFER %d bytes \n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), rlc_pP->retrans_num_bytes_to_retransmit);
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n",
+ rlc_pP->status_buffer_occupancy = rlc_am_get_status_pdu_buffer_occupancy(rlc_pP);
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : CONTROL PDU %d bytes \n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->sdu_buffer_occupancy,
- 0,
- 0,
- rlc_pP->nb_sdu_no_segmented);
+ rlc_pP->status_buffer_occupancy);
+ }
+
+ if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
+ if ((rlc_pP->status_buffer_occupancy + rlc_pP->retrans_num_bytes_to_retransmit + rlc_pP->sdu_buffer_occupancy ) > 0) {
+ LOG_UI(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : STATUS BUFFER %d bytes \n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), rlc_pP->status_buffer_occupancy);
+ LOG_UI(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : RETRANS BUFFER %d bytes \n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), rlc_pP->retrans_num_bytes_to_retransmit);
+ LOG_UI(RLC, PROTOCOL_RLC_AM_CTXT_FMT" BO : SDU BUFFER %d bytes + li_overhead %d bytes header_overhead %d bytes (nb sdu not segmented %d)\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
+ rlc_pP->sdu_buffer_occupancy,
+ 0,
+ 0,
+ rlc_pP->nb_sdu_no_segmented);
+ }
}
-#endif
return rlc_pP->status_buffer_occupancy + rlc_pP->retrans_num_bytes_to_retransmit + rlc_pP->sdu_buffer_occupancy;
}
//-----------------------------------------------------------------------------
void
rlc_am_release (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP
-)
-{
+ const protocol_ctxt_t *const ctxt_pP,
+ rlc_am_entity_t *const rlc_pP
+) {
// empty
}
//-----------------------------------------------------------------------------
void
config_req_rlc_am (
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
- const rlc_am_info_t * config_am_pP,
+ const rlc_am_info_t *config_am_pP,
const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP
-)
-{
+ const logical_chan_id_t chan_idP
+) {
rlc_union_t *rlc_union_p = NULL;
rlc_am_entity_t *l_rlc_p = NULL;
hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
hashtable_rc_t h_rc;
-
- h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
+ h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
l_rlc_p = &rlc_union_p->rlc.am;
@@ -252,18 +224,16 @@ uint32_t t_StatusProhibit_tab[LTE_T_StatusProhibit_spare8]= {0,5,10,15,20,25,30,
//-----------------------------------------------------------------------------
void config_req_rlc_am_asn1 (
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
- const struct LTE_RLC_Config__am * const config_am_pP,
+ const struct LTE_RLC_Config__am *const config_am_pP,
const rb_id_t rb_idP,
- const logical_chan_id_t chan_idP)
-{
+ const logical_chan_id_t chan_idP) {
rlc_union_t *rlc_union_p = NULL;
rlc_am_entity_t *l_rlc_p = NULL;
hash_key_t key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
hashtable_rc_t h_rc;
-
- h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
+ h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
l_rlc_p = &rlc_union_p->rlc.am;
@@ -280,7 +250,6 @@ void config_req_rlc_am_asn1 (
(config_am_pP->dl_AM_RLC.t_Reorderingdl_AM_RLC.t_StatusProhibitenb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE,
@@ -292,7 +261,6 @@ void config_req_rlc_am_asn1 (
PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]);
-
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" CONFIG_REQ (max_retx_threshold=%d poll_pdu=%d poll_byte=%d t_poll_retransmit=%d t_reord=%d t_status_prohibit=%d)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold],
@@ -301,7 +269,6 @@ void config_req_rlc_am_asn1 (
PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]);
-
rlc_am_init(ctxt_pP, l_rlc_p);
rlc_am_set_debug_infos(ctxt_pP, l_rlc_p, srb_flagP, rb_idP, chan_idP);
rlc_am_configure(ctxt_pP, l_rlc_p,
@@ -311,7 +278,8 @@ void config_req_rlc_am_asn1 (
PollRetransmit_tab[config_am_pP->ul_AM_RLC.t_PollRetransmit],
am_t_Reordering_tab[config_am_pP->dl_AM_RLC.t_Reordering],
t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]);
- } else {
+ }
+ else {
MSC_LOG_RX_DISCARDED_MESSAGE(
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RRC_ENB:MSC_RRC_UE,
@@ -320,7 +288,6 @@ void config_req_rlc_am_asn1 (
MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" CONFIG-REQ",
MSC_AS_TIME_ARGS(ctxt_pP),
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p));
-
LOG_D(RLC,
PROTOCOL_RLC_AM_CTXT_FMT"ILLEGAL CONFIG_REQ (max_retx_threshold=%ld poll_pdu=%ld poll_byte=%ld t_poll_retransmit=%ld t_reord=%ld t_status_prohibit=%ld), RLC-AM NOT CONFIGURED\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
@@ -339,36 +306,35 @@ void config_req_rlc_am_asn1 (
//-----------------------------------------------------------------------------
void rlc_am_stat_req (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP,
- unsigned int* stat_tx_pdcp_sdu,
- unsigned int* stat_tx_pdcp_bytes,
- unsigned int* stat_tx_pdcp_sdu_discarded,
- unsigned int* stat_tx_pdcp_bytes_discarded,
- unsigned int* stat_tx_data_pdu,
- unsigned int* stat_tx_data_bytes,
- unsigned int* stat_tx_retransmit_pdu_by_status,
- unsigned int* stat_tx_retransmit_bytes_by_status,
- unsigned int* stat_tx_retransmit_pdu,
- unsigned int* stat_tx_retransmit_bytes,
- unsigned int* stat_tx_control_pdu,
- unsigned int* stat_tx_control_bytes,
- unsigned int* stat_rx_pdcp_sdu,
- unsigned int* stat_rx_pdcp_bytes,
- unsigned int* stat_rx_data_pdus_duplicate,
- unsigned int* stat_rx_data_bytes_duplicate,
- unsigned int* stat_rx_data_pdu,
- unsigned int* stat_rx_data_bytes,
- unsigned int* stat_rx_data_pdu_dropped,
- unsigned int* stat_rx_data_bytes_dropped,
- unsigned int* stat_rx_data_pdu_out_of_window,
- unsigned int* stat_rx_data_bytes_out_of_window,
- unsigned int* stat_rx_control_pdu,
- unsigned int* stat_rx_control_bytes,
- unsigned int* stat_timer_reordering_timed_out,
- unsigned int* stat_timer_poll_retransmit_timed_out,
- unsigned int* stat_timer_status_prohibit_timed_out)
-{
+ const protocol_ctxt_t *const ctxt_pP,
+ rlc_am_entity_t *const rlc_pP,
+ unsigned int *stat_tx_pdcp_sdu,
+ unsigned int *stat_tx_pdcp_bytes,
+ unsigned int *stat_tx_pdcp_sdu_discarded,
+ unsigned int *stat_tx_pdcp_bytes_discarded,
+ unsigned int *stat_tx_data_pdu,
+ unsigned int *stat_tx_data_bytes,
+ unsigned int *stat_tx_retransmit_pdu_by_status,
+ unsigned int *stat_tx_retransmit_bytes_by_status,
+ unsigned int *stat_tx_retransmit_pdu,
+ unsigned int *stat_tx_retransmit_bytes,
+ unsigned int *stat_tx_control_pdu,
+ unsigned int *stat_tx_control_bytes,
+ unsigned int *stat_rx_pdcp_sdu,
+ unsigned int *stat_rx_pdcp_bytes,
+ unsigned int *stat_rx_data_pdus_duplicate,
+ unsigned int *stat_rx_data_bytes_duplicate,
+ unsigned int *stat_rx_data_pdu,
+ unsigned int *stat_rx_data_bytes,
+ unsigned int *stat_rx_data_pdu_dropped,
+ unsigned int *stat_rx_data_bytes_dropped,
+ unsigned int *stat_rx_data_pdu_out_of_window,
+ unsigned int *stat_rx_data_bytes_out_of_window,
+ unsigned int *stat_rx_control_pdu,
+ unsigned int *stat_rx_control_bytes,
+ unsigned int *stat_timer_reordering_timed_out,
+ unsigned int *stat_timer_poll_retransmit_timed_out,
+ unsigned int *stat_timer_status_prohibit_timed_out) {
*stat_tx_pdcp_sdu = rlc_pP->stat_tx_pdcp_sdu;
*stat_tx_pdcp_bytes = rlc_pP->stat_tx_pdcp_bytes;
*stat_tx_pdcp_sdu_discarded = rlc_pP->stat_tx_pdcp_sdu_discarded;
@@ -396,15 +362,13 @@ void rlc_am_stat_req (
*stat_timer_reordering_timed_out = rlc_pP->stat_timer_reordering_timed_out;
*stat_timer_poll_retransmit_timed_out = rlc_pP->stat_timer_poll_retransmit_timed_out;
*stat_timer_status_prohibit_timed_out = rlc_pP->stat_timer_status_prohibit_timed_out;
-
}
//-----------------------------------------------------------------------------
void
rlc_am_get_pdus (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP
-)
-{
+ const protocol_ctxt_t *const ctxt_pP,
+ rlc_am_entity_t *const rlc_pP
+) {
//int display_flag = 0;
// 5.1.3.1 Transmit operations
// 5.1.3.1.1
@@ -412,31 +376,27 @@ rlc_am_get_pdus (
// The transmitting side of an AM RLC entity shall prioritize transmission of RLC control PDUs over RLC data PDUs.
// The transmitting side of an AM RLC entity shall prioritize retransmission of RLC data PDUs over transmission of new
// AMD PDUs.
-
-
switch (rlc_pP->protocol_state) {
+ case RLC_NULL_STATE:
+ break;
- case RLC_NULL_STATE:
- break;
-
- case RLC_DATA_TRANSFER_READY_STATE:
-
- // TRY TO SEND CONTROL PDU FIRST
- if ((rlc_pP->nb_bytes_requested_by_mac >= 2) &&
- ((rlc_pP->status_requested) && !(rlc_pP->status_requested & RLC_AM_STATUS_NO_TX_MASK))) {
- // When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall:
- // - if t-StatusProhibit is not running:
- // - at the first transmission opportunity indicated by lower layer, construct a STATUS PDU and deliver it to lower layer;
- // - else:
- // - at the first transmission opportunity indicated by lower layer after t-StatusProhibit expires, construct a single
- // STATUS PDU even if status reporting was triggered several times while t-StatusProhibit was running and
- // deliver it to lower layer;
- //
- // When a STATUS PDU has been delivered to lower layer, the receiving side of an AM RLC entity shall:
- // - start t-StatusProhibit.
+ case RLC_DATA_TRANSFER_READY_STATE:
+ // TRY TO SEND CONTROL PDU FIRST
+ if ((rlc_pP->nb_bytes_requested_by_mac >= 2) &&
+ ((rlc_pP->status_requested) && !(rlc_pP->status_requested & RLC_AM_STATUS_NO_TX_MASK))) {
+ // When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall:
+ // - if t-StatusProhibit is not running:
+ // - at the first transmission opportunity indicated by lower layer, construct a STATUS PDU and deliver it to lower layer;
+ // - else:
+ // - at the first transmission opportunity indicated by lower layer after t-StatusProhibit expires, construct a single
+ // STATUS PDU even if status reporting was triggered several times while t-StatusProhibit was running and
+ // deliver it to lower layer;
+ //
+ // When a STATUS PDU has been delivered to lower layer, the receiving side of an AM RLC entity shall:
+ // - start t-StatusProhibit.
rlc_am_send_status_pdu(ctxt_pP, rlc_pP);
- mem_block_t* pdu = list_remove_head(&rlc_pP->control_pdu_list);
+ mem_block_t *pdu = list_remove_head(&rlc_pP->control_pdu_list);
if (pdu) {
list_add_tail_eurecom (pdu, &rlc_pP->pdus_to_mac_layer);
@@ -445,89 +405,81 @@ rlc_am_get_pdus (
rlc_am_start_timer_status_prohibit(ctxt_pP, rlc_pP);
return;
}
- }
- else {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" DELAYED SENT STATUS PDU (Available MAC Data %u)(T-PROHIBIT %u) (DELAY FLAG %u)\n",
+ } else {
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" DELAYED SENT STATUS PDU (Available MAC Data %u)(T-PROHIBIT %u) (DELAY FLAG %u)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->nb_bytes_requested_by_mac,rlc_pP->t_status_prohibit.ms_time_out,(rlc_pP->status_requested & RLC_AM_STATUS_TRIGGERED_DELAYED));
- }
+ rlc_pP->nb_bytes_requested_by_mac,rlc_pP->t_status_prohibit.ms_time_out,(rlc_pP->status_requested & RLC_AM_STATUS_TRIGGERED_DELAYED));
+ }
- // THEN TRY TO SEND RETRANS PDU
+ // THEN TRY TO SEND RETRANS PDU
if ((rlc_pP->retrans_num_bytes_to_retransmit) && (rlc_pP->nb_bytes_requested_by_mac > 2)) {
+ /* Get 1 AM data PDU or PDU segment to retransmit */
+ mem_block_t *pdu_retx = rlc_am_get_pdu_to_retransmit(ctxt_pP, rlc_pP);
- /* Get 1 AM data PDU or PDU segment to retransmit */
- mem_block_t* pdu_retx = rlc_am_get_pdu_to_retransmit(ctxt_pP, rlc_pP);
-
- if (pdu_retx != NULL) {
- list_add_tail_eurecom (pdu_retx, &rlc_pP->pdus_to_mac_layer);
-
+ if (pdu_retx != NULL) {
+ list_add_tail_eurecom (pdu_retx, &rlc_pP->pdus_to_mac_layer);
return;
}
- }
-
- // THEN TRY TO SEND NEW DATA PDU
- if ((rlc_pP->nb_bytes_requested_by_mac > 2) && (rlc_pP->sdu_buffer_occupancy) && (rlc_pP->vt_s != rlc_pP->vt_ms)) {
- rlc_am_segment_10(ctxt_pP, rlc_pP);
- list_add_list (&rlc_pP->segmentation_pdu_list, &rlc_pP->pdus_to_mac_layer);
-
- if (rlc_pP->pdus_to_mac_layer.head != NULL) {
- rlc_pP->stat_tx_data_pdu += 1;
- rlc_pP->stat_tx_data_bytes += (((struct mac_tb_req*)(rlc_pP->pdus_to_mac_layer.head->data))->tb_size);
- return;
}
- }
+ // THEN TRY TO SEND NEW DATA PDU
+ if ((rlc_pP->nb_bytes_requested_by_mac > 2) && (rlc_pP->sdu_buffer_occupancy) && (rlc_pP->vt_s != rlc_pP->vt_ms)) {
+ rlc_am_segment_10(ctxt_pP, rlc_pP);
+ list_add_list (&rlc_pP->segmentation_pdu_list, &rlc_pP->pdus_to_mac_layer);
- break;
+ if (rlc_pP->pdus_to_mac_layer.head != NULL) {
+ rlc_pP->stat_tx_data_pdu += 1;
+ rlc_pP->stat_tx_data_bytes += (((struct mac_tb_req *)(rlc_pP->pdus_to_mac_layer.head->data))->tb_size);
+ return;
+ }
+ }
- default:
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" MAC_DATA_REQ UNKNOWN PROTOCOL STATE 0x%02X\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->protocol_state);
+ break;
+
+ default:
+ LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" MAC_DATA_REQ UNKNOWN PROTOCOL STATE 0x%02X\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
+ rlc_pP->protocol_state);
}
}
//-----------------------------------------------------------------------------
void
rlc_am_rx (
- const protocol_ctxt_t* const ctxt_pP,
- void * const arg_pP,
+ const protocol_ctxt_t *const ctxt_pP,
+ void *const arg_pP,
struct mac_data_ind data_indP
-)
-{
+) {
rlc_am_entity_t *rlc = (rlc_am_entity_t *) arg_pP;
switch (rlc->protocol_state) {
+ case RLC_NULL_STATE:
+ LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP, rlc));
+ list_free (&data_indP.data);
+ break;
- case RLC_NULL_STATE:
- LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT" ERROR MAC_DATA_IND IN RLC_NULL_STATE\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP, rlc));
- list_free (&data_indP.data);
- break;
+ case RLC_DATA_TRANSFER_READY_STATE:
+ rlc_am_receive_routing (ctxt_pP, rlc, data_indP);
+ break;
- case RLC_DATA_TRANSFER_READY_STATE:
- rlc_am_receive_routing (ctxt_pP, rlc, data_indP);
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE 0x%02X\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP, rlc), rlc->protocol_state);
- list_free (&data_indP.data);
+ default:
+ LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE 0x%02X\n", PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP, rlc), rlc->protocol_state);
+ list_free (&data_indP.data);
}
}
//-----------------------------------------------------------------------------
struct mac_status_resp
rlc_am_mac_status_indication (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlc_pP,
+ const protocol_ctxt_t *const ctxt_pP,
+ void *const rlc_pP,
const uint16_t tb_sizeP,
struct mac_status_ind tx_statusP,
- const eNB_flag_t enb_flagP)
-{
+ const eNB_flag_t enb_flagP) {
struct mac_status_resp status_resp;
uint16_t sdu_size = 0;
uint16_t sdu_remaining_size = 0;
int32_t diff_time=0;
rlc_am_entity_t *rlc = (rlc_am_entity_t *) rlc_pP;
-
status_resp.buffer_occupancy_in_bytes = 0;
status_resp.buffer_occupancy_in_pdus = 0;
status_resp.head_sdu_remaining_size_to_send = 0;
@@ -561,31 +513,27 @@ rlc_am_mac_status_indication (
// For eNB scheduler : Add Max RLC header size for new PDU
// For UE : do not add RLC header part to be compliant with BSR definition in 36.321
if (enb_flagP == ENB_FLAG_YES) {
- uint32_t max_li_overhead = 0;
- uint32_t header_overhead = 0;
+ uint32_t max_li_overhead = 0;
+ uint32_t header_overhead = 0;
- if (rlc->nb_sdu_no_segmented > 1) {
- /* This computation assumes there is no SDU with size greater than 2047 bytes, otherwise a new PDU must be built except for LI15 configuration from Rel12*/
- uint32_t num_li = rlc->nb_sdu_no_segmented - 1;
- max_li_overhead = num_li + (num_li >> 1) + (num_li & 1);
- }
+ if (rlc->nb_sdu_no_segmented > 1) {
+ /* This computation assumes there is no SDU with size greater than 2047 bytes, otherwise a new PDU must be built except for LI15 configuration from Rel12*/
+ uint32_t num_li = rlc->nb_sdu_no_segmented - 1;
+ max_li_overhead = num_li + (num_li >> 1) + (num_li & 1);
+ }
- if (rlc->sdu_buffer_occupancy > 0) {
- header_overhead = 2;
- }
+ if (rlc->sdu_buffer_occupancy > 0) {
+ header_overhead = 2;
+ }
- status_resp.buffer_occupancy_in_bytes += (header_overhead + max_li_overhead);
+ status_resp.buffer_occupancy_in_bytes += (header_overhead + max_li_overhead);
}
-
if ((rlc->input_sdus[rlc->current_sdu_index].mem_block != NULL) && (status_resp.buffer_occupancy_in_bytes)) {
-
//status_resp.buffer_occupancy_in_bytes += ((rlc_am_entity_t *) rlc)->tx_header_min_length_in_bytes;
status_resp.buffer_occupancy_in_pdus = rlc->nb_sdu;
diff_time = ctxt_pP->frame - ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_creation_time;
-
status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + ctxt_pP->frame) ;
-
sdu_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_size;
sdu_remaining_size = ((rlc_am_tx_sdu_management_t *) (rlc->input_sdus[rlc->current_sdu_index].mem_block->data))->sdu_remaining_size;
status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
@@ -595,83 +543,71 @@ rlc_am_mac_status_indication (
} else {
status_resp.head_sdu_is_segmented = 1;
}
-
} else {
- /* Not so many possibilities ... */
- /* either buffer_occupancy_in_bytes = 0 and that's it */
- /* or we have segmented all received SDUs and buffer occupancy is then made of retransmissions and/or status pdu pending */
- /* then consider only retransmission buffer for the specific BO values used by eNB scheduler (not used up to now...) */
- if (rlc->retrans_num_bytes_to_retransmit) {
- status_resp.buffer_occupancy_in_pdus = rlc->retrans_num_pdus;
- status_resp.head_sdu_remaining_size_to_send = rlc->retrans_num_bytes_to_retransmit;
- status_resp.head_sdu_is_segmented = 1;
- }
- }
-#if MESSAGE_CHART_GENERATOR_RLC_MAC
- MSC_LOG_RX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_MAC_ENB:MSC_MAC_UE,
- NULL,0,
- MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS-IND %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc),
- tb_sizeP);
- MSC_LOG_TX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_MAC_ENB:MSC_MAC_UE,
- NULL,0,
- MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS-RESP BO:%u/n%u(%u) %s sdu remain %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc),
- status_resp.buffer_occupancy_in_bytes,
- status_resp.buffer_occupancy_in_pdus,rlc->nb_sdu,
- (status_resp.head_sdu_is_segmented)?"sdu seg":"sdu not seg",
- status_resp.head_sdu_remaining_size_to_send);
-#endif
+ /* Not so many possibilities ... */
+ /* either buffer_occupancy_in_bytes = 0 and that's it */
+ /* or we have segmented all received SDUs and buffer occupancy is then made of retransmissions and/or status pdu pending */
+ /* then consider only retransmission buffer for the specific BO values used by eNB scheduler (not used up to now...) */
+ if (rlc->retrans_num_bytes_to_retransmit) {
+ status_resp.buffer_occupancy_in_pdus = rlc->retrans_num_pdus;
+ status_resp.head_sdu_remaining_size_to_send = rlc->retrans_num_bytes_to_retransmit;
+ status_resp.head_sdu_is_segmented = 1;
+ }
+ }
-#if TRACE_RLC_AM_TX_STATUS
+ if (MESSAGE_CHART_GENERATOR) {
+ MSC_LOG_RX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_MAC_ENB:MSC_MAC_UE,
+ NULL,0,
+ MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS-IND %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc),
+ tb_sizeP);
+ MSC_LOG_TX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_MAC_ENB:MSC_MAC_UE,
+ NULL,0,
+ MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS-RESP BO:%u/n%u(%u) %s sdu remain %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, rlc),
+ status_resp.buffer_occupancy_in_bytes,
+ status_resp.buffer_occupancy_in_pdus,rlc->nb_sdu,
+ (status_resp.head_sdu_is_segmented)?"sdu seg":"sdu not seg",
+ status_resp.head_sdu_remaining_size_to_send);
+ }
- if (tb_sizeP > 0) {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- tb_sizeP,
- status_resp.buffer_occupancy_in_bytes);
- /*if ((tx_statusP.tx_status == MAC_TX_STATUS_SUCCESSFUL) && (tx_statusP.no_pdu)) {
- msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",rlc->module_id,
- rlc->rb_id, ctxt_pP->frame, tx_statusP.no_pdu);
+ if (LOG_DEBUGFLAG(DEBUG_RLC)) {
+ if (tb_sizeP > 0) {
+ LOG_UI(RLC, PROTOCOL_RLC_AM_CTXT_FMT" MAC_STATUS_INDICATION (DATA) %d bytes -> %d bytes\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc),
+ tb_sizeP,
+ status_resp.buffer_occupancy_in_bytes);
}
- if ((tx_statusP.tx_status == MAC_TX_STATUS_UNSUCCESSFUL) && (tx_statusP.no_pdu)) {
- msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",rlc->module_id, rlc->rb_id,
- ctxt_pP->frame, tx_statusP.no_pdu);
- }*/
}
-#endif
return status_resp;
}
//-----------------------------------------------------------------------------
void
rlc_am_set_nb_bytes_requested_by_mac (
- void * const rlc_pP,
+ void *const rlc_pP,
const tb_size_t tb_sizeP
-)
-{
- ((rlc_am_entity_t *) rlc_pP)->nb_bytes_requested_by_mac = tb_sizeP;
+) {
+ ((rlc_am_entity_t *) rlc_pP)->nb_bytes_requested_by_mac = tb_sizeP;
}
//-----------------------------------------------------------------------------
struct mac_data_req
rlc_am_mac_data_request (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlc_pP,
+ const protocol_ctxt_t *const ctxt_pP,
+ void *const rlc_pP,
const eNB_flag_t enb_flagP
-)
-{
+) {
struct mac_data_req data_req;
rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP;
unsigned int nb_bytes_requested_by_mac = ((rlc_am_entity_t *) rlc_pP)->nb_bytes_requested_by_mac;
-#if TRACE_RLC_AM_PDU || MESSAGE_CHART_GENERATOR
rlc_am_pdu_info_t pdu_info;
rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p;
mem_block_t *tb_p;
@@ -679,9 +615,6 @@ rlc_am_mac_data_request (
int num_nack;
char message_string[9000];
size_t message_string_size = 0;
-# if ENABLE_ITTI
- MessageDef *msg_p;
-# endif
int octet_index, index;
/* for no gcc warnings */
(void)num_nack;
@@ -689,8 +622,6 @@ rlc_am_mac_data_request (
(void)message_string_size;
(void)octet_index;
(void)index;
-#endif
-
list_init (&data_req.data, NULL);
rlc_am_get_pdus (ctxt_pP, l_rlc_p);
list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data);
@@ -704,217 +635,197 @@ rlc_am_mac_data_request (
}
if (enb_flagP) {
- // redundant in UE MAC Tx processing and not used in eNB ...
- data_req.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, l_rlc_p);
+ // redundant in UE MAC Tx processing and not used in eNB ...
+ data_req.buffer_occupancy_in_bytes = rlc_am_get_buffer_occupancy_in_bytes(ctxt_pP, l_rlc_p);
}
+
data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state;
-#if TRACE_RLC_AM_PDU || MESSAGE_CHART_GENERATOR
-
- if (data_req.data.nb_elements > 0) {
-
+ if ( (MESSAGE_CHART_GENERATOR || LOG_DEBUGFLAG(DEBUG_RLC))&& data_req.data.nb_elements > 0) {
tb_p = data_req.data.head;
while (tb_p != NULL) {
-
- rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)((struct mac_tb_req *) (tb_p->data))->data_ptr;
+ rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t *)((struct mac_tb_req *) (tb_p->data))->data_ptr;
tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size;
if ((((struct mac_tb_req *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) {
if (rlc_am_get_data_pdu_infos(ctxt_pP,l_rlc_p,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) {
-#if MESSAGE_CHART_GENERATOR
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size],
- MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA SN %u size %u RF %u P %u FI %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p),
- pdu_info.sn,
- tb_size_in_bytes,
- pdu_info.rf,
- pdu_info.p,
- pdu_info.fi);
+ if (MESSAGE_CHART_GENERATOR) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size],
+ MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA SN %u size %u RF %u P %u FI %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p),
+ pdu_info.sn,
+ tb_size_in_bytes,
+ pdu_info.rf,
+ pdu_info.p,
+ pdu_info.fi);
- if (pdu_info.rf) {
- message_string_size += sprintf(&message_string[message_string_size], " LSF %u\n", pdu_info.lsf);
- message_string_size += sprintf(&message_string[message_string_size], " SO %u\n", pdu_info.so);
- }
-
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "| HE:");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]);
+ if (pdu_info.rf) {
+ message_string_size += sprintf(&message_string[message_string_size], " LSF %u\n", pdu_info.lsf);
+ message_string_size += sprintf(&message_string[message_string_size], " SO %u\n", pdu_info.so);
}
- }
- MSC_LOG_TX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
- (char*)rlc_am_pdu_sn_10_p,
- tb_size_in_bytes,
- message_string);
+ if (pdu_info.e) {
+ message_string_size += sprintf(&message_string[message_string_size], "| HE:");
-#endif
-# if ENABLE_ITTI
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
- message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
- message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
-
- if (pdu_info.rf) {
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: AMD PDU segment\n\n");
- } else {
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: AMD PDU\n\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", pdu_info.d_c);
- message_string_size += sprintf(&message_string[message_string_size], " RF : %u\n", pdu_info.rf);
- message_string_size += sprintf(&message_string[message_string_size], " P : %u\n", pdu_info.p);
- message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
- message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
- message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
-
- if (pdu_info.rf) {
- message_string_size += sprintf(&message_string[message_string_size], " LSF : %u\n", pdu_info.lsf);
- message_string_size += sprintf(&message_string[message_string_size], " SO : %u\n", pdu_info.so);
- }
-
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
+ for (index=0; index < pdu_info.num_li; index++) {
+ message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]);
+ }
}
+
+ MSC_LOG_TX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
+ (char *)rlc_am_pdu_sn_10_p,
+ tb_size_in_bytes,
+ message_string);
}
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+ if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
+ message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
+ message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
+ message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
- for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ if (pdu_info.rf) {
+ message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: AMD PDU segment\n\n");
+ } else {
+ message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: AMD PDU\n\n");
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
+ message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", pdu_info.d_c);
+ message_string_size += sprintf(&message_string[message_string_size], " RF : %u\n", pdu_info.rf);
+ message_string_size += sprintf(&message_string[message_string_size], " P : %u\n", pdu_info.p);
+ message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
+ message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
+ message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
+
+ if (pdu_info.rf) {
+ message_string_size += sprintf(&message_string[message_string_size], " LSF : %u\n", pdu_info.lsf);
+ message_string_size += sprintf(&message_string[message_string_size], " SO : %u\n", pdu_info.so);
+ }
+
+ if (pdu_info.e) {
+ message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
+
+ for (index=0; index < pdu_info.num_li; index++) {
+ message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
+ }
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+ message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+
+ for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
+ if ((octet_index % 16) == 0) {
+ if (octet_index != 0) {
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
}
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
+ /*
+ * Print every single octet in hexadecimal form
+ */
+ message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
+ /*
+ * Align newline and pipes according to the octets in groups of 2
+ */
}
/*
- * Print every single octet in hexadecimal form
+ * Append enough spaces and put final pipe
*/
- message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
+ for (index = octet_index; index < 16; ++index) {
+ message_string_size += sprintf(&message_string[message_string_size], " ");
+ }
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
-
- msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_DATA_PDU_REQ, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rlc_am_data_pdu_req.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rlc_am_data_pdu_req.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-
-# else
- rlc_am_display_data_pdu_infos(ctxt_pP, l_rlc_p, &pdu_info);
-# endif
+ LOG_UI(RLC,"%s\n",message_string);
+ } /* LOG_DEBUGFLAG(DEBUG_RLC) */
}
} else {
if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, &tb_size_in_bytes, &l_rlc_p->control_pdu_info) >= 0) {
tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size; //tb_size_in_bytes modified by rlc_am_get_control_pdu_infos!
-#if MESSAGE_CHART_GENERATOR
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size],
- MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS ACK_SN %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p),
- l_rlc_p->control_pdu_info.ack_sn);
- for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) {
- if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u SO START %u SO END %u",
- l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_start,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_end);
+ if (MESSAGE_CHART_GENERATOR ) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size],
+ MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS ACK_SN %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p),
+ l_rlc_p->control_pdu_info.ack_sn);
- } else {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u",
- l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn);
+ for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) {
+ if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) {
+ message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u SO START %u SO END %u",
+ l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn,
+ l_rlc_p->control_pdu_info.nack_list[num_nack].so_start,
+ l_rlc_p->control_pdu_info.nack_list[num_nack].so_end);
+ } else {
+ message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u",
+ l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn);
+ }
}
+
+ MSC_LOG_TX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
+ (char *)rlc_am_pdu_sn_10_p,
+ tb_size_in_bytes,
+ message_string);
}
- MSC_LOG_TX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
- (char*)rlc_am_pdu_sn_10_p,
- tb_size_in_bytes,
- message_string);
+ if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
+ message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
+ message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: STATUS PDU\n\n");
+ message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
+ message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", l_rlc_p->control_pdu_info.d_c);
+ message_string_size += sprintf(&message_string[message_string_size], " CPT : %u\n", l_rlc_p->control_pdu_info.cpt);
+ message_string_size += sprintf(&message_string[message_string_size], " ACK_SN : %u\n", l_rlc_p->control_pdu_info.ack_sn);
+ message_string_size += sprintf(&message_string[message_string_size], " E1 : %u\n", l_rlc_p->control_pdu_info.e1);
-#endif
-# if ENABLE_ITTI
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA REQ: STATUS PDU\n\n");
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", l_rlc_p->control_pdu_info.d_c);
- message_string_size += sprintf(&message_string[message_string_size], " CPT : %u\n", l_rlc_p->control_pdu_info.cpt);
- message_string_size += sprintf(&message_string[message_string_size], " ACK_SN : %u\n", l_rlc_p->control_pdu_info.ack_sn);
- message_string_size += sprintf(&message_string[message_string_size], " E1 : %u\n", l_rlc_p->control_pdu_info.e1);
-
- for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) {
- if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d SO START %05d SO END %05d",
- l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_start,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_end);
- } else {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d", l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn);
+ for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) {
+ if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) {
+ message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d SO START %05d SO END %05d",
+ l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn,
+ l_rlc_p->control_pdu_info.nack_list[num_nack].so_start,
+ l_rlc_p->control_pdu_info.nack_list[num_nack].so_end);
+ } else {
+ message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d", l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn);
+ }
}
- }
- msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_REQ, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rlc_am_status_pdu_req.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rlc_am_status_pdu_req.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-
-# endif
+ LOG_UI(RLC,"%s\n",message_string);
+ } /* LOG_DEBUGFLAG(DEBUG_RLC) */
}
}
tb_p = tb_p->next;
- }
- }
+ } /* while */
+ } /* MESSAGE_CHART_GENERATOR && data_req.data.nb_elements > 0 */
-#endif
return data_req;
}
//-----------------------------------------------------------------------------
void
rlc_am_mac_data_indication (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlc_pP,
+ const protocol_ctxt_t *const ctxt_pP,
+ void *const rlc_pP,
struct mac_data_ind data_indP
-)
-{
- rlc_am_entity_t* l_rlc_p = (rlc_am_entity_t*) rlc_pP;
+) {
+ rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP;
/*rlc_am_control_pdu_info_t control_pdu_info;
int num_li;
int16_t tb_size;*/
-#if TRACE_RLC_AM_PDU || MESSAGE_CHART_GENERATOR
rlc_am_pdu_info_t pdu_info;
rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p;
mem_block_t *tb_p;
@@ -922,9 +833,6 @@ rlc_am_mac_data_indication (
int num_nack;
char message_string[7000];
size_t message_string_size = 0;
-# if ENABLE_ITTI
- MessageDef *msg_p;
-# endif
int octet_index, index;
/* for no gcc warnings */
(void)num_nack;
@@ -932,242 +840,209 @@ rlc_am_mac_data_indication (
(void)message_string_size;
(void)octet_index;
(void)index;
-#endif
-
(void)l_rlc_p; /* avoid gcc warning "unused variable" */
-#if TRACE_RLC_AM_PDU || MESSAGE_CHART_GENERATOR
+ if ( LOG_DEBUGFLAG(DEBUG_RLC) || MESSAGE_CHART_GENERATOR ) {
+ if (data_indP.data.nb_elements > 0) {
+ tb_p = data_indP.data.head;
- if (data_indP.data.nb_elements > 0) {
+ while (tb_p != NULL) {
+ rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t *)((struct mac_tb_ind *) (tb_p->data))->data_ptr;
+ tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
- tb_p = data_indP.data.head;
+ if ((((struct mac_tb_ind *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) {
+ if (rlc_am_get_data_pdu_infos(ctxt_pP,l_rlc_p,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) {
+ if (MESSAGE_CHART_GENERATOR) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size],
+ MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA SN %u size %u RF %u P %u FI %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p),
+ pdu_info.sn,
+ tb_size_in_bytes,
+ pdu_info.rf,
+ pdu_info.p,
+ pdu_info.fi);
- while (tb_p != NULL) {
-
- rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)((struct mac_tb_ind *) (tb_p->data))->data_ptr;
- tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
-
- if ((((struct mac_tb_ind *) (tb_p->data))->data_ptr[0] & RLC_DC_MASK) == RLC_DC_DATA_PDU ) {
- if (rlc_am_get_data_pdu_infos(ctxt_pP,l_rlc_p,rlc_am_pdu_sn_10_p, tb_size_in_bytes, &pdu_info) >= 0) {
-#if MESSAGE_CHART_GENERATOR
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size],
- MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA SN %u size %u RF %u P %u FI %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p),
- pdu_info.sn,
- tb_size_in_bytes,
- pdu_info.rf,
- pdu_info.p,
- pdu_info.fi);
-
- if (pdu_info.rf) {
- message_string_size += sprintf(&message_string[message_string_size], " LSF %u\n", pdu_info.lsf);
- message_string_size += sprintf(&message_string[message_string_size], " SO %u\n", pdu_info.so);
- }
-
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "| HE:");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]);
- }
- }
-
- MSC_LOG_RX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
- (char*)rlc_am_pdu_sn_10_p,
- tb_size_in_bytes,
- message_string);
-
-#endif
-
-# if ENABLE_ITTI && TRACE_RLC_AM_PDU
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
- message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
- message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
-
- if (pdu_info.rf) {
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: AMD PDU segment\n\n");
- } else {
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: AMD PDU\n\n");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", pdu_info.d_c);
- message_string_size += sprintf(&message_string[message_string_size], " RF : %u\n", pdu_info.rf);
- message_string_size += sprintf(&message_string[message_string_size], " P : %u\n", pdu_info.p);
- message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
- message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
- message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
-
- if (pdu_info.rf) {
- message_string_size += sprintf(&message_string[message_string_size], " LSF : %u\n", pdu_info.lsf);
- message_string_size += sprintf(&message_string[message_string_size], " SO : %u\n", pdu_info.so);
- }
-
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
- }
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ if (pdu_info.rf) {
+ message_string_size += sprintf(&message_string[message_string_size], " LSF %u\n", pdu_info.lsf);
+ message_string_size += sprintf(&message_string[message_string_size], " SO %u\n", pdu_info.so);
}
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
+ if (pdu_info.e) {
+ message_string_size += sprintf(&message_string[message_string_size], "| HE:");
+
+ for (index=0; index < pdu_info.num_li; index++) {
+ message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]);
+ }
+ }
+
+ MSC_LOG_RX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
+ (char *)rlc_am_pdu_sn_10_p,
+ tb_size_in_bytes,
+ message_string);
}
- /*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
+ if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
+ message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
+ message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
+ message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
+ message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
+
+ if (pdu_info.rf) {
+ message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: AMD PDU segment\n\n");
+ } else {
+ message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: AMD PDU\n\n");
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
+ message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", pdu_info.d_c);
+ message_string_size += sprintf(&message_string[message_string_size], " RF : %u\n", pdu_info.rf);
+ message_string_size += sprintf(&message_string[message_string_size], " P : %u\n", pdu_info.p);
+ message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
+ message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
+ message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
+
+ if (pdu_info.rf) {
+ message_string_size += sprintf(&message_string[message_string_size], " LSF : %u\n", pdu_info.lsf);
+ message_string_size += sprintf(&message_string[message_string_size], " SO : %u\n", pdu_info.so);
+ }
+
+ if (pdu_info.e) {
+ message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
+
+ for (index=0; index < pdu_info.num_li; index++) {
+ message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
+ }
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+ message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+
+ for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
+ if ((octet_index % 16) == 0) {
+ if (octet_index != 0) {
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
+ }
+
+ /*
+ * Print every single octet in hexadecimal form
+ */
+ message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
+ /*
+ * Align newline and pipes according to the octets in groups of 2
+ */
+ }
+
+ /*
+ * Append enough spaces and put final pipe
+ */
+ for (index = octet_index; index < 16; ++index) {
+ message_string_size += sprintf(&message_string[message_string_size], " ");
+ }
+
+ LOG_UI(RLC,"%s\n",message_string);
+ } /* LOG_DEBUGFLAG */
}
+ } else {
+ if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, &tb_size_in_bytes, &l_rlc_p->control_pdu_info) >= 0) {
+ if (MESSAGE_CHART_GENERATOR) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size],
+ MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS size ACK_SN %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p),
+ l_rlc_p->control_pdu_info.ack_sn);
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
+ for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) {
+ if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) {
+ message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u SO START %u SO END %u",
+ l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn,
+ l_rlc_p->control_pdu_info.nack_list[num_nack].so_start,
+ l_rlc_p->control_pdu_info.nack_list[num_nack].so_end);
+ } else {
+ message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u",
+ l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn);
+ }
+ }
+
+ MSC_LOG_RX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
+ (char *)rlc_am_pdu_sn_10_p,
+ tb_size_in_bytes,
+ message_string);
+ }
+
+ if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
+ message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", ((struct mac_tb_ind *) (tb_p->data))->size);
+ message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: STATUS PDU\n\n");
+ message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
+ message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", l_rlc_p->control_pdu_info.d_c);
+ message_string_size += sprintf(&message_string[message_string_size], " CPT : %u\n", l_rlc_p->control_pdu_info.cpt);
+ message_string_size += sprintf(&message_string[message_string_size], " ACK_SN : %u\n", l_rlc_p->control_pdu_info.ack_sn);
+ message_string_size += sprintf(&message_string[message_string_size], " E1 : %u\n", l_rlc_p->control_pdu_info.e1);
+
+ for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) {
+ if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) {
+ message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d SO START %05d SO END %05d",
+ l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn,
+ l_rlc_p->control_pdu_info.nack_list[num_nack].so_start,
+ l_rlc_p->control_pdu_info.nack_list[num_nack].so_end);
+ } else {
+ message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d", l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn);
+ }
+ }
+
+ LOG_UI(RLC, "%s\n",message_string);
+ }
}
-
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
-
- msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_DATA_PDU_IND, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rlc_am_data_pdu_ind.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rlc_am_data_pdu_ind.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-
-# else
- rlc_am_display_data_pdu_infos(ctxt_pP, l_rlc_p, &pdu_info);
-# endif
}
- } else {
- if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, &tb_size_in_bytes, &l_rlc_p->control_pdu_info) >= 0) {
-#if MESSAGE_CHART_GENERATOR
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size],
- MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" STATUS size ACK_SN %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p),
- l_rlc_p->control_pdu_info.ack_sn);
- for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) {
- if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u SO START %u SO END %u",
- l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_start,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_end);
-
- } else {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %u",
- l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn);
- }
- }
-
- MSC_LOG_RX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
- (char*)rlc_am_pdu_sn_10_p,
- tb_size_in_bytes,
- message_string);
-
-#endif
-
-# if ENABLE_ITTI && TRACE_RLC_AM_PDU
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", ((struct mac_tb_ind *) (tb_p->data))->size);
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC AM DATA IND: STATUS PDU\n\n");
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " D/C : %u\n", l_rlc_p->control_pdu_info.d_c);
- message_string_size += sprintf(&message_string[message_string_size], " CPT : %u\n", l_rlc_p->control_pdu_info.cpt);
- message_string_size += sprintf(&message_string[message_string_size], " ACK_SN : %u\n", l_rlc_p->control_pdu_info.ack_sn);
- message_string_size += sprintf(&message_string[message_string_size], " E1 : %u\n", l_rlc_p->control_pdu_info.e1);
-
- for (num_nack = 0; num_nack < l_rlc_p->control_pdu_info.num_nack; num_nack++) {
- if (l_rlc_p->control_pdu_info.nack_list[num_nack].e2) {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d SO START %05d SO END %05d",
- l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_start,
- l_rlc_p->control_pdu_info.nack_list[num_nack].so_end);
- } else {
- message_string_size += sprintf(&message_string[message_string_size], " NACK SN %04d", l_rlc_p->control_pdu_info.nack_list[num_nack].nack_sn);
- }
- }
-
- msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_IND, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rlc_am_status_pdu_ind.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rlc_am_status_pdu_ind.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-
-# endif
- }
+ tb_p = tb_p->next;
}
-
- tb_p = tb_p->next;
}
- }
+ } /* LOG_DEBUGFLAG(RLC) || MESSAGE_TRACE_GENERATOR) */
-#endif
rlc_am_rx (ctxt_pP, rlc_pP, data_indP);
}
//-----------------------------------------------------------------------------
void
rlc_am_data_req (
- const protocol_ctxt_t* const ctxt_pP,
- void * const rlc_pP,
- mem_block_t * const sdu_pP)
-{
+ const protocol_ctxt_t *const ctxt_pP,
+ void *const rlc_pP,
+ mem_block_t *const sdu_pP) {
rlc_am_entity_t *l_rlc_p = (rlc_am_entity_t *) rlc_pP;
uint32_t mui;
uint16_t data_offset;
uint16_t data_size;
-#if TRACE_RLC_AM_PDU
char message_string[7000];
size_t message_string_size = 0;
-#if ENABLE_ITTI
- MessageDef *msg_p;
-#endif
int octet_index, index;
-#endif
-
RLC_AM_MUTEX_LOCK(&l_rlc_p->lock_input_sdus, ctxt_pP, l_rlc_p);
if ((l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mem_block == NULL) &&
(l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.segmented == 0) &&
(((l_rlc_p->next_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE) != l_rlc_p->current_sdu_index)) {
-
-
memset(&l_rlc_p->input_sdus[l_rlc_p->next_sdu_index], 0, sizeof(rlc_am_tx_sdu_management_t));
l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mem_block = sdu_pP;
-
mui = ((struct rlc_am_data_req *) (sdu_pP->data))->mui;
data_offset = ((struct rlc_am_data_req *) (sdu_pP->data))->data_offset;
data_size = ((struct rlc_am_data_req *) (sdu_pP->data))->data_size;
-
MSC_LOG_RX_MESSAGE(
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (const char*)(&sdu_pP->data[data_offset]),
+ (const char *)(&sdu_pP->data[data_offset]),
data_size,
MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA-REQ size %u mui %u",
MSC_AS_TIME_ARGS(ctxt_pP),
@@ -1175,68 +1050,53 @@ rlc_am_data_req (
data_size,
mui);
+ if (LOG_DEBUGFLAG(DEBUG_RLC)) {
+ message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
+ message_string_size += sprintf(&message_string[message_string_size], "SDU size : %u\n", data_size);
+ message_string_size += sprintf(&message_string[message_string_size], "MUI : %u\n", mui);
+ message_string_size += sprintf(&message_string[message_string_size], "CONF : %u\n", ((struct rlc_am_data_req *) (sdu_pP->data))->conf);
+ message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+ message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-#if TRACE_RLC_AM_PDU
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "SDU size : %u\n", data_size);
- message_string_size += sprintf(&message_string[message_string_size], "MUI : %u\n", mui);
- message_string_size += sprintf(&message_string[message_string_size], "CONF : %u\n", ((struct rlc_am_data_req *) (sdu_pP->data))->conf);
+ for (octet_index = 0; octet_index < data_size; octet_index++) {
+ if ((octet_index % 16) == 0) {
+ if (octet_index != 0) {
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ }
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < data_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
}
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
+ /*
+ * Print every single octet in hexadecimal form
+ */
+ message_string_size += sprintf(&message_string[message_string_size], " %02x", ((uint8_t *)(&sdu_pP->data[data_offset]))[octet_index]);
+ /*
+ * Align newline and pipes according to the octets in groups of 2
+ */
}
/*
- * Print every single octet in hexadecimal form
+ * Append enough spaces and put final pipe
*/
- message_string_size += sprintf(&message_string[message_string_size], " %02x", ((uint8_t*)(&sdu_pP->data[data_offset]))[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
+ for (index = octet_index; index < 16; ++index) {
+ message_string_size += sprintf(&message_string[message_string_size], " ");
+ }
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
-
-# if ENABLE_ITTI
- msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_SDU_REQ, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rlc_am_sdu_req.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rlc_am_sdu_req.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-
-# else
- LOG_T(RLC, "%s", message_string);
-# endif
-#endif
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ LOG_UI(RLC, "%s\n", message_string);
+ } /* LOG_DEBUGFLAG(RLC) */
l_rlc_p->stat_tx_pdcp_sdu += 1;
l_rlc_p->stat_tx_pdcp_bytes += data_size;
-
l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mui = mui;
l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_size = data_size;
-
l_rlc_p->sdu_buffer_occupancy += data_size;
l_rlc_p->nb_sdu += 1;
l_rlc_p->nb_sdu_no_segmented += 1;
-
- l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].first_byte = (uint8_t*)(&sdu_pP->data[data_offset]);
+ l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].first_byte = (uint8_t *)(&sdu_pP->data[data_offset]);
l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_remaining_size = l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_size;
l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_segmented_size = 0;
l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].sdu_creation_time = ctxt_pP->frame;
@@ -1250,43 +1110,44 @@ rlc_am_data_req (
l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.no_new_sdu_segmented_in_last_pdu = 0;
//l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].li_index_for_discard = -1;
l_rlc_p->next_sdu_index = (l_rlc_p->next_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
- if (l_rlc_p->channel_id <3)
- {
- LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ size %d Bytes, NB SDU %d current_sdu_index=%d next_sdu_index=%d conf %d mui %d vtA %d vtS %d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- data_size,
- l_rlc_p->nb_sdu,
- l_rlc_p->current_sdu_index,
- l_rlc_p->next_sdu_index,
- ((struct rlc_am_data_req *) (sdu_pP->data))->conf,
- mui,
- l_rlc_p->vt_a,
- l_rlc_p->vt_s);
+
+ if (l_rlc_p->channel_id <3) {
+ LOG_I(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ size %d Bytes, NB SDU %d current_sdu_index=%d next_sdu_index=%d conf %d mui %d vtA %d vtS %d\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
+ data_size,
+ l_rlc_p->nb_sdu,
+ l_rlc_p->current_sdu_index,
+ l_rlc_p->next_sdu_index,
+ ((struct rlc_am_data_req *) (sdu_pP->data))->conf,
+ mui,
+ l_rlc_p->vt_a,
+ l_rlc_p->vt_s);
}
} else {
-#if MESSAGE_CHART_GENERATOR
- mui = ((struct rlc_am_data_req*) (sdu_pP->data))->mui;
- data_offset = ((struct rlc_am_data_req*) (sdu_pP->data))->data_offset;
- data_size = ((struct rlc_am_data_req*) (sdu_pP->data))->data_size;
- MSC_LOG_RX_DISCARDED_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (const char*)(&sdu_pP->data[data_offset]),
- data_size,
- MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA-REQ size %u mui %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p),
- data_size,
- mui);
-#endif
+ if( MESSAGE_CHART_GENERATOR) {
+ mui = ((struct rlc_am_data_req *) (sdu_pP->data))->mui;
+ data_offset = ((struct rlc_am_data_req *) (sdu_pP->data))->data_offset;
+ data_size = ((struct rlc_am_data_req *) (sdu_pP->data))->data_size;
+ MSC_LOG_RX_DISCARDED_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+ (const char *)(&sdu_pP->data[data_offset]),
+ data_size,
+ MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA-REQ size %u mui %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP, l_rlc_p),
+ data_size,
+ mui);
+ }
+
LOG_W(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ BUFFER FULL, NB SDU %d current_sdu_index=%d next_sdu_index=%d size_input_sdus_buffer=%d vtA=%d vtS=%d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
l_rlc_p->nb_sdu,
l_rlc_p->current_sdu_index,
l_rlc_p->next_sdu_index,
RLC_AM_SDU_CONTROL_BUFFER_SIZE,
- l_rlc_p->vt_a,
- l_rlc_p->vt_s);
+ l_rlc_p->vt_a,
+ l_rlc_p->vt_s);
LOG_W(RLC, " input_sdus[].mem_block=%p next input_sdus[].flags.segmented=%d\n",
l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mem_block, l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.segmented);
l_rlc_p->stat_tx_pdcp_sdu_discarded += 1;
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
index d2fe1d1bfd..369c7fd0da 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
@@ -23,9 +23,7 @@
#define RLC_AM_REASSEMBLY_C 1
#include "platform_types.h"
//-----------------------------------------------------------------------------
-#if ENABLE_ITTI
-# include "intertask_interface.h"
-#endif
+
#include "assertions.h"
#include "rlc.h"
#include "rlc_am.h"
@@ -37,19 +35,17 @@
//-----------------------------------------------------------------------------
inline void
rlc_am_clear_rx_sdu (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP)
-{
+ const protocol_ctxt_t *const ctxt_pP,
+ rlc_am_entity_t *const rlc_pP) {
rlc_pP->output_sdu_size_to_write = 0;
}
//-----------------------------------------------------------------------------
void
rlc_am_reassembly (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP,
- uint8_t * src_pP,
- const int32_t lengthP)
-{
+ const protocol_ctxt_t *const ctxt_pP,
+ rlc_am_entity_t *const rlc_pP,
+ uint8_t *src_pP,
+ const int32_t lengthP) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PAYLOAD] reassembly() %d bytes\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
lengthP);
@@ -57,6 +53,7 @@ rlc_am_reassembly (
if (rlc_pP->output_sdu_in_construction == NULL) {
rlc_pP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE, __func__);
rlc_pP->output_sdu_size_to_write = 0;
+
//assert(rlc_pP->output_sdu_in_construction != NULL);
if(rlc_pP->output_sdu_in_construction == NULL) {
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PAYLOAD] output_sdu_in_construction is NULL\n",
@@ -66,7 +63,6 @@ rlc_am_reassembly (
}
if (rlc_pP->output_sdu_in_construction != NULL) {
-
// check if no overflow in size
if ((rlc_pP->output_sdu_size_to_write + lengthP) <= RLC_SDU_MAX_SIZE) {
memcpy (&rlc_pP->output_sdu_in_construction->data[rlc_pP->output_sdu_size_to_write], src_pP, lengthP);
@@ -93,18 +89,8 @@ rlc_am_reassembly (
//-----------------------------------------------------------------------------
void
rlc_am_send_sdu (
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP)
-{
-# if TRACE_RLC_AM_PDU
- char message_string[7000];
- size_t message_string_size = 0;
-#if ENABLE_ITTI
- MessageDef *msg_p;
-#endif
- int octet_index, index;
-#endif
-
+ const protocol_ctxt_t *const ctxt_pP,
+ rlc_am_entity_t *const rlc_pP) {
if ((rlc_pP->output_sdu_in_construction)) {
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND_SDU] %d bytes sdu %p\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
@@ -120,73 +106,62 @@ rlc_am_send_sdu (
rlc_pP->output_sdu_size_to_write,
rlc_pP->output_sdu_in_construction);
#else
-# if TRACE_RLC_AM_PDU
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", rlc_pP->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "SDU size : %u\n", rlc_pP->output_sdu_size_to_write);
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+ if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
+ char message_string[7000];
+ size_t message_string_size = 0;
+ int octet_index, index;
+ message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", rlc_pP->rb_id);
+ message_string_size += sprintf(&message_string[message_string_size], "SDU size : %u\n", rlc_pP->output_sdu_size_to_write);
+ message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+ message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- for (octet_index = 0; octet_index < rlc_pP->output_sdu_size_to_write; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ for (octet_index = 0; octet_index < rlc_pP->output_sdu_size_to_write; octet_index++) {
+ if ((octet_index % 16) == 0) {
+ if (octet_index != 0) {
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
}
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
+ /*
+ * Print every single octet in hexadecimal form
+ */
+ message_string_size += sprintf(&message_string[message_string_size],
+ " %02x",
+ rlc_pP->output_sdu_in_construction->data[octet_index]);
+ /*
+ * Align newline and pipes according to the octets in groups of 2
+ */
}
/*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size],
- " %02x",
- rlc_pP->output_sdu_in_construction->data[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
+ * Append enough spaces and put final pipe
*/
+ for (index = octet_index; index < 16; ++index) {
+ message_string_size += sprintf(&message_string[message_string_size], " ");
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ LOG_T(RLC, "%s", message_string);
}
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
-
-
-
-# if ENABLE_ITTI
- msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE ,
- RLC_AM_SDU_IND,
- message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rlc_am_sdu_ind.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rlc_am_sdu_ind.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-
-# else
- LOG_T(RLC, "%s", message_string);
-# endif
-# endif
#if !ENABLE_ITTI
RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
#endif
MSC_LOG_TX_MESSAGE(
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
- (const char*)(rlc_pP->output_sdu_in_construction->data),
+ (const char *)(rlc_pP->output_sdu_in_construction->data),
rlc_pP->output_sdu_size_to_write,
MSC_AS_TIME_FMT" "PROTOCOL_RLC_AM_MSC_FMT" DATA-IND size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP),
rlc_pP->output_sdu_size_to_write
);
-
rlc_data_ind (ctxt_pP,
BOOL_NOT(rlc_pP->is_data_plane),
MBMS_FLAG_NO,
@@ -203,16 +178,16 @@ rlc_am_send_sdu (
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
//msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id);
//free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
-//Assertion(eNB)_PRAN_DesignDocument_annex No.764
- LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->output_sdu_size_to_write);
-/*
- AssertFatal(3==4,
- PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- rlc_pP->output_sdu_size_to_write);
-*/
+ //Assertion(eNB)_PRAN_DesignDocument_annex No.764
+ LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
+ rlc_pP->output_sdu_size_to_write);
+ /*
+ AssertFatal(3==4,
+ PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
+ rlc_pP->output_sdu_size_to_write);
+ */
}
rlc_pP->output_sdu_size_to_write = 0;
@@ -221,191 +196,189 @@ rlc_am_send_sdu (
//-----------------------------------------------------------------------------
void
rlc_am_reassemble_pdu(
- const protocol_ctxt_t* const ctxt_pP,
- rlc_am_entity_t * const rlc_pP,
- mem_block_t * const tb_pP,
- boolean_t free_rlc_pdu)
-{
+ const protocol_ctxt_t *const ctxt_pP,
+ rlc_am_entity_t *const rlc_pP,
+ mem_block_t *const tb_pP,
+ boolean_t free_rlc_pdu) {
int i,j;
-
- rlc_am_pdu_info_t* pdu_info = &((rlc_am_rx_pdu_management_t*)(tb_pP->data))->pdu_info;
+ rlc_am_pdu_info_t *pdu_info = &((rlc_am_rx_pdu_management_t *)(tb_pP->data))->pdu_info;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU SN=%03d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_info->sn);
-#if TRACE_RLC_AM_RX_DECODE
- rlc_am_display_data_pdu_infos(ctxt_pP, rlc_pP, pdu_info);
-#endif
+
+ if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
+ rlc_am_display_data_pdu_infos(ctxt_pP, rlc_pP, pdu_info);
+ }
if (pdu_info->e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) {
switch (pdu_info->fi) {
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=11 (00)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- // one complete SDU
- rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary
- rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size);
- rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
+ case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=11 (00)\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
+ // one complete SDU
+ rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary
+ rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size);
+ rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary
+ //rlc_pP->reassembly_missing_sn_detected = 0;
+ break;
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=10 (01)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- // one beginning segment of SDU in PDU
- rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary
- rlc_am_reassembly (ctxt_pP, rlc_pP,pdu_info->payload, pdu_info->payload_size);
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
+ case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=10 (01)\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
+ // one beginning segment of SDU in PDU
+ rlc_am_send_sdu(ctxt_pP, rlc_pP); // may be not necessary
+ rlc_am_reassembly (ctxt_pP, rlc_pP,pdu_info->payload, pdu_info->payload_size);
+ //rlc_pP->reassembly_missing_sn_detected = 0;
+ break;
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=01 (10)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- // one last segment of SDU
- //if (rlc_pP->reassembly_missing_sn_detected == 0) {
- rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- //} // else { clear sdu already done
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
+ case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=01 (10)\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
+ // one last segment of SDU
+ //if (rlc_pP->reassembly_missing_sn_detected == 0) {
+ rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size);
+ rlc_am_send_sdu(ctxt_pP, rlc_pP);
+ //} // else { clear sdu already done
+ //rlc_pP->reassembly_missing_sn_detected = 0;
+ break;
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=00 (11)\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- //if (rlc_pP->reassembly_missing_sn_detected == 0) {
- // one whole segment of SDU in PDU
- rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size);
- //} else {
- // rlc_pP->reassembly_missing_sn_detected = 1; // not necessary but for readability of the code
- //}
+ case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU NO E_LI FI=00 (11)\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
+ //if (rlc_pP->reassembly_missing_sn_detected == 0) {
+ // one whole segment of SDU in PDU
+ rlc_am_reassembly (ctxt_pP, rlc_pP, pdu_info->payload, pdu_info->payload_size);
+ //} else {
+ // rlc_pP->reassembly_missing_sn_detected = 1; // not necessary but for readability of the code
+ //}
+ break;
- break;
-
- default:
-//Assertion(eNB)_PRAN_DesignDocument_annex No.1428
- LOG_E(RLC, "RLC_E_FIXED_PART_DATA_FIELD_FOLLOW error pdu_info->fi[%d]\n", pdu_info->fi);
-// assert(0 != 0);
+ default:
+ //Assertion(eNB)_PRAN_DesignDocument_annex No.1428
+ LOG_E(RLC, "RLC_E_FIXED_PART_DATA_FIELD_FOLLOW error pdu_info->fi[%d]\n", pdu_info->fi);
+ // assert(0 != 0);
}
} else {
switch (pdu_info->fi) {
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=11 (00) Li=",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
+ case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=11 (00) Li=",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- for (i=0; i < pdu_info->num_li; i++) {
- LOG_D(RLC, "%d ",pdu_info->li_list[i]);
- }
+ for (i=0; i < pdu_info->num_li; i++) {
+ LOG_D(RLC, "%d ",pdu_info->li_list[i]);
+ }
- LOG_D(RLC, "\n");
- //msg(" remaining size %d\n",size);
- // N complete SDUs
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = 0;
-
- for (i = 0; i < pdu_info->num_li; i++) {
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
+ LOG_D(RLC, "\n");
+ //msg(" remaining size %d\n",size);
+ // N complete SDUs
rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = j + pdu_info->li_list[i];
- }
+ j = 0;
- if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
- // data is already ok, done by last loop above
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
+ for (i = 0; i < pdu_info->num_li; i++) {
+ rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
+ rlc_am_send_sdu(ctxt_pP, rlc_pP);
+ j = j + pdu_info->li_list[i];
+ }
+
+ if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
+ // data is already ok, done by last loop above
+ rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
+ rlc_am_send_sdu(ctxt_pP, rlc_pP);
+ }
+
+ //rlc_pP->reassembly_missing_sn_detected = 0;
+ break;
+
+ case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=10 (01) Li=",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
+
+ for (i=0; i < pdu_info->num_li; i++) {
+ LOG_D(RLC, "%d ",pdu_info->li_list[i]);
+ }
+
+ LOG_D(RLC, "\n");
+ //msg(" remaining size %d\n",size);
+ // N complete SDUs + one segment of SDU in PDU
rlc_am_send_sdu(ctxt_pP, rlc_pP);
- }
+ j = 0;
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
+ for (i = 0; i < pdu_info->num_li; i++) {
+ rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
+ rlc_am_send_sdu(ctxt_pP, rlc_pP);
+ j = j + pdu_info->li_list[i];
+ }
- case RLC_FI_1ST_BYTE_DATA_IS_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=10 (01) Li=",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
+ if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
+ // data is already ok, done by last loop above
+ rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
+ }
- for (i=0; i < pdu_info->num_li; i++) {
- LOG_D(RLC, "%d ",pdu_info->li_list[i]);
- }
+ //rlc_pP->reassembly_missing_sn_detected = 0;
+ break;
- LOG_D(RLC, "\n");
- //msg(" remaining size %d\n",size);
- // N complete SDUs + one segment of SDU in PDU
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = 0;
+ case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=01 (10) Li=",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- for (i = 0; i < pdu_info->num_li; i++) {
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = j + pdu_info->li_list[i];
- }
+ for (i=0; i < pdu_info->num_li; i++) {
+ LOG_D(RLC, "%d ",pdu_info->li_list[i]);
+ }
- if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
- // data is already ok, done by last loop above
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
- }
+ LOG_D(RLC, "\n");
+ //msg(" remaining size %d\n",size);
+ // one last segment of SDU + N complete SDUs in PDU
+ j = 0;
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
+ for (i = 0; i < pdu_info->num_li; i++) {
+ rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
+ rlc_am_send_sdu(ctxt_pP, rlc_pP);
+ j = j + pdu_info->li_list[i];
+ }
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=01 (10) Li=",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
+ if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
+ // data is already ok, done by last loop above
+ rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
+ rlc_am_send_sdu(ctxt_pP, rlc_pP);
+ }
- for (i=0; i < pdu_info->num_li; i++) {
- LOG_D(RLC, "%d ",pdu_info->li_list[i]);
- }
+ //rlc_pP->reassembly_missing_sn_detected = 0;
+ break;
- LOG_D(RLC, "\n");
- //msg(" remaining size %d\n",size);
- // one last segment of SDU + N complete SDUs in PDU
- j = 0;
+ case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=00 (11) Li=",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
- for (i = 0; i < pdu_info->num_li; i++) {
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = j + pdu_info->li_list[i];
- }
+ for (i=0; i < pdu_info->num_li; i++) {
+ LOG_D(RLC, "%d ",pdu_info->li_list[i]);
+ }
- if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
- // data is already ok, done by last loop above
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- }
+ LOG_D(RLC, "\n");
+ //msg(" remaining size %d\n",size);
+ j = 0;
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
+ for (i = 0; i < pdu_info->num_li; i++) {
+ rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
+ rlc_am_send_sdu(ctxt_pP, rlc_pP);
+ j = j + pdu_info->li_list[i];
+ }
- case RLC_FI_1ST_BYTE_DATA_IS_NOT_1ST_BYTE_SDU_LAST_BYTE_DATA_IS_NOT_LAST_BYTE_SDU:
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[REASSEMBLY PDU] TRY REASSEMBLY PDU FI=00 (11) Li=",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
+ if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
+ // data is already ok, done by last loop above
+ rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
+ }
- for (i=0; i < pdu_info->num_li; i++) {
- LOG_D(RLC, "%d ",pdu_info->li_list[i]);
- }
+ //rlc_pP->reassembly_missing_sn_detected = 0;
+ break;
- LOG_D(RLC, "\n");
- //msg(" remaining size %d\n",size);
- j = 0;
-
- for (i = 0; i < pdu_info->num_li; i++) {
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->li_list[i]);
- rlc_am_send_sdu(ctxt_pP, rlc_pP);
- j = j + pdu_info->li_list[i];
- }
-
- if (pdu_info->hidden_size > 0) { // normally should always be > 0 but just for help debug
- // data is already ok, done by last loop above
- rlc_am_reassembly (ctxt_pP, rlc_pP, &pdu_info->payload[j], pdu_info->hidden_size);
- }
-
- //rlc_pP->reassembly_missing_sn_detected = 0;
- break;
-
- default:
-//Assertion(eNB)_PRAN_DesignDocument_annex No.1429
- LOG_E(RLC, "not RLC_E_FIXED_PART_DATA_FIELD_FOLLOW error pdu_info->fi[%d]\n", pdu_info->fi);
-// assert(1 != 1);
+ default:
+ //Assertion(eNB)_PRAN_DesignDocument_annex No.1429
+ LOG_E(RLC, "not RLC_E_FIXED_PART_DATA_FIELD_FOLLOW error pdu_info->fi[%d]\n", pdu_info->fi);
+ // assert(1 != 1);
}
}
if (free_rlc_pdu) {
- free_mem_block(tb_pP, __func__);
+ free_mem_block(tb_pP, __func__);
}
}
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
index 917f1a1791..5c68aecf61 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
@@ -27,59 +27,19 @@
#include "platform_types.h"
//-----------------------------------------------------------------------------
#if ENABLE_ITTI
-# include "intertask_interface.h"
+ #include "intertask_interface.h"
#endif
#include "assertions.h"
#include "list.h"
#include "rlc_am.h"
#include "common/utils/LOG/log.h"
-# if ENABLE_ITTI
-//-----------------------------------------------------------------------------
-void
-rlc_am_itti_display_status_ind_infos(
- const protocol_ctxt_t* const ctxt_pP,
- const rlc_am_entity_t *const rlc_pP,
- const rlc_am_control_pdu_info_t *const pdu_info_pP)
-{
- char message_string[1000];
- size_t message_string_size = 0;
- MessageDef *msg_p;
-
- int num_nack;
-
- if (!pdu_info_pP->d_c) {
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", rlc_pP->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "CONTROL PDU ACK SN %04d", pdu_info_pP->ack_sn);
-
- for (num_nack = 0; num_nack < pdu_info_pP->num_nack; num_nack++) {
- if (pdu_info_pP->nack_list[num_nack].e2) {
- message_string_size += sprintf(&message_string[message_string_size], "\n\tNACK SN %04d SO START %05d SO END %05d", pdu_info_pP->nack_list[num_nack].nack_sn,
- pdu_info_pP->nack_list[num_nack].so_start,
- pdu_info_pP->nack_list[num_nack].so_end);
- } else {
- message_string_size += sprintf(&message_string[message_string_size], "\n\tNACK SN %04d", pdu_info_pP->nack_list[num_nack].nack_sn);
- }
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "\n");
-
- msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_AM_STATUS_PDU_IND, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rlc_am_status_pdu_ind.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rlc_am_status_pdu_ind.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
- }
-}
-
-# endif
//-----------------------------------------------------------------------------
uint16_t rlc_am_read_bit_field(
- uint8_t** data_ppP,
- unsigned int* bit_pos_pP,
- const signed int bits_to_readP)
-{
+ uint8_t **data_ppP,
+ unsigned int *bit_pos_pP,
+ const signed int bits_to_readP) {
uint16_t value = 0;
unsigned int bits_read = 0;
signed int bits_to_read = bits_to_readP;
@@ -113,11 +73,10 @@ uint16_t rlc_am_read_bit_field(
//-----------------------------------------------------------------------------
void
rlc_am_write8_bit_field(
- uint8_t** data_ppP,
- unsigned int* bit_pos_pP,
+ uint8_t **data_ppP,
+ unsigned int *bit_pos_pP,
const signed int bits_to_writeP,
- const uint8_t valueP)
-{
+ const uint8_t valueP) {
unsigned int available_bits;
signed int bits_to_write= bits_to_writeP;
@@ -148,11 +107,10 @@ rlc_am_write8_bit_field(
//-----------------------------------------------------------------------------
void
rlc_am_write16_bit_field(
- uint8_t** data_ppP,
- unsigned int* bit_pos_pP,
+ uint8_t **data_ppP,
+ unsigned int *bit_pos_pP,
signed int bits_to_writeP,
- const uint16_t valueP)
-{
+ const uint16_t valueP) {
//assert(bits_to_writeP <= 16);
if(bits_to_writeP > 16) {
LOG_E(RLC, "bits_to_writeP error. %d\n", bits_to_writeP);
@@ -168,15 +126,12 @@ rlc_am_write16_bit_field(
//-----------------------------------------------------------------------------
signed int
rlc_am_get_control_pdu_infos(
- rlc_am_pdu_sn_10_t* const header_pP,
- sdu_size_t * const total_size_pP,
- rlc_am_control_pdu_info_t* const pdu_info_pP)
-{
+ rlc_am_pdu_sn_10_t *const header_pP,
+ sdu_size_t *const total_size_pP,
+ rlc_am_control_pdu_info_t *const pdu_info_pP) {
memset(pdu_info_pP, 0, sizeof (rlc_am_control_pdu_info_t));
-
pdu_info_pP->d_c = header_pP->b1 >> 7;
-
if (!pdu_info_pP->d_c) {
pdu_info_pP->cpt = (header_pP->b1 >> 4) & 0x07;
@@ -191,7 +146,7 @@ rlc_am_get_control_pdu_infos(
if (pdu_info_pP->e1) {
unsigned int nack_to_read = 1;
unsigned int bit_pos = 7; // range from 0 (MSB/left) to 7 (LSB/right)
- uint8_t* byte_pos_p = &header_pP->b2;
+ uint8_t *byte_pos_p = &header_pP->b2;
while (nack_to_read) {
pdu_info_pP->nack_list[pdu_info_pP->num_nack].nack_sn = rlc_am_read_bit_field(&byte_pos_p, &bit_pos, 10);
@@ -214,9 +169,11 @@ rlc_am_get_control_pdu_infos(
if (!pdu_info_pP->nack_list[pdu_info_pP->num_nack - 1].e1) {
nack_to_read = 0;
*total_size_pP = *total_size_pP - (sdu_size_t)((uint64_t)byte_pos_p + (uint64_t)((bit_pos + 7)/8) - (uint64_t)header_pP);
+
if (*total_size_pP != 0) {
LOG_E(RLC, "[RLC_AM_GET_CONTROL_PDU_INFOS][FIRST]header_pP->b1=%d,header_pP->b2=%d\n",header_pP->b1,header_pP->b2);
}
+
return 0;
}
@@ -230,9 +187,11 @@ rlc_am_get_control_pdu_infos(
} else {
*total_size_pP = *total_size_pP - 2;
}
+
if (*total_size_pP != 0) {
LOG_E(RLC, "[RLC_AM_GET_CONTROL_PDU_INFOS][SECOND]header_pP->b1=%d,header_pP->b2=%d\n",header_pP->b1,header_pP->b2);
}
+
return 0;
} else {
return -1;
@@ -241,9 +200,8 @@ rlc_am_get_control_pdu_infos(
//-----------------------------------------------------------------------------
void
rlc_am_display_control_pdu_infos(
- const rlc_am_control_pdu_info_t* const pdu_info_pP
-)
-{
+ const rlc_am_control_pdu_info_t *const pdu_info_pP
+) {
int num_nack;
if (!pdu_info_pP->d_c) {
@@ -267,25 +225,23 @@ rlc_am_display_control_pdu_infos(
//-----------------------------------------------------------------------------
void
rlc_am_receive_process_control_pdu(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
- mem_block_t* const tb_pP,
- uint8_t** first_byte_ppP,
- sdu_size_t * const tb_size_in_bytes_pP)
-{
- rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t*)*first_byte_ppP;
+ mem_block_t *const tb_pP,
+ uint8_t **first_byte_ppP,
+ sdu_size_t *const tb_size_in_bytes_pP) {
+ rlc_am_pdu_sn_10_t *rlc_am_pdu_sn_10_p = (rlc_am_pdu_sn_10_t *)*first_byte_ppP;
sdu_size_t initial_pdu_size = *tb_size_in_bytes_pP;
rlc_sn_t ack_sn = RLC_AM_NEXT_SN(rlc_pP->vt_a);
rlc_sn_t sn_cursor = rlc_pP->vt_a;
- rlc_sn_t vt_a_new = rlc_pP->vt_a;
- rlc_sn_t sn_data_cnf;
+ rlc_sn_t vt_a_new = rlc_pP->vt_a;
+ rlc_sn_t sn_data_cnf;
rlc_sn_t nack_sn,prev_nack_sn;
- sdu_size_t data_cnf_so_stop = 0x7FFF;
+ sdu_size_t data_cnf_so_stop = 0x7FFF;
unsigned int nack_index;
boolean_t status = TRUE;
if (rlc_am_get_control_pdu_infos(rlc_am_pdu_sn_10_p, tb_size_in_bytes_pP, &rlc_pP->control_pdu_info) >= 0) {
-
rlc_am_tx_buffer_display(ctxt_pP, rlc_pP, " TX BUFFER BEFORE PROCESS OF STATUS PDU");
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RX CONTROL PDU VT(A) %04d VT(S) %04d POLL_SN %04d ACK_SN %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
@@ -294,7 +250,6 @@ rlc_am_receive_process_control_pdu(
rlc_pP->poll_sn,
rlc_pP->control_pdu_info.ack_sn);
rlc_am_display_control_pdu_infos(&rlc_pP->control_pdu_info);
-
ack_sn = rlc_pP->control_pdu_info.ack_sn;
// 5.2.1 Retransmission
//
@@ -326,8 +281,7 @@ rlc_am_receive_process_control_pdu(
/* Note : ackSn can be equal to current vtA only in case the status pdu contains a list of nack_sn with same value = vtA with SOStart/SOEnd */
/* and meaning the report is not complete due to not enough ressources to fill all SOStart/SOEnd of this NACK_SN */
- if (RLC_AM_DIFF_SN(rlc_pP->vt_s,rlc_pP->vt_a) >= RLC_AM_DIFF_SN(ack_sn,rlc_pP->vt_a))
- {
+ if (RLC_AM_DIFF_SN(rlc_pP->vt_s,rlc_pP->vt_a) >= RLC_AM_DIFF_SN(ack_sn,rlc_pP->vt_a)) {
if (rlc_pP->control_pdu_info.num_nack == 0) {
while (sn_cursor != ack_sn) {
rlc_am_ack_pdu(ctxt_pP, rlc_pP, sn_cursor,TRUE);
@@ -342,63 +296,56 @@ rlc_am_receive_process_control_pdu(
prev_nack_sn = 0x3FFF;
while (sn_cursor != nack_sn) {
- rlc_am_ack_pdu(ctxt_pP, rlc_pP, sn_cursor,TRUE);
- sn_cursor = RLC_AM_NEXT_SN(sn_cursor);
+ rlc_am_ack_pdu(ctxt_pP, rlc_pP, sn_cursor,TRUE);
+ sn_cursor = RLC_AM_NEXT_SN(sn_cursor);
}
vt_a_new = nack_sn;
-
// catch DataCfn
rlc_am_tx_data_pdu_management_t *tx_data_pdu_buffer_p = &rlc_pP->tx_data_pdu_buffer[nack_sn % RLC_AM_WINDOW_SIZE];
- if (tx_data_pdu_buffer_p->retx_payload_size == tx_data_pdu_buffer_p->payload_size) {
- sn_data_cnf = RLC_AM_PREV_SN(nack_sn);
- }
- else if (tx_data_pdu_buffer_p->nack_so_start != 0) {
- sn_data_cnf = nack_sn;
- data_cnf_so_stop = tx_data_pdu_buffer_p->nack_so_start - 1;
- }
- else {
- sn_data_cnf = RLC_AM_PREV_SN(nack_sn);
- }
+ if (tx_data_pdu_buffer_p->retx_payload_size == tx_data_pdu_buffer_p->payload_size) {
+ sn_data_cnf = RLC_AM_PREV_SN(nack_sn);
+ } else if (tx_data_pdu_buffer_p->nack_so_start != 0) {
+ sn_data_cnf = nack_sn;
+ data_cnf_so_stop = tx_data_pdu_buffer_p->nack_so_start - 1;
+ } else {
+ sn_data_cnf = RLC_AM_PREV_SN(nack_sn);
+ }
while ((sn_cursor != ack_sn) && (status)) {
if (sn_cursor != nack_sn) {
rlc_am_ack_pdu(ctxt_pP,
rlc_pP,
sn_cursor,
- FALSE);
+ FALSE);
} else {
- status = rlc_am_nack_pdu (ctxt_pP,
- rlc_pP,
- nack_sn,
- prev_nack_sn,
- rlc_pP->control_pdu_info.nack_list[nack_index].so_start,
- rlc_pP->control_pdu_info.nack_list[nack_index].so_end);
-
+ status = rlc_am_nack_pdu (ctxt_pP,
+ rlc_pP,
+ nack_sn,
+ prev_nack_sn,
+ rlc_pP->control_pdu_info.nack_list[nack_index].so_start,
+ rlc_pP->control_pdu_info.nack_list[nack_index].so_end);
nack_index = nack_index + 1;
prev_nack_sn = nack_sn;
if (nack_index < rlc_pP->control_pdu_info.num_nack) {
- nack_sn = rlc_pP->control_pdu_info.nack_list[nack_index].nack_sn;
- }
- else if (nack_sn != ack_sn) {
- /* general case*/
- nack_sn = ack_sn;
- }
- else {
- /*specific case when the sender did not have enough TBS to fill all SOStart SOEnd for this NACK_SN */
- break;
+ nack_sn = rlc_pP->control_pdu_info.nack_list[nack_index].nack_sn;
+ } else if (nack_sn != ack_sn) {
+ /* general case*/
+ nack_sn = ack_sn;
+ } else {
+ /*specific case when the sender did not have enough TBS to fill all SOStart SOEnd for this NACK_SN */
+ break;
}
}
+
if (prev_nack_sn != nack_sn) {
- /* do not increment sn_cursor in case of several informations for the same nack_sn */
- sn_cursor = (sn_cursor + 1) & RLC_AM_SN_MASK;
+ /* do not increment sn_cursor in case of several informations for the same nack_sn */
+ sn_cursor = (sn_cursor + 1) & RLC_AM_SN_MASK;
}
}
}
-
-
} else {
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT" WARNING CONTROL PDU ACK SN %d OUT OF WINDOW vtA=%d vtS=%d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,rlc_pP->vt_a,rlc_pP->vt_s);
@@ -413,61 +360,57 @@ rlc_am_receive_process_control_pdu(
}
if (status) {
- /* Check for Stopping TpollReTx */
- if ((rlc_pP->poll_sn != RLC_SN_UNDEFINED) &&
- (RLC_AM_DIFF_SN(ack_sn,rlc_pP->vt_a) > RLC_AM_DIFF_SN(rlc_pP->poll_sn,rlc_pP->vt_a))) {
- rlc_am_stop_and_reset_timer_poll_retransmit(ctxt_pP, rlc_pP);
- rlc_pP->poll_sn = RLC_SN_UNDEFINED;
+ /* Check for Stopping TpollReTx */
+ if ((rlc_pP->poll_sn != RLC_SN_UNDEFINED) &&
+ (RLC_AM_DIFF_SN(ack_sn,rlc_pP->vt_a) > RLC_AM_DIFF_SN(rlc_pP->poll_sn,rlc_pP->vt_a))) {
+ rlc_am_stop_and_reset_timer_poll_retransmit(ctxt_pP, rlc_pP);
+ rlc_pP->poll_sn = RLC_SN_UNDEFINED;
+ }
+
+ //TODO : this part does not cover all cases of Data Cnf and move it at the end of Status PDU processing
+ sn_cursor = rlc_pP->vt_a;
+
+ // Fix Issue 238 : check sn_data_cnf has been transmitted
+ if ((rlc_pP->tx_data_pdu_buffer[sn_data_cnf % RLC_AM_WINDOW_SIZE].flags.transmitted) &&
+ (rlc_pP->tx_data_pdu_buffer[sn_data_cnf % RLC_AM_WINDOW_SIZE].sn == sn_data_cnf)) {
+ /* Handle all acked PDU up to and excluding sn_data_cnf */
+ while (sn_cursor != sn_data_cnf) {
+ rlc_am_pdu_sdu_data_cnf(ctxt_pP,rlc_pP,sn_cursor);
+ sn_cursor = RLC_AM_NEXT_SN(sn_cursor);
}
- //TODO : this part does not cover all cases of Data Cnf and move it at the end of Status PDU processing
- sn_cursor = rlc_pP->vt_a;
-
- // Fix Issue 238 : check sn_data_cnf has been transmitted
- if ((rlc_pP->tx_data_pdu_buffer[sn_data_cnf % RLC_AM_WINDOW_SIZE].flags.transmitted) &&
- (rlc_pP->tx_data_pdu_buffer[sn_data_cnf % RLC_AM_WINDOW_SIZE].sn == sn_data_cnf)) {
- /* Handle all acked PDU up to and excluding sn_data_cnf */
- while (sn_cursor != sn_data_cnf) {
- rlc_am_pdu_sdu_data_cnf(ctxt_pP,rlc_pP,sn_cursor);
- sn_cursor = RLC_AM_NEXT_SN(sn_cursor);
- }
-
- // Handle last SN. TO DO : case of PDU partially ACKED with SDU to be data conf
- if (data_cnf_so_stop == 0x7FFF) {
- rlc_am_pdu_sdu_data_cnf(ctxt_pP,rlc_pP,sn_data_cnf);
- }
-
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RECEIVE STATUS PDU ACK_SN=%d NewvtA=%d OldvtA=%d SnDataCnf=%d DataCnfSOStop=%d vtS=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,vt_a_new,rlc_pP->vt_a,sn_data_cnf,data_cnf_so_stop,rlc_pP->vt_s);
- }
- else {
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RECEIVE STATUS PDU WITH NO SDU CNF ACK_SN=%d NewvtA=%d OldvtA=%d vtS=%d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,vt_a_new,rlc_pP->vt_a,rlc_pP->vt_s);
+ // Handle last SN. TO DO : case of PDU partially ACKED with SDU to be data conf
+ if (data_cnf_so_stop == 0x7FFF) {
+ rlc_am_pdu_sdu_data_cnf(ctxt_pP,rlc_pP,sn_data_cnf);
}
- /* Update vtA and vtMS */
- rlc_pP->vt_a = vt_a_new;
- rlc_pP->vt_ms = (rlc_pP->vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RECEIVE STATUS PDU ACK_SN=%d NewvtA=%d OldvtA=%d SnDataCnf=%d DataCnfSOStop=%d vtS=%d\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,vt_a_new,rlc_pP->vt_a,sn_data_cnf,data_cnf_so_stop,rlc_pP->vt_s);
+ } else {
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" RECEIVE STATUS PDU WITH NO SDU CNF ACK_SN=%d NewvtA=%d OldvtA=%d vtS=%d\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),ack_sn,vt_a_new,rlc_pP->vt_a,rlc_pP->vt_s);
+ }
+
+ /* Update vtA and vtMS */
+ rlc_pP->vt_a = vt_a_new;
+ rlc_pP->vt_ms = (rlc_pP->vt_a + RLC_AM_WINDOW_SIZE) & RLC_AM_SN_MASK;
}
- *first_byte_ppP = (uint8_t*)((uint64_t)*first_byte_ppP + initial_pdu_size - *tb_size_in_bytes_pP);
-
+ *first_byte_ppP = (uint8_t *)((uint64_t)*first_byte_ppP + initial_pdu_size - *tb_size_in_bytes_pP);
free_mem_block(tb_pP, __func__);
rlc_am_tx_buffer_display(ctxt_pP, rlc_pP, NULL);
}
//-----------------------------------------------------------------------------
int
rlc_am_write_status_pdu(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
- rlc_am_pdu_sn_10_t* const rlc_am_pdu_sn_10_pP,
- rlc_am_control_pdu_info_t* const pdu_info_pP)
-{
+ rlc_am_pdu_sn_10_t *const rlc_am_pdu_sn_10_pP,
+ rlc_am_control_pdu_info_t *const pdu_info_pP) {
unsigned int bit_pos = 4; // range from 0 (MSB/left) to 7 (LSB/right)
- uint8_t* byte_pos_p = &rlc_am_pdu_sn_10_pP->b1;
+ uint8_t *byte_pos_p = &rlc_am_pdu_sn_10_pP->b1;
unsigned int index = 0;
unsigned int num_bytes = 0;
-
rlc_am_write16_bit_field(&byte_pos_p, &bit_pos, 10, pdu_info_pP->ack_sn);
if (pdu_info_pP->num_nack > 0) {
@@ -495,20 +438,17 @@ rlc_am_write_status_pdu(
num_bytes += 1;
}
-#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT" WROTE STATUS PDU %d BYTES\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
num_bytes);
-#endif
return num_bytes;
}
//-----------------------------------------------------------------------------
void
rlc_am_send_status_pdu(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
rlc_am_entity_t *const rlc_pP
-)
-{
+) {
// When STATUS reporting has been triggered, the receiving side of an AM RLC entity shall:
// - if t-StatusProhibit is not running:
// - at the first transmission opportunity indicated by lower layer, construct a STATUS PDU and deliver it to lower layer;
@@ -530,10 +470,9 @@ rlc_am_send_status_pdu(
// - include in the STATUS PDU a set of NACK_SN, SOstart and SOend
// - set the ACK_SN to the SN of the next not received RLC Data PDU which is not indicated as missing in the
// resulting STATUS PDU.
-
signed int nb_bits_to_transmit = rlc_pP->nb_bytes_requested_by_mac << 3;
// minimum header size in bits to be transmitted: D/C + CPT + ACK_SN + E1
- signed int nb_bits_transmitted = RLC_AM_PDU_D_C_BITS + RLC_AM_STATUS_PDU_CPT_LENGTH + RLC_AM_SN_BITS + RLC_AM_PDU_E_BITS;
+ signed int nb_bits_transmitted = RLC_AM_PDU_D_C_BITS + RLC_AM_STATUS_PDU_CPT_LENGTH + RLC_AM_SN_BITS + RLC_AM_PDU_E_BITS;
rlc_am_control_pdu_info_t control_pdu_info;
rlc_am_pdu_info_t *pdu_info_cursor_p = NULL;
rlc_sn_t sn_cursor = 0;
@@ -543,325 +482,278 @@ rlc_am_send_status_pdu(
int waited_so = 0;
mem_block_t *tb_p = NULL;
sdu_size_t pdu_size = 0;
- boolean_t status_report_completed = false;
- boolean_t segment_loop_end = false;
-
+ boolean_t status_report_completed = false;
+ boolean_t segment_loop_end = false;
memset(&control_pdu_info, 0, sizeof(rlc_am_control_pdu_info_t));
-
-#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] nb_bits_to_transmit %d (15 already allocated for header)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
nb_bits_to_transmit);
rlc_am_rx_list_display(rlc_pP, " DISPLAY BEFORE CONSTRUCTION OF STATUS REPORT");
-#endif
/* Handle no NACK first */
if (rlc_pP->vr_r == rlc_pP->vr_ms) {
-
- control_pdu_info.ack_sn = rlc_pP->vr_ms;
- status_report_completed = true;
-#if TRACE_RLC_AM_STATUS_CREATION
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d ALL ACK WITH ACK_SN %04d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- rlc_pP->vr_ms);
-#endif
- }
- else if ((cursor_p != NULL) && ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1)) <= nb_bits_to_transmit)) {
-
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
+ control_pdu_info.ack_sn = rlc_pP->vr_ms;
+ status_report_completed = true;
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d ALL ACK WITH ACK_SN %04d\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
+ __LINE__,
+ rlc_pP->vr_ms);
+ } else if ((cursor_p != NULL) && ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1)) <= nb_bits_to_transmit)) {
+ pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
sn_cursor = pdu_info_cursor_p->sn;
-
/* Set E1 bit for the presence of first NACK_SN/E1/E2 */
control_pdu_info.e1 = 1;
// 12 bits = size of NACK_SN field + E1, E2 bits
// 42 bits = size of NACK_SN field + SO_START, SO_END fields, E1, E2 bits
while ((!status_report_completed) && (RLC_AM_DIFF_SN(sn_nack,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r))
- && (cursor_p != NULL) && (nb_bits_transmitted <= nb_bits_to_transmit)) {
-
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
+ && (cursor_p != NULL) && (nb_bits_transmitted <= nb_bits_to_transmit)) {
+ pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
sn_cursor = pdu_info_cursor_p->sn;
- all_segments_received = ((rlc_am_rx_pdu_management_t*)(cursor_p->data))->all_segments_received;
+ all_segments_received = ((rlc_am_rx_pdu_management_t *)(cursor_p->data))->all_segments_received;
/* First fill NACK_SN with each missing PDU between current sn_nack and sn_cursor */
while ((sn_nack != sn_cursor) && (RLC_AM_DIFF_SN(sn_nack,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r))) {
- if (nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) <= nb_bits_to_transmit) {
- /* Fill NACK_SN infos */
- control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_nack;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = 0;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = RLC_AM_STATUS_PDU_SO_END_ALL_BYTES;
- control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 0;
- /* Set E1 for next NACK_SN. The last one will be cleared */
- control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
- control_pdu_info.num_nack += 1;
- nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1));
-#if TRACE_RLC_AM_STATUS_CREATION
+ if (nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) <= nb_bits_to_transmit) {
+ /* Fill NACK_SN infos */
+ control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_nack;
+ control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = 0;
+ control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = RLC_AM_STATUS_PDU_SO_END_ALL_BYTES;
+ control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 0;
+ /* Set E1 for next NACK_SN. The last one will be cleared */
+ control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
+ control_pdu_info.num_nack += 1;
+ nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1));
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
- sn_nack);
-#endif
- sn_nack = RLC_AM_NEXT_SN(sn_nack);
- }
- else {
- /* Not enough UL TBS*/
- /* latest value of sn_nack shall be used as ACK_SN */
- control_pdu_info.ack_sn = sn_nack;
- status_report_completed = true;
-#if TRACE_RLC_AM_STATUS_CREATION
+ sn_nack);
+ sn_nack = RLC_AM_NEXT_SN(sn_nack);
+ } else {
+ /* Not enough UL TBS*/
+ /* latest value of sn_nack shall be used as ACK_SN */
+ control_pdu_info.ack_sn = sn_nack;
+ status_report_completed = true;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d NOT ENOUGH TBS STOP WITH ACK_SN %04d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
- sn_nack);
-#endif
- break;
- }
+ sn_nack);
+ break;
+ }
}
if (sn_nack == rlc_pP->vr_ms) {
- break;
+ break;
}
/* Now process all Segments of sn_cursor if PDU not fully received */
if ((!status_report_completed) && (all_segments_received == 0) && (sn_cursor != rlc_pP->vr_ms)) {
- //AssertFatal (sn_nack == sn_cursor, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
- if(sn_nack != sn_cursor){
- LOG_E(RLC, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
- }
-
- /* First ensure there is enough TBS for at least 1 SOStart/SOEnd, else break */
+ //AssertFatal (sn_nack == sn_cursor, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
+ if(sn_nack != sn_cursor) {
+ LOG_E(RLC, "RLC AM Tx Status PDU Data sn_nack=%d and sn_cursor=%d should be equal LcId=%d\n",sn_nack,sn_cursor, rlc_pP->channel_id);
+ }
+ /* First ensure there is enough TBS for at least 1 SOStart/SOEnd, else break */
else if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
- /* Init loop flags */
- /* Check lsf */
- segment_loop_end = (pdu_info_cursor_p->lsf == 1);
+ /* Init loop flags */
+ /* Check lsf */
+ segment_loop_end = (pdu_info_cursor_p->lsf == 1);
- /* Init first SO Start according to first segment */
- if (pdu_info_cursor_p->so) {
- /* Fill the first SO */
+ /* Init first SO Start according to first segment */
+ if (pdu_info_cursor_p->so) {
+ /* Fill the first SO */
+ control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
+ control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = 0;
+ control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = pdu_info_cursor_p->so - 1;
+ control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
+ /* Set E1 for next NACK_SN. The last one will be cleared */
+ control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
+ control_pdu_info.num_nack += 1;
+ nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
+ __LINE__,
+ sn_cursor,
+ 0,
+ pdu_info_cursor_p->so - 1);
+ waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
+ } else {
+ waited_so = pdu_info_cursor_p->payload_size;
+ }
+
+ /* Go to next segment */
+ cursor_p = cursor_p->next;
+
+ if (cursor_p != NULL) {
+ pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
+ }
+
+ /* Find the first discontinuity and then fill SOStart/SOEnd */
+ while (!segment_loop_end) {
+ if ((cursor_p != NULL) && (pdu_info_cursor_p->sn == sn_cursor)) {
+ /* PDU segment is for the same SN*/
+ /* Check lsf */
+ segment_loop_end = (pdu_info_cursor_p->lsf == 1);
+
+ if (waited_so < pdu_info_cursor_p->so) {
+ /* SO is greater than previous received portion : gap identified to fill */
+ if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = 0;
+ control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = pdu_info_cursor_p->so - 1;
control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
/* Set E1 for next NACK_SN. The last one will be cleared */
control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
control_pdu_info.num_nack += 1;
nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
-#if TRACE_RLC_AM_STATUS_CREATION
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- sn_cursor,
- 0,
- pdu_info_cursor_p->so - 1);
-#endif
- waited_so = pdu_info_cursor_p->so + pdu_info_cursor_p->payload_size;
- }
- else {
- waited_so = pdu_info_cursor_p->payload_size;
- }
-
- /* Go to next segment */
- cursor_p = cursor_p->next;
- if (cursor_p != NULL)
- {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
+ __LINE__,
+ sn_cursor,
+ waited_so,
+ pdu_info_cursor_p->so);
+ } else {
+ /* Not enough resources to set a SOStart/SEnd, then set ACK_SN to current NACK_SN and stop Status PDU build */
+ control_pdu_info.ack_sn = sn_cursor;
+ status_report_completed = true;
+ segment_loop_end = true;
+ break;
+ }
+ } else {
+ /* contiguous segment: only update waited_so */
+ /* Assuming so and payload_size updated according to duplication removal done at reception ... */
+ waited_so += pdu_info_cursor_p->payload_size;
}
- /* Find the first discontinuity and then fill SOStart/SOEnd */
- while (!segment_loop_end) {
- if ((cursor_p != NULL) && (pdu_info_cursor_p->sn == sn_cursor)) {
+ /* Go to next received PDU or PDU Segment */
+ cursor_p = cursor_p->next;
- /* PDU segment is for the same SN*/
- /* Check lsf */
- segment_loop_end = (pdu_info_cursor_p->lsf == 1);
+ if (cursor_p != NULL) {
+ pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info;
+ }
+ } //end if (cursor_p != NULL) && (pdu_info_cursor_p->sn == sn_cursor)
+ else {
+ /* Previous PDU segment was the last one and did not have lsf indication : fill the latest gap */
+ if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
+ control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
+ control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
+ control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = RLC_AM_STATUS_PDU_SO_END_ALL_BYTES;
+ control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
+ /* Set E1 for next NACK_SN. The last one will be cleared */
+ control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
+ control_pdu_info.num_nack += 1;
+ nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
+ LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING LAST NACK %04d SO START %05d SO END %05d\n",
+ PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
+ __LINE__,
+ sn_cursor,
+ waited_so,
+ RLC_AM_STATUS_PDU_SO_END_ALL_BYTES);
+ } else {
+ /* Not enough resources to set a SOStart/SEnd, then set ACK_SN to current NACK_SN and stop Status PDU build */
+ control_pdu_info.ack_sn = sn_cursor;
+ status_report_completed = true;
+ }
- if (waited_so < pdu_info_cursor_p->so) {
- /* SO is greater than previous received portion : gap identified to fill */
- if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
- control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = pdu_info_cursor_p->so - 1;
- control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
- /* Set E1 for next NACK_SN. The last one will be cleared */
- control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
- control_pdu_info.num_nack += 1;
- nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
-#if TRACE_RLC_AM_STATUS_CREATION
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING NACK %04d SO START %05d SO END %05d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- sn_cursor,
- waited_so,
- pdu_info_cursor_p->so);
-#endif
- }
- else {
- /* Not enough resources to set a SOStart/SEnd, then set ACK_SN to current NACK_SN and stop Status PDU build */
- control_pdu_info.ack_sn = sn_cursor;
- status_report_completed = true;
- segment_loop_end = true;
- break;
- }
- }
- else {
- /* contiguous segment: only update waited_so */
- /* Assuming so and payload_size updated according to duplication removal done at reception ... */
- waited_so += pdu_info_cursor_p->payload_size;
- }
-
- /* Go to next received PDU or PDU Segment */
- cursor_p = cursor_p->next;
- if (cursor_p != NULL)
- {
- pdu_info_cursor_p = &((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info;
- }
-
- } //end if (cursor_p != NULL) && (pdu_info_cursor_p->sn == sn_cursor)
- else {
- /* Previous PDU segment was the last one and did not have lsf indication : fill the latest gap */
- if ((nb_bits_transmitted + RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1)) <= nb_bits_to_transmit) {
- control_pdu_info.nack_list[control_pdu_info.num_nack].nack_sn = sn_cursor;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_start = waited_so;
- control_pdu_info.nack_list[control_pdu_info.num_nack].so_end = RLC_AM_STATUS_PDU_SO_END_ALL_BYTES;
- control_pdu_info.nack_list[control_pdu_info.num_nack].e2 = 1;
- /* Set E1 for next NACK_SN. The last one will be cleared */
- control_pdu_info.nack_list[control_pdu_info.num_nack].e1 = 1;
- control_pdu_info.num_nack += 1;
- nb_bits_transmitted += (RLC_AM_SN_BITS + (RLC_AM_PDU_E_BITS << 1) + (RLC_AM_STATUS_PDU_SO_LENGTH << 1));
-#if TRACE_RLC_AM_STATUS_CREATION
- LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING LAST NACK %04d SO START %05d SO END %05d\n",
- PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
- __LINE__,
- sn_cursor,
- waited_so,
- RLC_AM_STATUS_PDU_SO_END_ALL_BYTES);
-#endif
- }
- else {
- /* Not enough resources to set a SOStart/SEnd, then set ACK_SN to current NACK_SN and stop Status PDU build */
- control_pdu_info.ack_sn = sn_cursor;
- status_report_completed = true;
- }
-
- segment_loop_end = true;
- }
- } //end while (!segment_loop_end)
- } // end if enough resource for transmitting at least one SOStart/SOEnd
- else {
- /* Not enough UL TBS to set at least one SOStart/SOEnd */
- /* latest value of sn_nack shall be used as ACK_SN */
- control_pdu_info.ack_sn = sn_nack;
- status_report_completed = true;
- }
+ segment_loop_end = true;
+ }
+ } //end while (!segment_loop_end)
+ } // end if enough resource for transmitting at least one SOStart/SOEnd
+ else {
+ /* Not enough UL TBS to set at least one SOStart/SOEnd */
+ /* latest value of sn_nack shall be used as ACK_SN */
+ control_pdu_info.ack_sn = sn_nack;
+ status_report_completed = true;
+ }
} // end while on all PDU segments of sn_cursor
else {
- /* Go to next received PDU or PDU segment with different SN */
- do {
- cursor_p = cursor_p->next;
- } while ((cursor_p != NULL) && (((rlc_am_rx_pdu_management_t*)(cursor_p->data))->pdu_info.sn == sn_cursor));
+ /* Go to next received PDU or PDU segment with different SN */
+ do {
+ cursor_p = cursor_p->next;
+ } while ((cursor_p != NULL) && (((rlc_am_rx_pdu_management_t *)(cursor_p->data))->pdu_info.sn == sn_cursor));
}
/* Increment sn_nack except if sn_cursor = vrMS and if current SN was not fully received */
if (RLC_AM_DIFF_SN(sn_cursor,rlc_pP->vr_r) < RLC_AM_DIFF_SN(rlc_pP->vr_ms,rlc_pP->vr_r)) {
- sn_nack = RLC_AM_NEXT_SN(sn_cursor);
+ sn_nack = RLC_AM_NEXT_SN(sn_cursor);
+ } else {
+ sn_nack = rlc_pP->vr_ms;
}
- else {
- sn_nack = rlc_pP->vr_ms;
- }
-
-
} // End main while NACK_SN
/* Clear E1 of last nack_sn entry */
-// AssertFatal ((control_pdu_info.num_nack) || (all_segments_received == 0), "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
-// rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
- if (!((control_pdu_info.num_nack) || (all_segments_received == 0))){
- LOG_E(RLC, "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
- rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
- return;
- }
-
- if (control_pdu_info.num_nack) {
- control_pdu_info.nack_list[control_pdu_info.num_nack - 1].e1 = 0;
- }
-
-
- /* Set ACK_SN unless it was set before */
- if (!status_report_completed){
-
- control_pdu_info.ack_sn = sn_nack;
+ // AssertFatal ((control_pdu_info.num_nack) || (all_segments_received == 0), "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
+ // rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
+ if (!((control_pdu_info.num_nack) || (all_segments_received == 0))) {
+ LOG_E(RLC, "RLC AM Tx Status PDU Data Error no NACK_SN vrR=%d vrMS=%d lastSN_NACK=%d Completed=%d NbBytesAvailable=%d LcId=%d\n",
+ rlc_pP->vr_r,rlc_pP->vr_ms,sn_nack,status_report_completed,(nb_bits_to_transmit >> 3),rlc_pP->channel_id);
+ return;
}
+ if (control_pdu_info.num_nack) {
+ control_pdu_info.nack_list[control_pdu_info.num_nack - 1].e1 = 0;
+ }
+
+ /* Set ACK_SN unless it was set before */
+ if (!status_report_completed) {
+ control_pdu_info.ack_sn = sn_nack;
+ }
} else {
- /* reception buffer empty or not enough TBS for filling at least 1 NACK_SN + E1 + E2 */
+ /* reception buffer empty or not enough TBS for filling at least 1 NACK_SN + E1 + E2 */
control_pdu_info.ack_sn = rlc_pP->vr_r;
-#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK %04d = VR(R)\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
control_pdu_info.ack_sn);
-#endif
}
-
//msg ("[FRAME %5u][%s][RLC_AM][MOD %u/%u][RB %u] nb_bits_to_transmit %d\n",
// rlc_pP->module_id, rlc_pP->rb_id, ctxt_pP->frame,nb_bits_to_transmit);
-
-#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d PREPARE SENDING ACK %04d NUM NACK %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
control_pdu_info.ack_sn,
control_pdu_info.num_nack);
-#endif
-
-
/* encode the control pdu */
pdu_size = (nb_bits_transmitted + 7) >> 3;
-// AssertFatal (pdu_size <= rlc_pP->nb_bytes_requested_by_mac, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
-// pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id);
- if(pdu_size > rlc_pP->nb_bytes_requested_by_mac){
- LOG_E(RLC, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
- pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id);
- return;
- }
+ // AssertFatal (pdu_size <= rlc_pP->nb_bytes_requested_by_mac, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
+ // pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id);
+ if(pdu_size > rlc_pP->nb_bytes_requested_by_mac) {
+ LOG_E(RLC, "RLC AM Tx Status PDU Data size=%d bigger than remaining TBS=%d nb_bits_transmitted=%d LcId=%d\n",
+ pdu_size,rlc_pP->nb_bytes_requested_by_mac,nb_bits_transmitted, rlc_pP->channel_id);
+ return;
+ }
-#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] LINE %d forecast pdu_size %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
__LINE__,
pdu_size);
-#endif
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
+
if(tb_p == NULL) return;
+
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
- ((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]);
-
+ ((struct mac_tb_req *)(tb_p->data))->data_ptr = (uint8_t *)&(tb_p->data[sizeof(struct mac_tb_req)]);
// warning reuse of pdu_size
// TODO : rlc_am_write_status_pdu should be rewritten as not very tested ...
- pdu_size = rlc_am_write_status_pdu(ctxt_pP, rlc_pP,(rlc_am_pdu_sn_10_t*)(((struct mac_tb_req*)(tb_p->data))->data_ptr), &control_pdu_info);
- ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
+ pdu_size = rlc_am_write_status_pdu(ctxt_pP, rlc_pP,(rlc_am_pdu_sn_10_t *)(((struct mac_tb_req *)(tb_p->data))->data_ptr), &control_pdu_info);
+ ((struct mac_tb_req *)(tb_p->data))->tb_size = pdu_size;
//assert((((struct mac_tb_req*)(tb_p->data))->tb_size) < 3000);
-
-#if TRACE_RLC_AM_STATUS_CREATION
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND-STATUS] SEND STATUS PDU SIZE %d, rlc_pP->nb_bytes_requested_by_mac %d, nb_bits_to_transmit>>3 %d\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
pdu_size,
rlc_pP->nb_bytes_requested_by_mac,
nb_bits_to_transmit >> 3);
-#endif
-// AssertFatal (pdu_size == ((nb_bits_transmitted + 7) >> 3), "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
-// pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id);
- if(pdu_size != ((nb_bits_transmitted + 7) >> 3)){
- LOG_E(RLC, "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
- pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id);
- pdu_size = 0;
- return;
- }
+ // AssertFatal (pdu_size == ((nb_bits_transmitted + 7) >> 3), "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
+ // pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id);
+ if(pdu_size != ((nb_bits_transmitted + 7) >> 3)) {
+ LOG_E(RLC, "RLC AM Tx Status PDU Data encoding size=%d different than expected=%d LcId=%d\n",
+ pdu_size,((nb_bits_transmitted + 7) >> 3), rlc_pP->channel_id);
+ pdu_size = 0;
+ return;
+ }
// remaining bytes to transmit for RLC (retrans pdus and new data pdus)
rlc_pP->nb_bytes_requested_by_mac = rlc_pP->nb_bytes_requested_by_mac - pdu_size;
@@ -869,7 +761,6 @@ rlc_am_send_status_pdu(
list_add_head(tb_p, &rlc_pP->control_pdu_list);
rlc_pP->stat_tx_control_pdu += 1;
rlc_pP->stat_tx_control_bytes += pdu_size;
-
}
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
index f04fd66819..b59a6025f5 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
@@ -27,7 +27,7 @@
#include "platform_constants.h"
//-----------------------------------------------------------------------------
#if ENABLE_ITTI
-# include "intertask_interface.h"
+ #include "intertask_interface.h"
#endif
#include "assertions.h"
#include "msc.h"
@@ -43,24 +43,23 @@
//-----------------------------------------------------------------------------
void rlc_um_stat_req (rlc_um_entity_t *rlc_pP,
- unsigned int* stat_tx_pdcp_sdu,
- unsigned int* stat_tx_pdcp_bytes,
- unsigned int* stat_tx_pdcp_sdu_discarded,
- unsigned int* stat_tx_pdcp_bytes_discarded,
- unsigned int* stat_tx_data_pdu,
- unsigned int* stat_tx_data_bytes,
- unsigned int* stat_rx_pdcp_sdu,
- unsigned int* stat_rx_pdcp_bytes,
- unsigned int* stat_rx_data_pdus_duplicate,
- unsigned int* stat_rx_data_bytes_duplicate,
- unsigned int* stat_rx_data_pdu,
- unsigned int* stat_rx_data_bytes,
- unsigned int* stat_rx_data_pdu_dropped,
- unsigned int* stat_rx_data_bytes_dropped,
- unsigned int* stat_rx_data_pdu_out_of_window,
- unsigned int* stat_rx_data_bytes_out_of_window,
- unsigned int* stat_timer_reordering_timed_out)
-{
+ unsigned int *stat_tx_pdcp_sdu,
+ unsigned int *stat_tx_pdcp_bytes,
+ unsigned int *stat_tx_pdcp_sdu_discarded,
+ unsigned int *stat_tx_pdcp_bytes_discarded,
+ unsigned int *stat_tx_data_pdu,
+ unsigned int *stat_tx_data_bytes,
+ unsigned int *stat_rx_pdcp_sdu,
+ unsigned int *stat_rx_pdcp_bytes,
+ unsigned int *stat_rx_data_pdus_duplicate,
+ unsigned int *stat_rx_data_bytes_duplicate,
+ unsigned int *stat_rx_data_pdu,
+ unsigned int *stat_rx_data_bytes,
+ unsigned int *stat_rx_data_pdu_dropped,
+ unsigned int *stat_rx_data_bytes_dropped,
+ unsigned int *stat_rx_data_pdu_out_of_window,
+ unsigned int *stat_rx_data_bytes_out_of_window,
+ unsigned int *stat_timer_reordering_timed_out) {
*stat_tx_pdcp_sdu = rlc_pP->stat_tx_pdcp_sdu;
*stat_tx_pdcp_bytes = rlc_pP->stat_tx_pdcp_bytes;
*stat_tx_pdcp_sdu_discarded = rlc_pP->stat_tx_pdcp_sdu_discarded;
@@ -81,8 +80,7 @@ void rlc_um_stat_req (rlc_um_entity_t *rlc_pP,
}
//-----------------------------------------------------------------------------
uint32_t
-rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP)
-{
+rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP) {
if (rlc_pP->buffer_occupancy > 0) {
return rlc_pP->buffer_occupancy;
} else {
@@ -91,351 +89,294 @@ rlc_um_get_buffer_occupancy (rlc_um_entity_t *rlc_pP)
}
//-----------------------------------------------------------------------------
void
-rlc_um_get_pdus (const protocol_ctxt_t* const ctxt_pP, void *argP)
-{
+rlc_um_get_pdus (const protocol_ctxt_t *const ctxt_pP, void *argP) {
rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) argP;
switch (rlc_p->protocol_state) {
+ case RLC_NULL_STATE:
+ // from 3GPP TS 25.322 V9.2.0 p43
+ // In the NULL state the RLC entity does not exist and therefore it is
+ // not possible to transfer any data through it.
+ // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
+ // establishment, the RLC entity:
+ // - is created; and
+ // - enters the DATA_TRANSFER_READY state.
+ break;
- case RLC_NULL_STATE:
- // from 3GPP TS 25.322 V9.2.0 p43
- // In the NULL state the RLC entity does not exist and therefore it is
- // not possible to transfer any data through it.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // establishment, the RLC entity:
- // - is created; and
- // - enters the DATA_TRANSFER_READY state.
- break;
+ case RLC_DATA_TRANSFER_READY_STATE:
- case RLC_DATA_TRANSFER_READY_STATE:
+ // from 3GPP TS 25.322 V9.2.0 p43-44
+ // In the DATA_TRANSFER_READY state, unacknowledged mode data can be
+ // exchanged between the entities according to subclause 11.2.
+ // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
+ // release, the RLC entity:
+ // -enters the NULL state; and
+ // -is considered as being terminated.
+ // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
+ // modification, the RLC entity:
+ // - stays in the DATA_TRANSFER_READY state;
+ // - modifies only the protocol parameters and timers as indicated by
+ // upper layers.
+ // Upon reception of a CRLC-SUSPEND-Req from upper layers, the RLC
+ // entity:
+ // - enters the LOCAL_SUSPEND state.
- // from 3GPP TS 25.322 V9.2.0 p43-44
- // In the DATA_TRANSFER_READY state, unacknowledged mode data can be
- // exchanged between the entities according to subclause 11.2.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // release, the RLC entity:
- // -enters the NULL state; and
- // -is considered as being terminated.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // modification, the RLC entity:
- // - stays in the DATA_TRANSFER_READY state;
- // - modifies only the protocol parameters and timers as indicated by
- // upper layers.
- // Upon reception of a CRLC-SUSPEND-Req from upper layers, the RLC
- // entity:
- // - enters the LOCAL_SUSPEND state.
+ // SEND DATA TO MAC
+ if (rlc_p->tx_sn_length == 10) {
+ rlc_um_segment_10 (ctxt_pP, rlc_p);
+ }
- // SEND DATA TO MAC
- if (rlc_p->tx_sn_length == 10) {
- rlc_um_segment_10 (ctxt_pP, rlc_p);
- }
+ if (rlc_p->tx_sn_length == 5) {
+ rlc_um_segment_5 (ctxt_pP, rlc_p);
+ }
- if (rlc_p->tx_sn_length == 5) {
- rlc_um_segment_5 (ctxt_pP, rlc_p);
- }
+ break;
- break;
+ case RLC_LOCAL_SUSPEND_STATE:
+ // from 3GPP TS 25.322 V9.2.0 p44
+ // In the LOCAL_SUSPEND state, the RLC entity is suspended, i.e. it does
+ // not send UMD PDUs with "Sequence Number" greater than or equal to a
+ // certain specified value (see subclause 9.7.5).
+ // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
+ // release, the RLC entity:
+ // - enters the NULL state; and
+ // - is considered as being terminated.
+ // Upon reception of a CRLC-RESUME-Req from upper layers, the RLC entity:
+ // - enters the DATA_TRANSFER_READY state; and
+ // - resumes the data transmission.
+ // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
+ // modification, the RLC entity:
+ // - stays in the LOCAL_SUSPEND state;
+ // - modifies only the protocol parameters and timers as indicated by
+ // upper layers.
+ // TO DO TAKE CARE OF SN : THE IMPLEMENTATION OF THIS FUNCTIONNALITY IS NOT CRITICAL
+ break;
- case RLC_LOCAL_SUSPEND_STATE:
- // from 3GPP TS 25.322 V9.2.0 p44
- // In the LOCAL_SUSPEND state, the RLC entity is suspended, i.e. it does
- // not send UMD PDUs with "Sequence Number" greater than or equal to a
- // certain specified value (see subclause 9.7.5).
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // release, the RLC entity:
- // - enters the NULL state; and
- // - is considered as being terminated.
- // Upon reception of a CRLC-RESUME-Req from upper layers, the RLC entity:
- // - enters the DATA_TRANSFER_READY state; and
- // - resumes the data transmission.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // modification, the RLC entity:
- // - stays in the LOCAL_SUSPEND state;
- // - modifies only the protocol parameters and timers as indicated by
- // upper layers.
-
- // TO DO TAKE CARE OF SN : THE IMPLEMENTATION OF THIS FUNCTIONNALITY IS NOT CRITICAL
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_DATA_REQ UNKNOWN PROTOCOL STATE %02X hex\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
- rlc_p->protocol_state);
+ default:
+ LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_DATA_REQ UNKNOWN PROTOCOL STATE %02X hex\n",
+ PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
+ rlc_p->protocol_state);
}
}
//-----------------------------------------------------------------------------
void
-rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, void *argP, struct mac_data_ind data_indP)
-{
+rlc_um_rx (const protocol_ctxt_t *const ctxt_pP, void *argP, struct mac_data_ind data_indP) {
rlc_um_entity_t *l_rlc_p = (rlc_um_entity_t *) argP;
-#if TRACE_RLC_UM_PDU || MESSAGE_CHART_GENERATOR
char message_string[10000];
mem_block_t *tb_p;
int16_t tb_size_in_bytes;
size_t message_string_size = 0;
rlc_um_pdu_info_t pdu_info;
int index;
-#endif
-#if TRACE_RLC_UM_PDU
int octet_index;
-# if ENABLE_ITTI
- MessageDef *msg_p;
-# endif
-#endif
switch (l_rlc_p->protocol_state) {
+ case RLC_NULL_STATE:
+ // from 3GPP TS 25.322 V9.2.0 p43
+ // In the NULL state the RLC entity does not exist and therefore it is
+ // not possible to transfer any data through it.
+ // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
+ // establishment, the RLC entity:
+ // - is created; and
+ // - enters the DATA_TRANSFER_READY state.
+ LOG_I(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR MAC_DATA_IND IN RLC_NULL_STATE\n",
+ PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p));
- case RLC_NULL_STATE:
- // from 3GPP TS 25.322 V9.2.0 p43
- // In the NULL state the RLC entity does not exist and therefore it is
- // not possible to transfer any data through it.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // establishment, the RLC entity:
- // - is created; and
- // - enters the DATA_TRANSFER_READY state.
- LOG_I(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR MAC_DATA_IND IN RLC_NULL_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p));
-#if MESSAGE_CHART_GENERATOR
+ if (data_indP.data.nb_elements > 0 && MESSAGE_CHART_GENERATOR) {
+ tb_p = data_indP.data.head;
- if (data_indP.data.nb_elements > 0) {
- tb_p = data_indP.data.head;
+ while (tb_p != NULL) {
+ tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
+ rlc_um_get_pdu_infos(ctxt_pP,l_rlc_p,(rlc_um_pdu_sn_10_t *) ((struct mac_tb_ind *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size],
+ MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT"DATA SN %u size %u FI %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, l_rlc_p),
+ pdu_info.sn,
+ tb_size_in_bytes,
+ pdu_info.fi);
- while (tb_p != NULL) {
- tb_size_in_bytes = ((struct mac_tb_ind*) (tb_p->data))->size;
- rlc_um_get_pdu_infos(ctxt_pP,l_rlc_p,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_ind*) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size],
- MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT"DATA SN %u size %u FI %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, l_rlc_p),
- pdu_info.sn,
- tb_size_in_bytes,
- pdu_info.fi);
+ if (pdu_info.e) {
+ message_string_size += sprintf(&message_string[message_string_size], "| HE:");
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "| HE:");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]);
- }
- }
-
- MSC_LOG_RX_DISCARDED_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
- (const char*)pdu_info.payload,
- tb_size_in_bytes,
- message_string);
-
- tb_p = tb_p->next;
- }
- }
-
-#endif
- list_free (&data_indP.data);
- break;
-
- case RLC_DATA_TRANSFER_READY_STATE:
- // from 3GPP TS 25.322 V9.2.0 p43-44
- // In the DATA_TRANSFER_READY state, unacknowledged mode data can be
- // exchanged between the entities according to subclause 11.2.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // release, the RLC entity:
- // -enters the NULL state; and
- // -is considered as being terminated.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // modification, the RLC entity:
- // - stays in the DATA_TRANSFER_READY state;
- // - modifies only the protocol parameters and timers as indicated by
- // upper layers.
- // Upon reception of a CRLC-SUSPEND-Req from upper layers, the RLC
- // entity:
- // - enters the LOCAL_SUSPEND state.
- data_indP.tb_size = data_indP.tb_size >> 3;
-
-#if TRACE_RLC_UM_PDU || MESSAGE_CHART_GENERATOR
-
- if (data_indP.data.nb_elements > 0) {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_DATA_IND %d TBs\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- data_indP.data.nb_elements);
-
- tb_p = data_indP.data.head;
-
- while (tb_p != NULL) {
- tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
- rlc_um_get_pdu_infos(ctxt_pP,
- l_rlc_p,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_ind*) (tb_p->data))->data_ptr,
- tb_size_in_bytes,
- &pdu_info,
- l_rlc_p->rx_sn_length);
-
-#if MESSAGE_CHART_GENERATOR
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size],
- MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT"DATA SN %u size %u FI %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, l_rlc_p),
- pdu_info.sn,
- tb_size_in_bytes,
- pdu_info.fi);
-
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "| HE:");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]);
+ for (index=0; index < pdu_info.num_li; index++) {
+ message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]);
+ }
}
+
+ MSC_LOG_RX_DISCARDED_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
+ (const char *)pdu_info.payload,
+ tb_size_in_bytes,
+ message_string);
+ tb_p = tb_p->next;
}
+ }/*MESSAGE_CHART_GENERATOR*/
- MSC_LOG_RX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
- (char*)pdu_info.payload,
- tb_size_in_bytes,
- message_string);
+ list_free (&data_indP.data);
+ break;
-#endif
-#if TRACE_RLC_UM_PDU
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
- message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
- message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC UM DATA IND: UMD PDU\n\n");
+ case RLC_DATA_TRANSFER_READY_STATE:
+ // from 3GPP TS 25.322 V9.2.0 p43-44
+ // In the DATA_TRANSFER_READY state, unacknowledged mode data can be
+ // exchanged between the entities according to subclause 11.2.
+ // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
+ // release, the RLC entity:
+ // -enters the NULL state; and
+ // -is considered as being terminated.
+ // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
+ // modification, the RLC entity:
+ // - stays in the DATA_TRANSFER_READY state;
+ // - modifies only the protocol parameters and timers as indicated by
+ // upper layers.
+ // Upon reception of a CRLC-SUSPEND-Req from upper layers, the RLC
+ // entity:
+ // - enters the LOCAL_SUSPEND state.
+ data_indP.tb_size = data_indP.tb_size >> 3;
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
- message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
- message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
+ if (data_indP.data.nb_elements > 0 && (MESSAGE_CHART_GENERATOR || LOG_DEBUGFLAG(DEBUG_RLC))) {
+ LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_DATA_IND %d TBs\n",
+ PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p),
+ data_indP.data.nb_elements);
+ tb_p = data_indP.data.head;
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
+ while (tb_p != NULL) {
+ tb_size_in_bytes = ((struct mac_tb_ind *) (tb_p->data))->size;
+ rlc_um_get_pdu_infos(ctxt_pP,
+ l_rlc_p,(rlc_um_pdu_sn_10_t *) ((struct mac_tb_ind *) (tb_p->data))->data_ptr,
+ tb_size_in_bytes,
+ &pdu_info,
+ l_rlc_p->rx_sn_length);
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
- }
- }
+ if (MESSAGE_CHART_GENERATOR) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size],
+ MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT"DATA SN %u size %u FI %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, l_rlc_p),
+ pdu_info.sn,
+ tb_size_in_bytes,
+ pdu_info.fi);
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+ if (pdu_info.e) {
+ message_string_size += sprintf(&message_string[message_string_size], "| HE:");
- for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ for (index=0; index < pdu_info.num_li; index++) {
+ message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]);
+ }
}
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
+ MSC_LOG_RX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
+ (char *)pdu_info.payload,
+ tb_size_in_bytes,
+ message_string);
}
- /*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
+ if (LOG_DEBUGFLAG(DEBUG_RLC)) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
+ message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
+ message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
+ message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
+ message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC UM DATA IND: UMD PDU\n\n");
+ message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
+ message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
+ message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
+ message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
+
+ if (pdu_info.e) {
+ message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
+
+ for (index=0; index < pdu_info.num_li; index++) {
+ message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
+ }
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+ message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+
+ for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
+ if ((octet_index % 16) == 0) {
+ if (octet_index != 0) {
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
+ }
+
+ /*
+ * Print every single octet in hexadecimal form
+ */
+ message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
+ /*
+ * Align newline and pipes according to the octets in groups of 2
+ */
+ }
+
+ /*
+ * Append enough spaces and put final pipe
+ */
+ for (index = octet_index; index < 16; ++index) {
+ message_string_size += sprintf(&message_string[message_string_size], " ");
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ LOG_UI(RLC, "%s|\n", message_string);
+ }
+
+ tb_p = tb_p->next;
}
-
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
-
-# if ENABLE_ITTI
- msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag ? TASK_RLC_ENB:TASK_RLC_UE , RLC_UM_DATA_PDU_IND, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rlc_um_data_pdu_ind.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rlc_um_data_pdu_ind.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-
-# else
- LOG_T(RLC, "%s", message_string);
-# endif // ENABLE_ITTI
-#endif // TRACE_RLC_UM_PDU
-
- tb_p = tb_p->next;
}
- }
-#endif
- rlc_um_receive (ctxt_pP, l_rlc_p, data_indP);
- break;
+ rlc_um_receive (ctxt_pP, l_rlc_p, data_indP);
+ break;
- case RLC_LOCAL_SUSPEND_STATE:
- // from 3GPP TS 25.322 V9.2.0 p44
- // In the LOCAL_SUSPEND state, the RLC entity is suspended, i.e. it does
- // not send UMD PDUs with "Sequence Number" greater than or equal to a
- // certain specified value (see subclause 9.7.5).
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // release, the RLC entity:
- // - enters the NULL state; and
- // - is considered as being terminated.
- // Upon reception of a CRLC-RESUME-Req from upper layers, the RLC entity:
- // - enters the DATA_TRANSFER_READY state; and
- // - resumes the data transmission.
- // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
- // modification, the RLC entity:
- // - stays in the LOCAL_SUSPEND state;
- // - modifies only the protocol parameters and timers as indicated by
- // upper layers.
- LOG_I(RLC, PROTOCOL_RLC_UM_CTXT_FMT" RLC_LOCAL_SUSPEND_STATE\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p));
- /*if (data_indP.data.nb_elements > 0) {
- LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_DATA_IND %d TBs\n", l_rlc_p->module_id, l_rlc_p->rb_id, ctxt_pP->frame, data_indP.data.nb_elements);
- rlc_p[l_rlc_p->module_id].m_mscgen_trace_length = sprintf(rlc_p[l_rlc_p->module_id].m_mscgen_trace, "[MSC_MSG][FRAME %05d][MAC_%s][MOD %02d][][--- MAC_DATA_IND/ %d TB(s) ",
- ctxt_pP->frame,
- (ctxt_pP->enb_flag) ? "eNB":"UE",
- l_rlc_p->module_id,
- data_indP.data.nb_elements);
+ case RLC_LOCAL_SUSPEND_STATE:
+ // from 3GPP TS 25.322 V9.2.0 p44
+ // In the LOCAL_SUSPEND state, the RLC entity is suspended, i.e. it does
+ // not send UMD PDUs with "Sequence Number" greater than or equal to a
+ // certain specified value (see subclause 9.7.5).
+ // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
+ // release, the RLC entity:
+ // - enters the NULL state; and
+ // - is considered as being terminated.
+ // Upon reception of a CRLC-RESUME-Req from upper layers, the RLC entity:
+ // - enters the DATA_TRANSFER_READY state; and
+ // - resumes the data transmission.
+ // Upon reception of a CRLC-CONFIG-Req from upper layer indicating
+ // modification, the RLC entity:
+ // - stays in the LOCAL_SUSPEND state;
+ // - modifies only the protocol parameters and timers as indicated by
+ // upper layers.
+ LOG_I(RLC, PROTOCOL_RLC_UM_CTXT_FMT" RLC_LOCAL_SUSPEND_STATE\n",
+ PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p));
+ list_free (&data_indP.data);
+ break;
- tb = data_indP.data.head;
- while (tb != NULL) {
- rlc_p[l_rlc_p->module_id].m_mscgen_trace_length += sprintf(&rlc_p[l_rlc_p->module_id].m_mscgen_trace[rlc_p[l_rlc_p->module_id].m_mscgen_trace_length], " SN %d %c%c%c %d Bytes ",
- (((struct mac_tb_ind *) (tb->data))->data_ptr[1]) + (((uint16_t)((((struct mac_tb_ind *) (tb->data))->data_ptr[0]) & 0x03)) << 8),
- (((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x10) ? '}':'{',
- (((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x08) ? '{':'}',
- (((struct mac_tb_ind *) (tb->data))->data_ptr[0] & 0x04) ? 'E':'_',
- ((struct mac_tb_ind *) (tb->data))->size);
- tb = tb->next;
- }
- rlc_p[l_rlc_p->module_id].m_mscgen_trace_length += sprintf(&rlc_p[l_rlc_p->module_id].m_mscgen_trace[rlc_p[l_rlc_p->module_id].m_mscgen_trace_length], " DROPPED RLC LOCAL SUSPEND STATE ---X][RLC_UM][MOD %02d][RB %02d]\n",
- l_rlc_p->module_id,
- l_rlc_p->rb_id);
-
- rlc_p[l_rlc_p->module_id].m_mscgen_trace[rlc_p[l_rlc_p->module_id].m_mscgen_trace_length] = 0;
- LOG_D(RLC, "%s", rlc_p[l_rlc_p->module_id].m_mscgen_trace);
- }*/
- list_free (&data_indP.data);
- break;
-
- default:
- LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE %02X hex\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p),
- l_rlc_p->protocol_state);
- list_free (&data_indP.data);
+ default:
+ LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" TX UNKNOWN PROTOCOL STATE %02X hex\n",
+ PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p),
+ l_rlc_p->protocol_state);
+ list_free (&data_indP.data);
}
}
//-----------------------------------------------------------------------------
struct mac_status_resp
-rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP)
-{
+rlc_um_mac_status_indication (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP) {
struct mac_status_resp status_resp;
uint16_t sdu_size = 0;
uint16_t sdu_remaining_size = 0;
int32_t diff_time=0;
- rlc_um_entity_t *rlc_p = NULL;
+ rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) rlc_pP;
mem_block_t *mb_p = NULL;
-
status_resp.buffer_occupancy_in_pdus = 0;
status_resp.buffer_occupancy_in_bytes = 0;
status_resp.head_sdu_remaining_size_to_send = 0;
@@ -443,31 +384,24 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP
status_resp.head_sdu_is_segmented = 0;
if (rlc_pP) {
-
- rlc_p = (rlc_um_entity_t *) rlc_pP;
status_resp.rlc_info.rlc_protocol_state = rlc_p->protocol_state;
rlc_um_check_timer_dar_time_out(ctxt_pP, rlc_p);
-
rlc_p->nb_bytes_requested_by_mac = tbs_sizeP;
-
status_resp.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (rlc_p);
if ((status_resp.buffer_occupancy_in_bytes > 0) && ((mb_p = list_get_head(&rlc_p->input_sdus)) != NULL)) {
-
if (enb_flagP == ENB_FLAG_YES) {
- /* For eNB: add minimum RLC UM header size for the scheduler */
- /* For UE : RLC header part is not taken into account for BSR reporting (cf 36.321) */
- status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes;
+ /* For eNB: add minimum RLC UM header size for the scheduler */
+ /* For UE : RLC header part is not taken into account for BSR reporting (cf 36.321) */
+ status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes;
}
- status_resp.buffer_occupancy_in_pdus = rlc_p->input_sdus.nb_elements;
+ status_resp.buffer_occupancy_in_pdus = rlc_p->input_sdus.nb_elements;
diff_time = ctxt_pP->frame - ((struct rlc_um_tx_sdu_management *)mb_p->data)->sdu_creation_time;
status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + ctxt_pP->frame) ;
//msg("rlc_p status for ctxt_pP->frame %d diff time %d resp %d\n", ctxt_pP->frame, diff_time,status_resp.head_sdu_creation_time) ;
-
sdu_size = ((struct rlc_um_tx_sdu_management *) mb_p->data)->sdu_size;
sdu_remaining_size = ((struct rlc_um_tx_sdu_management *) mb_p->data)->sdu_remaining_size;
-
status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size;
if (sdu_size == sdu_remaining_size) {
@@ -475,35 +409,31 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP
} else {
status_resp.head_sdu_is_segmented = 1;
}
-
} else {
}
- //msg("[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_STATUS_INDICATION BO = %d\n", ((rlc_um_entity_t *) rlc_pP)->module_id, ((rlc_um_entity_t *) rlc_pP)->rb_id, status_resp.buffer_occupancy_in_bytes);
+ status_resp.rlc_info.rlc_protocol_state = rlc_p->protocol_state;
- status_resp.rlc_info.rlc_protocol_state = ((rlc_um_entity_t *) rlc_pP)->protocol_state;
-#if TRACE_RLC_UM_TX_STATUS
+ if (LOG_DEBUGFLAG(DEBUG_RLC)) {
+ if (( rlc_p->rb_id > 0) && (status_resp.buffer_occupancy_in_bytes > 0)) {
+ LOG_UI(RLC, PROTOCOL_RLC_UM_CTXT_FMT"MAC_STATUS_INDICATION (DATA) %d bytes requested -> %d bytes available\n",
+ PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
+ tbs_sizeP,
+ status_resp.buffer_occupancy_in_bytes);
- if ((((rlc_um_entity_t *) rlc_pP)->rb_id > 0) && (status_resp.buffer_occupancy_in_bytes > 0)) {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_STATUS_INDICATION (DATA) %d bytes requested -> %d bytes available\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- tbs_sizeP,
- status_resp.buffer_occupancy_in_bytes);
+ if ((tx_statusP.tx_status == MAC_TX_STATUS_SUCCESSFUL) && (tx_statusP.no_pdu)) {
+ LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",
+ PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
+ tx_statusP.no_pdu);
+ }
- if ((tx_statusP.tx_status == MAC_TX_STATUS_SUCCESSFUL) && (tx_statusP.no_pdu)) {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_STATUS_INDICATION TX STATUS SUCCESSFUL %d PDUs\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- tx_statusP.no_pdu);
- }
-
- if ((tx_statusP.tx_status == MAC_TX_STATUS_UNSUCCESSFUL) && (tx_statusP.no_pdu)) {
- LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",
- PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
- tx_statusP.no_pdu);
+ if ((tx_statusP.tx_status == MAC_TX_STATUS_UNSUCCESSFUL) && (tx_statusP.no_pdu)) {
+ LOG_UI(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_STATUS_INDICATION TX STATUS UNSUCCESSFUL %d PDUs\n",
+ PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
+ tx_statusP.no_pdu);
+ }
}
}
-
-#endif
} else {
LOG_E(RLC, "[RLC] rlc_um_mac_status_indication RLC NULL!!!\n");
}
@@ -514,44 +444,34 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP
//-----------------------------------------------------------------------------
void
rlc_um_set_nb_bytes_requested_by_mac (
- void * rlc_pP,
- const tb_size_t tb_sizeP
-)
-{
- ((rlc_um_entity_t *) rlc_pP)->nb_bytes_requested_by_mac = tb_sizeP;
+ void *rlc_pP,
+ const tb_size_t tb_sizeP
+) {
+ ((rlc_um_entity_t *) rlc_pP)->nb_bytes_requested_by_mac = tb_sizeP;
}
//-----------------------------------------------------------------------------
struct mac_data_req
-rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP,const eNB_flag_t enb_flagP)
-{
+rlc_um_mac_data_request (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP,const eNB_flag_t enb_flagP) {
struct mac_data_req data_req;
int16_t tb_size_in_bytes;
mem_block_t *tb_p;
-#if TRACE_RLC_UM_PDU || MESSAGE_CHART_GENERATOR
char message_string[10000];
size_t message_string_size = 0;
-# if ENABLE_ITTI
- MessageDef *msg_p;
-# endif
rlc_um_pdu_info_t pdu_info;
int octet_index, index;
-#endif
rlc_um_entity_t *l_rlc_p = (rlc_um_entity_t *) rlc_pP;
-
rlc_um_get_pdus(ctxt_pP, l_rlc_p);
-
list_init (&data_req.data, NULL);
list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data);
-
if (enb_flagP) {
- // redundant in UE MAC Tx processing and not used in eNB scheduler ...
- data_req.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (l_rlc_p);
+ // redundant in UE MAC Tx processing and not used in eNB scheduler ...
+ data_req.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (l_rlc_p);
- if (data_req.buffer_occupancy_in_bytes > 0) {
- data_req.buffer_occupancy_in_bytes += l_rlc_p->tx_header_min_length_in_bytes;
- }
+ if (data_req.buffer_occupancy_in_bytes > 0) {
+ data_req.buffer_occupancy_in_bytes += l_rlc_p->tx_header_min_length_in_bytes;
+ }
}
data_req.rlc_info.rlc_protocol_state = l_rlc_p->protocol_state;
@@ -561,7 +481,6 @@ rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP,cons
while (tb_p != NULL) {
tb_size_in_bytes = ((struct mac_tb_req *) (tb_p->data))->tb_size;
-
LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" MAC_DATA_REQUEST TB SIZE %u\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,l_rlc_p),
((struct mac_tb_req *) (tb_p->data))->tb_size);
@@ -574,156 +493,130 @@ rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP,cons
tb_p = tb_p->next;
continue;
}
-
-#if TRACE_RLC_UM_PDU || MESSAGE_CHART_GENERATOR
- rlc_um_get_pdu_infos(ctxt_pP, l_rlc_p,(rlc_um_pdu_sn_10_t*) ((struct mac_tb_req*) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
-#endif
-#if MESSAGE_CHART_GENERATOR
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size],
- MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT" DATA SN %u size %u FI %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, l_rlc_p),
- pdu_info.sn,
- tb_size_in_bytes,
- pdu_info.fi);
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "|HE:");
+ if (MESSAGE_CHART_GENERATOR || LOG_DEBUGFLAG(DEBUG_RLC) ) {
+ rlc_um_get_pdu_infos(ctxt_pP, l_rlc_p,(rlc_um_pdu_sn_10_t *) ((struct mac_tb_req *) (tb_p->data))->data_ptr, tb_size_in_bytes, &pdu_info, l_rlc_p->rx_sn_length);
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]);
- }
- }
+ if(MESSAGE_CHART_GENERATOR) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size],
+ MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT" DATA SN %u size %u FI %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, l_rlc_p),
+ pdu_info.sn,
+ tb_size_in_bytes,
+ pdu_info.fi);
- MSC_LOG_TX_MESSAGE(
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
- (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
- (const char*)pdu_info.payload,
- pdu_info.payload_size,
- message_string);
+ if (pdu_info.e) {
+ message_string_size += sprintf(&message_string[message_string_size], "|HE:");
-#endif
-#if TRACE_RLC_UM_PDU
- message_string_size = 0;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
- message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
- message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
- message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC UM DATA IND: UMD PDU\n\n");
-
- message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
- message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
- message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
- message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
-
- if (pdu_info.e) {
- message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
-
- for (index=0; index < pdu_info.num_li; index++) {
- message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
- }
- }
-
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ for (index=0; index < pdu_info.num_li; index++) {
+ message_string_size += sprintf(&message_string[message_string_size], " LI %u", pdu_info.li_list[index]);
+ }
}
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
+ MSC_LOG_TX_MESSAGE(
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
+ (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_UE:MSC_RLC_ENB,
+ (const char *)pdu_info.payload,
+ pdu_info.payload_size,
+ message_string);
}
- /*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
- */
- }
+ if(LOG_DEBUGFLAG(DEBUG_RLC)) {
+ message_string_size = 0;
+ message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", l_rlc_p->rb_id);
+ message_string_size += sprintf(&message_string[message_string_size], "PDU size : %u\n", tb_size_in_bytes);
+ message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
+ message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
+ message_string_size += sprintf(&message_string[message_string_size], "PDU type : RLC UM DATA IND: UMD PDU\n\n");
+ message_string_size += sprintf(&message_string[message_string_size], "Header :\n");
+ message_string_size += sprintf(&message_string[message_string_size], " FI : %u\n", pdu_info.fi);
+ message_string_size += sprintf(&message_string[message_string_size], " E : %u\n", pdu_info.e);
+ message_string_size += sprintf(&message_string[message_string_size], " SN : %u\n", pdu_info.sn);
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
+ if (pdu_info.e) {
+ message_string_size += sprintf(&message_string[message_string_size], "\nHeader extension : \n");
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ for (index=0; index < pdu_info.num_li; index++) {
+ message_string_size += sprintf(&message_string[message_string_size], " LI : %u\n", pdu_info.li_list[index]);
+ }
+ }
-# if ENABLE_ITTI
- msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_UM_DATA_PDU_REQ, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rlc_um_data_pdu_req.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rlc_um_data_pdu_req.text, message_string, message_string_size);
+ message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+ message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+ for (octet_index = 0; octet_index < pdu_info.payload_size; octet_index++) {
+ if ((octet_index % 16) == 0) {
+ if (octet_index != 0) {
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
+ }
+
+ /*
+ * Print every single octet in hexadecimal form
+ */
+ message_string_size += sprintf(&message_string[message_string_size], " %02x", pdu_info.payload[octet_index]);
+ /*
+ * Align newline and pipes according to the octets in groups of 2
+ */
+ }
+
+ /*
+ * Append enough spaces and put final pipe
+ */
+ for (index = octet_index; index < 16; ++index) {
+ message_string_size += sprintf(&message_string[message_string_size], " ");
+ }
+
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ LOG_UI(RLC, "%s\n", message_string);
+ } /*LOG_DEBUGFLAG(DEBUG_RLC) */
+ } /* MESSAGE_CHART_GENERATOR || LOG_DEBUGFLAG(DEBUG_RLC) */
-# else
- LOG_T(RLC, "%s", message_string);
-# endif
-#endif
tb_p = tb_p->next;
- }
- }
+ } /* while (tb_p != NULL) */
+ } /* if (data_req.data.nb_elements > 0) */
return data_req;
}
//-----------------------------------------------------------------------------
void
-rlc_um_mac_data_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, struct mac_data_ind data_indP)
-{
+rlc_um_mac_data_indication (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, struct mac_data_ind data_indP) {
rlc_um_rx (ctxt_pP, rlc_pP, data_indP);
rlc_um_check_timer_dar_time_out(ctxt_pP, rlc_pP);
}
//-----------------------------------------------------------------------------
void
-rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, mem_block_t *sdu_pP)
-{
+rlc_um_data_req (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, mem_block_t *sdu_pP) {
rlc_um_entity_t *rlc_p = (rlc_um_entity_t *) rlc_pP;
-
-#if TRACE_RLC_UM_PDU
-#if ENABLE_ITTI
- MessageDef *msg_p;
-# endif
uint16_t data_offset;
uint16_t data_size;
size_t message_string_size = 0;
int octet_index, index;
char message_string[7000];
-#endif
-
LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" RLC_UM_DATA_REQ size %d Bytes, BO %d , NB SDU %d\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
((struct rlc_um_data_req *) (sdu_pP->data))->data_size,
rlc_p->buffer_occupancy,
rlc_p->input_sdus.nb_elements);
-
- /*rlc_util_print_hex_octets(
- RLC,
- (uint8_t*)&sdu_pP->data[sizeof (struct rlc_um_data_req_alloc)],
- ((struct rlc_um_data_req *) (sdu_pP->data))->data_size);*/
-
// IMPORTANT : do not change order of affectations
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size = ((struct rlc_um_data_req *) (sdu_pP->data))->data_size;
//rlc_p->nb_sdu += 1;
- ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->first_byte = (uint8_t*)&sdu_pP->data[sizeof (struct rlc_um_data_req_alloc)];
+ ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->first_byte = (uint8_t *)&sdu_pP->data[sizeof (struct rlc_um_data_req_alloc)];
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_remaining_size = ((struct rlc_um_tx_sdu_management *)
(sdu_pP->data))->sdu_size;
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_segmented_size = 0;
((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_creation_time = ctxt_pP->frame;
//rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer;
-
rlc_p->stat_tx_pdcp_sdu += 1;
rlc_p->stat_tx_pdcp_bytes += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size;
-
MSC_LOG_RX_MESSAGE(
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
@@ -732,74 +625,61 @@ rlc_um_data_req (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, mem_block_t
MSC_AS_TIME_FMT" "PROTOCOL_RLC_UM_MSC_FMT" DATA-REQ size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
PROTOCOL_RLC_UM_MSC_ARGS(ctxt_pP, rlc_p),
- ((struct rlc_um_tx_sdu_management*) (sdu_pP->data))->sdu_size);
+ ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size);
+ if (LOG_DEBUGFLAG(DEBUG_RLC) ) {
+ data_offset = sizeof (struct rlc_um_data_req_alloc);
+ data_size = ((struct rlc_um_tx_sdu_management *)(sdu_pP->data))->sdu_size;
+ message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", rlc_p->rb_id);
+ message_string_size += sprintf(&message_string[message_string_size], "SDU size : %u\n", data_size);
+ message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
+ message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
+ message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-# if TRACE_RLC_UM_PDU
- data_offset = sizeof (struct rlc_um_data_req_alloc);
- data_size = ((struct rlc_um_tx_sdu_management *)(sdu_pP->data))->sdu_size;
- message_string_size += sprintf(&message_string[message_string_size], "Bearer : %u\n", rlc_p->rb_id);
- message_string_size += sprintf(&message_string[message_string_size], "SDU size : %u\n", data_size);
+ for (octet_index = 0; octet_index < data_size; octet_index++) {
+ if ((octet_index % 16) == 0) {
+ if (octet_index != 0) {
+ message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ }
- message_string_size += sprintf(&message_string[message_string_size], "\nPayload : \n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
- message_string_size += sprintf(&message_string[message_string_size], " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
- message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
-
- for (octet_index = 0; octet_index < data_size; octet_index++) {
- if ((octet_index % 16) == 0) {
- if (octet_index != 0) {
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
+ message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
}
- message_string_size += sprintf(&message_string[message_string_size], " %04d |", octet_index);
+ /*
+ * Print every single octet in hexadecimal form
+ */
+ message_string_size += sprintf(&message_string[message_string_size], " %02x", ((uint8_t *)(&sdu_pP->data[data_offset]))[octet_index]);
+ /*
+ * Align newline and pipes according to the octets in groups of 2
+ */
}
/*
- * Print every single octet in hexadecimal form
- */
- message_string_size += sprintf(&message_string[message_string_size], " %02x", ((uint8_t*)(&sdu_pP->data[data_offset]))[octet_index]);
- /*
- * Align newline and pipes according to the octets in groups of 2
+ * Append enough spaces and put final pipe
*/
+ for (index = octet_index; index < 16; ++index) {
+ message_string_size += sprintf(&message_string[message_string_size], " ");
+ }
+
+ LOG_UI(RLC, "%s|\n", message_string);
}
- /*
- * Append enough spaces and put final pipe
- */
- for (index = octet_index; index < 16; ++index) {
- message_string_size += sprintf(&message_string[message_string_size], " ");
- }
-
- message_string_size += sprintf(&message_string[message_string_size], " |\n");
-
-# if ENABLE_ITTI
- msg_p = itti_alloc_new_message_sized (ctxt_pP->enb_flag > 0 ? TASK_RLC_ENB:TASK_RLC_UE , RLC_UM_SDU_REQ, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rlc_um_sdu_req.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rlc_um_sdu_req.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-
-#else
- LOG_T(RLC, "%s", message_string);
-#endif
-# endif
RLC_UM_MUTEX_LOCK(&rlc_p->lock_input_sdus, ctxt_pP, rlc_p);
rlc_p->buffer_occupancy += ((struct rlc_um_tx_sdu_management *) (sdu_pP->data))->sdu_size;
list_add_tail_eurecom(sdu_pP, &rlc_p->input_sdus);
RLC_UM_MUTEX_UNLOCK(&rlc_p->lock_input_sdus);
-#if DEBUG_RLC_CONGESTION
-#if MESSAGE_CHART_GENERATOR
- if (rlc_p->buffer_occupancy > 4096) {
+
+ if (MESSAGE_CHART_GENERATOR) {
+ if (rlc_p->buffer_occupancy > 4096) {
MSC_LOG_EVENT((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_RLC_ENB:MSC_RLC_UE,\
- "0 "PROTOCOL_RLC_AM_MSC_FMT" BO %u bytes",\
- PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_pP), rlc_p->buffer_occupancy);
+ "0 "PROTOCOL_RLC_AM_MSC_FMT" BO %u bytes",\
+ PROTOCOL_RLC_AM_MSC_ARGS(ctxt_pP,rlc_p), rlc_p->buffer_occupancy);
+ }
}
-#else
- LOG_W(RLC, PROTOCOL_RLC_UM_CTXT_FMT" BO %d , NB SDU %d\n",
+
+ LOG_T(RLC, PROTOCOL_RLC_UM_CTXT_FMT" BO %d , NB SDU %d\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
rlc_p->buffer_occupancy,
rlc_p->input_sdus.nb_elements);
-#endif
-#endif
}
diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c
index 428f3c19c7..e5d9977de7 100644
--- a/openair2/LAYER2/RLC/rlc.c
+++ b/openair2/LAYER2/RLC/rlc.c
@@ -38,19 +38,19 @@
#include "assertions.h"
extern boolean_t pdcp_data_ind(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
const sdu_size_t sdu_buffer_sizeP,
- mem_block_t* const sdu_buffer_pP);
+ mem_block_t *const sdu_buffer_pP);
#define DEBUG_RLC_PDCP_INTERFACE 1
//#define TRACE_RLC_PAYLOAD 1
#define DEBUG_RLC_DATA_REQ 1
//-----------------------------------------------------------------------------
-void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, const signed long sizeP)
+void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP)
//-----------------------------------------------------------------------------
{
unsigned long octet_index = 0;
@@ -59,9 +59,6 @@ void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, con
return;
}
-
-
-
LOG_T(componentP, "+-----+-------------------------------------------------+\n");
LOG_T(componentP, "| | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n");
LOG_T(componentP, "+-----+-------------------------------------------------+\n");
@@ -98,38 +95,37 @@ void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, con
//-----------------------------------------------------------------------------
rlc_op_status_t rlc_stat_req (
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
- unsigned int* stat_rlc_mode,
- unsigned int* stat_tx_pdcp_sdu,
- unsigned int* stat_tx_pdcp_bytes,
- unsigned int* stat_tx_pdcp_sdu_discarded,
- unsigned int* stat_tx_pdcp_bytes_discarded,
- unsigned int* stat_tx_data_pdu,
- unsigned int* stat_tx_data_bytes,
- unsigned int* stat_tx_retransmit_pdu_by_status,
- unsigned int* stat_tx_retransmit_bytes_by_status,
- unsigned int* stat_tx_retransmit_pdu,
- unsigned int* stat_tx_retransmit_bytes,
- unsigned int* stat_tx_control_pdu,
- unsigned int* stat_tx_control_bytes,
- unsigned int* stat_rx_pdcp_sdu,
- unsigned int* stat_rx_pdcp_bytes,
- unsigned int* stat_rx_data_pdus_duplicate,
- unsigned int* stat_rx_data_bytes_duplicate,
- unsigned int* stat_rx_data_pdu,
- unsigned int* stat_rx_data_bytes,
- unsigned int* stat_rx_data_pdu_dropped,
- unsigned int* stat_rx_data_bytes_dropped,
- unsigned int* stat_rx_data_pdu_out_of_window,
- unsigned int* stat_rx_data_bytes_out_of_window,
- unsigned int* stat_rx_control_pdu,
- unsigned int* stat_rx_control_bytes,
- unsigned int* stat_timer_reordering_timed_out,
- unsigned int* stat_timer_poll_retransmit_timed_out,
- unsigned int* stat_timer_status_prohibit_timed_out)
-{
+ unsigned int *stat_rlc_mode,
+ unsigned int *stat_tx_pdcp_sdu,
+ unsigned int *stat_tx_pdcp_bytes,
+ unsigned int *stat_tx_pdcp_sdu_discarded,
+ unsigned int *stat_tx_pdcp_bytes_discarded,
+ unsigned int *stat_tx_data_pdu,
+ unsigned int *stat_tx_data_bytes,
+ unsigned int *stat_tx_retransmit_pdu_by_status,
+ unsigned int *stat_tx_retransmit_bytes_by_status,
+ unsigned int *stat_tx_retransmit_pdu,
+ unsigned int *stat_tx_retransmit_bytes,
+ unsigned int *stat_tx_control_pdu,
+ unsigned int *stat_tx_control_bytes,
+ unsigned int *stat_rx_pdcp_sdu,
+ unsigned int *stat_rx_pdcp_bytes,
+ unsigned int *stat_rx_data_pdus_duplicate,
+ unsigned int *stat_rx_data_bytes_duplicate,
+ unsigned int *stat_rx_data_pdu,
+ unsigned int *stat_rx_data_bytes,
+ unsigned int *stat_rx_data_pdu_dropped,
+ unsigned int *stat_rx_data_bytes_dropped,
+ unsigned int *stat_rx_data_pdu_out_of_window,
+ unsigned int *stat_rx_data_bytes_out_of_window,
+ unsigned int *stat_rx_control_pdu,
+ unsigned int *stat_rx_control_bytes,
+ unsigned int *stat_timer_reordering_timed_out,
+ unsigned int *stat_timer_poll_retransmit_timed_out,
+ unsigned int *stat_timer_status_prohibit_timed_out) {
//-----------------------------------------------------------------------------
rlc_mode_t rlc_mode = RLC_MODE_NONE;
rlc_union_t *rlc_union_p = NULL;
@@ -137,182 +133,183 @@ rlc_op_status_t rlc_stat_req (
hashtable_rc_t h_rc;
//AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
- if(rb_idP >= NB_RB_MAX){
- LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
-
+ if(rb_idP >= NB_RB_MAX) {
+ LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
+ return RLC_OP_STATUS_BAD_PARAMETER;
+ }
+
key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
+ h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_mode = rlc_union_p->mode;
}
+
*stat_rlc_mode = rlc_mode;
+
switch (rlc_mode) {
- case RLC_MODE_NONE:
- *stat_tx_pdcp_sdu = 0;
- *stat_tx_pdcp_bytes = 0;
- *stat_tx_pdcp_sdu_discarded = 0;
- *stat_tx_pdcp_bytes_discarded = 0;
- *stat_tx_data_pdu = 0;
- *stat_tx_data_bytes = 0;
- *stat_tx_retransmit_pdu_by_status = 0;
- *stat_tx_retransmit_bytes_by_status = 0;
- *stat_tx_retransmit_pdu = 0;
- *stat_tx_retransmit_bytes = 0;
- *stat_tx_control_pdu = 0;
- *stat_tx_control_bytes = 0;
- *stat_rx_pdcp_sdu = 0;
- *stat_rx_pdcp_bytes = 0;
- *stat_rx_data_pdus_duplicate = 0;
- *stat_rx_data_bytes_duplicate = 0;
- *stat_rx_data_pdu = 0;
- *stat_rx_data_bytes = 0;
- *stat_rx_data_pdu_dropped = 0;
- *stat_rx_data_bytes_dropped = 0;
- *stat_rx_data_pdu_out_of_window = 0;
- *stat_rx_data_bytes_out_of_window = 0;
- *stat_rx_control_pdu = 0;
- *stat_rx_control_bytes = 0;
- *stat_timer_reordering_timed_out = 0;
- *stat_timer_poll_retransmit_timed_out = 0;
- *stat_timer_status_prohibit_timed_out = 0;
- return RLC_OP_STATUS_BAD_PARAMETER;
- break;
+ case RLC_MODE_NONE:
+ *stat_tx_pdcp_sdu = 0;
+ *stat_tx_pdcp_bytes = 0;
+ *stat_tx_pdcp_sdu_discarded = 0;
+ *stat_tx_pdcp_bytes_discarded = 0;
+ *stat_tx_data_pdu = 0;
+ *stat_tx_data_bytes = 0;
+ *stat_tx_retransmit_pdu_by_status = 0;
+ *stat_tx_retransmit_bytes_by_status = 0;
+ *stat_tx_retransmit_pdu = 0;
+ *stat_tx_retransmit_bytes = 0;
+ *stat_tx_control_pdu = 0;
+ *stat_tx_control_bytes = 0;
+ *stat_rx_pdcp_sdu = 0;
+ *stat_rx_pdcp_bytes = 0;
+ *stat_rx_data_pdus_duplicate = 0;
+ *stat_rx_data_bytes_duplicate = 0;
+ *stat_rx_data_pdu = 0;
+ *stat_rx_data_bytes = 0;
+ *stat_rx_data_pdu_dropped = 0;
+ *stat_rx_data_bytes_dropped = 0;
+ *stat_rx_data_pdu_out_of_window = 0;
+ *stat_rx_data_bytes_out_of_window = 0;
+ *stat_rx_control_pdu = 0;
+ *stat_rx_control_bytes = 0;
+ *stat_timer_reordering_timed_out = 0;
+ *stat_timer_poll_retransmit_timed_out = 0;
+ *stat_timer_status_prohibit_timed_out = 0;
+ return RLC_OP_STATUS_BAD_PARAMETER;
+ break;
- case RLC_MODE_AM:
- rlc_am_stat_req(ctxt_pP,
- &rlc_union_p->rlc.am,
- stat_tx_pdcp_sdu,
- stat_tx_pdcp_bytes,
- stat_tx_pdcp_sdu_discarded,
- stat_tx_pdcp_bytes_discarded,
- stat_tx_data_pdu,
- stat_tx_data_bytes,
- stat_tx_retransmit_pdu_by_status,
- stat_tx_retransmit_bytes_by_status,
- stat_tx_retransmit_pdu,
- stat_tx_retransmit_bytes,
- stat_tx_control_pdu,
- stat_tx_control_bytes,
- stat_rx_pdcp_sdu,
- stat_rx_pdcp_bytes,
- stat_rx_data_pdus_duplicate,
- stat_rx_data_bytes_duplicate,
- stat_rx_data_pdu,
- stat_rx_data_bytes,
- stat_rx_data_pdu_dropped,
- stat_rx_data_bytes_dropped,
- stat_rx_data_pdu_out_of_window,
- stat_rx_data_bytes_out_of_window,
- stat_rx_control_pdu,
- stat_rx_control_bytes,
- stat_timer_reordering_timed_out,
- stat_timer_poll_retransmit_timed_out,
- stat_timer_status_prohibit_timed_out);
- return RLC_OP_STATUS_OK;
- break;
+ case RLC_MODE_AM:
+ rlc_am_stat_req(ctxt_pP,
+ &rlc_union_p->rlc.am,
+ stat_tx_pdcp_sdu,
+ stat_tx_pdcp_bytes,
+ stat_tx_pdcp_sdu_discarded,
+ stat_tx_pdcp_bytes_discarded,
+ stat_tx_data_pdu,
+ stat_tx_data_bytes,
+ stat_tx_retransmit_pdu_by_status,
+ stat_tx_retransmit_bytes_by_status,
+ stat_tx_retransmit_pdu,
+ stat_tx_retransmit_bytes,
+ stat_tx_control_pdu,
+ stat_tx_control_bytes,
+ stat_rx_pdcp_sdu,
+ stat_rx_pdcp_bytes,
+ stat_rx_data_pdus_duplicate,
+ stat_rx_data_bytes_duplicate,
+ stat_rx_data_pdu,
+ stat_rx_data_bytes,
+ stat_rx_data_pdu_dropped,
+ stat_rx_data_bytes_dropped,
+ stat_rx_data_pdu_out_of_window,
+ stat_rx_data_bytes_out_of_window,
+ stat_rx_control_pdu,
+ stat_rx_control_bytes,
+ stat_timer_reordering_timed_out,
+ stat_timer_poll_retransmit_timed_out,
+ stat_timer_status_prohibit_timed_out);
+ return RLC_OP_STATUS_OK;
+ break;
- case RLC_MODE_UM:
- *stat_tx_retransmit_pdu_by_status = 0;
- *stat_tx_retransmit_bytes_by_status = 0;
- *stat_tx_retransmit_pdu = 0;
- *stat_tx_retransmit_bytes = 0;
- *stat_tx_control_pdu = 0;
- *stat_tx_control_bytes = 0;
- *stat_rx_data_pdu_dropped = 0;
- *stat_rx_data_bytes_dropped = 0;
- *stat_rx_data_pdu_out_of_window = 0;
- *stat_rx_data_bytes_out_of_window = 0;
- *stat_timer_poll_retransmit_timed_out = 0;
- *stat_timer_status_prohibit_timed_out = 0;
- rlc_um_stat_req (&rlc_union_p->rlc.um,
- stat_tx_pdcp_sdu,
- stat_tx_pdcp_bytes,
- stat_tx_pdcp_sdu_discarded,
- stat_tx_pdcp_bytes_discarded,
- stat_tx_data_pdu,
- stat_tx_data_bytes,
- stat_rx_pdcp_sdu,
- stat_rx_pdcp_bytes,
- stat_rx_data_pdus_duplicate,
- stat_rx_data_bytes_duplicate,
- stat_rx_data_pdu,
- stat_rx_data_bytes,
- stat_rx_data_pdu_dropped,
- stat_rx_data_bytes_dropped,
- stat_rx_data_pdu_out_of_window,
- stat_rx_data_bytes_out_of_window,
- stat_timer_reordering_timed_out);
- return RLC_OP_STATUS_OK;
- break;
+ case RLC_MODE_UM:
+ *stat_tx_retransmit_pdu_by_status = 0;
+ *stat_tx_retransmit_bytes_by_status = 0;
+ *stat_tx_retransmit_pdu = 0;
+ *stat_tx_retransmit_bytes = 0;
+ *stat_tx_control_pdu = 0;
+ *stat_tx_control_bytes = 0;
+ *stat_rx_data_pdu_dropped = 0;
+ *stat_rx_data_bytes_dropped = 0;
+ *stat_rx_data_pdu_out_of_window = 0;
+ *stat_rx_data_bytes_out_of_window = 0;
+ *stat_timer_poll_retransmit_timed_out = 0;
+ *stat_timer_status_prohibit_timed_out = 0;
+ rlc_um_stat_req (&rlc_union_p->rlc.um,
+ stat_tx_pdcp_sdu,
+ stat_tx_pdcp_bytes,
+ stat_tx_pdcp_sdu_discarded,
+ stat_tx_pdcp_bytes_discarded,
+ stat_tx_data_pdu,
+ stat_tx_data_bytes,
+ stat_rx_pdcp_sdu,
+ stat_rx_pdcp_bytes,
+ stat_rx_data_pdus_duplicate,
+ stat_rx_data_bytes_duplicate,
+ stat_rx_data_pdu,
+ stat_rx_data_bytes,
+ stat_rx_data_pdu_dropped,
+ stat_rx_data_bytes_dropped,
+ stat_rx_data_pdu_out_of_window,
+ stat_rx_data_bytes_out_of_window,
+ stat_timer_reordering_timed_out);
+ return RLC_OP_STATUS_OK;
+ break;
- case RLC_MODE_TM:
- *stat_tx_pdcp_sdu = 0;
- *stat_tx_pdcp_bytes = 0;
- *stat_tx_pdcp_sdu_discarded = 0;
- *stat_tx_pdcp_bytes_discarded = 0;
- *stat_tx_data_pdu = 0;
- *stat_tx_data_bytes = 0;
- *stat_tx_retransmit_pdu_by_status = 0;
- *stat_tx_retransmit_bytes_by_status = 0;
- *stat_tx_retransmit_pdu = 0;
- *stat_tx_retransmit_bytes = 0;
- *stat_tx_control_pdu = 0;
- *stat_tx_control_bytes = 0;
- *stat_rx_pdcp_sdu = 0;
- *stat_rx_pdcp_bytes = 0;
- *stat_rx_data_pdus_duplicate = 0;
- *stat_rx_data_bytes_duplicate = 0;
- *stat_rx_data_pdu = 0;
- *stat_rx_data_bytes = 0;
- *stat_rx_data_pdu_dropped = 0;
- *stat_rx_data_bytes_dropped = 0;
- *stat_rx_data_pdu_out_of_window = 0;
- *stat_rx_data_bytes_out_of_window = 0;
- *stat_rx_control_pdu = 0;
- *stat_rx_control_bytes = 0;
- *stat_timer_reordering_timed_out = 0;
- *stat_timer_poll_retransmit_timed_out = 0;
- *stat_timer_status_prohibit_timed_out = 0;
- return RLC_OP_STATUS_BAD_PARAMETER;
- break;
+ case RLC_MODE_TM:
+ *stat_tx_pdcp_sdu = 0;
+ *stat_tx_pdcp_bytes = 0;
+ *stat_tx_pdcp_sdu_discarded = 0;
+ *stat_tx_pdcp_bytes_discarded = 0;
+ *stat_tx_data_pdu = 0;
+ *stat_tx_data_bytes = 0;
+ *stat_tx_retransmit_pdu_by_status = 0;
+ *stat_tx_retransmit_bytes_by_status = 0;
+ *stat_tx_retransmit_pdu = 0;
+ *stat_tx_retransmit_bytes = 0;
+ *stat_tx_control_pdu = 0;
+ *stat_tx_control_bytes = 0;
+ *stat_rx_pdcp_sdu = 0;
+ *stat_rx_pdcp_bytes = 0;
+ *stat_rx_data_pdus_duplicate = 0;
+ *stat_rx_data_bytes_duplicate = 0;
+ *stat_rx_data_pdu = 0;
+ *stat_rx_data_bytes = 0;
+ *stat_rx_data_pdu_dropped = 0;
+ *stat_rx_data_bytes_dropped = 0;
+ *stat_rx_data_pdu_out_of_window = 0;
+ *stat_rx_data_bytes_out_of_window = 0;
+ *stat_rx_control_pdu = 0;
+ *stat_rx_control_bytes = 0;
+ *stat_timer_reordering_timed_out = 0;
+ *stat_timer_poll_retransmit_timed_out = 0;
+ *stat_timer_status_prohibit_timed_out = 0;
+ return RLC_OP_STATUS_BAD_PARAMETER;
+ break;
- default:
- *stat_tx_pdcp_sdu = 0;
- *stat_tx_pdcp_bytes = 0;
- *stat_tx_pdcp_sdu_discarded = 0;
- *stat_tx_pdcp_bytes_discarded = 0;
- *stat_tx_data_pdu = 0;
- *stat_tx_data_bytes = 0;
- *stat_tx_retransmit_pdu_by_status = 0;
- *stat_tx_retransmit_bytes_by_status = 0;
- *stat_tx_retransmit_pdu = 0;
- *stat_tx_retransmit_bytes = 0;
- *stat_tx_control_pdu = 0;
- *stat_tx_control_bytes = 0;
- *stat_rx_pdcp_sdu = 0;
- *stat_rx_pdcp_bytes = 0;
- *stat_rx_data_pdus_duplicate = 0;
- *stat_rx_data_bytes_duplicate = 0;
- *stat_rx_data_pdu = 0;
- *stat_rx_data_bytes = 0;
- *stat_rx_data_pdu_dropped = 0;
- *stat_rx_data_bytes_dropped = 0;
- *stat_rx_data_pdu_out_of_window = 0;
- *stat_rx_data_bytes_out_of_window = 0;
- *stat_rx_control_pdu = 0;
- *stat_rx_control_bytes = 0;
-
- *stat_timer_poll_retransmit_timed_out = 0;
- *stat_timer_status_prohibit_timed_out = 0;
- return RLC_OP_STATUS_BAD_PARAMETER;
+ default:
+ *stat_tx_pdcp_sdu = 0;
+ *stat_tx_pdcp_bytes = 0;
+ *stat_tx_pdcp_sdu_discarded = 0;
+ *stat_tx_pdcp_bytes_discarded = 0;
+ *stat_tx_data_pdu = 0;
+ *stat_tx_data_bytes = 0;
+ *stat_tx_retransmit_pdu_by_status = 0;
+ *stat_tx_retransmit_bytes_by_status = 0;
+ *stat_tx_retransmit_pdu = 0;
+ *stat_tx_retransmit_bytes = 0;
+ *stat_tx_control_pdu = 0;
+ *stat_tx_control_bytes = 0;
+ *stat_rx_pdcp_sdu = 0;
+ *stat_rx_pdcp_bytes = 0;
+ *stat_rx_data_pdus_duplicate = 0;
+ *stat_rx_data_bytes_duplicate = 0;
+ *stat_rx_data_pdu = 0;
+ *stat_rx_data_bytes = 0;
+ *stat_rx_data_pdu_dropped = 0;
+ *stat_rx_data_bytes_dropped = 0;
+ *stat_rx_data_pdu_out_of_window = 0;
+ *stat_rx_data_bytes_out_of_window = 0;
+ *stat_rx_control_pdu = 0;
+ *stat_rx_control_bytes = 0;
+ *stat_timer_poll_retransmit_timed_out = 0;
+ *stat_timer_status_prohibit_timed_out = 0;
+ return RLC_OP_STATUS_BAD_PARAMETER;
}
}
//-----------------------------------------------------------------------------
-rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
+rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
@@ -321,18 +318,16 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
sdu_size_t sdu_sizeP,
mem_block_t *sdu_pP
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,const uint32_t * const sourceL2Id
- ,const uint32_t * const destinationL2Id
+ ,const uint32_t *const sourceL2Id
+ ,const uint32_t *const destinationL2Id
#endif
- )
-{
+ ) {
//-----------------------------------------------------------------------------
mem_block_t *new_sdu_p = NULL;
rlc_mode_t rlc_mode = RLC_MODE_NONE;
rlc_union_t *rlc_union_p = NULL;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc;
-
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
rlc_mbms_id_t *mbms_id_p = NULL;
logical_chan_id_t log_ch_id = 0;
@@ -351,32 +346,33 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
#else
AssertFatal(MBMS_flagP == 0, "MBMS_flagP %u", MBMS_flagP);
#endif
-
#if T_TRACER
+
if (ctxt_pP->enb_flag)
T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP));
+
#endif
if (MBMS_flagP) {
//AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
- if(rb_idP >= NB_RB_MBMS_MAX){
- LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
+ if(rb_idP >= NB_RB_MBMS_MAX) {
+ LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
+ return RLC_OP_STATUS_BAD_PARAMETER;
+ }
} else {
//AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
- if(rb_idP >= NB_RB_MAX){
- LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
+ if(rb_idP >= NB_RB_MAX) {
+ LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
+ return RLC_OP_STATUS_BAD_PARAMETER;
+ }
}
//DevAssert(sdu_pP != NULL);
- if(sdu_pP == NULL){
- LOG_E(RLC, "sdu_pP == NULL\n");
- return RLC_OP_STATUS_BAD_PARAMETER;
- }
-
+ if(sdu_pP == NULL) {
+ LOG_E(RLC, "sdu_pP == NULL\n");
+ return RLC_OP_STATUS_BAD_PARAMETER;
+ }
+
//DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0);
if(sdu_sizeP <= 0) {
LOG_E(RLC, "sdu_sizeP %d, file %s, line %d\n", sdu_sizeP, __FILE__ ,__LINE__);
@@ -386,9 +382,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
#if (LTE_RRC_VERSION < MAKE_VERSION(10, 0, 0))
DevCheck(MBMS_flagP == 0, MBMS_flagP, 0, 0);
#endif
-
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_IN);
-
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
if (MBMS_flagP == TRUE) {
@@ -402,31 +396,31 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id);
}
- if (sourceL2Id && destinationL2Id){
- LOG_I (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%d, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
- //Thinh's line originally uncommented
- //key = RLC_COLL_KEY_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
-
-
- //key_lcid = RLC_COLL_KEY_LCID_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, chan_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
+ if (sourceL2Id && destinationL2Id) {
+ LOG_D (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%d, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP,
+ srb_flagP);
+ key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
+ //Thinh's line originally uncommented
+ //key = RLC_COLL_KEY_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
+ //key_lcid = RLC_COLL_KEY_LCID_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, chan_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
} else
#endif
{
- LOG_I (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%d, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
+ LOG_D (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%d, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP,
+ srb_flagP);
key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
}
- h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p);
+ h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
if (h_rc == HASH_TABLE_OK) {
rlc_mode = rlc_union_p->mode;
} else {
rlc_mode = RLC_MODE_NONE;
//AssertFatal (0 , "RLC not configured key %ju\n", key);
- LOG_E(RLC, "not configured key %lu\n", key);
- return RLC_OP_STATUS_OUT_OF_RESSOURCES;
+ LOG_E(RLC, "not configured key %lu\n", key);
+ return RLC_OP_STATUS_OUT_OF_RESSOURCES;
}
if (MBMS_flagP == 0) {
@@ -434,111 +428,105 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
PROTOCOL_CTXT_ARGS(ctxt_pP),
rb_idP);
#if defined(TRACE_RLC_PAYLOAD)
- rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP);
+ rlc_util_print_hex_octets(RLC, (unsigned char *)sdu_pP->data, sdu_sizeP);
#endif
-
#ifdef DEBUG_RLC_DATA_REQ
LOG_D(RLC,"RLC_TYPE : %d\n", rlc_mode);
#endif
switch (rlc_mode) {
- case RLC_MODE_NONE:
- free_mem_block(sdu_pP, __func__);
- LOG_E(RLC, PROTOCOL_CTXT_FMT" Received RLC_MODE_NONE as rlc_type for rb_id %u\n",
- PROTOCOL_CTXT_ARGS(ctxt_pP),
- rb_idP);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_BAD_PARAMETER;
+ case RLC_MODE_NONE:
+ free_mem_block(sdu_pP, __func__);
+ LOG_E(RLC, PROTOCOL_CTXT_FMT" Received RLC_MODE_NONE as rlc_type for rb_id %u\n",
+ PROTOCOL_CTXT_ARGS(ctxt_pP),
+ rb_idP);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
+ return RLC_OP_STATUS_BAD_PARAMETER;
- case RLC_MODE_AM:
+ case RLC_MODE_AM:
#ifdef DEBUG_RLC_DATA_REQ
- LOG_D(RLC,"RLC_MODE_AM\n");
+ LOG_D(RLC,"RLC_MODE_AM\n");
#endif
- new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_am_data_req_alloc), __func__);
+ new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_am_data_req_alloc), __func__);
- if (new_sdu_p != NULL) {
- // PROCESS OF COMPRESSION HERE:
- memset (new_sdu_p->data, 0, sizeof (struct rlc_am_data_req_alloc));
- memcpy (&new_sdu_p->data[sizeof (struct rlc_am_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
+ if (new_sdu_p != NULL) {
+ // PROCESS OF COMPRESSION HERE:
+ memset (new_sdu_p->data, 0, sizeof (struct rlc_am_data_req_alloc));
+ memcpy (&new_sdu_p->data[sizeof (struct rlc_am_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
+ ((struct rlc_am_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
+ ((struct rlc_am_data_req *) (new_sdu_p->data))->conf = confirmP;
+ ((struct rlc_am_data_req *) (new_sdu_p->data))->mui = muiP;
+ ((struct rlc_am_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_am_data_req_alloc);
+ free_mem_block(sdu_pP, __func__);
+ rlc_am_data_req(ctxt_pP, &rlc_union_p->rlc.am, new_sdu_p);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
+ return RLC_OP_STATUS_OK;
+ } else {
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
+ free_mem_block(sdu_pP, __func__);
+ return RLC_OP_STATUS_INTERNAL_ERROR;
+ }
- ((struct rlc_am_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
- ((struct rlc_am_data_req *) (new_sdu_p->data))->conf = confirmP;
- ((struct rlc_am_data_req *) (new_sdu_p->data))->mui = muiP;
- ((struct rlc_am_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_am_data_req_alloc);
+ break;
+
+ case RLC_MODE_UM:
+
+ /* TODO: this is a hack, needs better solution. Let's not use too
+ * much memory and store at maximum 5 millions bytes.
+ */
+ /* look for HACK_RLC_UM_LIMIT for others places related to the hack. Please do not remove this comment. */
+ if (rlc_um_get_buffer_occupancy(&rlc_union_p->rlc.um) > 5000000) {
+ free_mem_block(sdu_pP, __func__);
+ return RLC_OP_STATUS_OUT_OF_RESSOURCES;
+ }
+
+ new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc), __func__);
+
+ if (new_sdu_p != NULL) {
+ // PROCESS OF COMPRESSION HERE:
+ memset (new_sdu_p->data, 0, sizeof (struct rlc_um_data_req_alloc));
+ memcpy (&new_sdu_p->data[sizeof (struct rlc_um_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
+ ((struct rlc_um_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
+ ((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
+ free_mem_block(sdu_pP, __func__);
+ rlc_um_data_req(ctxt_pP, &rlc_union_p->rlc.um, new_sdu_p);
+ //free_mem_block(new_sdu, __func__);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
+ return RLC_OP_STATUS_OK;
+ } else {
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
+ free_mem_block(sdu_pP, __func__);
+ return RLC_OP_STATUS_INTERNAL_ERROR;
+ }
+
+ break;
+
+ case RLC_MODE_TM:
+ new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_tm_data_req_alloc), __func__);
+
+ if (new_sdu_p != NULL) {
+ // PROCESS OF COMPRESSION HERE:
+ memset (new_sdu_p->data, 0, sizeof (struct rlc_tm_data_req_alloc));
+ memcpy (&new_sdu_p->data[sizeof (struct rlc_tm_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
+ ((struct rlc_tm_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
+ ((struct rlc_tm_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_tm_data_req_alloc);
+ free_mem_block(sdu_pP, __func__);
+ rlc_tm_data_req(ctxt_pP, &rlc_union_p->rlc.tm, new_sdu_p);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
+ return RLC_OP_STATUS_OK;
+ } else {
+ //handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : out of memory\n", __FILE__, __LINE__);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
+ free_mem_block(sdu_pP, __func__);
+ return RLC_OP_STATUS_INTERNAL_ERROR;
+ }
+
+ break;
+
+ default:
free_mem_block(sdu_pP, __func__);
- rlc_am_data_req(ctxt_pP, &rlc_union_p->rlc.am, new_sdu_p);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_OK;
- } else {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- free_mem_block(sdu_pP, __func__);
return RLC_OP_STATUS_INTERNAL_ERROR;
- }
-
- break;
-
- case RLC_MODE_UM:
- /* TODO: this is a hack, needs better solution. Let's not use too
- * much memory and store at maximum 5 millions bytes.
- */
- /* look for HACK_RLC_UM_LIMIT for others places related to the hack. Please do not remove this comment. */
- if (rlc_um_get_buffer_occupancy(&rlc_union_p->rlc.um) > 5000000) {
- free_mem_block(sdu_pP, __func__);
- return RLC_OP_STATUS_OUT_OF_RESSOURCES;
- }
-
- new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc), __func__);
-
- if (new_sdu_p != NULL) {
- // PROCESS OF COMPRESSION HERE:
- memset (new_sdu_p->data, 0, sizeof (struct rlc_um_data_req_alloc));
- memcpy (&new_sdu_p->data[sizeof (struct rlc_um_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
-
- ((struct rlc_um_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
- ((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
- free_mem_block(sdu_pP, __func__);
-
- rlc_um_data_req(ctxt_pP, &rlc_union_p->rlc.um, new_sdu_p);
-
- //free_mem_block(new_sdu, __func__);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_OK;
- } else {
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- free_mem_block(sdu_pP, __func__);
- return RLC_OP_STATUS_INTERNAL_ERROR;
- }
-
- break;
-
- case RLC_MODE_TM:
- new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_tm_data_req_alloc), __func__);
-
- if (new_sdu_p != NULL) {
- // PROCESS OF COMPRESSION HERE:
- memset (new_sdu_p->data, 0, sizeof (struct rlc_tm_data_req_alloc));
- memcpy (&new_sdu_p->data[sizeof (struct rlc_tm_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
-
- ((struct rlc_tm_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
- ((struct rlc_tm_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_tm_data_req_alloc);
- free_mem_block(sdu_pP, __func__);
- rlc_tm_data_req(ctxt_pP, &rlc_union_p->rlc.tm, new_sdu_p);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_OK;
- } else {
- //handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : out of memory\n", __FILE__, __LINE__);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- free_mem_block(sdu_pP, __func__);
- return RLC_OP_STATUS_INTERNAL_ERROR;
- }
-
- break;
-
- default:
- free_mem_block(sdu_pP, __func__);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
- return RLC_OP_STATUS_INTERNAL_ERROR;
-
}
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
@@ -557,7 +545,6 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
free_mem_block(sdu_pP, __func__);
rlc_um_data_req(ctxt_pP, &rlc_union_p->rlc.um, new_sdu_p);
-
//free_mem_block(new_sdu, __func__);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
return RLC_OP_STATUS_OK;
@@ -578,8 +565,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
#else
}
- else /* MBMS_flag != 0 */
- {
+ else { /* MBMS_flag != 0 */
free_mem_block(sdu_pP, __func__);
LOG_E(RLC, "MBMS_flag != 0 while Rel10/Rel14 is not defined...\n");
//handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : parameter module_id out of bounds :%d\n", __FILE__, __LINE__, module_idP);
@@ -592,32 +578,27 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
//-----------------------------------------------------------------------------
void rlc_data_ind (
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
- mem_block_t *sdu_pP)
-{
+ mem_block_t *sdu_pP) {
//-----------------------------------------------------------------------------
-
-
#if defined(TRACE_RLC_PAYLOAD)
LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u] Display of rlc_data_ind: size %u\n",
PROTOCOL_CTXT_ARGS(ctxt_pP),
(srb_flagP) ? "SRB" : "DRB",
rb_idP,
sdu_sizeP);
-
- rlc_util_print_hex_octets(RLC, (unsigned char*)sdu_pP->data, sdu_sizeP);
+ rlc_util_print_hex_octets(RLC, (unsigned char *)sdu_pP->data, sdu_sizeP);
#endif
-
#if T_TRACER
+
if (ctxt_pP->enb_flag)
T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP));
+
#endif
-
-
pdcp_data_ind (
ctxt_pP,
srb_flagP,
@@ -627,14 +608,12 @@ void rlc_data_ind (
sdu_pP);
}
//-----------------------------------------------------------------------------
-void rlc_data_conf (const protocol_ctxt_t* const ctxt_pP,
+void rlc_data_conf (const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
- const rlc_tx_status_t statusP)
-{
+ const rlc_tx_status_t statusP) {
//-----------------------------------------------------------------------------
-
if (srb_flagP) {
if (rlc_rrc_data_conf != NULL) {
rlc_rrc_data_conf (ctxt_pP, rb_idP , muiP, statusP);
@@ -643,20 +622,17 @@ void rlc_data_conf (const protocol_ctxt_t* const ctxt_pP,
}
//-----------------------------------------------------------------------------
int
-rlc_module_init (void)
-{
+rlc_module_init (void) {
//-----------------------------------------------------------------------------
int k;
module_id_t module_id1;
-
/* for no gcc warnings */
(void)k;
-
LOG_D(RLC, "MODULE INIT\n");
rlc_rrc_data_ind = NULL;
rlc_rrc_data_conf = NULL;
-
rlc_coll_p = hashtable_create ((LTE_maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, rb_free_rlc_union);
+
//AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed");
if(rlc_coll_p == NULL) {
LOG_E(RLC, "UNRECOVERABLE error, RLC hashtable_create failed\n");
@@ -694,7 +670,6 @@ rlc_module_init (void)
}
pool_buffer_init();
-
return(0);
}
//-----------------------------------------------------------------------------
@@ -706,8 +681,7 @@ rlc_module_cleanup (void)
}
//-----------------------------------------------------------------------------
void
-rlc_layer_init (void)
-{
+rlc_layer_init (void) {
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
diff --git a/openair2/NETWORK_DRIVER/LITE/RB_TOOL/Makefile b/openair2/NETWORK_DRIVER/LITE/RB_TOOL/Makefile
old mode 100755
new mode 100644
diff --git a/openair2/NETWORK_DRIVER/UE_IP/README b/openair2/NETWORK_DRIVER/UE_IP/README
old mode 100755
new mode 100644
diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c
index 9ebee10f9b..28055bfc2d 100644
--- a/openair2/PHY_INTERFACE/IF_Module.c
+++ b/openair2/PHY_INTERFACE/IF_Module.c
@@ -47,7 +47,10 @@ void handle_rach(UL_IND_t *UL_info) {
AssertFatal(UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type>0,
"Got regular PRACH preamble, not BL/CE\n");
LOG_D(MAC,"Frame %d, Subframe %d Calling initiate_ra_proc (CE_level %d)\n",UL_info->frame,UL_info->subframe,
+
UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type-1);
+ UL_info->rach_ind_br.rach_indication_body.number_of_preambles=0;
+
initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
UL_info->frame,
diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c
index 2815ee3688..c64fd09bfc 100644
--- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c
+++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c
@@ -72,7 +72,7 @@ mac_rrc_data_req(
}
//------------------------------------------------------------------------------
-int8_t
+/*int8_t
mac_rrc_data_ind(
const module_id_t module_idP,
const int CC_idP,
@@ -100,7 +100,7 @@ mac_rrc_data_ind(
eNB_indexP,
mbsfn_sync_area)
);
-}
+}*/
//------------------------------------------------------------------------------
void
diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h
index 4b651761de..2e1d050387 100644
--- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h
+++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h
@@ -44,7 +44,7 @@ mac_rrc_data_req(
const uint8_t mbsfn_sync_areaP
);
-int8_t
+/*int8_t
mac_rrc_data_ind(
const module_id_t module_idP,
const int CC_idP,
@@ -81,7 +81,7 @@ mac_rrc_data_ind_ue(
const sdu_size_t sdu_lenP,
const mac_enb_index_t eNB_indexP,
const uint8_t mbsfn_sync_area
-);
+);*/
void mac_lite_sync_ind(
const module_id_t module_idP,
diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c
new file mode 100644
index 0000000000..736b16422b
--- /dev/null
+++ b/openair2/RRC/LITE/rrc_common.c
@@ -0,0 +1,496 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+/*! \file rrc_common.c
+ * \brief rrc common procedures for eNB and UE
+ * \author Navid Nikaein and Raymond Knopp
+ * \date 2011 - 2014
+ * \version 1.0
+ * \company Eurecom
+ * \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr
+ */
+
+#include "defs.h"
+#include "extern.h"
+#include "LAYER2/MAC/extern.h"
+#include "COMMON/openair_defs.h"
+#include "COMMON/platform_types.h"
+#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
+#include "LAYER2/RLC/rlc.h"
+#include "COMMON/mac_rrc_primitives.h"
+#include "UTIL/LOG/log.h"
+#include "asn1_msg.h"
+#include "pdcp.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
+#include "rrc_eNB_UE_context.h"
+#include "common/ran_context.h"
+
+#ifdef LOCALIZATION
+#include
+#endif
+
+#define DEBUG_RRC 1
+extern RAN_CONTEXT_t RC;
+extern UE_MAC_INST *UE_mac_inst;
+
+extern mui_t rrc_eNB_mui;
+
+//configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
+//-----------------------------------------------------------------------------
+void
+openair_rrc_on(
+ const protocol_ctxt_t* const ctxt_pP
+)
+//-----------------------------------------------------------------------------
+{
+ unsigned short i;
+ int CC_id;
+
+ if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" OPENAIR RRC IN....\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+ for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
+ rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1);
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1;
+ rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1);
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1;
+ }
+ } else {
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" OPENAIR RRC IN....\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+
+ for (i = 0; i < NB_eNB_INST; i++) {
+ LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" Activating CCCH (eNB %d)\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i);
+ UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Srb_id = CCCH;
+ memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[0], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
+ memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[1], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
+ rrc_config_buffer (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i], CCCH, 1);
+ UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Active = 1;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+int
+rrc_init_global_param(
+ void
+)
+//-----------------------------------------------------------------------------
+{
+
+ //#ifdef USER_MODE
+ // Rrc_xface = (RRC_XFACE*)malloc16(sizeof(RRC_XFACE));
+ //#endif //USRE_MODE
+
+ // Rrc_xface->openair_rrc_top_init = openair_rrc_top_init;
+ // Rrc_xface->openair_rrc_eNB_init = openair_rrc_eNB_init;
+ // Rrc_xface->openair_rrc_UE_init = openair_rrc_ue_init;
+ // Rrc_xface->mac_rrc_data_ind = mac_rrc_data_ind;
+ //Rrc_xface->mac_rrc_data_req = mac_rrc_data_req;
+ // Rrc_xface->rrc_data_indP = (void *)rlcrrc_data_ind;
+ // Rrc_xface->rrc_rx_tx = rrc_rx_tx;
+ // Rrc_xface->mac_rrc_meas_ind = mac_rrc_meas_ind;
+ // Rrc_xface->get_rrc_status = get_rrc_status;
+
+ //Rrc_xface->rrc_get_status = ...
+
+ // Mac_rlc_xface->mac_out_of_sync_ind=mac_out_of_sync_ind;
+
+#ifndef NO_RRM
+ // Rrc_xface->fn_rrc=fn_rrc;
+#endif
+ // LOG_D(RRC, "[RRC]INIT_GLOBAL_PARAM: Mac_rlc_xface %p, rrc_rlc_register %p,rlcrrc_data_ind%p\n",Mac_rlc_xface,Mac_rlc_xface->rrc_rlc_register_rrc,rlcrrc_data_ind);
+ /*
+ if((Mac_rlc_xface==NULL) || (Mac_rlc_xface->rrc_rlc_register_rrc==NULL) ||
+ (rlcrrc_data_ind==NULL)) {
+ LOG_E(RRC,"Data structured is not initialized \n");
+ return -1;
+ }
+ */
+ rrc_rlc_register_rrc (rrc_data_ind, NULL); //register with rlc
+
+ DCCH_LCHAN_DESC.transport_block_size = 4;
+ DCCH_LCHAN_DESC.max_transport_blocks = 16;
+ DCCH_LCHAN_DESC.Delay_class = 1;
+ DTCH_DL_LCHAN_DESC.transport_block_size = 52;
+ DTCH_DL_LCHAN_DESC.max_transport_blocks = 20;
+ DTCH_DL_LCHAN_DESC.Delay_class = 1;
+ DTCH_UL_LCHAN_DESC.transport_block_size = 52;
+ DTCH_UL_LCHAN_DESC.max_transport_blocks = 20;
+ DTCH_UL_LCHAN_DESC.Delay_class = 1;
+
+ Rlc_info_um.rlc_mode = RLC_MODE_UM;
+ Rlc_info_um.rlc.rlc_um_info.timer_reordering = 5;
+ Rlc_info_um.rlc.rlc_um_info.sn_field_length = 10;
+ Rlc_info_um.rlc.rlc_um_info.is_mXch = 0;
+ //Rlc_info_um.rlc.rlc_um_info.sdu_discard_mode=16;
+
+ Rlc_info_am_config.rlc_mode = RLC_MODE_AM;
+ Rlc_info_am_config.rlc.rlc_am_info.max_retx_threshold = 50;
+ Rlc_info_am_config.rlc.rlc_am_info.poll_pdu = 8;
+ Rlc_info_am_config.rlc.rlc_am_info.poll_byte = 1000;
+ Rlc_info_am_config.rlc.rlc_am_info.t_poll_retransmit = 15;
+ Rlc_info_am_config.rlc.rlc_am_info.t_reordering = 50;
+ Rlc_info_am_config.rlc.rlc_am_info.t_status_prohibit = 10;
+
+ return 0;
+}
+
+//-----------------------------------------------------------------------------
+void
+rrc_config_buffer(
+ SRB_INFO* Srb_info,
+ uint8_t Lchan_type,
+ uint8_t Role
+)
+//-----------------------------------------------------------------------------
+{
+
+ Srb_info->Rx_buffer.payload_size = 0;
+ Srb_info->Tx_buffer.payload_size = 0;
+}
+
+
+//-----------------------------------------------------------------------------
+void
+rrc_t310_expiration(
+ const protocol_ctxt_t* const ctxt_pP,
+ const uint8_t eNB_index
+)
+//-----------------------------------------------------------------------------
+{
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED) {
+ LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE;
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].UE_index = 0xffff;
+ UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Rx_buffer.payload_size = 0;
+ UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size = 0;
+ UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Rx_buffer.payload_size = 0;
+ UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size = 0;
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active == 1) {
+ msg ("[RRC Inst %d] eNB_index %d, Remove RB %d\n ", ctxt_pP->module_id, eNB_index,
+ UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id);
+ rrc_pdcp_config_req (ctxt_pP,
+ SRB_FLAG_YES,
+ CONFIG_ACTION_REMOVE,
+ UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
+ 0);
+ rrc_rlc_config_req (ctxt_pP,
+ SRB_FLAG_YES,
+ MBMS_FLAG_NO,
+ CONFIG_ACTION_REMOVE,
+ UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
+ Rlc_info_um);
+ UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active = 0;
+ UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Status = IDLE;
+ UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Next_check_frame = 0;
+ }
+ } else { // Restablishment procedure
+ LOG_D(RRC, "Timer 310 expired, trying RRCRestablishment ...\n");
+ }
+}
+
+//-----------------------------------------------------------------------------
+RRC_status_t
+rrc_rx_tx(
+ protocol_ctxt_t* const ctxt_pP,
+ const uint8_t enb_indexP,
+ const int CC_id
+)
+//-----------------------------------------------------------------------------
+{
+ //uint8_t UE_id;
+ int32_t current_timestamp_ms, ref_timestamp_ms;
+ struct timeval ts;
+ struct rrc_eNB_ue_context_s *ue_context_p = NULL,*ue_to_be_removed = NULL;
+
+#ifdef LOCALIZATION
+ double estimated_distance;
+ protocol_ctxt_t ctxt;
+#endif
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
+
+ if(ctxt_pP->enb_flag == ENB_FLAG_NO) {
+ // check timers
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) {
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0)
+ LOG_D(RRC,
+ "[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt);
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt
+ == T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0;
+ // ALLOW CCCH to be used
+ UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0;
+ rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+ return (RRC_ConnSetup_failed);
+ }
+
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++;
+ }
+
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) {
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt
+ == N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) {
+ LOG_I(RRC,"Activating T310\n");
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1;
+ }
+ } else { // in case we have not received SIB2 yet
+ /* if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0;
+
+ }*/
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+ return RRC_OK;
+ }
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) {
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt
+ == N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0;
+ }
+
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) {
+ LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt);
+ }
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
+ rrc_t310_expiration (ctxt_pP, enb_indexP);
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+ LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n");
+ return RRC_PHY_RESYNCH;
+ }
+
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++;
+ }
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) {
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0)
+ LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame,
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt);
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0;
+ UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
+ LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n",
+ ctxt_pP->module_id);
+ //Implement 36.331, section 5.3.5.6 here
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+ return(RRC_Handover_failed);
+ }
+
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--;
+ }
+
+ // Layer 3 filtering of RRC measurements
+ if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) {
+ ue_meas_filtering(ctxt_pP,enb_indexP);
+ }
+
+ ue_measurement_report_triggering(ctxt_pP,enb_indexP);
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) {
+ LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame);
+ }
+
+ if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION) &&
+ (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE;
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+ return(RRC_HO_STARTED);
+ }
+
+ } else { // eNB
+ check_handovers(ctxt_pP);
+ // counetr, and get the value and aggregate
+
+
+ // check for UL failure
+ RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
+ LOG_D(RRC,"SFN.SN %d.%d => release timer %d/%d\n",ctxt_pP->frame,ctxt_pP->subframe,
+ ue_context_p->ue_context.ue_release_timer,ue_context_p->ue_context.ue_release_timer_thres);
+ if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
+ if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
+ LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/20000\n",
+ ue_context_p->ue_context.rnti,
+ ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
+ ue_context_p->ue_context.ul_failure_timer);
+ }
+ else {
+ LOG_I(RRC,"UE rnti %x failure timer %d/20000\n",
+ ue_context_p->ue_context.rnti,
+ ue_context_p->ue_context.ul_failure_timer);
+ }
+ }
+ if (ue_context_p->ue_context.ul_failure_timer>0) {
+ ue_context_p->ue_context.ul_failure_timer++;
+ if (ue_context_p->ue_context.ul_failure_timer >= 20000) {
+ // remove UE after 20 seconds after MAC has indicated UL failure
+ LOG_I(RRC,"Removing UE %x instance (failure)\n",ue_context_p->ue_context.rnti);
+ ue_to_be_removed = ue_context_p;
+ break;
+ }
+ }
+ if (ue_context_p->ue_context.ue_release_timer>0) {
+ ue_context_p->ue_context.ue_release_timer++;
+ if (ue_context_p->ue_context.ue_release_timer >=
+ ue_context_p->ue_context.ue_release_timer_thres) {
+ LOG_I(RRC,"Removing UE %x instance (release timer %d)\n",ue_context_p->ue_context.rnti,ue_context_p->ue_context.ue_release_timer);
+ ue_to_be_removed = ue_context_p;
+ exit(-1);
+ break;
+ }
+ }
+ }
+ if (ue_to_be_removed)
+ rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed);
+
+#ifdef RRC_LOCALIZATION
+
+ /* for the localization, only primary CC_id might be relevant*/
+ gettimeofday(&ts, NULL);
+ current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
+ ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms;
+ RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
+ ctxt = *ctxt_pP;
+ ctxt.rnti = ue_context_p->ue_context.rnti;
+ estimated_distance = rrc_get_estimated_ue_distance(
+ &ctxt,
+ CC_id,
+ RC.rrc[ctxt_pP->module_id]->loc_type);
+
+ if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) &&
+ estimated_distance != -1) {
+ LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n",
+ ctxt.rnti,
+ ctxt_pP->module_id,
+ current_timestamp_ms,
+ ctxt_pP->frame,
+ estimated_distance);
+ LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status);
+ push_front(&RC.rrc[ctxt_pP->module_id]->loc_list,
+ estimated_distance);
+ RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms;
+ }
+ }
+
+#endif
+ (void)ts; /* remove gcc warning "unused variable" */
+ (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */
+ (void)current_timestamp_ms; /* remove gcc warning "unused variable" */
+ }
+
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+ return (RRC_OK);
+}
+
+//-----------------------------------------------------------------------------
+long
+binary_search_int(
+ int elements[],
+ long numElem,
+ int value
+)
+//-----------------------------------------------------------------------------
+{
+ long first, last, middle, search = -1;
+ first = 0;
+ last = numElem-1;
+ middle = (first+last)/2;
+
+ if(value < elements[0]) {
+ return first;
+ }
+
+ if(value > elements[last]) {
+ return last;
+ }
+
+ while (first <= last) {
+ if (elements[middle] < value) {
+ first = middle+1;
+ } else if (elements[middle] == value) {
+ search = middle+1;
+ break;
+ } else {
+ last = middle -1;
+ }
+
+ middle = (first+last)/2;
+ }
+
+ if (first > last) {
+ LOG_E(RRC,"Error in binary search!");
+ }
+
+ return search;
+}
+
+/* This is a binary search routine which operates on an array of floating
+ point numbers and returns the index of the range the value lies in
+ Used for RSRP and RSRQ measurement mapping. Can potentially be used for other things
+*/
+//-----------------------------------------------------------------------------
+long
+binary_search_float(
+ float elements[],
+ long numElem,
+ float value
+)
+//-----------------------------------------------------------------------------
+{
+ long first, last, middle;
+ first = 0;
+ last = numElem-1;
+ middle = (first+last)/2;
+
+ if(value <= elements[0]) {
+ return first;
+ }
+
+ if(value >= elements[last]) {
+ return last;
+ }
+
+ while (last - first > 1) {
+ if (elements[middle] > value) {
+ last = middle;
+ } else {
+ first = middle;
+ }
+
+ middle = (first+last)/2;
+ }
+
+ if (first < 0 || first >= numElem) {
+ LOG_E(RRC,"\n Error in binary search float!");
+ }
+
+ return first;
+}
+
diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c
index 4265a841e9..5929ac6689 100644
--- a/openair2/RRC/LTE/L2_interface.c
+++ b/openair2/RRC/LTE/L2_interface.c
@@ -231,6 +231,10 @@ mac_rrc_data_ind(
const uint8_t *sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ , const boolean_t brOption
+#endif
+
)
//--------------------------------------------------------------------------
{
@@ -247,8 +251,9 @@ mac_rrc_data_ind(
if((srb_idP & RAB_OFFSET) == CCCH) {
Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
-
- // msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ ctxt.brOption = brOption;
+#endif
if (sdu_lenP > 0) {
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
Srb_info->Rx_buffer.payload_size = sdu_lenP;
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
index 6d831741c2..0bb11fa037 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
@@ -20,13 +20,13 @@
*/
/*! \file asn1_msg.c
-* \brief primitives to build the asn1 messages
-* \author Raymond Knopp and Navid Nikaein
-* \date 2011
-* \version 1.0
-* \company Eurecom
-* \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr
-*/
+ * \brief primitives to build the asn1 messages
+ * \author Raymond Knopp and Navid Nikaein
+ * \date 2011
+ * \version 1.0
+ * \company Eurecom
+ * \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr
+ */
#include
#include
@@ -65,7 +65,10 @@
#include "LTE_MasterInformationBlock.h"
#include "LTE_SystemInformation.h"
+
#include "LTE_SystemInformationBlockType1.h"
+#include "LTE_SystemInformationBlockType1-BR-r13.h"
+
#include "LTE_SIB-Type.h"
@@ -105,12 +108,12 @@ extern RAN_CONTEXT_t RC;
uint16_t two_tier_hexagonal_cellIds[7] = {0,1,2,4,5,7,8};
uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8}, // CellId 0
- {11,18,2,0,8,15}, // CellId 1
- {18,13,3,4,0,1}, // CellId 2
- {2,3,14,6,5,0}, // CellId 4
- {0,4,6,16,9,7}, // CellId 5
- {8,0,5,9,17,12}, // CellId 7
- {15,1,0,7,12,10}
+ {11,18,2,0,8,15}, // CellId 1
+ {18,13,3,4,0,1}, // CellId 2
+ {2,3,14,6,5,0}, // CellId 4
+ {0,4,6,16,9,7}, // CellId 5
+ {8,0,5,9,17,12}, // CellId 7
+ {15,1,0,7,12,10}
};// CellId 8
/*
@@ -172,7 +175,13 @@ uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId) {
return 0xFF; //error!
}
-uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame) {
+
+uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ , uint32_t schedulingInfoSIB1
+#endif
+ ) {
+
asn_enc_rval_t enc_rval;
LTE_BCCH_BCH_Message_t *mib=&carrier->mib ;
uint8_t sfn = (uint8_t)((frame>>2)&0xff);
@@ -228,7 +237,10 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
#else
mib->message.spare.size = 1;
mib->message.spare.bits_unused = 3; // This makes a spare of 5 bits
- mib->message.schedulingInfoSIB1_BR_r13 = 0; // turn off eMTC
+ mib->message.schedulingInfoSIB1_BR_r13 = schedulingInfoSIB1; // turn on/off eMTC
+ LOG_I(RRC,"[MIB] schedulingInfoSIB1 %d\n",
+ (uint32_t)mib->message.schedulingInfoSIB1_BR_r13);
+
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_BCH_Message,
NULL,
@@ -305,7 +317,10 @@ uint8_t do_MIB_SL(const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
- int Mod_id,int CC_id
+ int Mod_id,int CC_id
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ , BOOLEAN_t brOption
+#endif
#if defined(ENABLE_ITTI)
, RrcConfigurationReq *configuration
#endif
@@ -321,13 +336,29 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
asn_enc_rval_t enc_rval;
LTE_SchedulingInfo_t schedulingInfo;
LTE_SIB_Type_t sib_type;
- uint8_t *buffer = carrier->SIB1;
- LTE_BCCH_DL_SCH_Message_t *bcch_message = &carrier->siblock1;
- LTE_SystemInformationBlockType1_t **sib1 = &carrier->sib1;
- int i;
+
+ uint8_t *buffer;
+ LTE_BCCH_DL_SCH_Message_t *bcch_message;
+ LTE_SystemInformationBlockType1_t **sib1;
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ if (brOption) {
+ buffer = carrier->SIB1_BR;
+ bcch_message = &carrier->siblock1_BR;
+ sib1 = &carrier->sib1_BR;
+ }
+ else
+#endif
+ {
+ buffer = carrier->SIB1;
+ bcch_message = &carrier->siblock1;
+ sib1 = &carrier->sib1;
+ }
+
memset(bcch_message,0,sizeof(LTE_BCCH_DL_SCH_Message_t));
bcch_message->message.present = LTE_BCCH_DL_SCH_MessageType_PR_c1;
bcch_message->message.choice.c1.present = LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
+
// memcpy(&bcch_message.message.choice.c1.choice.systemInformationBlockType1,sib1,sizeof(SystemInformationBlockType1_t));
*sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1;
memset(PLMN_identity_info,0,num_plmn * sizeof(LTE_PLMN_IdentityInfo_t));
@@ -335,7 +366,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
memset(&sib_type,0,sizeof(LTE_SIB_Type_t));
/* as per TS 36.311, up to 6 PLMN_identity_info are allowed in list -> add one by one */
- for (i = 0; i < configuration->num_plmn; ++i) {
+ for (int i = 0; i < configuration->num_plmn; ++i) {
PLMN_identity_info[i].plmn_Identity.mcc = CALLOC(1,sizeof(*PLMN_identity_info[i].plmn_Identity.mcc));
memset(PLMN_identity_info[i].plmn_Identity.mcc,0,sizeof(*PLMN_identity_info[i].plmn_Identity.mcc));
asn_set_empty(&PLMN_identity_info[i].plmn_Identity.mcc->list);//.size=0;
@@ -397,15 +428,15 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
(*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[0] = 0x00;
(*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[1] = 0x01;
#endif
- (*sib1)->cellAccessRelatedInfo.trackingAreaCode.size=2;
- (*sib1)->cellAccessRelatedInfo.trackingAreaCode.bits_unused=0;
+ (*sib1)->cellAccessRelatedInfo.trackingAreaCode.size = 2;
+ (*sib1)->cellAccessRelatedInfo.trackingAreaCode.bits_unused = 0;
// 28 bits
(*sib1)->cellAccessRelatedInfo.cellIdentity.buf = MALLOC(8);
#if defined(ENABLE_ITTI)
(*sib1)->cellAccessRelatedInfo.cellIdentity.buf[0] = (configuration->cell_identity >> 20) & 0xff;
(*sib1)->cellAccessRelatedInfo.cellIdentity.buf[1] = (configuration->cell_identity >> 12) & 0xff;
- (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[2] = (configuration->cell_identity >> 4) & 0xff;
- (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[3] = (configuration->cell_identity << 4) & 0xf0;
+ (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[2] = (configuration->cell_identity >> 4) & 0xff;
+ (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[3] = (configuration->cell_identity << 4) & 0xf0;
#else
(*sib1)->cellAccessRelatedInfo.cellIdentity.buf[0] = 0x00;
(*sib1)->cellAccessRelatedInfo.cellIdentity.buf[1] = 0x00;
@@ -427,7 +458,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
#if defined(ENABLE_ITTI)
configuration->eutra_band[CC_id];
#else
- 7;
+ 7;
#endif
schedulingInfo.si_Periodicity=LTE_SchedulingInfo__si_Periodicity_rf8;
// This is for SIB2/3
@@ -443,17 +474,399 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
(*sib1)->tdd_Config = CALLOC(1,sizeof(struct LTE_TDD_Config));
(*sib1)->tdd_Config->subframeAssignment =
#if defined(ENABLE_ITTI)
- configuration->tdd_config[CC_id];
+ configuration->tdd_config[CC_id];
#else
- 3;
+ 3; // +kogo this was frame_parms->tdd_config
#endif
(*sib1)->tdd_Config->specialSubframePatterns =
#if defined(ENABLE_ITTI)
- configuration->tdd_config_s[CC_id];
+ configuration->tdd_config_s[CC_id];
#else
0;
#endif
+ }
+
+ (*sib1)->si_WindowLength = LTE_SystemInformationBlockType1__si_WindowLength_ms20;
+ (*sib1)->systemInfoValueTag = 0;
+
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ (*sib1)->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v890_IEs_t));
+
+ LTE_SystemInformationBlockType1_v890_IEs_t *sib1_890 = (*sib1)->nonCriticalExtension;
+ sib1_890->lateNonCriticalExtension = NULL;
+ sib1_890->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v920_IEs_t));
+ memset(sib1_890->nonCriticalExtension, 0, sizeof(LTE_SystemInformationBlockType1_v920_IEs_t));
+
+ LTE_SystemInformationBlockType1_v920_IEs_t *sib1_920 = (*sib1_890).nonCriticalExtension;
+ sib1_920->ims_EmergencySupport_r9 = NULL; // ptr
+ sib1_920->cellSelectionInfo_v920 = NULL;
+ sib1_920->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v1130_IEs_t));
+ memset(sib1_920->nonCriticalExtension, 0, sizeof(LTE_SystemInformationBlockType1_v1130_IEs_t));
+
+ //////Rel11
+ LTE_SystemInformationBlockType1_v1130_IEs_t *sib1_1130 = sib1_920->nonCriticalExtension;
+
+ sib1_1130->tdd_Config_v1130 = NULL; // ptr
+ sib1_1130->cellSelectionInfo_v1130 = NULL; // ptr
+ sib1_1130->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v1250_IEs_t));
+ memset(sib1_1130->nonCriticalExtension, 0, sizeof(LTE_SystemInformationBlockType1_v1250_IEs_t));
+
+ ///Rel12
+ LTE_SystemInformationBlockType1_v1250_IEs_t *sib1_1250 = sib1_1130->nonCriticalExtension;
+ sib1_1250->cellAccessRelatedInfo_v1250.category0Allowed_r12 = NULL; // long*
+ sib1_1250->cellSelectionInfo_v1250 = NULL;
+ sib1_1250->freqBandIndicatorPriority_r12 = 0; // long* // FIXME
+ sib1_1250->nonCriticalExtension = NULL;
+
+ ////Rel1310
+#if defined(ENABLE_ITTI)
+ if ((configuration->schedulingInfoSIB1_BR_r13[CC_id] != 0) &&
+ (brOption==TRUE))
+ {
+ sib1_1250->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v1310_IEs_t));
+ memset(sib1_1250->nonCriticalExtension, 0, sizeof(LTE_SystemInformationBlockType1_v1310_IEs_t));
+ LTE_SystemInformationBlockType1_v1310_IEs_t *sib1_1310 = sib1_1250->nonCriticalExtension;
+
+
+ if (configuration->hyperSFN_r13[CC_id])
+ {
+ sib1_1310->hyperSFN_r13 = calloc(1, sizeof(BIT_STRING_t)); // type
+ memset(sib1_1310->hyperSFN_r13, 0, sizeof(BIT_STRING_t));
+ sib1_1310->hyperSFN_r13->buf = calloc(2, sizeof(uint8_t));
+ memmove(sib1_1310->hyperSFN_r13->buf, configuration->hyperSFN_r13[CC_id], 2 * sizeof(uint8_t));
+ sib1_1310->hyperSFN_r13->size = 2;
+ sib1_1310->hyperSFN_r13->bits_unused = 6;
+ }
+ else
+ sib1_1310->hyperSFN_r13 = NULL;
+
+ if (configuration->eDRX_Allowed_r13[CC_id])
+ {
+ sib1_1310->eDRX_Allowed_r13 = calloc(1, sizeof(long));
+ *sib1_1310->eDRX_Allowed_r13 = *configuration->eDRX_Allowed_r13[CC_id];
+ }
+ else
+ sib1_1310->eDRX_Allowed_r13 = NULL; // long*
+
+ if (configuration->cellSelectionInfoCE_r13[CC_id])
+ {
+ sib1_1310->cellSelectionInfoCE_r13 = calloc(1, sizeof(LTE_CellSelectionInfoCE_r13_t));
+ memset(sib1_1310->cellSelectionInfoCE_r13, 0, sizeof(LTE_CellSelectionInfoCE_r13_t));
+ sib1_1310->cellSelectionInfoCE_r13->q_RxLevMinCE_r13 = configuration->q_RxLevMinCE_r13[CC_id]; // (Q_RxLevMin_t) long
+ if (configuration->q_QualMinRSRQ_CE_r13[CC_id])
+ {
+ sib1_1310->cellSelectionInfoCE_r13->q_QualMinRSRQ_CE_r13 = calloc(1, sizeof(long));
+ *sib1_1310->cellSelectionInfoCE_r13->q_QualMinRSRQ_CE_r13 = *configuration->q_QualMinRSRQ_CE_r13[CC_id];
+ }
+ else
+ sib1_1310->cellSelectionInfoCE_r13->q_QualMinRSRQ_CE_r13 = NULL;
+ }
+ else
+ sib1_1310->cellSelectionInfoCE_r13 = NULL;
+
+ if (configuration->bandwidthReducedAccessRelatedInfo_r13[CC_id])
+ {
+
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13
+ = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13));
+
+ LOG_I(RRC,"Allocating memory for BR access of SI (%p)\n",
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13);
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13
+ = configuration->si_WindowLength_BR_r13[CC_id]; // 0
+
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13
+ = configuration->si_RepetitionPattern_r13[CC_id]; // 0
+
+
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13 = calloc(1, sizeof(LTE_SchedulingInfoList_BR_r13_t));
+
+ LTE_SchedulingInfo_BR_r13_t *schedulinginfo_br_13 = calloc(1, sizeof(LTE_SchedulingInfo_BR_r13_t));
+ memset(schedulinginfo_br_13, 0, sizeof(LTE_SchedulingInfo_BR_r13_t));
+
+ int num_sched_info_br = configuration->scheduling_info_br_size[CC_id];
+ int index;
+ for (index = 0; index < num_sched_info_br; ++index)
+ {
+
+ schedulinginfo_br_13->si_Narrowband_r13 = configuration->si_Narrowband_r13[CC_id][index];
+ schedulinginfo_br_13->si_TBS_r13 = configuration->si_TBS_r13[CC_id][index];
+ LOG_I(RRC,"Adding (%d,%d) to scheduling_info_br_13\n",(int)schedulinginfo_br_13->si_Narrowband_r13,(int)schedulinginfo_br_13->si_TBS_r13);
+ ASN_SEQUENCE_ADD(&sib1_1310->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13->list, schedulinginfo_br_13);
+ }
+
+
+ if (configuration->fdd_DownlinkOrTddSubframeBitmapBR_r13[CC_id])
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13
+ = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13));
+ memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13, 0,
+ sizeof(sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13)));
+
+ if (*configuration->fdd_DownlinkOrTddSubframeBitmapBR_r13[CC_id])
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->present
+ = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13_PR_subframePattern10_r13;
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.buf = calloc(2, sizeof(uint8_t));
+ memmove(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.buf, &configuration->fdd_DownlinkOrTddSubframeBitmapBR_val_r13[CC_id], 2 * sizeof(uint8_t));
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.size = 2;
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.bits_unused = 6;
+ }
+ else
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->present
+ = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13_PR_subframePattern40_r13;
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern40_r13.buf = calloc(5, sizeof(uint8_t));
+// memmove(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern40_r13.buf, &configuration->fdd_DownlinkOrTddSubframeBitmapBR_val_r13[CC_id], 5 * sizeof(uint8_t));
+ int bm_index;
+ for (bm_index = 0; bm_index < 5; bm_index++)
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern40_r13.buf[bm_index] = 0xFF;
+ }
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern40_r13.size = 5;
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern40_r13.bits_unused = 0;
+ }
+
+ }
+ else
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13 = NULL;
+ }
+
+ if (configuration->fdd_UplinkSubframeBitmapBR_r13[CC_id])
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13 = calloc(1, sizeof(BIT_STRING_t));
+ memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13, 0, sizeof(BIT_STRING_t));
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->buf = calloc(2, sizeof(uint8_t));
+ memmove(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->buf, configuration->fdd_UplinkSubframeBitmapBR_r13[CC_id],
+ 2 * sizeof(uint8_t));
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->size = 2;
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->bits_unused = 6;
+ }
+ else
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13 = NULL;
+ }
+
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13 = configuration->startSymbolBR_r13[CC_id];
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13
+ = configuration->si_HoppingConfigCommon_r13[CC_id];
+
+ if (configuration->si_ValidityTime_r13[CC_id])
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_ValidityTime_r13 = calloc(1, sizeof(long));
+ memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_ValidityTime_r13, 0, sizeof(long));
+ *sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_ValidityTime_r13 = *configuration->si_ValidityTime_r13[CC_id];
+
+ }
+ else
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_ValidityTime_r13 = NULL;
+ }
+
+
+ LTE_SystemInfoValueTagSI_r13_t *systemInfoValueTagSi_r13;
+ int num_system_info_value_tag = configuration->system_info_value_tag_SI_size[CC_id];
+ if (num_system_info_value_tag > 0)
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->systemInfoValueTagList_r13 = calloc(1, sizeof(LTE_SystemInfoValueTagList_r13_t));
+ for (index = 0; index < num_system_info_value_tag; ++index)
+ {
+ systemInfoValueTagSi_r13 = CALLOC(1, sizeof(LTE_SystemInfoValueTagSI_r13_t));
+ if (configuration->systemInfoValueTagSi_r13[CC_id][index])
+ {
+ *systemInfoValueTagSi_r13 = configuration->systemInfoValueTagSi_r13[CC_id][index];
+ }
+ else
+ {
+ *systemInfoValueTagSi_r13 = 0;
+ }
+ ASN_SEQUENCE_ADD(&sib1_1310->bandwidthReducedAccessRelatedInfo_r13->systemInfoValueTagList_r13->list, systemInfoValueTagSi_r13);
+ }
+
+ }
+ else
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->systemInfoValueTagList_r13 = NULL;
+ }
+
+ }
+ else
+ {
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13 = NULL;
+ }
+
+ sib1_1310->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v1320_IEs_t));
+ memset(sib1_1310->nonCriticalExtension, 0, sizeof(LTE_SystemInformationBlockType1_v1320_IEs_t));
+
+ /////Rel1320
+ LTE_SystemInformationBlockType1_v1320_IEs_t *sib1_1320 = sib1_1310->nonCriticalExtension;
+
+
+
+ if (configuration->freqHoppingParametersDL_r13[CC_id])
+ {
+ sib1_1320->freqHoppingParametersDL_r13 = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13));
+ memset(sib1_1320->freqHoppingParametersDL_r13, 0, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13));
+
+
+ if (configuration->mpdcch_pdsch_HoppingNB_r13[CC_id])
+ {
+ sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingNB_r13 = calloc(1, sizeof(long));
+ *sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingNB_r13 = *configuration->mpdcch_pdsch_HoppingNB_r13[CC_id];
+ }
+ else
+ sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingNB_r13 = NULL;
+
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13 = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13));
+ memset(sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13, 0, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13));
+
+ if (configuration->interval_DLHoppingConfigCommonModeA_r13[CC_id])
+ {
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13->present = LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13_PR_interval_FDD_r13;
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13->choice.interval_FDD_r13 = configuration->interval_DLHoppingConfigCommonModeA_r13_val[CC_id];
+ }
+ else
+ {
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13->present = LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13_PR_interval_TDD_r13;
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13->choice.interval_TDD_r13 = configuration->interval_DLHoppingConfigCommonModeA_r13_val[CC_id];
+ }
+
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13 = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13));
+ memset(sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13, 0, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13));
+
+ if (configuration->interval_DLHoppingConfigCommonModeB_r13[CC_id])
+ {
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13->present = LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13_PR_interval_FDD_r13;
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13->choice.interval_FDD_r13 = configuration->interval_DLHoppingConfigCommonModeB_r13_val[CC_id];
+ }
+ else
+ {
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13->present = LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13_PR_interval_TDD_r13;
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13->choice.interval_TDD_r13 = configuration->interval_DLHoppingConfigCommonModeB_r13_val[CC_id];
+ }
+
+ if (configuration->mpdcch_pdsch_HoppingOffset_r13[CC_id])
+ {
+
+ sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingOffset_r13 = calloc(1, sizeof(long));
+ *sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingOffset_r13 = *configuration->mpdcch_pdsch_HoppingOffset_r13[CC_id];
+ }
+ else
+ sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingOffset_r13 = NULL;
+
+ }
+ else
+ sib1_1320->freqHoppingParametersDL_r13 = NULL;
+
+ sib1_1320->nonCriticalExtension = NULL;
}
+#else
+ sib1_1250->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v1310_IEs_t));
+ memset(sib1_1250->nonCriticalExtension, 0, sizeof(LTE_SystemInformationBlockType1_v1310_IEs_t));
+ SystemInformationBlockType1_v1310_IEs_t *sib1_1310 = sib1_1250->nonCriticalExtension;
+
+ sib1_1310->hyperSFN_r13 = calloc(1, sizeof(BIT_STRING_t)); // type
+ memset(sib1_1310->hyperSFN_r13, 0, sizeof(BIT_STRING_t));
+ sib1_1310->hyperSFN_r13->buf = calloc(2, sizeof(uint8_t));
+ memset(sib1_1310->hyperSFN_r13->buf, 0, 2*sizeof(uint8_t));
+ sib1_1310->hyperSFN_r13->size = 2;
+ sib1_1310->hyperSFN_r13->bits_unused = 6;
+
+ sib1_1310->eDRX_Allowed_r13 = NULL; // long*
+ sib1_1310->cellSelectionInfoCE_r13 = calloc(1, sizeof(LTE_CellSelectionInfoCE_r13_t));
+ memset(sib1_1310->cellSelectionInfoCE_r13, 0, sizeof(LTE_CellSelectionInfoCE_r13_t));
+ sib1_1310->cellSelectionInfoCE_r13->q_RxLevMinCE_r13 = -70; // (Q_RxLevMin_t) long
+ sib1_1310->cellSelectionInfoCE_r13->q_QualMinRSRQ_CE_r13 = NULL; // (Q_RxLevMin_t) *long
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13
+ = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13));
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13
+ = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms20; // 0
+
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13
+ = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_everyRF; // 0
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13 = calloc(1, sizeof(LTE_SchedulingInfoList_BR_r13_t));
+ SchedulingInfo_BR_r13_t *schedulinginfo_br_13 = calloc(1, sizeof(LTE_SchedulingInfo_BR_r13_t));
+ memset(schedulinginfo_br_13, 0, sizeof(LTE_SchedulingInfo_BR_r13_t));
+ schedulinginfo_br_13->si_Narrowband_r13 = 1;
+ schedulinginfo_br_13->si_TBS_r13 = LTE_SchedulingInfo_BR_r13__si_TBS_r13_b152;
+ ASN_SEQUENCE_ADD(&sib1_1310->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13->list, schedulinginfo_br_13);
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13
+ = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13));
+ memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13, 0,
+ sizeof(sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13)));
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->present
+ = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13_PR_subframePattern10_r13;
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.buf = calloc(2, sizeof(uint8_t));
+ memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.buf, 0, 2 * sizeof(uint8_t));
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.size = 2;
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.bits_unused = 6;
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13 = calloc(1, sizeof(BIT_STRING_t));
+ memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13, 0, sizeof(BIT_STRING_t));
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->buf = calloc(2, sizeof(uint8_t));
+ memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->buf, 0,
+ 2 * sizeof(uint8_t));
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->size = 2;
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->bits_unused = 6;
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13 = 1;
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13
+ = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_on;
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_ValidityTime_r13 = calloc(1, sizeof(long));
+ memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_ValidityTime_r13, 0, sizeof(long));
+ *sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_ValidityTime_r13
+ = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_ValidityTime_r13_true;
+
+
+ sib1_1310->bandwidthReducedAccessRelatedInfo_r13->systemInfoValueTagList_r13 = calloc(1, sizeof(LTE_SystemInfoValueTagList_r13_t));
+ LTE_SystemInfoValueTagSI_r13_t *systemInfoValueTagSi_r13 = CALLOC(1, sizeof(LTE_SystemInfoValueTagSI_r13_t));
+ *systemInfoValueTagSi_r13 = 0;
+ ASN_SEQUENCE_ADD(&sib1_1310->bandwidthReducedAccessRelatedInfo_r13->systemInfoValueTagList_r13->list, systemInfoValueTagSi_r13);
+
+ sib1_1310->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v1320_IEs_t));
+ memset(sib1_1310->nonCriticalExtension, 0, sizeof(LTE_SystemInformationBlockType1_v1320_IEs_t));
+
+ /////Rel1320
+ LTE_SystemInformationBlockType1_v1320_IEs_t *sib1_1320 = sib1_1310->nonCriticalExtension;
+ sib1_1320->freqHoppingParametersDL_r13 = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13));
+ memset(sib1_1320->freqHoppingParametersDL_r13, 0, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13));
+
+ sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingNB_r13 = calloc(1, sizeof(long));
+ *sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingNB_r13 = LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__mpdcch_pdsch_HoppingNB_r13_nb2;
+
+
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13 = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13));
+ memset(sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13, 0, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13));
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13->present = LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13_PR_interval_FDD_r13;
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13->choice.interval_FDD_r13 = LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13__interval_FDD_r13_int1;
+
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13 = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13));
+ memset(sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13, 0, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13));
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13->present = LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13_PR_interval_FDD_r13;
+ sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13->choice.interval_FDD_r13 = LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13__interval_FDD_r13_int2;
+
+
+ sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingOffset_r13 = calloc(1, sizeof(long));
+ *sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingOffset_r13 = 1;
+
+ sib1_1320->nonCriticalExtension = NULL;
+#endif
+#endif
(*sib1)->si_WindowLength=LTE_SystemInformationBlockType1__si_WindowLength_ms20;
(*sib1)->systemInfoValueTag=0;
@@ -479,16 +892,24 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
return((enc_rval.encoded+7)/8);
}
+
+
+
+
uint8_t do_SIB23(uint8_t Mod_id,
- int CC_id
-#if defined(ENABLE_ITTI)
- , RrcConfigurationReq *configuration
+ int CC_id
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ , BOOLEAN_t brOption
#endif
- ) {
+#if defined(ENABLE_ITTI)
+ , RrcConfigurationReq *configuration
+#endif
+ ) {
struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib2_part,*sib3_part;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- //TTN - for D2D
+
+ int eMTC_configured=configuration->eMTC_configured;
struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib18_part, *sib19_part, *sib21_part;
LTE_SL_CommRxPoolList_r12_t *SL_CommRxPoolList; //for SIB18
struct LTE_SL_CommResourcePool_r12 *SL_CommResourcePool; //for SIB18
@@ -499,19 +920,37 @@ uint8_t do_SIB23(uint8_t Mod_id,
//struct SL_V2X_ConfigCommon_r14 *SL_V2X_ConfigCommon;
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib13_part;
+ struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib13_part=NULL;
LTE_MBSFN_SubframeConfigList_t *MBSFNSubframeConfigList;
LTE_MBSFN_AreaInfoList_r9_t *MBSFNArea_list;
struct LTE_MBSFN_AreaInfo_r9 *MBSFN_Area1, *MBSFN_Area2;
#endif
asn_enc_rval_t enc_rval;
- uint8_t *buffer = RC.rrc[Mod_id]->carrier[CC_id].SIB23;
- LTE_BCCH_DL_SCH_Message_t *bcch_message = &RC.rrc[Mod_id]->carrier[CC_id].systemInformation;
- LTE_SystemInformationBlockType2_t **sib2 = &RC.rrc[Mod_id]->carrier[CC_id].sib2;
- LTE_SystemInformationBlockType3_t **sib3 = &RC.rrc[Mod_id]->carrier[CC_id].sib3;
-#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- LTE_SystemInformationBlockType13_r9_t **sib13 = &RC.rrc[Mod_id]->carrier[CC_id].sib13;
- uint8_t MBMS_flag = RC.rrc[Mod_id]->carrier[CC_id].MBMS_flag;
+
+
+ LTE_BCCH_DL_SCH_Message_t *bcch_message = &RC.rrc[Mod_id]->carrier[CC_id].systemInformation;
+ uint8_t *buffer;
+ LTE_SystemInformationBlockType2_t **sib2;
+ RadioResourceConfig *rrconfig;
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ if (brOption) {
+ buffer = RC.rrc[Mod_id]->carrier[CC_id].SIB23_BR;
+ sib2 = &RC.rrc[Mod_id]->carrier[CC_id].sib2_BR;
+ rrconfig = &configuration->radioresourceconfig_BR[CC_id];
+ LOG_I(RRC,"Running SIB2/3 Encoding for eMTC\n");
+ }
+ else
+#endif
+ {
+ buffer = RC.rrc[Mod_id]->carrier[CC_id].SIB23;
+ sib2 = &RC.rrc[Mod_id]->carrier[CC_id].sib2;
+ rrconfig = &configuration->radioresourceconfig[CC_id];
+ }
+
+ LTE_SystemInformationBlockType3_t **sib3 = &RC.rrc[Mod_id]->carrier[CC_id].sib3;
+#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
+ LTE_SystemInformationBlockType13_r9_t **sib13 = &RC.rrc[Mod_id]->carrier[CC_id].sib13;
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
//TTN - for D2D
@@ -537,8 +976,9 @@ uint8_t do_SIB23(uint8_t Mod_id,
exit(-1);
}
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- LOG_I(RRC,"[eNB %d] Configuration SIB2/3, MBMS = %d\n", Mod_id, MBMS_flag);
+ LOG_I(RRC,"[eNB %d] Configuration SIB2/3, eMBMS = %d\n", Mod_id, configuration->eMBMS_configured);
#else
LOG_I(RRC,"[eNB %d] Configuration SIB2/3\n", Mod_id);
#endif
@@ -552,7 +992,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
*sib3 = &sib3_part->choice.sib3;
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- if (MBMS_flag > 0) {
+ if ((configuration->eMBMS_configured > 0) && (brOption==FALSE)) {
sib13_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
memset(sib13_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
sib13_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920;
@@ -560,20 +1000,24 @@ uint8_t do_SIB23(uint8_t Mod_id,
}
#endif
-#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ if (configuration->SL_configured > 0) {
//TTN - for D2D
- sib18_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
- sib19_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
- sib21_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
- memset(sib18_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
- memset(sib19_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
- memset(sib21_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
- sib18_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250;
- sib19_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250;
- sib21_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430;
- *sib18 = &sib18_part->choice.sib18_v1250;
- *sib19 = &sib19_part->choice.sib19_v1250;
- *sib21 = &sib21_part->choice.sib21_v1430;
+ sib18_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+ sib19_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+ sib21_part = CALLOC(1,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+ memset(sib18_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+ memset(sib19_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+ memset(sib21_part,0,sizeof(struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
+
+ sib18_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250;
+ sib19_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250;
+ sib21_part->present = LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430;
+
+ *sib18 = &sib18_part->choice.sib18_v1250;
+ *sib19 = &sib19_part->choice.sib19_v1250;
+ *sib21 = &sib21_part->choice.sib21_v1430;
+ }
#endif
// sib2
(*sib2)->ac_BarringInfo = NULL;
@@ -582,98 +1026,131 @@ uint8_t do_SIB23(uint8_t Mod_id,
(*sib2)->ext2 = NULL;
#endif
#if defined(ENABLE_ITTI)
- (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles = configuration->rach_numberOfRA_Preambles[CC_id];
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles = rrconfig->rach_numberOfRA_Preambles;
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL;
- if (configuration->rach_preamblesGroupAConfig[CC_id]) {
+ if (rrconfig->rach_preamblesGroupAConfig) {
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig
= CALLOC(1,sizeof(struct LTE_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig));
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA
- = configuration->rach_sizeOfRA_PreamblesGroupA[CC_id];
+ = rrconfig->rach_sizeOfRA_PreamblesGroupA;
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messageSizeGroupA
- = configuration->rach_messageSizeGroupA[CC_id];
+ = rrconfig->rach_messageSizeGroupA;
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messagePowerOffsetGroupB
- = configuration->rach_messagePowerOffsetGroupB[CC_id];
+ = rrconfig->rach_messagePowerOffsetGroupB;
}
- (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep = configuration->rach_powerRampingStep[CC_id];
- (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower =
- configuration->rach_preambleInitialReceivedTargetPower[CC_id];
- (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax = configuration->rach_preambleTransMax[CC_id];
- (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize = configuration->rach_raResponseWindowSize[CC_id];
- (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer =
- configuration->rach_macContentionResolutionTimer[CC_id];
- (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = configuration->rach_maxHARQ_Msg3Tx[CC_id];
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep = rrconfig->rach_powerRampingStep;
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower = rrconfig->rach_preambleInitialReceivedTargetPower;
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax = rrconfig->rach_preambleTransMax;
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize = rrconfig->rach_raResponseWindowSize;
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer = rrconfig->rach_macContentionResolutionTimer;
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = rrconfig->rach_maxHARQ_Msg3Tx;
+
+ if (eMTC_configured>0) {
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1 = calloc(1, sizeof(struct LTE_RACH_ConfigCommon__ext1));
+ memset((*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1, 0, sizeof(struct LTE_RACH_ConfigCommon__ext1));
+
+ if (rrconfig->preambleTransMax_CE_r13) {
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = calloc(1, sizeof(LTE_PreambleTransMax_t));
+ *(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = *rrconfig->preambleTransMax_CE_r13; // to be re-initialized when we find the enum
+ }
+ else (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = NULL;
+
+
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13 = calloc(1, sizeof(LTE_RACH_CE_LevelInfoList_r13_t));
+ memset((*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13, 0, sizeof(LTE_RACH_CE_LevelInfoList_r13_t));
+
+ LTE_RACH_CE_LevelInfo_r13_t *rach_ce_levelinfo_r13;
+ int num_rach_ce_level_info = configuration->rach_CE_LevelInfoList_r13_size[CC_id];
+ int index;
+ for (index = 0; index < num_rach_ce_level_info; ++index) {
+ rach_ce_levelinfo_r13 = calloc(1, sizeof(LTE_RACH_CE_LevelInfo_r13_t));
+ if (configuration->rach_CE_LevelInfoList_r13_size[CC_id]) {
+ rach_ce_levelinfo_r13->preambleMappingInfo_r13.firstPreamble_r13 = configuration->firstPreamble_r13[CC_id][index];
+ rach_ce_levelinfo_r13->preambleMappingInfo_r13.lastPreamble_r13 = configuration->lastPreamble_r13[CC_id][index];
+ rach_ce_levelinfo_r13->ra_ResponseWindowSize_r13 = configuration->ra_ResponseWindowSize_r13[CC_id][index];
+ rach_ce_levelinfo_r13->mac_ContentionResolutionTimer_r13 = configuration->mac_ContentionResolutionTimer_r13[CC_id][index];
+ rach_ce_levelinfo_r13->rar_HoppingConfig_r13 = configuration->rar_HoppingConfig_r13[CC_id][index];
+ }
+ else
+ {
+ rach_ce_levelinfo_r13->preambleMappingInfo_r13.firstPreamble_r13 = 0;
+ rach_ce_levelinfo_r13->preambleMappingInfo_r13.lastPreamble_r13 = 63;
+ rach_ce_levelinfo_r13->ra_ResponseWindowSize_r13 = LTE_RACH_CE_LevelInfo_r13__ra_ResponseWindowSize_r13_sf80;
+ rach_ce_levelinfo_r13->mac_ContentionResolutionTimer_r13 = LTE_RACH_CE_LevelInfo_r13__mac_ContentionResolutionTimer_r13_sf200;
+ rach_ce_levelinfo_r13->rar_HoppingConfig_r13 = LTE_RACH_CE_LevelInfo_r13__rar_HoppingConfig_r13_off;
+ }
+ ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13->list, rach_ce_levelinfo_r13);
+ }
+ }
+
+
// BCCH-Config
(*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff
- = configuration->bcch_modificationPeriodCoeff[CC_id];
+ = rrconfig->bcch_modificationPeriodCoeff;
// PCCH-Config
(*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle
- = configuration->pcch_defaultPagingCycle[CC_id];
+ = rrconfig->pcch_defaultPagingCycle;
(*sib2)->radioResourceConfigCommon.pcch_Config.nB
- = configuration->pcch_nB[CC_id];
- LOG_I(RRC,"[SIB2] With ITTI. Basic config of paging cycle DRX: radio frame cycle length %x, paging occasion number %x\n",
- (uint32_t)configuration->pcch_defaultPagingCycle[CC_id],
- (uint32_t)configuration->pcch_nB[CC_id]);
+ = rrconfig->pcch_nB;
// PRACH-Config
(*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex
- = configuration->prach_root[CC_id];
+ = rrconfig->prach_root;
(*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex
- = configuration->prach_config_index[CC_id];
+ = rrconfig->prach_config_index;
(*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag
- = configuration->prach_high_speed[CC_id];
+ = rrconfig->prach_high_speed;
(*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig
- = configuration->prach_zero_correlation[CC_id];
+ = rrconfig->prach_zero_correlation;
(*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset
- = configuration->prach_freq_offset[CC_id];
+ = rrconfig->prach_freq_offset;
// PDSCH-Config
(*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower
- = configuration->pdsch_referenceSignalPower[CC_id];
+ = rrconfig->pdsch_referenceSignalPower;
(*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b
- = configuration->pdsch_p_b[CC_id];
+ = rrconfig->pdsch_p_b;
// PUSCH-Config
(*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB
- = configuration->pusch_n_SB[CC_id];
+ = rrconfig->pusch_n_SB;
(*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode
- = configuration->pusch_hoppingMode[CC_id];
+ = rrconfig->pusch_hoppingMode;
(*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset
- = configuration->pusch_hoppingOffset[CC_id];
+ = rrconfig->pusch_hoppingOffset;
(*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM
- = configuration->pusch_enable64QAM[CC_id];
+ = rrconfig->pusch_enable64QAM;
(*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled
- = configuration->pusch_groupHoppingEnabled[CC_id];
+ = rrconfig->pusch_groupHoppingEnabled;
(*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH
- = configuration->pusch_groupAssignment[CC_id];
+ = rrconfig->pusch_groupAssignment;
(*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled
- = configuration->pusch_sequenceHoppingEnabled[CC_id];
+ = rrconfig->pusch_sequenceHoppingEnabled;
(*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift
- = configuration->pusch_nDMRS1[CC_id];
+ = rrconfig->pusch_nDMRS1;
// PUCCH-Config
(*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift
- = configuration->pucch_delta_shift[CC_id];
+ = rrconfig->pucch_delta_shift;
(*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI
- = configuration->pucch_nRB_CQI[CC_id];
+ = rrconfig->pucch_nRB_CQI;
(*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN
- = configuration->pucch_nCS_AN[CC_id];
- //#if (LTE_RRC_VERSION < MAKE_VERSION(10, 0, 0))
+ = rrconfig->pucch_nCS_AN;
(*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN
- = configuration->pucch_n1_AN[CC_id];
- //#endif
+ = rrconfig->pucch_n1_AN;
// SRS Config
- if (configuration->srs_enable[CC_id]==1) {
+ if (rrconfig->srs_enable == 1) {
(*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present
= LTE_SoundingRS_UL_ConfigCommon_PR_setup;
(*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig
- = configuration->srs_BandwidthConfig[CC_id];
+ = rrconfig->srs_BandwidthConfig;
(*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig
- = configuration->srs_SubframeConfig[CC_id];
+ = rrconfig->srs_SubframeConfig;
(*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission
- = configuration->srs_ackNackST[CC_id];
+ = rrconfig->srs_ackNackST;
- if (configuration->srs_MaxUpPts[CC_id]) {
+ if (rrconfig->srs_MaxUpPts) {
(*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts
- = CALLOC(1,sizeof(long));
+ = CALLOC(1,sizeof(long));
*(*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts=1;
} else {
(*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts = NULL;
@@ -688,38 +1165,292 @@ uint8_t do_SIB23(uint8_t Mod_id,
// uplinkPowerControlCommon
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH
- = configuration->pusch_p0_Nominal[CC_id];
+ = rrconfig->pusch_p0_Nominal;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH
- = configuration->pucch_p0_Nominal[CC_id];
+ = rrconfig->pucch_p0_Nominal;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.alpha
- = configuration->pusch_alpha[CC_id];
+ = rrconfig->pusch_alpha;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1
- = configuration->pucch_deltaF_Format1[CC_id];
+ = rrconfig->pucch_deltaF_Format1;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b
- = configuration->pucch_deltaF_Format1b[CC_id];
+ = rrconfig->pucch_deltaF_Format1b;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2
- = configuration->pucch_deltaF_Format2[CC_id];
+ = rrconfig->pucch_deltaF_Format2;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a
- = configuration->pucch_deltaF_Format2a[CC_id];
+ = rrconfig->pucch_deltaF_Format2a;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b
- = configuration->pucch_deltaF_Format2b[CC_id];
+ = rrconfig->pucch_deltaF_Format2b;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3
- = configuration->msg3_delta_Preamble[CC_id];
+ = rrconfig->msg3_delta_Preamble;
(*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength
- = configuration->ul_CyclicPrefixLength[CC_id];
+ = rrconfig->ul_CyclicPrefixLength;
+
+ if (eMTC_configured>0) {
+ (*sib2)->radioResourceConfigCommon.ext4 = calloc(1, sizeof(struct LTE_RadioResourceConfigCommonSIB__ext4));
+ memset((*sib2)->radioResourceConfigCommon.ext4, 0, sizeof(struct LTE_RadioResourceConfigCommonSIB__ext4));
+ (*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310 = NULL; //calloc(1, sizeof(BCCH_Config_v1310_t));
+ //memset((*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310, 0, sizeof(BCCH_Config_v1310_t));
+ //(*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310->modificationPeriodCoeff_v1310 = BCCH_Config_v1310__modificationPeriodCoeff_v1310_n64;
+
+ if (configuration->pcch_config_v1310) {
+ (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310 = CALLOC(1, sizeof(LTE_PCCH_Config_v1310_t));
+ (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->paging_narrowBands_r13 = configuration->paging_narrowbands_r13[CC_id];
+ (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->mpdcch_NumRepetition_Paging_r13 = configuration->mpdcch_numrepetition_paging_r13[CC_id];
+ if (configuration->nb_v1310[CC_id])
+ {
+ (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->nB_v1310 = CALLOC(1, sizeof(long));
+ *(*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->nB_v1310 = *configuration->nb_v1310[CC_id];
+ }
+ else
+ {
+ (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->nB_v1310 = NULL;
+ }
+ }
+ else (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310 = NULL;
+
+
+
+
+ if (configuration->sib2_freq_hoppingParameters_r13_exists[CC_id]) {
+
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13 = CALLOC(1, sizeof(LTE_FreqHoppingParameters_r13_t));
+
+ if (configuration->sib2_interval_ULHoppingConfigCommonModeA_r13[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeA_r13
+ = CALLOC(1, sizeof(struct LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13));
+ if (*configuration->sib2_interval_ULHoppingConfigCommonModeA_r13[CC_id] == 0) {
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeA_r13->present
+ = LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_FDD_r13;
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeA_r13->choice.interval_FDD_r13
+ = configuration->sib2_interval_ULHoppingConfigCommonModeA_r13_val[CC_id];
+
+ }
+ else
+ {
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeA_r13->present
+ = LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeA_r13_PR_interval_TDD_r13;
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeA_r13->choice.interval_TDD_r13
+ = configuration->sib2_interval_ULHoppingConfigCommonModeA_r13_val[CC_id];
+
+ }
+ }
+ else (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeA_r13 = NULL;
+
+
+ if (configuration->sib2_interval_ULHoppingConfigCommonModeB_r13[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeB_r13
+ = CALLOC(1, sizeof(struct LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13));
+ if (*configuration->sib2_interval_ULHoppingConfigCommonModeB_r13[CC_id] == 0) {
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeB_r13->present
+ = LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_FDD_r13;
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeB_r13->choice.interval_FDD_r13
+ = configuration->sib2_interval_ULHoppingConfigCommonModeB_r13_val[CC_id];
+ }
+ else {
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeB_r13->present
+ = LTE_FreqHoppingParameters_r13__interval_ULHoppingConfigCommonModeB_r13_PR_interval_TDD_r13;
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeB_r13->choice.interval_TDD_r13
+ = configuration->sib2_interval_ULHoppingConfigCommonModeB_r13_val[CC_id];
+ }
+ }
+ else (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13->interval_ULHoppingConfigCommonModeB_r13 = NULL;
+ }
+ else (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13 = NULL;
+ // pdsch_ConfigCommon_v1310
+ (*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310 = CALLOC(1,sizeof(LTE_PDSCH_ConfigCommon_v1310_t));
+
+ if (configuration->pdsch_maxNumRepetitionCEmodeA_r13[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310->pdsch_maxNumRepetitionCEmodeA_r13 = CALLOC(1, sizeof(long));
+ *(*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310->pdsch_maxNumRepetitionCEmodeA_r13 = *configuration->pdsch_maxNumRepetitionCEmodeA_r13[CC_id];
+ } else {
+ (*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310->pdsch_maxNumRepetitionCEmodeA_r13 = NULL;
+ }
+
+ if (configuration->pdsch_maxNumRepetitionCEmodeB_r13[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310->pdsch_maxNumRepetitionCEmodeB_r13 = CALLOC(1, sizeof(long)); // check if they're really long
+ *(*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310->pdsch_maxNumRepetitionCEmodeB_r13 = *configuration->pdsch_maxNumRepetitionCEmodeB_r13[CC_id];
+ } else {
+ (*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310->pdsch_maxNumRepetitionCEmodeB_r13 = NULL;
+ }
+
+ // *(*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310->pdsch_maxNumRepetitionCEmodeA_r13 = 0;
+ // (*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310->pdsch_maxNumRepetitionCEmodeB_r13 = NULL;
+
+ // pusch_ConfigCommon_v1310
+ (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310 = calloc(1,sizeof(LTE_PUSCH_ConfigCommon_v1310_t));
+
+ if (configuration->pusch_maxNumRepetitionCEmodeA_r13[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_maxNumRepetitionCEmodeA_r13 = calloc(1,sizeof(long));
+ *(*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_maxNumRepetitionCEmodeA_r13 = *configuration->pusch_maxNumRepetitionCEmodeA_r13[CC_id];
+ } else {
+ (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_maxNumRepetitionCEmodeA_r13 = NULL;
+ }
+
+ if (configuration->pusch_maxNumRepetitionCEmodeB_r13[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_maxNumRepetitionCEmodeB_r13 = CALLOC(1, sizeof(long));
+ *(*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_maxNumRepetitionCEmodeB_r13 = *configuration->pusch_maxNumRepetitionCEmodeB_r13[CC_id];
+ } else {
+ (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_maxNumRepetitionCEmodeB_r13 = NULL;
+ }
+
+ if (configuration->pusch_HoppingOffset_v1310[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_HoppingOffset_v1310 = CALLOC(1, sizeof(long));
+ *(*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_HoppingOffset_v1310 = *configuration->pusch_HoppingOffset_v1310[CC_id];
+ } else {
+ (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_HoppingOffset_v1310 = NULL;
+ }
+
+ // *(*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_maxNumRepetitionCEmodeA_r13 = 0;
+ // (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_maxNumRepetitionCEmodeB_r13 = NULL;
+ // (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310->pusch_HoppingOffset_v1310 = NULL;
+
+
+ if (rrconfig->prach_ConfigCommon_v1310) {
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310 = calloc(1, sizeof(LTE_PRACH_ConfigSIB_v1310_t));
+ memset((*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310, 0, sizeof(LTE_PRACH_ConfigSIB_v1310_t));
+
+ LTE_RSRP_Range_t *rsrp_range;
+ int num_rsrp_range = configuration->rsrp_range_list_size[CC_id];
+ int rsrp_index;
+ for (rsrp_index = 0; rsrp_index < num_rsrp_range; ++rsrp_index) {
+ rsrp_range = CALLOC(1, sizeof(LTE_RSRP_Range_t));
+ if (configuration->rsrp_range_list_size[CC_id]) *rsrp_range = configuration->rsrp_range[CC_id][rsrp_index];
+ else *rsrp_range = 60;
+ ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->rsrp_ThresholdsPrachInfoList_r13.list, rsrp_range);
+ }
+
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13 = NULL;
+
+ if (rrconfig->mpdcch_startSF_CSS_RA_r13) {
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13 = calloc(1, sizeof(struct LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13));
+ memset((*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13, 0, sizeof(struct LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13));
+
+ if (*rrconfig->mpdcch_startSF_CSS_RA_r13) {
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13->present = LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13_PR_fdd_r13;
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13->choice.fdd_r13 = rrconfig->mpdcch_startSF_CSS_RA_r13_val;
+ }
+ else {
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13->present = LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13_PR_tdd_r13;
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13->choice.tdd_r13 = rrconfig->mpdcch_startSF_CSS_RA_r13_val;
+ }
+ }
+
+ if (rrconfig->prach_HoppingOffset_r13) {
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->prach_HoppingOffset_r13 = calloc(1, sizeof(long));
+ *(*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->prach_HoppingOffset_r13 = *rrconfig->prach_HoppingOffset_r13;
+ }
+ else (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->prach_HoppingOffset_r13 = NULL;
+
+ LTE_PRACH_ParametersCE_r13_t *prach_parametersce_r13;
+
+ int num_prach_parameters_ce = configuration->prach_parameters_list_size[CC_id];
+ int prach_parameters_index;
+ AssertFatal(num_prach_parameters_ce > 0, "PRACH CE parameter list is empty\n");
+
+ for (prach_parameters_index = 0; prach_parameters_index < num_prach_parameters_ce; ++prach_parameters_index) {
+ prach_parametersce_r13 = CALLOC(1, sizeof(LTE_PRACH_ParametersCE_r13_t));
+ prach_parametersce_r13->prach_ConfigIndex_r13 = configuration->prach_config_index[CC_id][prach_parameters_index];
+ prach_parametersce_r13->prach_FreqOffset_r13 = configuration->prach_freq_offset[CC_id][prach_parameters_index];
+
+ AssertFatal(configuration->prach_StartingSubframe_r13[CC_id][prach_parameters_index]!=NULL,
+ "configuration->prach_StartingSubframe_r13[%d][%d] is null",
+ (int)CC_id,(int)prach_parameters_index);
+ if (configuration->prach_StartingSubframe_r13[CC_id][prach_parameters_index]){
+ prach_parametersce_r13->prach_StartingSubframe_r13 = CALLOC(1, sizeof(long));
+ *prach_parametersce_r13->prach_StartingSubframe_r13 = *configuration->prach_StartingSubframe_r13[CC_id][prach_parameters_index];
+ }
+ else prach_parametersce_r13->prach_StartingSubframe_r13 = NULL;
+
+
+ if (configuration->maxNumPreambleAttemptCE_r13[CC_id][prach_parameters_index]) {
+ prach_parametersce_r13->maxNumPreambleAttemptCE_r13 = CALLOC(1, sizeof(long));
+ *prach_parametersce_r13->maxNumPreambleAttemptCE_r13 = *configuration->maxNumPreambleAttemptCE_r13[CC_id][prach_parameters_index];
+ }
+ else prach_parametersce_r13->maxNumPreambleAttemptCE_r13 = NULL;
+
+ prach_parametersce_r13->numRepetitionPerPreambleAttempt_r13 = configuration->numRepetitionPerPreambleAttempt_r13[CC_id][prach_parameters_index];
+ prach_parametersce_r13->mpdcch_NumRepetition_RA_r13 = configuration->mpdcch_NumRepetition_RA_r13[CC_id][prach_parameters_index];
+ prach_parametersce_r13->prach_HoppingConfig_r13 = configuration->prach_HoppingConfig_r13[CC_id][prach_parameters_index];
+
+ long *maxavailablenarrowband;
+ int num_narrow_bands = configuration->max_available_narrow_band_size[CC_id][prach_parameters_index];
+ int narrow_band_index;
+ for (narrow_band_index = 0; narrow_band_index < num_narrow_bands; narrow_band_index++)
+ {
+ maxavailablenarrowband = CALLOC(1, sizeof(long));
+ *maxavailablenarrowband = configuration->max_available_narrow_band[CC_id][prach_parameters_index][narrow_band_index];
+ ASN_SEQUENCE_ADD(&prach_parametersce_r13->mpdcch_NarrowbandsToMonitor_r13.list, maxavailablenarrowband);
+ }
+
+
+ prach_parametersce_r13->mpdcch_NumRepetition_RA_r13 = LTE_PRACH_ParametersCE_r13__mpdcch_NumRepetition_RA_r13_r1;
+ prach_parametersce_r13->prach_HoppingConfig_r13 = LTE_PRACH_ParametersCE_r13__prach_HoppingConfig_r13_off;
+
+
+ ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->prach_ParametersListCE_r13.list, prach_parametersce_r13);
+ }
+ }
+ else (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310 = NULL;
+
+
+
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310 = calloc(1, sizeof(LTE_PUCCH_ConfigCommon_v1310_t));
+ memset((*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310, 0, sizeof(LTE_PUCCH_ConfigCommon_v1310_t));
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->n1PUCCH_AN_InfoList_r13 = calloc(1, sizeof(LTE_N1PUCCH_AN_InfoList_r13_t));
+
+ int num_pucch_info_list = configuration->pucch_info_value_size[CC_id];
+ int pucch_index;
+ long *pucch_info_value;
+ for (pucch_index = 0; pucch_index < num_pucch_info_list; ++pucch_index) {
+ pucch_info_value = CALLOC(1, sizeof(long));
+ if (configuration->pucch_info_value_size[CC_id]) *pucch_info_value = configuration->pucch_info_value[CC_id][pucch_index];
+ else *pucch_info_value = 0;
+
+ ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->n1PUCCH_AN_InfoList_r13->list, pucch_info_value);
+ }
+
+ if (configuration->pucch_NumRepetitionCE_Msg4_Level0_r13[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level0_r13 = CALLOC(1, sizeof(long));
+ *(*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level0_r13 = *configuration->pucch_NumRepetitionCE_Msg4_Level0_r13[CC_id];
+ }
+ else (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level0_r13 = NULL;
+
+ if (configuration->pucch_NumRepetitionCE_Msg4_Level1_r13[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level1_r13 = CALLOC(1, sizeof(long));
+ *(*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level1_r13 = *configuration->pucch_NumRepetitionCE_Msg4_Level1_r13[CC_id];
+ }
+ else (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level1_r13 = NULL;
+
+
+ if (configuration->pucch_NumRepetitionCE_Msg4_Level2_r13[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level2_r13 = CALLOC(1, sizeof(long));
+ *(*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level2_r13 = *configuration->pucch_NumRepetitionCE_Msg4_Level2_r13[CC_id];
+ }
+ else (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level2_r13 = NULL;
+
+ if (configuration->pucch_NumRepetitionCE_Msg4_Level3_r13[CC_id]) {
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level3_r13 = CALLOC(1, sizeof(long));
+ *(*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level3_r13 = *configuration->pucch_NumRepetitionCE_Msg4_Level3_r13[CC_id];
+ }
+ else (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level3_r13 = NULL;
+
+ } // eMTC_configured>0
+ //-----------------------------------------------------------------------------------------------------------------------------------------
+
+
// UE Timers and Constants
(*sib2)->ue_TimersAndConstants.t300
- = configuration->ue_TimersAndConstants_t300[CC_id];
+ = rrconfig->ue_TimersAndConstants_t300;
(*sib2)->ue_TimersAndConstants.t301
- = configuration->ue_TimersAndConstants_t301[CC_id];
+ = rrconfig->ue_TimersAndConstants_t301;
(*sib2)->ue_TimersAndConstants.t310
- = configuration->ue_TimersAndConstants_t310[CC_id];
+ = rrconfig->ue_TimersAndConstants_t310;
(*sib2)->ue_TimersAndConstants.n310
- = configuration->ue_TimersAndConstants_n310[CC_id];
+ = rrconfig->ue_TimersAndConstants_n310;
(*sib2)->ue_TimersAndConstants.t311
- = configuration->ue_TimersAndConstants_t311[CC_id];
+ = rrconfig->ue_TimersAndConstants_t311;
(*sib2)->ue_TimersAndConstants.n311
- = configuration->ue_TimersAndConstants_n311[CC_id];
+ = rrconfig->ue_TimersAndConstants_n311;
#else
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles=LTE_RACH_ConfigCommon__preambleInfo__numberOfRA_Preambles_n64;
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL;
@@ -731,13 +1462,32 @@ uint8_t do_SIB23(uint8_t Mod_id,
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer=
LTE_RACH_ConfigCommon__ra_SupervisionInfo__mac_ContentionResolutionTimer_sf48;
(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = 4;
+
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1 = calloc(1, sizeof(struct LTE_RACH_ConfigCommon__ext1));
+ memset((*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1, 0, sizeof(struct LTE_RACH_ConfigCommon__ext1));
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = calloc(1, sizeof(LTE_PreambleTransMax_t));
+ *(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = LTE_PreambleTransMax_n5; // to be re-initialized when we find the enum
+ (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13 = calloc(1, sizeof(LTE_RACH_CE_LevelInfoList_r13_t));
+ memset((*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13, 0, sizeof(LTE_RACH_CE_LevelInfoList_r13_t));
+
+ LTE_RACH_CE_LevelInfo_r13_t *rach_ce_levelinfo_r13 = calloc(1, sizeof(LTE_RACH_CE_LevelInfo_r13_t));
+ memset(rach_ce_levelinfo_r13, 0, sizeof(LTE_RACH_CE_LevelInfo_r13_t));
+ rach_ce_levelinfo_r13->preambleMappingInfo_r13.firstPreamble_r13 = 0;
+ rach_ce_levelinfo_r13->preambleMappingInfo_r13.lastPreamble_r13 = 63;
+ rach_ce_levelinfo_r13->ra_ResponseWindowSize_r13 = LTE_RACH_CE_LevelInfo_r13__ra_ResponseWindowSize_r13_sf80;
+ rach_ce_levelinfo_r13->mac_ContentionResolutionTimer_r13 = LTE_RACH_CE_LevelInfo_r13__mac_ContentionResolutionTimer_r13_sf200;
+ rach_ce_levelinfo_r13->rar_HoppingConfig_r13 = LTE_RACH_CE_LevelInfo_r13__rar_HoppingConfig_r13_off;
+
+ ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13->list, rach_ce_levelinfo_r13);
+
// BCCH-Config
- (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff=BCCH_Config__modificationPeriodCoeff_n2;
+ (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff=LTE_BCCH_Config__modificationPeriodCoeff_n2;
+
// PCCH-Config
(*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle = LTE_PCCH_Config__defaultPagingCycle_rf128;
(*sib2)->radioResourceConfigCommon.pcch_Config.nB=LTE_PCCH_Config__nB_oneT;
// PRACH-Config
- (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex=Mod_id;//0;//384;
+ (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex = Mod_id;//0;//384;
(*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex = 0;//3;
(*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag = 0;
(*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig = 1;//12;
@@ -772,12 +1522,65 @@ uint8_t do_SIB23(uint8_t Mod_id,
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0;
(*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 = 6;
(*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength=UL_CyclicPrefixLength_len1;
+
+ (*sib2)->radioResourceConfigCommon.ext4 = calloc(1, sizeof(struct LTE_RadioResourceConfigCommonSIB__ext4));
+ memset((*sib2)->radioResourceConfigCommon.ext4, 0, sizeof(struct LTE_RadioResourceConfigCommonSIB__ext4));
+ (*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310 = calloc(1, sizeof(LTE_BCCH_Config_v1310_t));
+ memset((*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310, 0, sizeof(LTE_BCCH_Config_v1310_t));
+ (*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310->modificationPeriodCoeff_v1310 = LTE_BCCH_Config_v1310__modificationPeriodCoeff_v1310_n64;
+ (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310 = NULL;
+ (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13 = NULL;
+ (*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310 = NULL;
+ (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310 = NULL;
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310 = calloc(1, sizeof(LTE_PRACH_ConfigSIB_v1310_t));
+ memset((*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310, 0, sizeof(PRACH_ConfigSIB_v1310_t));
+
+ LTE_RSRP_Range_t rsrp_range = 60;
+ ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->rsrp_ThresholdsPrachInfoList_r13.list, &rsrp_range);
+
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13 = calloc(1, sizeof(struct LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13));
+ memset((*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13, 0, sizeof(struct LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13));
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13->present = LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13_PR_fdd_r13;
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13->choice.fdd_r13 = LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13__fdd_r13_v5;
+ (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->prach_HoppingOffset_r13 = NULL;
+
+ LTE_PRACH_ParametersCE_r13_t *prach_parametersce_r13 = calloc(1, sizeof(LTE_PRACH_ParametersCE_r13_t));
+ memset(prach_parametersce_r13, 0, sizeof(LTE_PRACH_ParametersCE_r13_t));
+
+ prach_parametersce_r13->prach_ConfigIndex_r13 = 3;
+ prach_parametersce_r13->prach_FreqOffset_r13 = 1;
+ prach_parametersce_r13->prach_StartingSubframe_r13 = NULL;
+ prach_parametersce_r13->maxNumPreambleAttemptCE_r13 = calloc(1, sizeof(long));
+ *prach_parametersce_r13->maxNumPreambleAttemptCE_r13 = LTE_PRACH_ParametersCE_r13__maxNumPreambleAttemptCE_r13_n3;
+ prach_parametersce_r13->numRepetitionPerPreambleAttempt_r13 = LTE_PRACH_ParametersCE_r13__numRepetitionPerPreambleAttempt_r13_n1;
+
+ long maxavailablenarrowband = 2;
+ ASN_SEQUENCE_ADD(&prach_parametersce_r13->mpdcch_NarrowbandsToMonitor_r13.list, &maxavailablenarrowband);
+
+ prach_parametersce_r13->mpdcch_NumRepetition_RA_r13 = LTE_PRACH_ParametersCE_r13__mpdcch_NumRepetition_RA_r13_r1;
+ prach_parametersce_r13->prach_HoppingConfig_r13 = LTE_PRACH_ParametersCE_r13__prach_HoppingConfig_r13_off;
+ ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->prach_ParametersListCE_r13.list, prach_parametersce_r13);
+
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310 = calloc(1, sizeof(LTE_PUCCH_ConfigCommon_v1310_t));
+ memset((*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310, 0, sizeof(LTE_PUCCH_ConfigCommon_v1310_t));
+
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->n1PUCCH_AN_InfoList_r13 = calloc(1, sizeof(LTE_N1PUCCH_AN_InfoList_r13_t));
+ long pucch_info_value1 = 0;
+ long pucch_info_value2 = 2;
+ ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->n1PUCCH_AN_InfoList_r13->list, &pucch_info_value1);
+ ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->n1PUCCH_AN_InfoList_r13->list, &pucch_info_value2);
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level0_r13 = NULL;
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level1_r13 = NULL;
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level2_r13 = NULL;
+ (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level3_r13 = NULL;
+
(*sib2)->ue_TimersAndConstants.t300=UE_TimersAndConstants__t300_ms1000;
(*sib2)->ue_TimersAndConstants.t301=UE_TimersAndConstants__t301_ms1000;
(*sib2)->ue_TimersAndConstants.t310=UE_TimersAndConstants__t310_ms1000;
(*sib2)->ue_TimersAndConstants.n310=UE_TimersAndConstants__n310_n20;
(*sib2)->ue_TimersAndConstants.t311=UE_TimersAndConstants__t311_ms10000;
(*sib2)->ue_TimersAndConstants.n311=UE_TimersAndConstants__n311_n1;
+
#endif
(*sib2)->freqInfo.additionalSpectrumEmission = 1;
(*sib2)->freqInfo.ul_CarrierFreq = NULL;
@@ -785,7 +1588,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
// (*sib2)->mbsfn_SubframeConfigList = NULL;
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- if (MBMS_flag > 0) {
+ if (configuration->eMBMS_configured > 0) {
LOG_I(RRC,"Adding MBSFN subframe Configuration 1 to SIB2\n");
LTE_MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig1;
(*sib2)->mbsfn_SubframeConfigList = CALLOC(1,sizeof(struct LTE_MBSFN_SubframeConfigList));
@@ -799,9 +1602,11 @@ uint8_t do_SIB23(uint8_t Mod_id,
sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1;
sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2;
sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2;
+
ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig1);
- if (MBMS_flag == 4 ) {
+
+ if (configuration->eMBMS_configured == 4 ) {
LOG_I(RRC,"Adding MBSFN subframe Configuration 2 to SIB2\n");
LTE_MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig2;
sib2_mbsfn_SubframeConfig2= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig2));
@@ -813,6 +1618,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.size= 1;
sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.bits_unused= 2;
sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2;
+
ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig2);
}
}
@@ -830,6 +1636,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
(*sib3)->cellReselectionServingFreqInfo.s_NonIntraSearch=NULL;
(*sib3)->cellReselectionServingFreqInfo.threshServingLow=31;
(*sib3)->cellReselectionServingFreqInfo.cellReselectionPriority=7;
+
(*sib3)->intraFreqCellReselectionInfo.q_RxLevMin = -70;
(*sib3)->intraFreqCellReselectionInfo.p_Max = NULL;
(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch));
@@ -843,11 +1650,24 @@ uint8_t do_SIB23(uint8_t Mod_id,
(*sib3)->intraFreqCellReselectionInfo.neighCellConfig.bits_unused = 6;
(*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA = 1;
(*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF = (struct LTE_SpeedStateScaleFactors *)NULL;
+
+ (*sib3)->ext1 = CALLOC(1, sizeof(struct LTE_SystemInformationBlockType3__ext1));
+ (*sib3)->ext1->s_IntraSearch_v920 = CALLOC(1, sizeof(struct LTE_SystemInformationBlockType3__ext1__s_IntraSearch_v920));
+ (*sib3)->ext1->s_IntraSearch_v920->s_IntraSearchP_r9 = 31; // FIXME
+ (*sib3)->ext1->s_IntraSearch_v920->s_IntraSearchQ_r9 = 4;
+
+ (*sib3)->ext4 = CALLOC(1, sizeof(struct LTE_SystemInformationBlockType3__ext4));
+ (*sib3)->ext4->cellSelectionInfoCE_r13 = CALLOC(1, sizeof(LTE_CellSelectionInfoCE_r13_t));
+ (*sib3)->ext4->cellSelectionInfoCE_r13->q_RxLevMinCE_r13 = -70;
+ (*sib3)->ext4->cellSelectionInfoCE_r13->q_QualMinRSRQ_CE_r13 = NULL;
+ (*sib3)->ext4->t_ReselectionEUTRA_CE_r13 = CALLOC(1, sizeof(LTE_T_ReselectionEUTRA_CE_r13_t));
+ *(*sib3)->ext4->t_ReselectionEUTRA_CE_r13 = 2;
+
// SIB13
// fill in all elements of SIB13 if present
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- if (MBMS_flag > 0 ) {
+ if (configuration->eMBMS_configured > 0 ) {
// Notification for mcch change
(*sib13)->notificationConfig_r9.notificationRepetitionCoeff_r9= LTE_MBMS_NotificationConfig_r9__notificationRepetitionCoeff_r9_n2;
(*sib13)->notificationConfig_r9.notificationOffset_r9= 0;
@@ -872,7 +1692,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area1);
//MBSFN Area 2: currently only activated for eMBMS relaying
- if (MBMS_flag == 4 ) {
+ if (configuration->eMBMS_configured == 4 ) {
MBSFN_Area2= CALLOC(1, sizeof(*MBSFN_Area2));
MBSFN_Area2->mbsfn_AreaId_r9= 2;
MBSFN_Area2->non_MBSFNregionLength= LTE_MBSFN_AreaInfo_r9__non_MBSFNregionLength_s2;
@@ -894,280 +1714,282 @@ uint8_t do_SIB23(uint8_t Mod_id,
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- //TTN - for D2D
- // SIB18
- //commRxPool_r12
- (*sib18)->commConfig_r12 = CALLOC (1, sizeof(*(*sib18)->commConfig_r12));
- SL_CommRxPoolList= &(*sib18)->commConfig_r12->commRxPool_r12;
- memset(SL_CommRxPoolList,0,sizeof(*SL_CommRxPoolList));
- SL_CommResourcePool = CALLOC(1, sizeof(*SL_CommResourcePool));
- memset(SL_CommResourcePool,0,sizeof(*SL_CommResourcePool));
- SL_CommResourcePool->sc_CP_Len_r12 = configuration->rxPool_sc_CP_Len[CC_id];
- SL_CommResourcePool->sc_Period_r12 = configuration->rxPool_sc_Period[CC_id];
- SL_CommResourcePool->data_CP_Len_r12 = configuration->rxPool_data_CP_Len[CC_id];
- //sc_TF_ResourceConfig_r12
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.prb_Num_r12 = configuration->rxPool_ResourceConfig_prb_Num[CC_id];
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.prb_Start_r12 = configuration->rxPool_ResourceConfig_prb_Start[CC_id];
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.prb_End_r12 = configuration->rxPool_ResourceConfig_prb_End[CC_id];
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present = configuration->rxPool_ResourceConfig_offsetIndicator_present[CC_id];
-
- if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_small_r12 ) {
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->rxPool_ResourceConfig_offsetIndicator_choice[CC_id] ;
- } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_large_r12 ) {
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->rxPool_ResourceConfig_offsetIndicator_choice[CC_id] ;
- }
-
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present = configuration->rxPool_ResourceConfig_subframeBitmap_present[CC_id];
-
- if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs4_r12) {
- //for BS4
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs8_r12) {
- //for BS8
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs12_r12) {
- //for BS12
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs16_r12) {
- //for BS16
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs30_r12) {
- //for BS30
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs40_r12) {
- //for BS40
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs42_r12) {
- //for BS42
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- }
-
- //dataHoppingConfig_r12
- SL_CommResourcePool->dataHoppingConfig_r12.hoppingParameter_r12 = 0;
- SL_CommResourcePool->dataHoppingConfig_r12.numSubbands_r12 = LTE_SL_HoppingConfigComm_r12__numSubbands_r12_ns1;
- SL_CommResourcePool->dataHoppingConfig_r12.rb_Offset_r12 = 0;
- //ue_SelectedResourceConfig_r12
- SL_CommResourcePool->ue_SelectedResourceConfig_r12 = CALLOC (1, sizeof (*SL_CommResourcePool->ue_SelectedResourceConfig_r12));
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_Num_r12 = 20;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_Start_r12 = 5;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_End_r12 = 44;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.present = LTE_SL_OffsetIndicator_r12_PR_small_r12;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0 ;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = LTE_SubframeBitmapSL_r12_PR_bs40_r12;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = 5;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = CALLOC(1,5);
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = 0;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[0] = 0xF0;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[1] = 0xFF;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[2] = 0xFF;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[3] = 0xFF;
- SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[4] = 0xFF;
- //SL_CommResourcePool->ue_SelectedResourceConfig_r12->trpt_Subset_r12 = CALLOC (1, sizeof(*SL_CommResourcePool->ue_SelectedResourceConfig_r12->trpt_Subset_r12));
- //rxParametersNCell_r12
- SL_CommResourcePool->rxParametersNCell_r12 = CALLOC (1, sizeof (*SL_CommResourcePool->rxParametersNCell_r12));
- SL_CommResourcePool->rxParametersNCell_r12->tdd_Config_r12 = CALLOC (1, sizeof (*SL_CommResourcePool->rxParametersNCell_r12->tdd_Config_r12));
- SL_CommResourcePool->rxParametersNCell_r12->tdd_Config_r12->subframeAssignment = 0 ;
- SL_CommResourcePool->rxParametersNCell_r12->tdd_Config_r12->specialSubframePatterns = 0;
- SL_CommResourcePool->rxParametersNCell_r12->syncConfigIndex_r12 = 0;
- //txParameters_r12
- SL_CommResourcePool->txParameters_r12 = CALLOC (1, sizeof (*SL_CommResourcePool->txParameters_r12));
- SL_CommResourcePool->txParameters_r12->sc_TxParameters_r12.alpha_r12 = LTE_Alpha_r12_al0;
- SL_CommResourcePool->txParameters_r12->sc_TxParameters_r12.p0_r12 = 0;
- SL_CommResourcePool->ext1 = NULL ;
- //end SL_CommResourcePool
- //add SL_CommResourcePool to SL_CommRxPoolList
- ASN_SEQUENCE_ADD(&SL_CommRxPoolList->list,SL_CommResourcePool);
- //end commRxPool_r12
- //TODO: commTxPoolNormalCommon_r12, similar to commRxPool_r12
- //TODO: commTxPoolExceptional_r12
- //TODO: commSyncConfig_r12
- // may add commTxResourceUC-ReqAllowed with Ext1
- (*sib18)->ext1 = NULL;
- (*sib18)->lateNonCriticalExtension = NULL;
- // end SIB18
- // SIB19
- // fill in all elements of SIB19 if present
- //discConfig_r12
- (*sib19)->discConfig_r12 = CALLOC (1, sizeof(*(*sib19)->discConfig_r12));
- SL_DiscRxPoolList = &(*sib19)->discConfig_r12->discRxPool_r12;
- memset(SL_DiscRxPoolList,0,sizeof(*SL_DiscRxPoolList));
- //fill SL_DiscResourcePool
- SL_DiscResourcePool = CALLOC(1, sizeof(*SL_DiscResourcePool));
- SL_DiscResourcePool->cp_Len_r12 = configuration->discRxPool_cp_Len[CC_id];
- SL_DiscResourcePool->discPeriod_r12 = configuration->discRxPool_discPeriod[CC_id];
- //sc_TF_ResourceConfig_r12
- SL_DiscResourcePool->numRetx_r12 = configuration->discRxPool_numRetx[CC_id];
- SL_DiscResourcePool->numRepetition_r12 = configuration->discRxPool_numRepetition[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.prb_Num_r12 = configuration->discRxPool_ResourceConfig_prb_Num[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.prb_Start_r12 = configuration->discRxPool_ResourceConfig_prb_Start[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.prb_End_r12 = configuration->discRxPool_ResourceConfig_prb_End[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present = configuration->discRxPool_ResourceConfig_offsetIndicator_present[CC_id];
-
- if (SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_small_r12 ) {
- SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->discRxPool_ResourceConfig_offsetIndicator_choice[CC_id] ;
- } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_large_r12 ) {
- SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->discRxPool_ResourceConfig_offsetIndicator_choice[CC_id] ;
- }
-
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present = configuration->discRxPool_ResourceConfig_subframeBitmap_present[CC_id];
-
- if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs4_r12) {
- //for BS4
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs8_r12) {
- //for BS8
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs12_r12) {
- //for BS12
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs16_r12) {
- //for BS16
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs30_r12) {
- //for BS30
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs40_r12) {
- //for BS40
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs42_r12) {
- //for BS42
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
- }
-
- //add SL_DiscResourcePool to SL_DiscRxPoolList
- ASN_SEQUENCE_ADD(&SL_DiscRxPoolList->list,SL_DiscResourcePool);
- /*
+ if (configuration->SL_configured>0) {
+ //TTN - for D2D
+ // SIB18
+ //commRxPool_r12
+ (*sib18)->commConfig_r12 = CALLOC (1, sizeof(*(*sib18)->commConfig_r12));
+ SL_CommRxPoolList= &(*sib18)->commConfig_r12->commRxPool_r12;
+ memset(SL_CommRxPoolList,0,sizeof(*SL_CommRxPoolList));
+ SL_CommResourcePool = CALLOC(1, sizeof(*SL_CommResourcePool));
+ memset(SL_CommResourcePool,0,sizeof(*SL_CommResourcePool));
+ SL_CommResourcePool->sc_CP_Len_r12 = configuration->rxPool_sc_CP_Len[CC_id];
+ SL_CommResourcePool->sc_Period_r12 = configuration->rxPool_sc_Period[CC_id];
+ SL_CommResourcePool->data_CP_Len_r12 = configuration->rxPool_data_CP_Len[CC_id];
+ //sc_TF_ResourceConfig_r12
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.prb_Num_r12 = configuration->rxPool_ResourceConfig_prb_Num[CC_id];
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.prb_Start_r12 = configuration->rxPool_ResourceConfig_prb_Start[CC_id];
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.prb_End_r12 = configuration->rxPool_ResourceConfig_prb_End[CC_id];
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present = configuration->rxPool_ResourceConfig_offsetIndicator_present[CC_id];
+
+ if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_small_r12 ) {
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->rxPool_ResourceConfig_offsetIndicator_choice[CC_id] ;
+ } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_large_r12 ) {
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->rxPool_ResourceConfig_offsetIndicator_choice[CC_id] ;
+ }
+
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present = configuration->rxPool_ResourceConfig_subframeBitmap_present[CC_id];
+
+ if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs4_r12) {
+ //for BS4
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs8_r12) {
+ //for BS8
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs12_r12) {
+ //for BS12
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs16_r12) {
+ //for BS16
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs30_r12) {
+ //for BS30
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs40_r12) {
+ //for BS40
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs42_r12) {
+ //for BS42
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = (uint8_t *)configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_CommResourcePool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ }
+
+ //dataHoppingConfig_r12
+ SL_CommResourcePool->dataHoppingConfig_r12.hoppingParameter_r12 = 0;
+ SL_CommResourcePool->dataHoppingConfig_r12.numSubbands_r12 = LTE_SL_HoppingConfigComm_r12__numSubbands_r12_ns1;
+ SL_CommResourcePool->dataHoppingConfig_r12.rb_Offset_r12 = 0;
+ //ue_SelectedResourceConfig_r12
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12 = CALLOC (1, sizeof (*SL_CommResourcePool->ue_SelectedResourceConfig_r12));
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_Num_r12 = 20;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_Start_r12 = 5;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.prb_End_r12 = 44;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.present = LTE_SL_OffsetIndicator_r12_PR_small_r12;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0 ;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = LTE_SubframeBitmapSL_r12_PR_bs40_r12;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = 5;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = CALLOC(1,5);
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = 0;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[0] = 0xF0;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[1] = 0xFF;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[2] = 0xFF;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[3] = 0xFF;
+ SL_CommResourcePool->ue_SelectedResourceConfig_r12->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf[4] = 0xFF;
+ //SL_CommResourcePool->ue_SelectedResourceConfig_r12->trpt_Subset_r12 = CALLOC (1, sizeof(*SL_CommResourcePool->ue_SelectedResourceConfig_r12->trpt_Subset_r12));
+ //rxParametersNCell_r12
+ SL_CommResourcePool->rxParametersNCell_r12 = CALLOC (1, sizeof (*SL_CommResourcePool->rxParametersNCell_r12));
+ SL_CommResourcePool->rxParametersNCell_r12->tdd_Config_r12 = CALLOC (1, sizeof (*SL_CommResourcePool->rxParametersNCell_r12->tdd_Config_r12));
+ SL_CommResourcePool->rxParametersNCell_r12->tdd_Config_r12->subframeAssignment = 0 ;
+ SL_CommResourcePool->rxParametersNCell_r12->tdd_Config_r12->specialSubframePatterns = 0;
+ SL_CommResourcePool->rxParametersNCell_r12->syncConfigIndex_r12 = 0;
+ //txParameters_r12
+ SL_CommResourcePool->txParameters_r12 = CALLOC (1, sizeof (*SL_CommResourcePool->txParameters_r12));
+ SL_CommResourcePool->txParameters_r12->sc_TxParameters_r12.alpha_r12 = LTE_Alpha_r12_al0;
+ SL_CommResourcePool->txParameters_r12->sc_TxParameters_r12.p0_r12 = 0;
+ SL_CommResourcePool->ext1 = NULL ;
+ //end SL_CommResourcePool
+ //add SL_CommResourcePool to SL_CommRxPoolList
+ ASN_SEQUENCE_ADD(&SL_CommRxPoolList->list,SL_CommResourcePool);
+ //end commRxPool_r12
+ //TODO: commTxPoolNormalCommon_r12, similar to commRxPool_r12
+ //TODO: commTxPoolExceptional_r12
+ //TODO: commSyncConfig_r12
+ // may add commTxResourceUC-ReqAllowed with Ext1
+ (*sib18)->ext1 = NULL;
+ (*sib18)->lateNonCriticalExtension = NULL;
+ // end SIB18
+ // SIB19
+ // fill in all elements of SIB19 if present
+ //discConfig_r12
+ (*sib19)->discConfig_r12 = CALLOC (1, sizeof(*(*sib19)->discConfig_r12));
+ SL_DiscRxPoolList = &(*sib19)->discConfig_r12->discRxPool_r12;
+ memset(SL_DiscRxPoolList,0,sizeof(*SL_DiscRxPoolList));
+ //fill SL_DiscResourcePool
+ SL_DiscResourcePool = CALLOC(1, sizeof(*SL_DiscResourcePool));
+ SL_DiscResourcePool->cp_Len_r12 = configuration->discRxPool_cp_Len[CC_id];
+ SL_DiscResourcePool->discPeriod_r12 = configuration->discRxPool_discPeriod[CC_id];
+ //sc_TF_ResourceConfig_r12
+ SL_DiscResourcePool->numRetx_r12 = configuration->discRxPool_numRetx[CC_id];
+ SL_DiscResourcePool->numRepetition_r12 = configuration->discRxPool_numRepetition[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.prb_Num_r12 = configuration->discRxPool_ResourceConfig_prb_Num[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.prb_Start_r12 = configuration->discRxPool_ResourceConfig_prb_Start[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.prb_End_r12 = configuration->discRxPool_ResourceConfig_prb_End[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present = configuration->discRxPool_ResourceConfig_offsetIndicator_present[CC_id];
+
+ if (SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_small_r12 ) {
+ SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->discRxPool_ResourceConfig_offsetIndicator_choice[CC_id] ;
+ } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.present == LTE_SL_OffsetIndicator_r12_PR_large_r12 ) {
+ SL_DiscResourcePool->tf_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->discRxPool_ResourceConfig_offsetIndicator_choice[CC_id] ;
+ }
+
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present = configuration->discRxPool_ResourceConfig_subframeBitmap_present[CC_id];
+
+ if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs4_r12) {
+ //for BS4
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs8_r12) {
+ //for BS8
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs12_r12) {
+ //for BS12
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs16_r12) {
+ //for BS16
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs30_r12) {
+ //for BS30
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs40_r12) {
+ //for BS40
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ } else if (SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.present == LTE_SubframeBitmapSL_r12_PR_bs42_r12) {
+ //for BS42
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = (uint8_t *)configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePool->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ }
+
+ //add SL_DiscResourcePool to SL_DiscRxPoolList
+ ASN_SEQUENCE_ADD(&SL_DiscRxPoolList->list,SL_DiscResourcePool);
+ /*
//for DiscRxPoolPS
(*sib19)->ext1 = CALLOC (1, sizeof(*(*sib19)->ext1));
(*sib19)->ext1->discConfigPS_13 = CALLOC (1, sizeof(*((*sib19)->ext1->discConfigPS_13)));
-
+
SL_DiscRxPoolPSList = &(*sib19)->ext1->discConfigPS_13->discRxPoolPS_r13;
memset(SL_DiscRxPoolPSList,0,sizeof(*SL_DiscRxPoolPSList));
//fill SL_DiscResourcePool
SL_DiscResourcePoolPS = CALLOC(1, sizeof(*SL_DiscResourcePoolPS));
-
+
SL_DiscResourcePoolPS->cp_Len_r12 = configuration->discRxPoolPS_cp_Len[CC_id];
SL_DiscResourcePoolPS->discPeriod_r12 = configuration->discRxPoolPS_discPeriod[CC_id];
//sc_TF_ResourceConfig_r12
SL_DiscResourcePoolPS->numRetx_r12 = configuration->discRxPoolPS_numRetx[CC_id];
SL_DiscResourcePoolPS->numRepetition_r12 = configuration->discRxPoolPS_numRepetition[CC_id];
-
+
SL_DiscResourcePoolPS->tf_ResourceConfig_r12.prb_Num_r12 = configuration->discRxPoolPS_ResourceConfig_prb_Num[CC_id];
SL_DiscResourcePoolPS->tf_ResourceConfig_r12.prb_Start_r12 = configuration->discRxPoolPS_ResourceConfig_prb_Start[CC_id];
SL_DiscResourcePoolPS->tf_ResourceConfig_r12.prb_End_r12 = configuration->discRxPoolPS_ResourceConfig_prb_End[CC_id];
-
+
SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.present = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_present[CC_id];
if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_small_r12 ) {
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_choice[CC_id] ;
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_choice[CC_id] ;
} else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.present == SL_OffsetIndicator_r12_PR_large_r12 ){
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_choice[CC_id] ;
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.offsetIndicator_r12.choice.large_r12 = configuration->discRxPoolPS_ResourceConfig_offsetIndicator_choice[CC_id] ;
}
-
+
SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_present[CC_id];
if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs4_r12){
- //for BS4
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ //for BS4
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs4_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
} else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs8_r12){
- //for BS8
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ //for BS8
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs8_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
} else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs12_r12){
- //for BS12
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ //for BS12
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs12_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
}else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs16_r12){
- //for BS16
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ //for BS16
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
}else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs30_r12){
- //for BS30
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ //for BS30
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs30_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
}else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs40_r12){
- //for BS40
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ //for BS40
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
}else if (SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.present == SubframeBitmapSL_r12_PR_bs42_r12){
- //for BS42
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
- SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
+ //for BS42
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.size = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size[CC_id];
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.buf = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf[CC_id];;
+ SL_DiscResourcePoolPS->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs42_r12.bits_unused = configuration->discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused[CC_id];
}
-
+
//add SL_DiscResourcePool to SL_DiscRxPoolList
ASN_SEQUENCE_ADD(&SL_DiscRxPoolPSList->list,SL_DiscResourcePoolPS);
- */
- (*sib19)->lateNonCriticalExtension = NULL;
- //end SIB19
- //SIB21
- (*sib21)->sl_V2X_ConfigCommon_r14 = CALLOC (1, sizeof(*(*sib21)->sl_V2X_ConfigCommon_r14));
- //SL_V2X_ConfigCommon= (*sib21)->sl_V2X_ConfigCommon_r14;
- memset((*sib21)->sl_V2X_ConfigCommon_r14,0,sizeof(*(*sib21)->sl_V2X_ConfigCommon_r14));
- struct LTE_SL_CommRxPoolListV2X_r14 *SL_CommRxPoolListV2X;
- struct LTE_SL_CommResourcePoolV2X_r14 *SL_CommResourcePoolV2X;
- (*sib21)->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14 = CALLOC(1, sizeof(*(*sib21)->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14));
- SL_CommRxPoolListV2X = (*sib21)->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14;
- SL_CommResourcePoolV2X = CALLOC(1, sizeof(*SL_CommResourcePoolV2X));
- memset(SL_CommResourcePoolV2X,0,sizeof(*SL_CommResourcePoolV2X));
- SL_CommResourcePoolV2X->sl_OffsetIndicator_r14 = CALLOC(1, sizeof(*SL_CommResourcePoolV2X->sl_OffsetIndicator_r14));
- SL_CommResourcePoolV2X->sl_OffsetIndicator_r14->present = LTE_SL_OffsetIndicator_r12_PR_small_r12;
- SL_CommResourcePoolV2X->sl_OffsetIndicator_r14->choice.small_r12 = 0;
- SL_CommResourcePoolV2X->sl_Subframe_r14.present = LTE_SubframeBitmapSL_r14_PR_bs40_r14;
- SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.size = 5;
- SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf = CALLOC(1,5);
- SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.bits_unused = 0;
- SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[0] = 0xF0;
- SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[1] = 0xFF;
- SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[2] = 0xFF;
- SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[3] = 0xFF;
- SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[4] = 0xFF;
- SL_CommResourcePoolV2X->adjacencyPSCCH_PSSCH_r14 = 1;
- SL_CommResourcePoolV2X->sizeSubchannel_r14 = 10;
- SL_CommResourcePoolV2X->numSubchannel_r14 = 5;
- SL_CommResourcePoolV2X->startRB_Subchannel_r14 = 10;
- //rxParametersNCell_r12
- SL_CommResourcePoolV2X->rxParametersNCell_r14 = CALLOC (1, sizeof (*SL_CommResourcePoolV2X->rxParametersNCell_r14));
- SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14 = CALLOC (1, sizeof (*SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14));
- SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14->subframeAssignment = 0 ;
- SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14->specialSubframePatterns = 0;
- SL_CommResourcePoolV2X->rxParametersNCell_r14->syncConfigIndex_r14 = 0;
- ASN_SEQUENCE_ADD(&SL_CommRxPoolListV2X->list,SL_CommResourcePoolV2X);
- //end SIB21
+ */
+ (*sib19)->lateNonCriticalExtension = NULL;
+ //end SIB19
+ //SIB21
+ (*sib21)->sl_V2X_ConfigCommon_r14 = CALLOC (1, sizeof(*(*sib21)->sl_V2X_ConfigCommon_r14));
+ //SL_V2X_ConfigCommon= (*sib21)->sl_V2X_ConfigCommon_r14;
+ memset((*sib21)->sl_V2X_ConfigCommon_r14,0,sizeof(*(*sib21)->sl_V2X_ConfigCommon_r14));
+ struct LTE_SL_CommRxPoolListV2X_r14 *SL_CommRxPoolListV2X;
+ struct LTE_SL_CommResourcePoolV2X_r14 *SL_CommResourcePoolV2X;
+ (*sib21)->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14 = CALLOC(1, sizeof(*(*sib21)->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14));
+ SL_CommRxPoolListV2X = (*sib21)->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14;
+ SL_CommResourcePoolV2X = CALLOC(1, sizeof(*SL_CommResourcePoolV2X));
+ memset(SL_CommResourcePoolV2X,0,sizeof(*SL_CommResourcePoolV2X));
+ SL_CommResourcePoolV2X->sl_OffsetIndicator_r14 = CALLOC(1, sizeof(*SL_CommResourcePoolV2X->sl_OffsetIndicator_r14));
+ SL_CommResourcePoolV2X->sl_OffsetIndicator_r14->present = LTE_SL_OffsetIndicator_r12_PR_small_r12;
+ SL_CommResourcePoolV2X->sl_OffsetIndicator_r14->choice.small_r12 = 0;
+ SL_CommResourcePoolV2X->sl_Subframe_r14.present = LTE_SubframeBitmapSL_r14_PR_bs40_r14;
+ SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.size = 5;
+ SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf = CALLOC(1,5);
+ SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.bits_unused = 0;
+ SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[0] = 0xF0;
+ SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[1] = 0xFF;
+ SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[2] = 0xFF;
+ SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[3] = 0xFF;
+ SL_CommResourcePoolV2X->sl_Subframe_r14.choice.bs40_r14.buf[4] = 0xFF;
+ SL_CommResourcePoolV2X->adjacencyPSCCH_PSSCH_r14 = 1;
+ SL_CommResourcePoolV2X->sizeSubchannel_r14 = 10;
+ SL_CommResourcePoolV2X->numSubchannel_r14 = 5;
+ SL_CommResourcePoolV2X->startRB_Subchannel_r14 = 10;
+ //rxParametersNCell_r12
+ SL_CommResourcePoolV2X->rxParametersNCell_r14 = CALLOC (1, sizeof (*SL_CommResourcePoolV2X->rxParametersNCell_r14));
+ SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14 = CALLOC (1, sizeof (*SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14));
+ SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14->subframeAssignment = 0 ;
+ SL_CommResourcePoolV2X->rxParametersNCell_r14->tdd_Config_r14->specialSubframePatterns = 0;
+ SL_CommResourcePoolV2X->rxParametersNCell_r14->syncConfigIndex_r14 = 0;
+ ASN_SEQUENCE_ADD(&SL_CommRxPoolListV2X->list,SL_CommResourcePoolV2X);
+ //end SIB21
+ }
#endif
bcch_message->message.present = LTE_BCCH_DL_SCH_MessageType_PR_c1;
bcch_message->message.choice.c1.present = LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformation;
@@ -1175,6 +1997,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
(void*)systemInformation,
sizeof(SystemInformation_t));*/
bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.present = LTE_SystemInformation__criticalExtensions_PR_systemInformation_r8;
+
bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count=0;
// asn_set_empty(&systemInformation->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list);//.size=0;
// systemInformation->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count=0;
@@ -1184,8 +2007,8 @@ uint8_t do_SIB23(uint8_t Mod_id,
sib3_part);
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- if (MBMS_flag > 0) {
- ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list,sib13_part);
+ if (configuration->eMBMS_configured > 0) {
+ ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list, sib13_part);
}
#endif
@@ -1201,6 +2024,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
900);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
+
LOG_D(RRC,"[eNB] SystemInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
if (enc_rval.encoded==-1) {
@@ -1262,7 +2086,7 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) {
buffer,
100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
+ enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(RRC,"[UE] RRCConnectionRequest Encoded %zd bits (%zd bytes) \n",enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
}
@@ -1412,8 +2236,8 @@ uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, LTE_SL_Destin
return((enc_rval.encoded+7)/8);
}
-
uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS) {
+
asn_enc_rval_t enc_rval;
LTE_UL_DCCH_Message_t ul_dcch_msg;
LTE_RRCConnectionSetupComplete_t *rrcConnectionSetupComplete;
@@ -1725,6 +2549,8 @@ do_RRCConnectionSetup(
//assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode,
// AntennaInfoDedicated__transmissionMode_tm2);
+ LOG_D(RRC,"physicalConfigDedicated2 %p, physicalConfigDedicated2->antennaInfo %p => %d\n",physicalConfigDedicated2,physicalConfigDedicated2->antennaInfo,transmission_mode);
+
switch (transmission_mode) {
default:
LOG_W(RRC,"At RRCConnectionSetup Transmission mode can only take values 1 or 2! Defaulting to 1!\n");
@@ -1883,15 +2709,443 @@ do_RRCConnectionSetup(
return((enc_rval.encoded+7)/8);
}
-//------------------------------------------------------------------------------
-uint8_t
-do_SecurityModeCommand(
- const protocol_ctxt_t *const ctxt_pP,
- uint8_t *const buffer,
- const uint8_t Transaction_id,
- const uint8_t cipheringAlgorithm,
- const uint8_t integrityProtAlgorithm
-)
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+uint8_t do_RRCConnectionSetup_BR(
+ const protocol_ctxt_t* const ctxt_pP,
+ rrc_eNB_ue_context_t* const ue_context_pP,
+ int CC_id,
+ uint8_t* const buffer,
+ const uint8_t transmission_mode,
+ const uint8_t Transaction_id,
+ LTE_SRB_ToAddModList_t **SRB_configList,
+ struct LTE_PhysicalConfigDedicated **physicalConfigDedicated)
+{
+
+ asn_enc_rval_t enc_rval;
+ eNB_RRC_INST *rrc = RC.rrc[ctxt_pP->module_id];
+ rrc_eNB_carrier_data_t *carrier = &rrc->carrier[CC_id];
+
+ long* logicalchannelgroup = NULL;
+ struct LTE_SRB_ToAddMod* SRB1_config = NULL;
+ struct LTE_SRB_ToAddMod__rlc_Config* SRB1_rlc_config = NULL;
+ struct LTE_SRB_ToAddMod__logicalChannelConfig* SRB1_lchan_config = NULL;
+ struct LTE_LogicalChannelConfig__ul_SpecificParameters* SRB1_ul_SpecificParameters = NULL;
+
+#ifdef CBA
+ struct PUSCH_CBAConfigDedicated_vlola* pusch_CBAConfigDedicated_vlola = NULL;
+ long* betaOffset_CBA_Index = NULL;
+ long* cShift_CBA = NULL;
+#endif
+ LTE_PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL;
+
+ LTE_DL_CCCH_Message_t dl_ccch_msg;
+
+ LTE_RRCConnectionSetup_t* rrcConnectionSetup = NULL;
+
+ memset((void *)&dl_ccch_msg,0,sizeof(LTE_DL_CCCH_Message_t));
+ dl_ccch_msg.message.present = LTE_DL_CCCH_MessageType_PR_c1;
+ dl_ccch_msg.message.choice.c1.present = LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionSetup;
+ rrcConnectionSetup = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionSetup;
+
+ // RRCConnectionSetup
+ // Configure SRB1
+
+ // *SRB_configList = CALLOC(1,sizeof(*SRB_configList));
+ if (*SRB_configList) {
+ free(*SRB_configList);
+ }
+
+ *SRB_configList = CALLOC(1,sizeof(LTE_SRB_ToAddModList_t));
+
+ /// SRB1
+ SRB1_config = CALLOC(1,sizeof(*SRB1_config));
+
+ SRB1_config->srb_Identity = 1;
+ SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config));
+ SRB1_config->rlc_Config = SRB1_rlc_config; // check this
+
+ SRB1_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue;
+ SRB1_rlc_config->choice.explicitValue.present = LTE_RLC_Config_PR_am;
+#if defined(ENABLE_ITTI)
+ SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit;
+ SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = rrc->srb1_poll_pdu;
+ SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = rrc->srb1_poll_byte;
+ SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold;
+ SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = rrc->srb1_timer_reordering;
+ SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit;
+#else
+ SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms20; // FIXME should be 80
+ SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p4; // FIXME should be infinity
+ SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity;
+ SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8;
+
+ SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35;
+ SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms0;
+#endif
+
+ SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config));
+ SRB1_config->logicalChannelConfig = SRB1_lchan_config;
+
+ SRB1_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
+ SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters));
+
+ SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters;
+
+ SRB1_ul_SpecificParameters->priority = 1;
+
+ //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity);
+ SRB1_ul_SpecificParameters->prioritisedBitRate=LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+
+ //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50);
+ SRB1_ul_SpecificParameters->bucketSizeDuration=LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+
+ logicalchannelgroup = CALLOC(1,sizeof(long));
+ *logicalchannelgroup=0;
+ SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup;
+
+
+ ASN_SEQUENCE_ADD(&(*SRB_configList)->list,SRB1_config);
+
+ // PhysicalConfigDedicated
+
+ physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2));
+ *physicalConfigDedicated = physicalConfigDedicated2;
+
+ physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated));
+ physicalConfigDedicated2->pucch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated));
+
+ physicalConfigDedicated2->pusch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated));;
+ physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = NULL;
+ physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = NULL;
+
+ physicalConfigDedicated2->uplinkPowerControlDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated));
+ physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig));
+
+ if (rrc->srs_enable[CC_id])
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated));
+ else
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL;
+ physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo));
+ physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig));
+#ifdef CBA
+ physicalConfigDedicated2->pusch_CBAConfigDedicated_vlola = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_CBAConfigDedicated_vlola));
+#endif
+
+ if (carrier->p_eNB==2)
+ physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = LTE_PDSCH_ConfigDedicated__p_a_dB_3;
+ else
+ physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = LTE_PDSCH_ConfigDedicated__p_a_dB0;
+
+ // PUCCH
+ physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present=LTE_PUCCH_ConfigDedicated__ackNackRepetition_PR_release;
+ physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release=0;
+
+ // PUSCH
+ physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 10;
+ physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 9;
+ physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 10;
+
+ //
+
+
+ if (carrier->sib1->tdd_Config == NULL) {
+ physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode=NULL;//PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing;
+ } else { //TDD
+ physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode = CALLOC(1,sizeof(long));
+ *(physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode) =
+ LTE_PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_bundling;//PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing;
+ }
+
+ /// TODO to be reviewed
+ // UplinkPowerControlDedicated
+ physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB
+ //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled,
+ // UplinkPowerControlDedicated__deltaMCS_Enabled_en1);
+ physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled= LTE_UplinkPowerControlDedicated__deltaMCS_Enabled_en1;
+ physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1; // TRUE
+ physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB
+ physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB
+ physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = CALLOC(1,
+ sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient));
+ // assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB
+ *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient=LTE_FilterCoefficient_fc4; // fc4 dB
+
+ // TPC-PDCCH-Config
+
+ // CQI ReportConfig
+ physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic));
+ *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic = LTE_CQI_ReportModeAperiodic_rm20;
+ physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB
+ physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic));
+ physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = LTE_CQI_ReportPeriodic_PR_release;
+ physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.release = (NULL_t)0;
+
+
+ /// TODO to be reviewed
+ if (rrc->srs_enable[CC_id]) {
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = LTE_SoundingRS_UL_ConfigDedicated_PR_setup;
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth =
+ LTE_SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0;
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth =
+ LTE_SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0;
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0;
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1;
+ if (carrier->sib1->tdd_Config==NULL) { // FDD
+ if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present
+ == LTE_SoundingRS_UL_ConfigCommon_PR_setup)
+ if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0)
+ LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %d. Expect undefined behaviour!\n",
+ (int)carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig);
+ if (ue_context_pP->local_uid >=20)
+ LOG_W(RRC,"This code has been optimized for up to 10 UEs, but current UE_id is %d. Expect undefined behaviour!\n",
+ ue_context_pP->local_uid);
+ //the current code will allow for 20 UEs - to be revised for more
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=7+ue_context_pP->local_uid/2;
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2;
+ }
+ else {
+ if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present
+ == LTE_SoundingRS_UL_ConfigCommon_PR_setup)
+ if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=7) {
+ LOG_W(RRC,"This code has been optimized for SRS Subframe Config 7 and TDD config 3, but current configs are %d and %d. Expect undefined behaviour!\n",
+ (int)carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig,
+ (int)carrier->sib1->tdd_Config->subframeAssignment);
+ }
+ if (ue_context_pP->local_uid >=6)
+ LOG_W(RRC,"This code has been optimized for up to 6 UEs, but current UE_id is %d. Expect undefined behaviour!\n",
+ ue_context_pP->local_uid);
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=17+ue_context_pP->local_uid/2;
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2;
+ }
+ LOG_W(RRC,"local UID %d, srs ConfigIndex %d, TransmissionComb %d\n",ue_context_pP->local_uid,
+ (int)physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex,
+ (int)physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb);
+
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift=
+ LTE_SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0;
+ }
+
+ //AntennaInfoDedicated
+ physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo));
+ physicalConfigDedicated2->antennaInfo->present = LTE_PhysicalConfigDedicated__antennaInfo_PR_explicitValue;
+
+ switch (transmission_mode) {
+ default:
+ LOG_W(RRC,"At RRCConnectionSetup Transmission mode can only take values 1 or 2! Defaulting to 1!\n");
+ case 1:
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= LTE_AntennaInfoDedicated__transmissionMode_tm1;
+ break;
+
+ case 2:
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= LTE_AntennaInfoDedicated__transmissionMode_tm2;
+ break;
+ /*
+ case 3:
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm3;
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction= CALLOC(1,
+ sizeof(*physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction));
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
+
+ break;
+
+ case 4:
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4;
+ break;
+
+ case 5:
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5;
+ break;
+
+ case 6:
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6;
+ break;
+
+ case 7:
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm7;
+ break;
+ */
+ }
+
+
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = LTE_AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release;
+ physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0;
+
+ // SchedulingRequestConfig
+
+ physicalConfigDedicated2->schedulingRequestConfig->present = LTE_SchedulingRequestConfig_PR_setup;
+ physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 18;//ue_context_pP->local_uid;
+
+ if (carrier->sib1->tdd_Config == NULL) { // FDD
+ physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 76+(ue_context_pP->local_uid%10); // Isr = 76 (every 80 subframes, offset=2+UE_id mod3)
+ } else {
+ switch (carrier->sib1->tdd_Config->subframeAssignment) {
+ case 1:
+ physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+(ue_context_pP->local_uid&1)+((
+ ue_context_pP->local_uid&3)>>1)*5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..)
+ break;
+
+ case 3:
+ physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+
+ (ue_context_pP->local_uid%3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..)
+ break;
+
+ case 4:
+ physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+
+ (ue_context_pP->local_uid&1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..)
+ break;
+
+ default:
+ physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..)
+ break;
+ }
+ }
+
+
+ physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = LTE_SchedulingRequestConfig__setup__dsr_TransMax_n16;
+
+ physicalConfigDedicated2->ext4 = calloc(1, sizeof(struct LTE_PhysicalConfigDedicated__ext4) );
+ physicalConfigDedicated2->ext4->csi_RS_ConfigNZPToReleaseList_r11 = NULL;
+ physicalConfigDedicated2->ext4->csi_RS_ConfigNZPToAddModList_r11 = NULL;
+ physicalConfigDedicated2->ext4->csi_RS_ConfigZPToAddModList_r11 = NULL;
+ physicalConfigDedicated2->ext4->csi_RS_ConfigZPToReleaseList_r11 = NULL;
+
+ physicalConfigDedicated2->ext4->epdcch_Config_r11 = calloc(1, sizeof(struct LTE_EPDCCH_Config_r11 ));
+ physicalConfigDedicated2->ext4->epdcch_Config_r11->config_r11.present = LTE_EPDCCH_Config_r11__config_r11_PR_setup;
+ physicalConfigDedicated2->ext4->epdcch_Config_r11->config_r11.choice.setup.subframePatternConfig_r11 = NULL;
+ physicalConfigDedicated2->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 = calloc(1,sizeof(long));
+ *physicalConfigDedicated2->ext4->epdcch_Config_r11->config_r11.choice.setup.startSymbol_r11 = 2;
+ physicalConfigDedicated2->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToReleaseList_r11 = NULL;
+
+
+ physicalConfigDedicated2->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11 = calloc(1, sizeof(LTE_EPDCCH_SetConfigToAddModList_r11_t));
+ // memset(physicalConfigDedicated2->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11, 0, sizeof())
+ LTE_EPDCCH_SetConfig_r11_t *epdcch_setconfig_r11 = calloc(1, sizeof(LTE_EPDCCH_SetConfig_r11_t));
+ epdcch_setconfig_r11->setConfigId_r11 = 0;
+ epdcch_setconfig_r11->transmissionType_r11 = LTE_EPDCCH_SetConfig_r11__transmissionType_r11_distributed;
+ epdcch_setconfig_r11->resourceBlockAssignment_r11.numberPRB_Pairs_r11 = LTE_EPDCCH_SetConfig_r11__resourceBlockAssignment_r11__numberPRB_Pairs_r11_n2;
+ //epdcch_setconfig_r11->resourceBlockAssignment_r11.resourceBlockAssignment_r11 = calloc(0, sizeof(BIT_STRING_t));
+ epdcch_setconfig_r11->resourceBlockAssignment_r11.resourceBlockAssignment_r11.buf = calloc(1, 5 * sizeof(uint8_t));
+ epdcch_setconfig_r11->resourceBlockAssignment_r11.resourceBlockAssignment_r11.size = 5;
+ epdcch_setconfig_r11->resourceBlockAssignment_r11.resourceBlockAssignment_r11.bits_unused = 2;
+ memset(epdcch_setconfig_r11->resourceBlockAssignment_r11.resourceBlockAssignment_r11.buf, 0, 5 * sizeof(uint8_t));
+
+ epdcch_setconfig_r11->dmrs_ScramblingSequenceInt_r11 = 54;
+ epdcch_setconfig_r11->pucch_ResourceStartOffset_r11 = 0;
+ epdcch_setconfig_r11->re_MappingQCL_ConfigId_r11 = NULL;
+
+ epdcch_setconfig_r11->ext2 = calloc(1, sizeof(struct LTE_EPDCCH_SetConfig_r11__ext2));
+ epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310 = calloc(1,sizeof(struct LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310));
+ epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->present = LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310_PR_setup;
+ epdcch_setconfig_r11->ext2->numberPRB_Pairs_v1310->choice.setup = LTE_EPDCCH_SetConfig_r11__ext2__numberPRB_Pairs_v1310__setup_n6;
+ epdcch_setconfig_r11->ext2->mpdcch_config_r13 = calloc(1, sizeof(struct LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13));
+ epdcch_setconfig_r11->ext2->mpdcch_config_r13->present = LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13_PR_setup;
+ epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.csi_NumRepetitionCE_r13 = LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__csi_NumRepetitionCE_r13_sf1;
+ epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_pdsch_HoppingConfig_r13 = LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_pdsch_HoppingConfig_r13_off;
+ epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_StartSF_UESS_r13.present = LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_StartSF_UESS_r13_PR_fdd_r13;
+ epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_StartSF_UESS_r13.choice.fdd_r13 = LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_StartSF_UESS_r13__fdd_r13_v1;
+ epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_NumRepetition_r13 = LTE_EPDCCH_SetConfig_r11__ext2__mpdcch_config_r13__setup__mpdcch_NumRepetition_r13_r1;
+ epdcch_setconfig_r11->ext2->mpdcch_config_r13->choice.setup.mpdcch_Narrowband_r13 = 3; // note: this is narrowband index 2
+ ASN_SEQUENCE_ADD(physicalConfigDedicated2->ext4->epdcch_Config_r11->config_r11.choice.setup.setConfigToAddModList_r11, epdcch_setconfig_r11);
+
+
+ // FIXME allocate physicalConfigDedicated2->ext7
+ physicalConfigDedicated2->ext7 = CALLOC(1, sizeof(struct LTE_PhysicalConfigDedicated__ext7));
+
+ physicalConfigDedicated2->ext7->pdsch_ConfigDedicated_v1310 = NULL; // has some parameters to be filled
+
+ physicalConfigDedicated2->ext7->pusch_ConfigDedicated_r13 = NULL;
+ physicalConfigDedicated2->ext7->pucch_ConfigDedicated_r13 = NULL;
+
+ physicalConfigDedicated2->ext7->pdcch_CandidateReductions_r13 = NULL;
+
+ physicalConfigDedicated2->ext7->cqi_ReportConfig_v1310 = NULL;
+
+ physicalConfigDedicated2->ext7->soundingRS_UL_ConfigDedicated_v1310 = NULL;
+ physicalConfigDedicated2->ext7->soundingRS_UL_ConfigDedicatedUpPTsExt_r13 = NULL;
+ physicalConfigDedicated2->ext7->soundingRS_UL_ConfigDedicatedAperiodic_v1310 = NULL;
+ physicalConfigDedicated2->ext7->soundingRS_UL_ConfigDedicatedAperiodicUpPTsExt_r13 = NULL;
+
+ physicalConfigDedicated2->ext7->csi_RS_Config_v1310 = NULL;
+
+ // FIXME ce_Mode_r13 allocation
+ physicalConfigDedicated2->ext7->ce_Mode_r13 = CALLOC(1, sizeof(struct LTE_PhysicalConfigDedicated__ext7__ce_Mode_r13));
+ physicalConfigDedicated2->ext7->ce_Mode_r13->present = LTE_PhysicalConfigDedicated__ext7__ce_Mode_r13_PR_setup;
+ physicalConfigDedicated2->ext7->ce_Mode_r13->choice.setup = LTE_PhysicalConfigDedicated__ext7__ce_Mode_r13__setup_ce_ModeA;
+ physicalConfigDedicated2->ext7->csi_RS_ConfigNZPToAddModListExt_r13 = NULL;
+ physicalConfigDedicated2->ext7->csi_RS_ConfigNZPToReleaseListExt_r13 = NULL;
+
+
+ rrcConnectionSetup->rrc_TransactionIdentifier = Transaction_id;
+ rrcConnectionSetup->criticalExtensions.present = LTE_RRCConnectionSetup__criticalExtensions_PR_c1;
+ rrcConnectionSetup->criticalExtensions.choice.c1.present =LTE_RRCConnectionSetup__criticalExtensions__c1_PR_rrcConnectionSetup_r8 ;
+ rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.srb_ToAddModList = *SRB_configList;
+ rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.drb_ToAddModList = NULL;
+ rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.drb_ToReleaseList = NULL;
+ rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.sps_Config = NULL;
+ rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.physicalConfigDedicated = physicalConfigDedicated2;
+ rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig = NULL;
+
+#ifdef XER_PRINT
+ xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
+#endif
+ enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message,
+ NULL,
+ (void*)&dl_ccch_msg,
+ buffer,
+ 100);
+ AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
+
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+ {
+ char message_string[20000];
+ size_t message_string_size;
+
+ if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) {
+ MessageDef *msg_p;
+
+ msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
+ msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
+ memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
+
+ itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+ }
+ }
+# endif
+#endif
+
+#ifdef USER_MODE
+ LOG_D(RRC,"RRCConnectionSetup_BR Encoded %d bits (%d bytes), ecause %d\n",
+ enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
+#endif
+
+ // FREEMEM(SRB_list);
+ // free(SRB1_config);
+ // free(SRB1_rlc_config);
+ // free(SRB1_lchan_config);
+ // free(SRB1_ul_SpecificParameters);
+
+ return((enc_rval.encoded+7)/8);
+}
+#endif
+
+
+
+
+uint8_t do_SecurityModeCommand(
+ const protocol_ctxt_t *const ctxt_pP,
+ uint8_t *const buffer,
+ const uint8_t Transaction_id,
+ const uint8_t cipheringAlgorithm,
+ const uint8_t integrityProtAlgorithm
+ )
//------------------------------------------------------------------------------
{
LTE_DL_DCCH_Message_t dl_dcch_msg;
@@ -1899,6 +3153,7 @@ do_SecurityModeCommand(
memset(&dl_dcch_msg,0,sizeof(LTE_DL_DCCH_Message_t));
dl_dcch_msg.message.present = LTE_DL_DCCH_MessageType_PR_c1;
dl_dcch_msg.message.choice.c1.present = LTE_DL_DCCH_MessageType__c1_PR_securityModeCommand;
+
dl_dcch_msg.message.choice.c1.choice.securityModeCommand.rrc_TransactionIdentifier = Transaction_id;
dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.present = LTE_SecurityModeCommand__criticalExtensions_PR_c1;
dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.present =
@@ -1933,8 +3188,8 @@ do_SecurityModeCommand(
if (enc_rval.encoded==-1) {
LOG_E(RRC,"[eNB %d] ASN1 : securityModeCommand encoding failed for UE %x\n",
- ctxt_pP->module_id,
- ctxt_pP->rnti);
+ ctxt_pP->module_id,
+ ctxt_pP->rnti);
return(-1);
}
@@ -1944,12 +3199,9 @@ do_SecurityModeCommand(
}
//------------------------------------------------------------------------------
-uint8_t
-do_UECapabilityEnquiry(
- const protocol_ctxt_t *const ctxt_pP,
- uint8_t *const buffer,
- const uint8_t Transaction_id
-)
+uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP,
+ uint8_t *const buffer,
+ const uint8_t Transaction_id)
//------------------------------------------------------------------------------
{
LTE_DL_DCCH_Message_t dl_dcch_msg;
@@ -1964,7 +3216,7 @@ do_UECapabilityEnquiry(
LTE_UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8;
dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count=0;
ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list,
- &rat);
+ &rat);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)&dl_dcch_msg);
@@ -1990,44 +3242,189 @@ do_UECapabilityEnquiry(
if (enc_rval.encoded==-1) {
LOG_E(RRC,"[eNB %d] ASN1 : UECapabilityRequest encoding failed for UE %x\n",
- ctxt_pP->module_id,
- ctxt_pP->rnti);
+ ctxt_pP->module_id,
+ ctxt_pP->rnti);
return(-1);
}
return((enc_rval.encoded+7)/8);
}
-//------------------------------------------------------------------------------
-uint16_t
-do_RRCConnectionReconfiguration(
- const protocol_ctxt_t *const ctxt_pP,
- uint8_t *buffer,
- uint8_t Transaction_id,
- LTE_SRB_ToAddModList_t *SRB_list,
- LTE_DRB_ToAddModList_t *DRB_list,
- LTE_DRB_ToReleaseList_t *DRB_list2,
- struct LTE_SPS_Config *sps_Config,
- struct LTE_PhysicalConfigDedicated *physicalConfigDedicated,
- LTE_MeasObjectToAddModList_t *MeasObj_list,
- LTE_ReportConfigToAddModList_t *ReportConfig_list,
- LTE_QuantityConfig_t *quantityConfig,
- LTE_MeasIdToAddModList_t *MeasId_list,
- LTE_MAC_MainConfig_t *mac_MainConfig,
- LTE_MeasGapConfig_t *measGapConfig,
- LTE_MobilityControlInfo_t *mobilityInfo,
- struct LTE_MeasConfig__speedStatePars *speedStatePars,
- LTE_RSRP_Range_t *rsrp,
- LTE_C_RNTI_t *cba_rnti,
- struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList
- *dedicatedInfoNASList,
- LTE_SL_CommConfig_r12_t *sl_CommConfig,
- LTE_SL_DiscConfig_r12_t *sl_DiscConfig
-#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- , LTE_SCellToAddMod_r10_t *SCell_config
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+uint16_t do_RRCConnectionReconfiguration_BR(const protocol_ctxt_t* const ctxt_pP,
+ uint8_t *buffer,
+ uint8_t Transaction_id,
+ LTE_SRB_ToAddModList_t *SRB_list,
+ LTE_DRB_ToAddModList_t *DRB_list,
+ LTE_DRB_ToReleaseList_t *DRB_list2,
+ struct LTE_SPS_Config *sps_Config,
+ struct LTE_PhysicalConfigDedicated *physicalConfigDedicated,
+ LTE_MeasObjectToAddModList_t *MeasObj_list,
+ LTE_ReportConfigToAddModList_t *ReportConfig_list,
+ LTE_QuantityConfig_t *quantityConfig,
+ LTE_MeasIdToAddModList_t *MeasId_list,
+ LTE_MAC_MainConfig_t *mac_MainConfig,
+ LTE_MeasGapConfig_t *measGapConfig,
+ LTE_MobilityControlInfo_t *mobilityInfo,
+ struct LTE_MeasConfig__speedStatePars *speedStatePars,
+ LTE_RSRP_Range_t *rsrp,
+ LTE_C_RNTI_t *cba_rnti,
+ struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList,
+ LTE_SCellToAddMod_r10_t *SCell_config)
+{
+ asn_enc_rval_t enc_rval;
+
+ LTE_DL_DCCH_Message_t dl_dcch_msg;
+ LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration;
+
+
+ memset(&dl_dcch_msg,0,sizeof(LTE_DL_DCCH_Message_t));
+
+ dl_dcch_msg.message.present = LTE_DL_DCCH_MessageType_PR_c1;
+ dl_dcch_msg.message.choice.c1.present = LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration;
+ rrcConnectionReconfiguration = &dl_dcch_msg.message.choice.c1.choice.rrcConnectionReconfiguration;
+
+ // RRCConnectionReconfiguration
+ rrcConnectionReconfiguration->rrc_TransactionIdentifier = Transaction_id;
+ rrcConnectionReconfiguration->criticalExtensions.present = LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1;
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.present =LTE_RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8 ;
+
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated = CALLOC(1,
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated));
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList = SRB_list;
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList = DRB_list;
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToReleaseList = DRB_list2;
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->sps_Config = sps_Config;
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->physicalConfigDedicated = physicalConfigDedicated;
+ physicalConfigDedicated->cqi_ReportConfig = CALLOC(1, sizeof(struct LTE_CQI_ReportConfig));
+ physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic = CALLOC(1, sizeof(LTE_CQI_ReportModeAperiodic_t));
+ *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic = LTE_CQI_ReportModeAperiodic_rm20;
+ physicalConfigDedicated->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0;
+
+ if (mac_MainConfig!=NULL) {
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig = CALLOC(1,
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig));
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig->present
+ =LTE_RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue;
+ memcpy(&rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue,
+ mac_MainConfig,
+ sizeof(*mac_MainConfig));
+ } else {
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig=NULL;
+ }
+
+ if (MeasId_list != NULL) {
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig = CALLOC(1,
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig));
+ memset((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig,
+ 0, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig));
+
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
+
+ if (quantityConfig!=NULL) {
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig = CALLOC(1,
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig));
+ memcpy((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig,
+ (void *)quantityConfig,
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig));
+ } else {
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig = NULL;
+ }
+
+ if(speedStatePars != NULL) {
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars = CALLOC(1,
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars));
+ memcpy((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars,
+ (void *)speedStatePars,sizeof(*speedStatePars));
+ } else {
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars = NULL;
+ }
+
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->s_Measure= rsrp;
+ } else {
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig = NULL;
+ }
+
+ if (mobilityInfo !=NULL) {
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo = CALLOC(1,
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo));
+ memcpy((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo, (void*)mobilityInfo,
+ sizeof(LTE_MobilityControlInfo_t));
+
+ } else {
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo = NULL;
+ }
+
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.dedicatedInfoNASList = dedicatedInfoNASList;
+ rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO = NULL;
+
+ enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message,
+ NULL,
+ (void*)&dl_dcch_msg,
+ buffer,
+ RRC_BUF_SIZE);
+ AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed %s, %lu!\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
+
+#ifdef XER_PRINT
+ xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)&dl_dcch_msg);
#endif
-)
+#if defined(ENABLE_ITTI)
+# if !defined(DISABLE_XER_SPRINT)
+ {
+ char message_string[30000];
+ size_t message_string_size;
+
+ if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) {
+ MessageDef *msg_p;
+
+ msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText));
+ msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size;
+ memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size);
+
+ itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
+ }
+ }
+# endif
+#endif
+
+
+ LOG_I(RRC,"RRCConnectionReconfiguration Encoded %d bits (%d bytes)\n",(int)enc_rval.encoded,(int)(enc_rval.encoded+7)/8);
+
+ return((enc_rval.encoded+7)/8);
+}
+#endif
+
+//------------------------------------------------------------------------------
+uint16_t do_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
+ uint8_t *buffer,
+ uint8_t Transaction_id,
+ LTE_SRB_ToAddModList_t *SRB_list,
+ LTE_DRB_ToAddModList_t *DRB_list,
+ LTE_DRB_ToReleaseList_t *DRB_list2,
+ struct LTE_SPS_Config *sps_Config,
+ struct LTE_PhysicalConfigDedicated *physicalConfigDedicated,
+ LTE_MeasObjectToAddModList_t *MeasObj_list,
+ LTE_ReportConfigToAddModList_t *ReportConfig_list,
+ LTE_QuantityConfig_t *quantityConfig,
+ LTE_MeasIdToAddModList_t *MeasId_list,
+ LTE_MAC_MainConfig_t *mac_MainConfig,
+ LTE_MeasGapConfig_t *measGapConfig,
+ LTE_MobilityControlInfo_t *mobilityInfo,
+ struct LTE_MeasConfig__speedStatePars *speedStatePars,
+ LTE_RSRP_Range_t *rsrp,
+ LTE_C_RNTI_t *cba_rnti,
+ struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList
+ *dedicatedInfoNASList,
+ LTE_SL_CommConfig_r12_t *sl_CommConfig,
+ LTE_SL_DiscConfig_r12_t *sl_DiscConfig
+#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+ , LTE_SCellToAddMod_r10_t *SCell_config
+#endif
+ )
//------------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;
@@ -2042,7 +3439,7 @@ do_RRCConnectionReconfiguration(
rrcConnectionReconfiguration->criticalExtensions.present = LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1;
rrcConnectionReconfiguration->criticalExtensions.choice.c1.present = LTE_RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8 ;
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated = CALLOC(1,
- sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated));
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated));
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList = SRB_list;
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList = DRB_list;
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToReleaseList = DRB_list2;
@@ -2054,12 +3451,12 @@ do_RRCConnectionReconfiguration(
if (mac_MainConfig!=NULL) {
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig = CALLOC(1,
- sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig));
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig));
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig->present
=LTE_RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue;
memcpy(&rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue,
- mac_MainConfig,
- sizeof(*mac_MainConfig));
+ mac_MainConfig,
+ sizeof(*mac_MainConfig));
} else {
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig=NULL;
}
@@ -2069,25 +3466,26 @@ do_RRCConnectionReconfiguration(
sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig));
memset((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig,
0, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig));
+
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list;
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list;
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list;
if (quantityConfig!=NULL) {
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig = CALLOC(1,
- sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig));
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig));
memcpy((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig,
- (void *)quantityConfig,
- sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig));
+ (void *)quantityConfig,
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig));
} else {
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig = NULL;
}
if(speedStatePars != NULL) {
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars = CALLOC(1,
- sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars));
+ sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars));
memcpy((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars,
- (void *)speedStatePars,sizeof(*speedStatePars));
+ (void *)speedStatePars,sizeof(*speedStatePars));
} else {
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars = NULL;
}
@@ -2356,10 +3754,8 @@ do_RRCConnectionReestablishment(
}
//------------------------------------------------------------------------------
-uint8_t
-do_RRCConnectionReestablishmentReject(
- uint8_t Mod_id,
- uint8_t *const buffer)
+uint8_t do_RRCConnectionReestablishmentReject(uint8_t Mod_id,
+ uint8_t *const buffer)
//------------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;
@@ -2394,10 +3790,8 @@ do_RRCConnectionReestablishmentReject(
}
//------------------------------------------------------------------------------
-uint8_t
-do_RRCConnectionReject(
- uint8_t Mod_id,
- uint8_t *const buffer)
+uint8_t do_RRCConnectionReject(uint8_t Mod_id,
+ uint8_t *const buffer)
//------------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;
@@ -2434,10 +3828,10 @@ do_RRCConnectionReject(
return((enc_rval.encoded+7)/8);
}
-uint8_t do_RRCConnectionRelease(
- uint8_t Mod_id,
- uint8_t *buffer,
- uint8_t Transaction_id) {
+uint8_t do_RRCConnectionRelease(uint8_t Mod_id,
+ uint8_t *buffer,
+ uint8_t Transaction_id)
+{
asn_enc_rval_t enc_rval;
LTE_DL_DCCH_Message_t dl_dcch_msg;
LTE_RRCConnectionRelease_t *rrcConnectionRelease;
@@ -2454,6 +3848,7 @@ uint8_t do_RRCConnectionRelease(
rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.idleModeMobilityControlInfo = NULL;
rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension=CALLOC(1,
sizeof(*rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension));
+
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message,
NULL,
(void *)&dl_dcch_msg,
@@ -2605,6 +4000,7 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
measurementReport->criticalExtensions.choice.c1.present=LTE_MeasurementReport__criticalExtensions__c1_PR_measurementReport_r8;
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension=CALLOC(1,
sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension));
+
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measId=measid;
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrpResult=rsrp_s;
@@ -2908,7 +4304,8 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) {
&UECapability.sdu[0],
MAX_UE_CAPABILITY_SIZE);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
+ enc_rval.failed_type->name, enc_rval.encoded);
+
UECapability.sdu_size = (enc_rval.encoded + 7) / 8;
LOG_I(PHY, "[RRC]UE Capability encoded, %d bytes (%zd bits)\n",
UECapability.sdu_size, enc_rval.encoded + 7);
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.h b/openair2/RRC/LTE/MESSAGES/asn1_msg.h
index 2d0c6ba7b6..819f90c336 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg.h
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.h
@@ -64,19 +64,31 @@ uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId);
@param phich_duration PHICH duration parameter
@param frame radio frame number
@return size of encoded bit stream in bytes*/
-uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame);
+uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame
+#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
+ , uint32_t schedulingInfoSIB1
+#endif
+ );
/**
\brief Generate configuration for SIB1 (eNB).
@param carrier pointer to Carrier information
@param Mod_id Instance of eNB
@param Component carrier Component carrier to configure
-@param configuration Pointer Configuration Request structure
+@param configuration Pointer Configuration Request structure
+@param br_flag Do for BL/CE UE configuration
@return size of encoded bit stream in bytes*/
-uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, RrcConfigurationReq *configuration
+uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id
+#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
+ , BOOLEAN_t brOption
+#endif
+#if defined(ENABLE_ITTI)
+ ,RrcConfigurationReq *configuration
+#endif
);
+
/**
\brief Generate a default configuration for SIB2/SIB3 in one System Information PDU (eNB).
@param Mod_id Index of eNB (used to derive some parameters)
@@ -90,6 +102,9 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, RrcConfigu
uint8_t do_SIB23(uint8_t Mod_id,
int CC_id
+#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
+ , BOOLEAN_t brOption
+#endif
#if defined(ENABLE_ITTI)
, RrcConfigurationReq *configuration
#endif
@@ -152,7 +167,47 @@ do_RRCConnectionSetup(
LTE_SRB_ToAddModList_t **SRB_configList,
struct LTE_PhysicalConfigDedicated **physicalConfigDedicated
);
+#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
+uint8_t
+do_RRCConnectionSetup_BR(
+ const protocol_ctxt_t* const ctxt_pP,
+ rrc_eNB_ue_context_t* const ue_context_pP,
+ int CC_id,
+ uint8_t* const buffer,
+ const uint8_t transmission_mode,
+ const uint8_t Transaction_id,
+ LTE_SRB_ToAddModList_t** SRB_configList,
+ struct LTE_PhysicalConfigDedicated** physicalConfigDedicated
+);
+#endif
+
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
+uint16_t
+do_RRCConnectionReconfiguration_BR(
+ const protocol_ctxt_t* const ctxt_pP,
+ uint8_t *buffer,
+ uint8_t Transaction_id,
+ LTE_SRB_ToAddModList_t *SRB_list,
+ LTE_DRB_ToAddModList_t *DRB_list,
+ LTE_DRB_ToReleaseList_t *DRB_list2,
+ struct LTE_SPS_Config *sps_Config,
+ struct LTE_PhysicalConfigDedicated *physicalConfigDedicated,
+ LTE_MeasObjectToAddModList_t *MeasObj_list,
+ LTE_ReportConfigToAddModList_t *ReportConfig_list,
+ LTE_QuantityConfig_t *quantityConfig,
+ LTE_MeasIdToAddModList_t *MeasId_list,
+ LTE_MAC_MainConfig_t *mac_MainConfig,
+ LTE_MeasGapConfig_t *measGapConfig,
+ LTE_MobilityControlInfo_t *mobilityInfo,
+ struct LTE_MeasConfig__speedStatePars *speedStatePars,
+ LTE_RSRP_Range_t *rsrp,
+ LTE_C_RNTI_t *cba_rnti,
+ struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList,
+ LTE_SCellToAddMod_r10_t *SCell_config
+ );
+#endif
/**
\brief Generate an RRCConnectionReconfiguration DL-DCCH-Message (eNB). This routine configures SRBToAddMod (SRB2) and one DRBToAddMod
(DRB3). PhysicalConfigDedicated is not updated.
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c
index 4c63db1d03..480f5c3516 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c
@@ -70,7 +70,7 @@
#include "enb_config.h"
#if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
+ #include "intertask_interface.h"
#endif
@@ -78,14 +78,12 @@
/*do_MIB_NB_NB_IoT*/
uint8_t do_MIB_NB_IoT(
- rrc_eNB_carrier_data_NB_IoT_t *carrier,
- uint16_t N_RB_DL,//may not needed--> for NB_IoT only 1 PRB is used
- uint32_t frame,
- uint32_t hyper_frame)
-{
+ rrc_eNB_carrier_data_NB_IoT_t *carrier,
+ uint16_t N_RB_DL,//may not needed--> for NB_IoT only 1 PRB is used
+ uint32_t frame,
+ uint32_t hyper_frame) {
asn_enc_rval_t enc_rval;
LTE_BCCH_BCH_Message_NB_t *mib_NB_IoT = &(carrier->mib_NB_IoT);
-
/*
* systemFrameNumber-MSB: (TS 36.331 pag 576)
* define the 4 MSB of the SFN (10 bits). The last significant 6 bits will be acquired implicitly by decoding the NPBCH
@@ -98,46 +96,39 @@ uint8_t do_MIB_NB_IoT(
*
* NOTE: in OAI never modify the SIB messages!!??
*/
-
//XXX check if correct the bit assignment
uint8_t sfn_MSB = (uint8_t)((frame>>6) & 0x0f); // all the 4 bits are set to 1
uint8_t hsfn_LSB = (uint8_t)(hyper_frame & 0x03); //2 bits set to 1 (0x3 = 0011)
uint16_t spare=0; //11 bits --> use uint16
-
mib_NB_IoT->message.systemFrameNumber_MSB_r13.buf = &sfn_MSB;
mib_NB_IoT->message.systemFrameNumber_MSB_r13.size = 1; //if expressed in byte
mib_NB_IoT->message.systemFrameNumber_MSB_r13.bits_unused = 4; //is byte based (so how many bits you don't use of the 8 bits of a bite
-
mib_NB_IoT->message.hyperSFN_LSB_r13.buf= &hsfn_LSB;
mib_NB_IoT->message.hyperSFN_LSB_r13.size= 1;
mib_NB_IoT->message.hyperSFN_LSB_r13.bits_unused = 6;
-
//XXX to be set??
mib_NB_IoT->message.spare.buf = (uint8_t *)&spare;
mib_NB_IoT->message.spare.size = 2;
mib_NB_IoT->message.spare.bits_unused = 5;
-
//decide how to set it
mib_NB_IoT->message.schedulingInfoSIB1_r13 =11; //see TS 36.213-->tables 16.4.1.3-3 ecc...
mib_NB_IoT->message.systemInfoValueTag_r13= 0;
mib_NB_IoT->message.ab_Enabled_r13 = 0;
-
//to be decided
mib_NB_IoT->message.operationModeInfo_r13.present = LTE_MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_SamePCI_r13;
mib_NB_IoT->message.operationModeInfo_r13.choice.inband_SamePCI_r13.eutra_CRS_SequenceInfo_r13 = 0;
-
printf("[MIB] Initialization of frame information,sfn_MSB %x, hsfn_LSB %x\n",
(uint32_t)sfn_MSB,
- (uint32_t)hsfn_LSB);
-
+ (uint32_t)hsfn_LSB);
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_BCH_Message_NB,
NULL,
- (void*)mib_NB_IoT,
+ (void *)mib_NB_IoT,
carrier->MIB_NB_IoT,
100);
+
if(enc_rval.encoded <= 0) {
- LOG_E(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
+ LOG_E(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
}
if (enc_rval.encoded==-1) {
@@ -145,63 +136,47 @@ uint8_t do_MIB_NB_IoT(
}
return((enc_rval.encoded+7)/8);
-
}
/*do_SIB1_NB*/
uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
- rrc_eNB_carrier_data_NB_IoT_t *carrier,
- NbIoTRrcConfigurationReq *configuration,
- uint32_t frame
- )
-{
+ rrc_eNB_carrier_data_NB_IoT_t *carrier,
+ NbIoTRrcConfigurationReq *configuration,
+ uint32_t frame
+ ) {
LTE_BCCH_DL_SCH_Message_NB_t *bcch_message= &(carrier->siblock1_NB_IoT);
LTE_SystemInformationBlockType1_NB_t **sib1_NB_IoT= &(carrier->sib1_NB_IoT);
-
-
asn_enc_rval_t enc_rval;
-
LTE_PLMN_IdentityInfo_NB_r13_t PLMN_identity_info_NB_IoT;
LTE_MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3];
LTE_SchedulingInfo_NB_r13_t *schedulingInfo_NB_IoT;
LTE_SIB_Type_NB_r13_t *sib_type_NB_IoT;
-
-
- long* attachWithoutPDN_Connectivity = NULL;
+ long *attachWithoutPDN_Connectivity = NULL;
attachWithoutPDN_Connectivity = CALLOC(1,sizeof(long));
long *nrs_CRS_PowerOffset=NULL;
nrs_CRS_PowerOffset = CALLOC(1, sizeof(long));
long *eutraControlRegionSize=NULL; //this parameter should be set only if we are considering in-band operating mode (samePCI or differentPCI)
- eutraControlRegionSize = CALLOC(1,sizeof(long));
+ eutraControlRegionSize = CALLOC(1,sizeof(long));
long systemInfoValueTagSI = 0;
-
memset(bcch_message,0,sizeof(LTE_BCCH_DL_SCH_Message_NB_t));
bcch_message->message.present = LTE_BCCH_DL_SCH_MessageType_NB_PR_c1;
bcch_message->message.choice.c1.present = LTE_BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformationBlockType1_r13;
-
//allocation
*sib1_NB_IoT = &bcch_message->message.choice.c1.choice.systemInformationBlockType1_r13;
-
-
/*TS 36.331 v14.2.0 pag 589
* hyperSFN-MSB
* Indicates the 8 most significant bits of the hyper-SFN. Together with the hyper-LSB in MIB-NB the complete HSFN is build up
*/
//FIXME see if correct
uint8_t hyperSFN_MSB = (uint8_t) ((frame>>2)& 0xff);
-
//XXX to be checked
(*sib1_NB_IoT)->hyperSFN_MSB_r13.buf = &hyperSFN_MSB;
(*sib1_NB_IoT)->hyperSFN_MSB_r13.size = 1;
(*sib1_NB_IoT)->hyperSFN_MSB_r13.bits_unused = 0;
-
memset(&PLMN_identity_info_NB_IoT,0,sizeof(LTE_PLMN_IdentityInfo_NB_r13_t));
-
PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc = CALLOC(1,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc));
memset(PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc,0,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc));
-
asn_set_empty(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list);//.size=0;
-
//left as it is???
#if defined(ENABLE_ITTI)
dummy_mcc[0] = (configuration->mcc / 100) % 10;
@@ -215,11 +190,8 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[0]);
ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[1]);
ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[2]);
-
PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list.size=0;
PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list.count=0;
-
-
#if defined(ENABLE_ITTI)
if (configuration->mnc >= 100) {
@@ -252,15 +224,11 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
//still set to "notReserved" as in the previous case
PLMN_identity_info_NB_IoT.cellReservedForOperatorUse_r13=LTE_PLMN_IdentityInfo_NB_r13__cellReservedForOperatorUse_r13_notReserved;
-
*attachWithoutPDN_Connectivity = 0;
PLMN_identity_info_NB_IoT.attachWithoutPDN_Connectivity_r13 = attachWithoutPDN_Connectivity;
-
ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.plmn_IdentityList_r13.list,&PLMN_identity_info_NB_IoT);
-
// 16 bits = 2 byte
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf = MALLOC(2); //MALLOC works in byte
-
//lefts as it is?
#if defined(ENABLE_ITTI)
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = (configuration->tac >> 8) & 0xff;
@@ -271,7 +239,6 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
#endif
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.size=2;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.bits_unused=0;
-
// 28 bits --> i have to use 32 bits = 4 byte
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf = MALLOC(8); // why allocate 8 byte?
#if defined(ENABLE_ITTI)
@@ -287,20 +254,14 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
#endif
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.size=4;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.bits_unused=4;
-
//Still set to "notBarred" as in the previous case
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellBarred_r13=LTE_SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__cellBarred_r13_notBarred;
-
//Still Set to "notAllowed" like in the previous case
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.intraFreqReselection_r13=LTE_SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__intraFreqReselection_r13_notAllowed;
-
-
(*sib1_NB_IoT)->cellSelectionInfo_r13.q_RxLevMin_r13=-65; //which value?? TS 36.331 V14.2.1 pag. 589
(*sib1_NB_IoT)->cellSelectionInfo_r13.q_QualMin_r13 = 0; //FIXME new parameter for SIB1-NB, not present in SIB1 (for cell reselection but if not used the UE should apply the default value)
-
(*sib1_NB_IoT)->p_Max_r13 = CALLOC(1, sizeof(LTE_P_Max_t));
*((*sib1_NB_IoT)->p_Max_r13) = 23;
-
//FIXME
(*sib1_NB_IoT)->freqBandIndicator_r13 =
#if defined(ENABLE_ITTI)
@@ -308,70 +269,55 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
#else
5; //if not configured we use band 5 (UL: 824 MHz - 849MHz / DL: 869 MHz - 894 MHz FDD mode)
#endif
-
- //OPTIONAL new parameters, to be used?
- /*
- * freqBandInfo_r13
- * multiBandInfoList_r13
- * nrs_CRS_PowerOffset_r13
- * sib1_NB_IoT->downlinkBitmap_r13.choice.subframePattern10_r13 =(is a BIT_STRING)
- */
-
-
- (*sib1_NB_IoT)->downlinkBitmap_r13 = CALLOC(1, sizeof(struct LTE_DL_Bitmap_NB_r13));
- ((*sib1_NB_IoT)->downlinkBitmap_r13)->present= LTE_DL_Bitmap_NB_r13_PR_NOTHING;
-
- *eutraControlRegionSize = 1;
- (*sib1_NB_IoT)->eutraControlRegionSize_r13 = eutraControlRegionSize;
-
-
- *nrs_CRS_PowerOffset= 0;
- (*sib1_NB_IoT)->nrs_CRS_PowerOffset_r13 = nrs_CRS_PowerOffset;
-
- schedulingInfo_NB_IoT = (LTE_SchedulingInfo_NB_r13_t*) malloc (3*sizeof(LTE_SchedulingInfo_NB_r13_t));
- sib_type_NB_IoT = (LTE_SIB_Type_NB_r13_t *) malloc (3*sizeof(LTE_SIB_Type_NB_r13_t));
-
+ //OPTIONAL new parameters, to be used?
+ /*
+ * freqBandInfo_r13
+ * multiBandInfoList_r13
+ * nrs_CRS_PowerOffset_r13
+ * sib1_NB_IoT->downlinkBitmap_r13.choice.subframePattern10_r13 =(is a BIT_STRING)
+ */
+ (*sib1_NB_IoT)->downlinkBitmap_r13 = CALLOC(1, sizeof(struct LTE_DL_Bitmap_NB_r13));
+ ((*sib1_NB_IoT)->downlinkBitmap_r13)->present= LTE_DL_Bitmap_NB_r13_PR_NOTHING;
+ *eutraControlRegionSize = 1;
+ (*sib1_NB_IoT)->eutraControlRegionSize_r13 = eutraControlRegionSize;
+ *nrs_CRS_PowerOffset= 0;
+ (*sib1_NB_IoT)->nrs_CRS_PowerOffset_r13 = nrs_CRS_PowerOffset;
+ schedulingInfo_NB_IoT = (LTE_SchedulingInfo_NB_r13_t *) malloc (3*sizeof(LTE_SchedulingInfo_NB_r13_t));
+ sib_type_NB_IoT = (LTE_SIB_Type_NB_r13_t *) malloc (3*sizeof(LTE_SIB_Type_NB_r13_t));
memset(&schedulingInfo_NB_IoT[0],0,sizeof(LTE_SchedulingInfo_NB_r13_t));
memset(&schedulingInfo_NB_IoT[1],0,sizeof(LTE_SchedulingInfo_NB_r13_t));
- memset(&schedulingInfo_NB_IoT[2],0,sizeof(LTE_SchedulingInfo_NB_r13_t));
+ memset(&schedulingInfo_NB_IoT[2],0,sizeof(LTE_SchedulingInfo_NB_r13_t));
memset(&sib_type_NB_IoT[0],0,sizeof(LTE_SIB_Type_NB_r13_t));
memset(&sib_type_NB_IoT[1],0,sizeof(LTE_SIB_Type_NB_r13_t));
memset(&sib_type_NB_IoT[2],0,sizeof(LTE_SIB_Type_NB_r13_t));
-
-
// Now, follow the scheduler SIB configuration
// There is only one sib2+sib3 common setting
schedulingInfo_NB_IoT[0].si_Periodicity_r13=LTE_SchedulingInfo_NB_r13__si_Periodicity_r13_rf4096;
- schedulingInfo_NB_IoT[0].si_RepetitionPattern_r13=LTE_SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF; //This Indicates the starting radio frames within the SI window used for SI message transmission.
+ schedulingInfo_NB_IoT[0].si_RepetitionPattern_r13=
+ LTE_SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF; //This Indicates the starting radio frames within the SI window used for SI message transmission.
schedulingInfo_NB_IoT[0].si_TB_r13= LTE_SchedulingInfo_NB_r13__si_TB_r13_b680;//208 bits
-
-
// This is for SIB2/3
/*SIB3 --> There is no mapping information of SIB2 since it is always present
* in the first SystemInformation message
* listed in the schedulingInfoList list.
* */
sib_type_NB_IoT[0]=LTE_SIB_Type_NB_r13_sibType3_NB_r13;
-
ASN_SEQUENCE_ADD(&schedulingInfo_NB_IoT[0].sib_MappingInfo_r13.list,&sib_type_NB_IoT[0]);
ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->schedulingInfoList_r13.list,&schedulingInfo_NB_IoT[0]);
-
//printf("[ASN Debug] SI P: %ld\n",(*sib1_NB_IoT)->schedulingInfoList_r13.list.array[0]->si_Periodicity_r13);
-
#if defined(ENABLE_ITTI)
if (configuration->frame_type == TDD)
#endif
{
- //FIXME in NB-IoT mandatory to be FDD --> so must give an error
- LOG_E(RRC,"[NB-IoT %d] Frame Type is TDD --> not supported by NB-IoT, exiting\n", Mod_id); //correct?
- exit(-1);
+ //FIXME in NB-IoT mandatory to be FDD --> so must give an error
+ LOG_E(RRC,"[NB-IoT %d] Frame Type is TDD --> not supported by NB-IoT, exiting\n", Mod_id); //correct?
+ exit(-1);
}
//FIXME which value chose for the following parameter
(*sib1_NB_IoT)->si_WindowLength_r13=LTE_SystemInformationBlockType1_NB__si_WindowLength_r13_ms160;
(*sib1_NB_IoT)->si_RadioFrameOffset_r13= 0;
-
/*In Nb-IoT change/update of specific SI message can additionally be indicated by a SI message specific value tag
* systemInfoValueTagSI (there is no SystemInfoValueTag in SIB1-NB but only in MIB-NB)
*contained in systemInfoValueTagList_r13
@@ -381,24 +327,21 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
asn_set_empty(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list);
ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list,&systemInfoValueTagSI);
-
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message_NB, (void*)bcch_message);
+ xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message_NB, (void *)bcch_message);
}
-
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_DL_SCH_Message_NB,
NULL,
- (void*)bcch_message,
+ (void *)bcch_message,
carrier->SIB1_NB_IoT,
100);
- if (enc_rval.encoded > 0){
- LOG_E(RRC,"ASN1 message encoding failed (%s, %lu)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
+ if (enc_rval.encoded > 0) {
+ LOG_E(RRC,"ASN1 message encoding failed (%s, %lu)!\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
}
-
#ifdef USER_MODE
LOG_D(RRC,"[NB-IoT] SystemInformationBlockType1-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
@@ -415,34 +358,26 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
int CC_id,
rrc_eNB_carrier_data_NB_IoT_t *carrier,//MP: this is already a carrier[CC_id]
- NbIoTRrcConfigurationReq *configuration ) //openair2/COMMON/rrc_messages_types.h
-{
+ NbIoTRrcConfigurationReq *configuration ) { //openair2/COMMON/rrc_messages_types.h
struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member *sib2_NB_part;
struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member *sib3_NB_part;
-
LTE_BCCH_DL_SCH_Message_NB_t *bcch_message = &(carrier->systemInformation_NB_IoT); //is the systeminformation-->BCCH_DL_SCH_Message_NB
LTE_SystemInformationBlockType2_NB_r13_t *sib2_NB_IoT;
LTE_SystemInformationBlockType3_NB_r13_t *sib3_NB_IoT;
-
asn_enc_rval_t enc_rval;
LTE_RACH_Info_NB_r13_t rach_Info_NB_IoT;
LTE_NPRACH_Parameters_NB_r13_t *nprach_parameters;
-
//optional
long *connEstFailOffset = NULL;
connEstFailOffset = CALLOC(1, sizeof(long));
-
-// RSRP_ThresholdsNPRACH_InfoList_NB_r13_t *rsrp_ThresholdsPrachInfoList;
-// RSRP_Range_t rsrp_range;
-
+ // RSRP_ThresholdsNPRACH_InfoList_NB_r13_t *rsrp_ThresholdsPrachInfoList;
+ // RSRP_Range_t rsrp_range;
LTE_ACK_NACK_NumRepetitions_NB_r13_t ack_nack_repetition;
struct LTE_NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13 *dmrs_config;
- struct LTE_DL_GapConfig_NB_r13 *dl_Gap;
-
+ struct LTE_DL_GapConfig_NB_r13 *dl_Gap;
long *srs_SubframeConfig;
srs_SubframeConfig= CALLOC(1, sizeof(long));
-
if (bcch_message) {
memset(bcch_message,0,sizeof(LTE_BCCH_DL_SCH_Message_NB_t));
} else {
@@ -451,84 +386,64 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
}
//before schould be allocated memory somewhere?
-// if (!carrier->sib2_NB_IoT) {
-// LOG_E(RRC,"[NB-IoT %d] sib2_NB_IoT is null, exiting\n", Mod_id);
-// exit(-1);
-// }
-//
-// if (!carrier->sib3_NB_IoT) {
-// LOG_E(RRC,"[NB-IoT %d] sib3_NB_IoT is null, exiting\n", Mod_id);
-// exit(-1);
-// }
-
-
+ // if (!carrier->sib2_NB_IoT) {
+ // LOG_E(RRC,"[NB-IoT %d] sib2_NB_IoT is null, exiting\n", Mod_id);
+ // exit(-1);
+ // }
+ //
+ // if (!carrier->sib3_NB_IoT) {
+ // LOG_E(RRC,"[NB-IoT %d] sib3_NB_IoT is null, exiting\n", Mod_id);
+ // exit(-1);
+ // }
LOG_I(RRC,"[NB-IoT %d] Configuration SIB2/3\n", Mod_id);
-
sib2_NB_part = CALLOC(1,sizeof(struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member));
sib3_NB_part = CALLOC(1,sizeof(struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member));
memset(sib2_NB_part,0,sizeof(struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member));
memset(sib3_NB_part,0,sizeof(struct LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member));
-
sib2_NB_part->present = LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib2_r13;
sib3_NB_part->present = LTE_SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib3_r13;
-
//may bug if not correct allocation of memory
carrier->sib2_NB_IoT = &sib2_NB_part->choice.sib2_r13;
carrier->sib3_NB_IoT = &sib3_NB_part->choice.sib3_r13;
sib2_NB_IoT = carrier->sib2_NB_IoT;
sib3_NB_IoT = carrier->sib3_NB_IoT;
-
nprach_parameters = (LTE_NPRACH_Parameters_NB_r13_t *) malloc (3*sizeof(LTE_NPRACH_Parameters_NB_r13_t));
-
memset(&nprach_parameters[0],0,sizeof(LTE_NPRACH_Parameters_NB_r13_t));
memset(&nprach_parameters[1],0,sizeof(LTE_NPRACH_Parameters_NB_r13_t));
memset(&nprach_parameters[2],0,sizeof(LTE_NPRACH_Parameters_NB_r13_t));
-
-/// SIB2-NB-----------------------------------------
-
+ /// SIB2-NB-----------------------------------------
//Barring is manage by ab-Enabled in MIB-NB (but is not a struct as ac-BarringInfo in LTE legacy)
-
//RACH Config. Common--------------------------------------------------------------
sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.preambleTransMax_CE_r13 =
- configuration->rach_preambleTransMax_CE_NB;
+ configuration->rach_preambleTransMax_CE_NB;
sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.powerRampingParameters_r13.powerRampingStep =
- configuration->rach_powerRampingStep_NB;
+ configuration->rach_powerRampingStep_NB;
sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.powerRampingParameters_r13.preambleInitialReceivedTargetPower =
configuration->rach_preambleInitialReceivedTargetPower_NB;
-
rach_Info_NB_IoT.ra_ResponseWindowSize_r13 = configuration->rach_raResponseWindowSize_NB;
rach_Info_NB_IoT.mac_ContentionResolutionTimer_r13 = configuration-> rach_macContentionResolutionTimer_NB;
//rach_infoList max size = maxNPRACH-Resources-NB-r13 = 3
ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.rach_InfoList_r13.list,&rach_Info_NB_IoT);
-
//TS 36.331 pag 614 --> if not present the value to infinity sould be used
*connEstFailOffset = 0;
-
sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.connEstFailOffset_r13 = connEstFailOffset; /*OPTIONAL*/
-
-
// BCCH-Config-NB-IoT----------------------------------------------------------------
sib2_NB_IoT->radioResourceConfigCommon_r13.bcch_Config_r13.modificationPeriodCoeff_r13
= configuration->bcch_modificationPeriodCoeff_NB;
-
// PCCH-Config-NB-IoT-----------------------------------------------------------------
sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.defaultPagingCycle_r13
= configuration->pcch_defaultPagingCycle_NB;
sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.nB_r13 = configuration->pcch_nB_NB;
sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.npdcch_NumRepetitionPaging_r13 = configuration-> pcch_npdcch_NumRepetitionPaging_NB;
-
//NPRACH-Config-NB-IoT-----------------------------------------------------------------
-
- sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13 = NULL;
+ sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13 = NULL;
sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_CP_Length_r13 = configuration->nprach_CP_Length;
/*OPTIONAL*/
-// =CALLOC(1, sizeof(struct RSRP_ThresholdsNPRACH_InfoList_NB_r13)); //fatto uguale dopo
-// rsrp_ThresholdsPrachInfoList = sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13;
-// rsrp_range = configuration->nprach_rsrp_range_NB;
-// ASN_SEQUENCE_ADD(&rsrp_ThresholdsPrachInfoList->list,rsrp_range);
-
+ // =CALLOC(1, sizeof(struct RSRP_ThresholdsNPRACH_InfoList_NB_r13)); //fatto uguale dopo
+ // rsrp_ThresholdsPrachInfoList = sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13;
+ // rsrp_range = configuration->nprach_rsrp_range_NB;
+ // ASN_SEQUENCE_ADD(&rsrp_ThresholdsPrachInfoList->list,rsrp_range);
// According configuration to set the 3 CE level configuration setting
-
nprach_parameters[0].nprach_Periodicity_r13 = configuration->nprach_Periodicity[0];
nprach_parameters[0].nprach_StartTime_r13 = configuration->nprach_StartTime[0];
nprach_parameters[0].nprach_SubcarrierOffset_r13 = configuration->nprach_SubcarrierOffset[0];
@@ -539,7 +454,6 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
nprach_parameters[0].npdcch_NumRepetitions_RA_r13 = configuration->npdcch_NumRepetitions_RA[0];
nprach_parameters[0].npdcch_StartSF_CSS_RA_r13 = configuration->npdcch_StartSF_CSS_RA[0];
nprach_parameters[0].npdcch_Offset_RA_r13 = configuration->npdcch_Offset_RA[0];
-
nprach_parameters[1].nprach_Periodicity_r13 = configuration->nprach_Periodicity[1];
nprach_parameters[1].nprach_StartTime_r13 = configuration->nprach_StartTime[1];
nprach_parameters[1].nprach_SubcarrierOffset_r13 = configuration->nprach_SubcarrierOffset[1];
@@ -550,7 +464,6 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
nprach_parameters[1].npdcch_NumRepetitions_RA_r13 = configuration->npdcch_NumRepetitions_RA[1];
nprach_parameters[1].npdcch_StartSF_CSS_RA_r13 = configuration->npdcch_StartSF_CSS_RA[1];
nprach_parameters[1].npdcch_Offset_RA_r13 = configuration->npdcch_Offset_RA[1];
-
nprach_parameters[2].nprach_Periodicity_r13 = configuration->nprach_Periodicity[2];
nprach_parameters[2].nprach_StartTime_r13 = configuration->nprach_StartTime[2];
nprach_parameters[2].nprach_SubcarrierOffset_r13 = configuration->nprach_SubcarrierOffset[2];
@@ -561,40 +474,29 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
nprach_parameters[2].npdcch_NumRepetitions_RA_r13 = configuration->npdcch_NumRepetitions_RA[2];
nprach_parameters[2].npdcch_StartSF_CSS_RA_r13 = configuration->npdcch_StartSF_CSS_RA[2];
nprach_parameters[2].npdcch_Offset_RA_r13 = configuration->npdcch_Offset_RA[2];
-
-
//nprach_parameterList have a max size of 3 possible nprach configuration (see maxNPRACH_Resources_NB_r13)
ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[0]);
ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[1]);
ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[2]);
-
// NPDSCH-Config NB-IOT
sib2_NB_IoT->radioResourceConfigCommon_r13.npdsch_ConfigCommon_r13.nrs_Power_r13= configuration->npdsch_nrs_Power;
-
-
//NPUSCH-Config NB-IoT----------------------------------------------------------------
//list of size 3 (see maxNPRACH_Resources_NB_r13)
ack_nack_repetition = configuration-> npusch_ack_nack_numRepetitions_NB; //is an enumerative
ASN_SEQUENCE_ADD(&(sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list) ,&ack_nack_repetition);
-
*srs_SubframeConfig = configuration->npusch_srs_SubframeConfig_NB;
sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.srs_SubframeConfig_r13= srs_SubframeConfig; /*OPTIONAL*/
-
-
/*OPTIONAL*/
dmrs_config = CALLOC(1,sizeof(struct LTE_NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13));
dmrs_config->threeTone_CyclicShift_r13 = configuration->npusch_threeTone_CyclicShift_r13;
dmrs_config->sixTone_CyclicShift_r13 = configuration->npusch_sixTone_CyclicShift_r13;
-
/*OPTIONAL
* -define the base sequence for a DMRS sequence in a cell with multi tone transmission (3,6,12) see TS 36.331 NPUSCH-Config-NB
* -if not defined will be calculated based on the cellID once we configure the phy layer (rrc_mac_config_req) through the config_sib2 */
dmrs_config->threeTone_BaseSequence_r13 = NULL;
dmrs_config->sixTone_BaseSequence_r13 = NULL;
dmrs_config->twelveTone_BaseSequence_r13 = NULL;
-
sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.dmrs_Config_r13 = dmrs_config;
-
//ulReferenceSignalsNPUSCH
/*Reference Signal (RS) for UL in NB-IoT is called DRS (Demodulation Reference Signal)
* sequence-group hopping can be enabled or disabled by means of the cell-specific parameter groupHoppingEnabled_r13
@@ -603,22 +505,17 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
*/
sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupHoppingEnabled_r13= configuration->npusch_groupHoppingEnabled;
sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13 =configuration->npusch_groupAssignmentNPUSCH_r13;
-
-
//dl_GAP---------------------------------------------------------------------------------/*OPTIONAL*/
dl_Gap = CALLOC(1,sizeof(struct LTE_DL_GapConfig_NB_r13));
dl_Gap->dl_GapDurationCoeff_r13= configuration-> dl_GapDurationCoeff_NB;
dl_Gap->dl_GapPeriodicity_r13= configuration->dl_GapPeriodicity_NB;
dl_Gap->dl_GapThreshold_r13= configuration->dl_GapThreshold_NB;
sib2_NB_IoT->radioResourceConfigCommon_r13.dl_Gap_r13 = dl_Gap;
-
-
// uplinkPowerControlCommon - NB-IoT------------------------------------------------------
sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.p0_NominalNPUSCH_r13 = configuration->npusch_p0_NominalNPUSCH;
sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.deltaPreambleMsg3_r13 = configuration->deltaPreambleMsg3;
sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.alpha_r13 = configuration->npusch_alpha;
//no deltaFlist_PUCCH and no UL cyclic prefix
-
// UE Timers and Constants -NB-IoT--------------------------------------------------------
sib2_NB_IoT->ue_TimersAndConstants_r13.t300_r13 = configuration-> ue_TimersAndConstants_t300_NB;
sib2_NB_IoT->ue_TimersAndConstants_r13.t301_r13 = configuration-> ue_TimersAndConstants_t301_NB;
@@ -626,61 +523,47 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
sib2_NB_IoT->ue_TimersAndConstants_r13.t311_r13 = configuration-> ue_TimersAndConstants_t311_NB;
sib2_NB_IoT->ue_TimersAndConstants_r13.n310_r13 = configuration-> ue_TimersAndConstants_n310_NB;
sib2_NB_IoT->ue_TimersAndConstants_r13.n311_r13 = configuration-> ue_TimersAndConstants_n311_NB;
-
//other SIB2-NB Parameters--------------------------------------------------------------------------------
sib2_NB_IoT->freqInfo_r13.additionalSpectrumEmission_r13 = 1;
sib2_NB_IoT->freqInfo_r13.ul_CarrierFreq_r13 = NULL; /*OPTIONAL*/
-
sib2_NB_IoT->timeAlignmentTimerCommon_r13=LTE_TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120;
-
/*OPTIONAL*/
sib2_NB_IoT->multiBandInfoList_r13 = NULL;
-
-/// SIB3-NB-------------------------------------------------------
-
+ /// SIB3-NB-------------------------------------------------------
sib3_NB_IoT->cellReselectionInfoCommon_r13.q_Hyst_r13=LTE_SystemInformationBlockType3_NB_r13__cellReselectionInfoCommon_r13__q_Hyst_r13_dB4;
sib3_NB_IoT->cellReselectionServingFreqInfo_r13.s_NonIntraSearch_r13=0; //or define in configuration?
-
sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_RxLevMin_r13 = -70;
//new
sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_QualMin_r13 = CALLOC(1,sizeof(*sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_QualMin_r13));
*(sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_QualMin_r13)= 10; //a caso
-
sib3_NB_IoT->intraFreqCellReselectionInfo_r13.p_Max_r13 = NULL;
sib3_NB_IoT->intraFreqCellReselectionInfo_r13.s_IntraSearchP_r13 = 31; // s_intraSearch --> s_intraSearchP!!! (they call in a different way)
sib3_NB_IoT->intraFreqCellReselectionInfo_r13.t_Reselection_r13=1;
-
//how to manage?
sib3_NB_IoT->freqBandInfo_r13 = NULL;
sib3_NB_IoT->multiBandInfoList_r13 = NULL;
-
-
-///BCCH message (generate the SI message)
+ ///BCCH message (generate the SI message)
bcch_message->message.present = LTE_BCCH_DL_SCH_MessageType_NB_PR_c1;
bcch_message->message.choice.c1.present = LTE_BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformation_r13;
-
bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.present = LTE_SystemInformation_NB__criticalExtensions_PR_systemInformation_r13;
bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list.count=0;
-
ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list,
sib2_NB_part);
ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list,
sib3_NB_part);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message_NB, (void*)bcch_message);
+ xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message_NB, (void *)bcch_message);
}
+
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_BCCH_DL_SCH_Message_NB,
NULL,
- (void*)bcch_message,
+ (void *)bcch_message,
carrier->SIB23_NB_IoT,
900);
-// AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
-// enc_rval.failed_type->name, enc_rval.encoded);
-
-//#if defined(ENABLE_ITTI).....
-
-
+ // AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
+ // enc_rval.failed_type->name, enc_rval.encoded);
+ //#if defined(ENABLE_ITTI).....
#ifdef USER_MODE
LOG_D(RRC,"[NB-IoT] SystemInformation-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
@@ -692,270 +575,226 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
carrier->sib2_NB_IoT = sib2_NB_IoT;
carrier->sib3_NB_IoT = sib3_NB_IoT;
-
return((enc_rval.encoded+7)/8);
}
/*do_RRCConnectionSetup_NB_IoT--> the aim is to establish SRB1 and SRB1bis(implicitly)*/
uint8_t do_RRCConnectionSetup_NB_IoT(
- const protocol_ctxt_t* const ctxt_pP,
- rrc_eNB_ue_context_NB_IoT_t* const ue_context_pP,
+ const protocol_ctxt_t *const ctxt_pP,
+ rrc_eNB_ue_context_NB_IoT_t *const ue_context_pP,
int CC_id,
- uint8_t* const buffer, //Srb0.Tx_buffer.Payload
+ uint8_t *const buffer, //Srb0.Tx_buffer.Payload
const uint8_t Transaction_id,
- const NB_IoT_DL_FRAME_PARMS* const frame_parms, // maybe not used
- LTE_SRB_ToAddModList_NB_r13_t** SRB_configList_NB_IoT, //for both SRB1bis and SRB1
- struct LTE_PhysicalConfigDedicated_NB_r13** physicalConfigDedicated_NB_IoT
+ const NB_IoT_DL_FRAME_PARMS *const frame_parms, // maybe not used
+ LTE_SRB_ToAddModList_NB_r13_t **SRB_configList_NB_IoT, //for both SRB1bis and SRB1
+ struct LTE_PhysicalConfigDedicated_NB_r13 **physicalConfigDedicated_NB_IoT
)
{
+ asn_enc_rval_t enc_rval;
+ //MP:logical channel group not defined for Nb-IoT
+ //MP: logical channel priority pag 605 (is 1 for SRB1 and for SRB1bis should be the same)
+ //long* prioritySRB1 = NULL;
+ long *prioritySRB1bis = NULL;
+ BOOLEAN_t *logicalChannelSR_Prohibit =NULL; //pag 605
+ BOOLEAN_t *npusch_AllSymbols= NULL;
+ // struct SRB_ToAddMod_NB_r13* SRB1_config_NB = NULL;
+ // struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1_rlc_config_NB = NULL;
+ // struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1_lchan_config_NB = NULL;
+ struct LTE_SRB_ToAddMod_NB_r13 *SRB1bis_config_NB_IoT = NULL;
+ struct LTE_SRB_ToAddMod_NB_r13__rlc_Config_r13 *SRB1bis_rlc_config_NB_IoT = NULL;
+ struct LTE_SRB_ToAddMod_NB_r13__logicalChannelConfig_r13 *SRB1bis_lchan_config_NB_IoT = NULL;
+ //No UL_specific parameters for NB-IoT in LogicalChanelConfig-NB
+ LTE_PhysicalConfigDedicated_NB_r13_t *physicalConfigDedicated2_NB_IoT = NULL;
+ LTE_DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT;
+ LTE_RRCConnectionSetup_NB_t *rrcConnectionSetup_NB_IoT = NULL;
+ memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(LTE_DL_CCCH_Message_NB_t));
+ dl_ccch_msg_NB_IoT.message.present = LTE_DL_CCCH_MessageType_NB_PR_c1;
+ dl_ccch_msg_NB_IoT.message.choice.c1.present = LTE_DL_CCCH_MessageType_NB__c1_PR_rrcConnectionSetup_r13;
+ rrcConnectionSetup_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionSetup_r13;
- asn_enc_rval_t enc_rval;
-
-
- //MP:logical channel group not defined for Nb-IoT
-
- //MP: logical channel priority pag 605 (is 1 for SRB1 and for SRB1bis should be the same)
- //long* prioritySRB1 = NULL;
- long* prioritySRB1bis = NULL;
- BOOLEAN_t* logicalChannelSR_Prohibit =NULL; //pag 605
- BOOLEAN_t* npusch_AllSymbols= NULL;
-
-// struct SRB_ToAddMod_NB_r13* SRB1_config_NB = NULL;
-// struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1_rlc_config_NB = NULL;
-// struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1_lchan_config_NB = NULL;
-
- struct LTE_SRB_ToAddMod_NB_r13* SRB1bis_config_NB_IoT = NULL;
- struct LTE_SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1bis_rlc_config_NB_IoT = NULL;
- struct LTE_SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1bis_lchan_config_NB_IoT = NULL;
-
- //No UL_specific parameters for NB-IoT in LogicalChanelConfig-NB
-
- LTE_PhysicalConfigDedicated_NB_r13_t* physicalConfigDedicated2_NB_IoT = NULL;
- LTE_DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT;
- LTE_RRCConnectionSetup_NB_t* rrcConnectionSetup_NB_IoT = NULL;
-
- memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(LTE_DL_CCCH_Message_NB_t));
- dl_ccch_msg_NB_IoT.message.present = LTE_DL_CCCH_MessageType_NB_PR_c1;
- dl_ccch_msg_NB_IoT.message.choice.c1.present = LTE_DL_CCCH_MessageType_NB__c1_PR_rrcConnectionSetup_r13;
- rrcConnectionSetup_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionSetup_r13;
-
-
- if (*SRB_configList_NB_IoT) {
- free(*SRB_configList_NB_IoT);
- }
- *SRB_configList_NB_IoT = CALLOC(1,sizeof(LTE_SRB_ToAddModList_NB_r13_t));
-
-/// SRB1--------------------
- {
-// SRB1_config_NB = CALLOC(1,sizeof(*SRB1_config_NB));
-//
-// //no srb_Identity in SRB_ToAddMod_NB
-//
-// SRB1_rlc_config_NB = CALLOC(1,sizeof(*SRB1_rlc_config_NB));
-// SRB1_config_NB->rlc_Config_r13 = SRB1_rlc_config_NB;
-//
-// SRB1_rlc_config_NB->present = SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue;
-// SRB1_rlc_config_NB->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//the only possible in NB_IoT
-//
-//// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = enb_properties.properties[ctxt_pP->module_id]->srb1_timer_poll_retransmit_r13;
-//// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = enb_properties.properties[ctxt_pP->module_id]->srb1_max_retx_threshold_r13;
-//// //(musT be disabled--> SRB1 config pag 640 specs )
-//// SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL;
-//
-//
-// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000;
-// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8;
-// //(musT be disabled--> SRB1 config pag 640 specs )
-// SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 = NULL;
-//
-// SRB1_lchan_config_NB = CALLOC(1,sizeof(*SRB1_lchan_config_NB));
-// SRB1_config_NB->logicalChannelConfig_r13 = SRB1_lchan_config_NB;
-//
-// SRB1_lchan_config_NB->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue;
-//
-//
-// prioritySRB1 = CALLOC(1, sizeof(long));
-// *prioritySRB1 = 1;
-// SRB1_lchan_config_NB->choice.explicitValue.priority_r13 = prioritySRB1;
-//
-// logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t));
-// *logicalChannelSR_Prohibit = 1;
-// //schould be set to TRUE (specs pag 641)
-// SRB1_lchan_config_NB->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit;
-//
-// //ADD SRB1
-// ASN_SEQUENCE_ADD(&(*SRB_configList_NB_IoT)->list,SRB1_config_NB);
- }
-
-///SRB1bis (The configuration for SRB1 and SRB1bis is the same) the only difference is the logical channel identity = 3 but not set here
-
- SRB1bis_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_config_NB_IoT));
-
- //no srb_Identity in SRB_ToAddMod_NB
- SRB1bis_rlc_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_rlc_config_NB_IoT));
- SRB1bis_config_NB_IoT->rlc_Config_r13 = SRB1bis_rlc_config_NB_IoT;
-
- SRB1bis_rlc_config_NB_IoT->present = LTE_SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue;
- SRB1bis_rlc_config_NB_IoT->choice.explicitValue.present=LTE_RLC_Config_NB_r13_PR_am;//MP: the only possible RLC config in NB_IoT
-
- SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = LTE_T_PollRetransmit_NB_r13_ms25000;
- SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = LTE_UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8;
- //(musT be disabled--> SRB1 config pag 640 specs )
- SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL;
-
- SRB1bis_lchan_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_lchan_config_NB_IoT));
- SRB1bis_config_NB_IoT->logicalChannelConfig_r13 = SRB1bis_lchan_config_NB_IoT;
-
- SRB1bis_lchan_config_NB_IoT->present = LTE_SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue;
-
- prioritySRB1bis = CALLOC(1, sizeof(long));
- *prioritySRB1bis = 1; //same as SRB1?
- SRB1bis_lchan_config_NB_IoT->choice.explicitValue.priority_r13 = prioritySRB1bis;
-
- logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t));
- *logicalChannelSR_Prohibit = 1; //schould be set to TRUE (specs pag 641)
- SRB1bis_lchan_config_NB_IoT->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit;
-
- //ADD SRB1bis
- //MP: Actually there is no way to distinguish SRB1 and SRB1bis once put in the list
- //MP: SRB_ToAddModList_NB_r13_t size = 1
- ASN_SEQUENCE_ADD(&(*SRB_configList_NB_IoT)->list,SRB1bis_config_NB_IoT);
-
-
- // PhysicalConfigDedicated (NPDCCH, NPUSCH, CarrierConfig, UplinkPowerControl)
-
- physicalConfigDedicated2_NB_IoT = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT));
- *physicalConfigDedicated_NB_IoT = physicalConfigDedicated2_NB_IoT;
-
- physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13= CALLOC(1, sizeof(*physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13));
- physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13));
- physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13));
- physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13));
-
- //no tpc, no cqi and no pucch, no pdsch, no soundingRS, no AntennaInfo, no scheduling request config
-
- /*
- * NB-IoT supports the operation with either one or two antenna ports, AP0 and AP1.
- * For the latter case, Space Frequency Block Coding (SFBC) is applied.
- * Once selected, the same transmission scheme applies to NPBCH, NPDCCH, and NPDSCH.
- * */
-
- //FIXME: MP: CarrierConfigDedicated check the set values ----------------------------------------------
+ if (*SRB_configList_NB_IoT) {
+ free(*SRB_configList_NB_IoT);
+ }
+ *SRB_configList_NB_IoT = CALLOC(1,sizeof(LTE_SRB_ToAddModList_NB_r13_t));
+ /// SRB1--------------------
+ {
+ // SRB1_config_NB = CALLOC(1,sizeof(*SRB1_config_NB));
+ //
+ // //no srb_Identity in SRB_ToAddMod_NB
+ //
+ // SRB1_rlc_config_NB = CALLOC(1,sizeof(*SRB1_rlc_config_NB));
+ // SRB1_config_NB->rlc_Config_r13 = SRB1_rlc_config_NB;
+ //
+ // SRB1_rlc_config_NB->present = SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue;
+ // SRB1_rlc_config_NB->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//the only possible in NB_IoT
+ //
+ //// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = enb_properties.properties[ctxt_pP->module_id]->srb1_timer_poll_retransmit_r13;
+ //// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = enb_properties.properties[ctxt_pP->module_id]->srb1_max_retx_threshold_r13;
+ //// //(musT be disabled--> SRB1 config pag 640 specs )
+ //// SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL;
+ //
+ //
+ // SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000;
+ // SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8;
+ // //(musT be disabled--> SRB1 config pag 640 specs )
+ // SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 = NULL;
+ //
+ // SRB1_lchan_config_NB = CALLOC(1,sizeof(*SRB1_lchan_config_NB));
+ // SRB1_config_NB->logicalChannelConfig_r13 = SRB1_lchan_config_NB;
+ //
+ // SRB1_lchan_config_NB->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue;
+ //
+ //
+ // prioritySRB1 = CALLOC(1, sizeof(long));
+ // *prioritySRB1 = 1;
+ // SRB1_lchan_config_NB->choice.explicitValue.priority_r13 = prioritySRB1;
+ //
+ // logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t));
+ // *logicalChannelSR_Prohibit = 1;
+ // //schould be set to TRUE (specs pag 641)
+ // SRB1_lchan_config_NB->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit;
+ //
+ // //ADD SRB1
+ // ASN_SEQUENCE_ADD(&(*SRB_configList_NB_IoT)->list,SRB1_config_NB);
+ }
+ ///SRB1bis (The configuration for SRB1 and SRB1bis is the same) the only difference is the logical channel identity = 3 but not set here
+ SRB1bis_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_config_NB_IoT));
+ //no srb_Identity in SRB_ToAddMod_NB
+ SRB1bis_rlc_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_rlc_config_NB_IoT));
+ SRB1bis_config_NB_IoT->rlc_Config_r13 = SRB1bis_rlc_config_NB_IoT;
+ SRB1bis_rlc_config_NB_IoT->present = LTE_SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue;
+ SRB1bis_rlc_config_NB_IoT->choice.explicitValue.present=LTE_RLC_Config_NB_r13_PR_am;//MP: the only possible RLC config in NB_IoT
+ SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = LTE_T_PollRetransmit_NB_r13_ms25000;
+ SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = LTE_UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8;
+ //(musT be disabled--> SRB1 config pag 640 specs )
+ SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL;
+ SRB1bis_lchan_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_lchan_config_NB_IoT));
+ SRB1bis_config_NB_IoT->logicalChannelConfig_r13 = SRB1bis_lchan_config_NB_IoT;
+ SRB1bis_lchan_config_NB_IoT->present = LTE_SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue;
+ prioritySRB1bis = CALLOC(1, sizeof(long));
+ *prioritySRB1bis = 1; //same as SRB1?
+ SRB1bis_lchan_config_NB_IoT->choice.explicitValue.priority_r13 = prioritySRB1bis;
+ logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t));
+ *logicalChannelSR_Prohibit = 1; //schould be set to TRUE (specs pag 641)
+ SRB1bis_lchan_config_NB_IoT->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit;
+ //ADD SRB1bis
+ //MP: Actually there is no way to distinguish SRB1 and SRB1bis once put in the list
+ //MP: SRB_ToAddModList_NB_r13_t size = 1
+ ASN_SEQUENCE_ADD(&(*SRB_configList_NB_IoT)->list,SRB1bis_config_NB_IoT);
+ // PhysicalConfigDedicated (NPDCCH, NPUSCH, CarrierConfig, UplinkPowerControl)
+ physicalConfigDedicated2_NB_IoT = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT));
+ *physicalConfigDedicated_NB_IoT = physicalConfigDedicated2_NB_IoT;
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13= CALLOC(1, sizeof(*physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13));
+ physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13));
+ physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13));
+ physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13));
+ //no tpc, no cqi and no pucch, no pdsch, no soundingRS, no AntennaInfo, no scheduling request config
+ /*
+ * NB-IoT supports the operation with either one or two antenna ports, AP0 and AP1.
+ * For the latter case, Space Frequency Block Coding (SFBC) is applied.
+ * Once selected, the same transmission scheme applies to NPBCH, NPDCCH, and NPDSCH.
+ * */
+ //FIXME: MP: CarrierConfigDedicated check the set values ----------------------------------------------
//DL
-
- physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_CarrierFreq_r13.carrierFreq_r13=0;//random value set
- physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13= CALLOC(1,sizeof(struct LTE_DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13));
- physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13->present=
- LTE_DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13_PR_useNoBitmap_r13;
-
- physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13 = CALLOC(1,sizeof(struct LTE_DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13));
- physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13->present =
- LTE_DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13_PR_useNoGap_r13;
-
- physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.inbandCarrierInfo_r13= NULL;
-
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_CarrierFreq_r13.carrierFreq_r13=0;//random value set
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13= CALLOC(1,
+ sizeof(struct LTE_DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13));
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13->present=
+ LTE_DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13_PR_useNoBitmap_r13;
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13 = CALLOC(1,sizeof(struct LTE_DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13));
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13->present =
+ LTE_DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13_PR_useNoGap_r13;
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.inbandCarrierInfo_r13= NULL;
//UL
- physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->ul_CarrierConfig_r13.ul_CarrierFreq_r13= NULL;
+ physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->ul_CarrierConfig_r13.ul_CarrierFreq_r13= NULL;
+ // NPDCCH
+ physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13 =0;
+ physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13 =0;
+ physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13=0;
+ // NPUSCH //(specs TS 36.331 v14.2.1 pag 643) /* OPTIONAL */
+ physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->ack_NACK_NumRepetitions_r13= NULL;
+ npusch_AllSymbols= CALLOC(1, sizeof(BOOLEAN_t));
+ *npusch_AllSymbols= 1; //TRUE
+ physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->npusch_AllSymbols_r13= npusch_AllSymbols; /* OPTIONAL */
+ physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->groupHoppingDisabled_r13=NULL; /* OPTIONAL */
+ // UplinkPowerControlDedicated
+ physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13->p0_UE_NPUSCH_r13 = 0; // 0 dB (specs TS36.331 v14.2.1 pag 643)
+ //Fill the rrcConnectionSetup-NB message
+ rrcConnectionSetup_NB_IoT->rrc_TransactionIdentifier = Transaction_id; //input value
+ rrcConnectionSetup_NB_IoT->criticalExtensions.present = LTE_RRCConnectionSetup_NB__criticalExtensions_PR_c1;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.present =LTE_RRCConnectionSetup_NB__criticalExtensions__c1_PR_rrcConnectionSetup_r13 ;
+ //MP: carry only SRB1bis at the moment and phyConfigDedicated
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = *SRB_configList_NB_IoT;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.rlf_TimersAndConstants_r13 = NULL;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = physicalConfigDedicated2_NB_IoT;
+ rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13 = NULL;
- // NPDCCH
- physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13 =0;
- physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13 =0;
- physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13=0;
+ if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+ xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message_NB, (void *)&dl_ccch_msg_NB_IoT);
+ }
- // NPUSCH //(specs TS 36.331 v14.2.1 pag 643) /* OPTIONAL */
- physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->ack_NACK_NumRepetitions_r13= NULL;
- npusch_AllSymbols= CALLOC(1, sizeof(BOOLEAN_t));
- *npusch_AllSymbols= 1; //TRUE
- physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->npusch_AllSymbols_r13= npusch_AllSymbols; /* OPTIONAL */
- physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->groupHoppingDisabled_r13=NULL; /* OPTIONAL */
+ enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message_NB,
+ NULL,
+ (void *)&dl_ccch_msg_NB_IoT,
+ buffer,
+ 100);
- // UplinkPowerControlDedicated
- physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13->p0_UE_NPUSCH_r13 = 0; // 0 dB (specs TS36.331 v14.2.1 pag 643)
-
-
- //Fill the rrcConnectionSetup-NB message
- rrcConnectionSetup_NB_IoT->rrc_TransactionIdentifier = Transaction_id; //input value
- rrcConnectionSetup_NB_IoT->criticalExtensions.present = LTE_RRCConnectionSetup_NB__criticalExtensions_PR_c1;
- rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.present =LTE_RRCConnectionSetup_NB__criticalExtensions__c1_PR_rrcConnectionSetup_r13 ;
- //MP: carry only SRB1bis at the moment and phyConfigDedicated
- rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = *SRB_configList_NB_IoT;
- rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL;
- rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL;
- rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.rlf_TimersAndConstants_r13 = NULL;
- rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = physicalConfigDedicated2_NB_IoT;
- rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13 = NULL;
-
- if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT);
- }
- enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message_NB,
- NULL,
- (void*)&dl_ccch_msg_NB_IoT,
- buffer,
- 100);
-
- if (enc_rval.encoded <= 0) {
- LOG_E(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
- }
+ if (enc_rval.encoded <= 0) {
+ LOG_E(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
+ }
#ifdef USER_MODE
- LOG_D(RRC,"RRCConnectionSetup-NB Encoded %zd bits (%zd bytes), ecause %d\n",
- enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
+ LOG_D(RRC,"RRCConnectionSetup-NB Encoded %zd bits (%zd bytes), ecause %d\n",
+ enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
#endif
-
- return((enc_rval.encoded+7)/8);
+ return((enc_rval.encoded+7)/8);
}
/*do_SecurityModeCommand - exactly the same as previous implementation*/
uint8_t do_SecurityModeCommand_NB_IoT(
- const protocol_ctxt_t* const ctxt_pP,
- uint8_t* const buffer,
+ const protocol_ctxt_t *const ctxt_pP,
+ uint8_t *const buffer,
const uint8_t Transaction_id,
const uint8_t cipheringAlgorithm,
- const uint8_t integrityProtAlgorithm)
-{
+ const uint8_t integrityProtAlgorithm) {
LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
asn_enc_rval_t enc_rval;
-
memset(&dl_dcch_msg_NB_IoT,0,sizeof(LTE_DL_DCCH_Message_NB_t));
-
dl_dcch_msg_NB_IoT.message.present = LTE_DL_DCCH_MessageType_NB_PR_c1;
dl_dcch_msg_NB_IoT.message.choice.c1.present = LTE_DL_DCCH_MessageType_NB__c1_PR_securityModeCommand_r13;
-
dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.rrc_TransactionIdentifier = Transaction_id;
dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.present = LTE_SecurityModeCommand__criticalExtensions_PR_c1;
-
dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.present =
- LTE_SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8;
-
+ LTE_SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8;
// the two following information could be based on the mod_id
dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm
= (LTE_CipheringAlgorithm_r12_t)cipheringAlgorithm; //bug solved
-
dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm
= (e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm;
-//only changed "asn_DEF_DL_DCCH_Message_NB"
+ //only changed "asn_DEF_DL_DCCH_Message_NB"
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT);
+ xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message_NB, (void *)&dl_dcch_msg_NB_IoT);
}
+
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message_NB,
NULL,
- (void*)&dl_dcch_msg_NB_IoT,
+ (void *)&dl_dcch_msg_NB_IoT,
buffer,
100);
+
if (enc_rval.encoded <= 0) {
- LOG_E(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
+ LOG_E(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
}
-
-//#if defined(ENABLE_ITTI)
-//# if !defined(DISABLE_XER_SPRINT)....
-
+ //#if defined(ENABLE_ITTI)
+ //# if !defined(DISABLE_XER_SPRINT)....
#ifdef USER_MODE
LOG_D(RRC,"[NB-IoT %d] securityModeCommand-NB for UE %x Encoded %zd bits (%zd bytes)\n",
ctxt_pP->module_id,
@@ -976,47 +815,43 @@ uint8_t do_SecurityModeCommand_NB_IoT(
/*do_UECapabilityEnquiry_NB_IoT - very similar to legacy lte*/
uint8_t do_UECapabilityEnquiry_NB_IoT(
- const protocol_ctxt_t* const ctxt_pP,
- uint8_t* const buffer,
+ const protocol_ctxt_t *const ctxt_pP,
+ uint8_t *const buffer,
const uint8_t Transaction_id
)
{
-
LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
//no RAT type in NB-IoT
asn_enc_rval_t enc_rval;
-
memset(&dl_dcch_msg_NB_IoT,0,sizeof(LTE_DL_DCCH_Message_NB_t));
-
dl_dcch_msg_NB_IoT.message.present = LTE_DL_DCCH_MessageType_NB_PR_c1;
dl_dcch_msg_NB_IoT.message.choice.c1.present = LTE_DL_DCCH_MessageType_NB__c1_PR_ueCapabilityEnquiry_r13;
-
dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.rrc_TransactionIdentifier = Transaction_id;
-
dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.criticalExtensions.present = LTE_UECapabilityEnquiry_NB__criticalExtensions_PR_c1;
dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.criticalExtensions.choice.c1.present =
- LTE_UECapabilityEnquiry_NB__criticalExtensions__c1_PR_ueCapabilityEnquiry_r13;
+ LTE_UECapabilityEnquiry_NB__criticalExtensions__c1_PR_ueCapabilityEnquiry_r13;
//no ue_CapabilityRequest (list of RAT_Type)
-//only changed "asn_DEF_DL_DCCH_Message_NB"
+ //only changed "asn_DEF_DL_DCCH_Message_NB"
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT);
+ xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message_NB, (void *)&dl_dcch_msg_NB_IoT);
}
+
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message_NB,
NULL,
- (void*)&dl_dcch_msg_NB_IoT,
+ (void *)&dl_dcch_msg_NB_IoT,
buffer,
100);
+
if (enc_rval.encoded <= 0) {
- LOG_E(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
- }
-
-//#if defined(ENABLE_ITTI)
-//# if !defined(DISABLE_XER_SPRINT)....
+ LOG_E(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
+ }
+ //#if defined(ENABLE_ITTI)
+ //# if !defined(DISABLE_XER_SPRINT)....
#ifdef USER_MODE
LOG_D(RRC,"[NB-IoT %d] UECapabilityEnquiry-NB for UE %x Encoded %zd bits (%zd bytes)\n",
ctxt_pP->module_id,
@@ -1039,39 +874,32 @@ uint8_t do_UECapabilityEnquiry_NB_IoT(
* (including RBs, MAC main configuration and physical channel configuration)
* including any associated dedicated NAS information.*/
uint16_t do_RRCConnectionReconfiguration_NB_IoT(
- const protocol_ctxt_t* const ctxt_pP,
- uint8_t *buffer,
- uint8_t Transaction_id,
- LTE_SRB_ToAddModList_NB_r13_t *SRB1_list_NB, //SRB_ConfigList2 (default)--> only SRB1
- LTE_DRB_ToAddModList_NB_r13_t *DRB_list_NB_IoT, //DRB_ConfigList (default)
- LTE_DRB_ToReleaseList_NB_r13_t *DRB_list2_NB_IoT, //is NULL when passed
- struct LTE_PhysicalConfigDedicated_NB_r13 *physicalConfigDedicated_NB_IoT,
- LTE_MAC_MainConfig_NB_r13_t *mac_MainConfig_NB_IoT,
- struct LTE_RRCConnectionReconfiguration_NB_r13_IEs__dedicatedInfoNASList_r13* dedicatedInfoNASList_NB_IoT)
+ const protocol_ctxt_t *const ctxt_pP,
+ uint8_t *buffer,
+ uint8_t Transaction_id,
+ LTE_SRB_ToAddModList_NB_r13_t *SRB1_list_NB, //SRB_ConfigList2 (default)--> only SRB1
+ LTE_DRB_ToAddModList_NB_r13_t *DRB_list_NB_IoT, //DRB_ConfigList (default)
+ LTE_DRB_ToReleaseList_NB_r13_t *DRB_list2_NB_IoT, //is NULL when passed
+ struct LTE_PhysicalConfigDedicated_NB_r13 *physicalConfigDedicated_NB_IoT,
+ LTE_MAC_MainConfig_NB_r13_t *mac_MainConfig_NB_IoT,
+ struct LTE_RRCConnectionReconfiguration_NB_r13_IEs__dedicatedInfoNASList_r13 *dedicatedInfoNASList_NB_IoT)
{
-
- //check on DRB_list if contains more than 2 DRB?
-
+ //check on DRB_list if contains more than 2 DRB?
asn_enc_rval_t enc_rval;
LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
LTE_RRCConnectionReconfiguration_NB_t *rrcConnectionReconfiguration_NB;
-
-
memset(&dl_dcch_msg_NB_IoT,0,sizeof(LTE_DL_DCCH_Message_NB_t));
-
dl_dcch_msg_NB_IoT.message.present = LTE_DL_DCCH_MessageType_NB_PR_c1;
dl_dcch_msg_NB_IoT.message.choice.c1.present = LTE_DL_DCCH_MessageType_NB__c1_PR_rrcConnectionReconfiguration_r13;
rrcConnectionReconfiguration_NB = &dl_dcch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReconfiguration_r13;
-
// RRCConnectionReconfiguration
rrcConnectionReconfiguration_NB->rrc_TransactionIdentifier = Transaction_id;
rrcConnectionReconfiguration_NB->criticalExtensions.present = LTE_RRCConnectionReconfiguration_NB__criticalExtensions_PR_c1;
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.present =LTE_RRCConnectionReconfiguration_NB__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r13 ;
-
//RAdioResourceconfigDedicated
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13 =
- CALLOC(1,sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13));
+ CALLOC(1,sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13));
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->srb_ToAddModList_r13 = SRB1_list_NB; //only SRB1
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->drb_ToAddModList_r13 = DRB_list_NB_IoT;
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->drb_ToReleaseList_r13 = DRB_list2_NB_IoT; //NULL
@@ -1081,126 +909,94 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT(
if (mac_MainConfig_NB_IoT!=NULL) {
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13 =
- CALLOC(1, sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13));
+ CALLOC(1, sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13));
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13->present
=LTE_RadioResourceConfigDedicated_NB_r13__mac_MainConfig_r13_PR_explicitValue_r13;
- //why memcopy only this one?
+ //why memcopy only this one?
memcpy(&rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13->choice.explicitValue_r13,
mac_MainConfig_NB_IoT, sizeof(*mac_MainConfig_NB_IoT));
-
} else {
- rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13=NULL;
+ rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13=NULL;
}
//no measConfig, measIDlist
//no mobilityControlInfo
-
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.dedicatedInfoNASList_r13 = dedicatedInfoNASList_NB_IoT;
//mainly used for cell-reselection/handover purposes??
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.fullConfig_r13 = NULL;
-
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message_NB,
NULL,
- (void*)&dl_dcch_msg_NB_IoT,
+ (void *)&dl_dcch_msg_NB_IoT,
buffer,
RRC_BUF_SIZE);
+
if (enc_rval.encoded <= 0) {
- LOG_E(RRC, "ASN1 message encoding failed %s, %li\n",
- enc_rval.failed_type->name, enc_rval.encoded);
+ LOG_E(RRC, "ASN1 message encoding failed %s, %li\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
}
//changed only asn_DEF_DL_DCCH_Message_NB
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message_NB,(void*)&dl_dcch_msg_NB_IoT);
+ xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message_NB,(void *)&dl_dcch_msg_NB_IoT);
}
-//#if defined(ENABLE_ITTI)
-//# if !defined(DISABLE_XER_SPRINT)...
-
-
+ //#if defined(ENABLE_ITTI)
+ //# if !defined(DISABLE_XER_SPRINT)...
LOG_I(RRC,"RRCConnectionReconfiguration-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-
return((enc_rval.encoded+7)/8);
}
/*do_RRCConnectionReestablishmentReject - exactly the same as legacy LTE*/
uint8_t do_RRCConnectionReestablishmentReject_NB_IoT(
- uint8_t Mod_id,
- uint8_t* const buffer)
-{
-
+ uint8_t Mod_id,
+ uint8_t *const buffer) {
asn_enc_rval_t enc_rval;
-
LTE_DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT;
LTE_RRCConnectionReestablishmentReject_t *rrcConnectionReestablishmentReject;
-
memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(LTE_DL_CCCH_Message_NB_t));
dl_ccch_msg_NB_IoT.message.present = LTE_DL_CCCH_MessageType_NB_PR_c1;
dl_ccch_msg_NB_IoT.message.choice.c1.present = LTE_DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishmentReject_r13;
rrcConnectionReestablishmentReject = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReestablishmentReject_r13;
-
// RRCConnectionReestablishmentReject //exactly the same as LTE
rrcConnectionReestablishmentReject->criticalExtensions.present = LTE_RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8;
//Only change in "asn_DEF_DL_CCCH_Message_NB"
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT);
+ xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message_NB, (void *)&dl_ccch_msg_NB_IoT);
}
+
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message_NB,
NULL,
- (void*)&dl_ccch_msg_NB_IoT,
+ (void *)&dl_ccch_msg_NB_IoT,
buffer,
100);
+
if (enc_rval.encoded <= 0) {
- LOG_E(RRC,"ASN1 message encoding failed (%s, %lu)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
+ LOG_E(RRC,"ASN1 message encoding failed (%s, %lu)!\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
}
//Only change in "asn_DEF_DL_CCCH_Message_NB"
-#if defined(ENABLE_ITTI)
-# if !defined(DISABLE_XER_SPRINT)
- {
- char message_string[20000];
- size_t message_string_size;
-
- if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
- }
- }
-# endif
-#endif
-
#ifdef USER_MODE
LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
-
return((enc_rval.encoded+7)/8);
}
/*do_RRCConnectionReject_NB_IoT*/
uint8_t do_RRCConnectionReject_NB_IoT(
- uint8_t Mod_id,
- uint8_t* const buffer)
+ uint8_t Mod_id,
+ uint8_t *const buffer)
{
-
asn_enc_rval_t enc_rval;
-
LTE_DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT;
LTE_RRCConnectionReject_NB_t *rrcConnectionReject_NB_IoT;
-
memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(LTE_DL_CCCH_Message_NB_t));
dl_ccch_msg_NB_IoT.message.present = LTE_DL_CCCH_MessageType_NB_PR_c1;
dl_ccch_msg_NB_IoT.message.choice.c1.present = LTE_DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReject_r13;
rrcConnectionReject_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReject_r13;
-
// RRCConnectionReject-NB_IoT
rrcConnectionReject_NB_IoT->criticalExtensions.present = LTE_RRCConnectionReject_NB__criticalExtensions_PR_c1;
rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.present = LTE_RRCConnectionReject_NB__criticalExtensions__c1_PR_rrcConnectionReject_r13;
@@ -1209,48 +1005,30 @@ uint8_t do_RRCConnectionReject_NB_IoT(
//new-use of suspend indication
//If present, this field indicates that the UE should remain suspended and not release its stored context.
rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReject_r13.rrc_SuspendIndication_r13=
- CALLOC(1, sizeof(long));
+ CALLOC(1, sizeof(long));
*(rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReject_r13.rrc_SuspendIndication_r13)=
- LTE_RRCConnectionReject_NB_r13_IEs__rrc_SuspendIndication_r13_true;
+ LTE_RRCConnectionReject_NB_r13_IEs__rrc_SuspendIndication_r13_true;
//Only Modified "asn_DEF_DL_CCCH_Message_NB"
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT);
+ xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message_NB, (void *)&dl_ccch_msg_NB_IoT);
}
+
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message_NB,
NULL,
- (void*)&dl_ccch_msg_NB_IoT,
+ (void *)&dl_ccch_msg_NB_IoT,
buffer,
100);
+
if (enc_rval.encoded <= 0) {
- LOG_E(RRC, "ASN1 message encoding failed (%s, %ld)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
+ LOG_E(RRC, "ASN1 message encoding failed (%s, %ld)!\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
}
-#if defined(ENABLE_ITTI)
-# if !defined(DISABLE_XER_SPRINT)
- {
- char message_string[20000];
- size_t message_string_size;
-
- if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
- }
- }
-# endif
-#endif
-
#ifdef USER_MODE
LOG_D(RRC,"RRCConnectionReject-NB Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
-
return((enc_rval.encoded+7)/8);
}
@@ -1260,19 +1038,16 @@ uint8_t do_RRCConnectionReject_NB_IoT(
/*do_DLInformationTransfer_NB*/
uint8_t do_DLInformationTransfer_NB_IoT(
- uint8_t Mod_id,
- uint8_t **buffer,
- uint8_t transaction_id,
- uint32_t pdu_length,
- uint8_t *pdu_buffer)
+ uint8_t Mod_id,
+ uint8_t **buffer,
+ uint8_t transaction_id,
+ uint32_t pdu_length,
+ uint8_t *pdu_buffer)
{
ssize_t encoded;
-
LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
-
memset(&dl_dcch_msg_NB_IoT, 0, sizeof(LTE_DL_DCCH_Message_NB_t));
-
dl_dcch_msg_NB_IoT.message.present = LTE_DL_DCCH_MessageType_NB_PR_c1;
dl_dcch_msg_NB_IoT.message.choice.c1.present = LTE_DL_DCCH_MessageType_NB__c1_PR_dlInformationTransfer_r13;
dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.rrc_TransactionIdentifier = transaction_id;
@@ -1280,29 +1055,8 @@ uint8_t do_DLInformationTransfer_NB_IoT(
dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.present = LTE_DLInformationTransfer_NB__criticalExtensions__c1_PR_dlInformationTransfer_r13;
dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.choice.dlInformationTransfer_r13.dedicatedInfoNAS_r13.size = pdu_length;
dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.choice.dlInformationTransfer_r13.dedicatedInfoNAS_r13.buf = pdu_buffer;
-
- encoded = uper_encode_to_new_buffer (&asn_DEF_LTE_DL_DCCH_Message_NB, NULL, (void*) &dl_dcch_msg_NB_IoT, (void **) buffer);
-
+ encoded = uper_encode_to_new_buffer (&asn_DEF_LTE_DL_DCCH_Message_NB, NULL, (void *) &dl_dcch_msg_NB_IoT, (void **) buffer);
//only change in "asn_DEF_DL_DCCH_Message_NB"
-#if defined(ENABLE_ITTI)
-# if !defined(DISABLE_XER_SPRINT)
- {
- char message_string[10000];
- size_t message_string_size;
-
- if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_DCCH_Message_NB, (void *)&dl_dcch_msg_NB_IoT)) > 0) {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
- }
- }
-# endif
-#endif
-
return encoded;
}
@@ -1313,70 +1067,43 @@ uint8_t do_DLInformationTransfer_NB_IoT(
/*do_RRCConnectionReestablishment_NB-->used to re-establish SRB1*/ //which parameter to use?
uint8_t do_RRCConnectionReestablishment_NB_IoT(
- uint8_t Mod_id,
- uint8_t* const buffer,
- const uint8_t Transaction_id,
- const NB_IoT_DL_FRAME_PARMS* const frame_parms, //to be changed
- LTE_SRB_ToAddModList_NB_r13_t* SRB_list_NB_IoT) //should contain SRB1 already configured?
-{
+ uint8_t Mod_id,
+ uint8_t *const buffer,
+ const uint8_t Transaction_id,
+ const NB_IoT_DL_FRAME_PARMS *const frame_parms, //to be changed
+ LTE_SRB_ToAddModList_NB_r13_t *SRB_list_NB_IoT) { //should contain SRB1 already configured?
+ asn_enc_rval_t enc_rval;
+ LTE_DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT;
+ LTE_RRCConnectionReestablishment_NB_t *rrcConnectionReestablishment_NB_IoT;
+ memset(&dl_ccch_msg_NB_IoT, 0, sizeof(LTE_DL_CCCH_Message_NB_t));
+ dl_ccch_msg_NB_IoT.message.present = LTE_DL_CCCH_MessageType_NB_PR_c1;
+ dl_ccch_msg_NB_IoT.message.choice.c1.present = LTE_DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishment_r13;
+ rrcConnectionReestablishment_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReestablishment_r13;
+ //rrcConnectionReestablishment_NB
+ rrcConnectionReestablishment_NB_IoT->rrc_TransactionIdentifier = Transaction_id;
+ rrcConnectionReestablishment_NB_IoT->criticalExtensions.present = LTE_RRCConnectionReestablishment_NB__criticalExtensions_PR_c1;
+ rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.present = LTE_RRCConnectionReestablishment_NB__criticalExtensions__c1_PR_rrcConnectionReestablishment_r13;
+ rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = SRB_list_NB_IoT;
+ rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL;
+ rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL;
+ rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.rlf_TimersAndConstants_r13= NULL;
+ rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13= NULL;
+ rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = NULL;
+ rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.nextHopChainingCount_r13=0;
+ enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message_NB,
+ NULL,
+ (void *)&dl_ccch_msg_NB_IoT,
+ buffer,
+ RRC_BUF_SIZE);
- asn_enc_rval_t enc_rval;
- LTE_DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT;
- LTE_RRCConnectionReestablishment_NB_t* rrcConnectionReestablishment_NB_IoT;
+ if (enc_rval.encoded <= 0) {
+ LOG_E(RRC, "ASN1 message encoding failed (%s, %li)!\n",
+ enc_rval.failed_type->name, enc_rval.encoded);
+ }
- memset(&dl_ccch_msg_NB_IoT, 0, sizeof(LTE_DL_CCCH_Message_NB_t));
-
- dl_ccch_msg_NB_IoT.message.present = LTE_DL_CCCH_MessageType_NB_PR_c1;
- dl_ccch_msg_NB_IoT.message.choice.c1.present = LTE_DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishment_r13;
- rrcConnectionReestablishment_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReestablishment_r13;
-
- //rrcConnectionReestablishment_NB
- rrcConnectionReestablishment_NB_IoT->rrc_TransactionIdentifier = Transaction_id;
- rrcConnectionReestablishment_NB_IoT->criticalExtensions.present = LTE_RRCConnectionReestablishment_NB__criticalExtensions_PR_c1;
- rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.present = LTE_RRCConnectionReestablishment_NB__criticalExtensions__c1_PR_rrcConnectionReestablishment_r13;
-
- rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = SRB_list_NB_IoT;
- rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL;
- rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL;
- rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.rlf_TimersAndConstants_r13= NULL;
- rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13= NULL;
- rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = NULL;
-
- rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.nextHopChainingCount_r13=0;
-
- enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message_NB,
- NULL,
- (void*)&dl_ccch_msg_NB_IoT,
- buffer,
- RRC_BUF_SIZE);
-
- if (enc_rval.encoded <= 0) {
- LOG_E(RRC, "ASN1 message encoding failed (%s, %li)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
- }
-
- if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout,&asn_DEF_LTE_DL_CCCH_Message_NB,(void*)&dl_ccch_msg_NB_IoT);
- }
-
-#if defined(ENABLE_ITTI)
-# if !defined(DISABLE_XER_SPRINT)
- {
- char message_string[30000];
- size_t message_string_size;
-
- if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
- }
+ if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+ xer_fprint(stdout,&asn_DEF_LTE_DL_CCCH_Message_NB,(void *)&dl_ccch_msg_NB_IoT);
}
-# endif
-#endif
LOG_I(RRC,"RRCConnectionReestablishment-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
return 0;
@@ -1386,40 +1113,29 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT(
uint8_t do_RRCConnectionRelease_NB_IoT(
uint8_t Mod_id,
uint8_t *buffer,
- const uint8_t Transaction_id)
-{
-
+ const uint8_t Transaction_id) {
asn_enc_rval_t enc_rval;
-
LTE_DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT;
LTE_RRCConnectionRelease_NB_t *rrcConnectionRelease_NB_IoT;
-
-
memset(&dl_dcch_msg_NB_IoT,0,sizeof(LTE_DL_DCCH_Message_NB_t));
-
dl_dcch_msg_NB_IoT.message.present = LTE_DL_DCCH_MessageType_NB_PR_c1;
dl_dcch_msg_NB_IoT.message.choice.c1.present = LTE_DL_DCCH_MessageType_NB__c1_PR_rrcConnectionRelease_r13;
rrcConnectionRelease_NB_IoT = &dl_dcch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionRelease_r13;
-
// RRCConnectionRelease
rrcConnectionRelease_NB_IoT->rrc_TransactionIdentifier = Transaction_id;
rrcConnectionRelease_NB_IoT->criticalExtensions.present = LTE_RRCConnectionRelease_NB__criticalExtensions_PR_c1;
rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.present = LTE_RRCConnectionRelease_NB__criticalExtensions__c1_PR_rrcConnectionRelease_r13 ;
-
rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.releaseCause_r13 = LTE_ReleaseCause_NB_r13_other;
rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.redirectedCarrierInfo_r13 = NULL;
rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.extendedWaitTime_r13 = NULL;
-
//Why allocate memory for non critical extension?
rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension=CALLOC(1,
sizeof(*rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension));
-
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message_NB,
NULL,
- (void*)&dl_dcch_msg_NB_IoT,
+ (void *)&dl_dcch_msg_NB_IoT,
buffer,
RRC_BUF_SIZE);//check
-
return((enc_rval.encoded+7)/8);
}
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-860.txt b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-860.txt
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-a20.txt b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-a20.txt
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-ah0.txt b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-ah0.txt
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-c60.txt b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-c60.txt
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-86.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-86.asn
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-a20.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-a20.asn
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn.orig b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn.orig
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-86.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-86.asn
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-a20.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-a20.asn
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-10.21.0.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-10.21.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-11.18.0.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-11.18.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-12.16.0.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-12.16.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.4.0.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.4.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.6.2.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.6.2.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.7.0.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.7.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.1.0.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.1.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.2.1.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.2.1.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.2.2.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.2.2.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-8.21.0.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-8.21.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-9.18.0.asn1 b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-9.18.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c
index 65150d32ab..49f9e16740 100644
--- a/openair2/RRC/LTE/rrc_UE.c
+++ b/openair2/RRC/LTE/rrc_UE.c
@@ -44,7 +44,7 @@
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#ifndef CELLULAR
-#include "RRC/LTE/MESSAGES/asn1_msg.h"
+ #include "RRC/LTE/MESSAGES/asn1_msg.h"
#endif
#include "LTE_RRCConnectionRequest.h"
#include "LTE_RRCConnectionReconfiguration.h"
@@ -55,7 +55,7 @@
#include "LTE_BCCH-DL-SCH-Message.h"
#include "LTE_PCCH-Message.h"
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
-#include "LTE_MCCH-Message.h"
+ #include "LTE_MCCH-Message.h"
#endif
#include "LTE_MeasConfig.h"
#include "LTE_MeasGapConfig.h"
@@ -66,11 +66,11 @@
#include "RRC/NAS/nas_config.h"
#include "RRC/NAS/rb_config.h"
#if ENABLE_RAL
-#include "rrc_UE_ral.h"
+ #include "rrc_UE_ral.h"
#endif
#if defined(ENABLE_SECURITY)
-# include "UTIL/OSA/osa_defs.h"
+ #include "UTIL/OSA/osa_defs.h"
#endif
#include "pdcp.h"
@@ -78,7 +78,7 @@
#include "msc.h"
#if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
+ #include "intertask_interface.h"
#endif
#include "SIMULATION/TOOLS/sim.h" // for taus
@@ -86,52 +86,52 @@
#include "openair2/LAYER2/MAC/mac_extern.h"
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
-#include "LTE_SL-Preconfiguration-r12.h"
+ #include "LTE_SL-Preconfiguration-r12.h"
-//for D2D
-int ctrl_sock_fd;
-#define BUFSIZE 1024
-struct sockaddr_in prose_app_addr;
-int slrb_id;
-int send_ue_information = 0;
+ //for D2D
+ int ctrl_sock_fd;
+ #define BUFSIZE 1024
+ struct sockaddr_in prose_app_addr;
+ int slrb_id;
+ int send_ue_information = 0;
#endif
// for malloc_clear
#include "PHY/defs_UE.h"
extern void pdcp_config_set_security(
- const protocol_ctxt_t* const ctxt_pP,
- pdcp_t * const pdcp_pP,
+ const protocol_ctxt_t *const ctxt_pP,
+ pdcp_t *const pdcp_pP,
const rb_id_t rb_idP,
const uint16_t lc_idP,
const uint8_t security_modeP,
- uint8_t * const kRRCenc,
- uint8_t * const kRRCint,
- uint8_t * const kUPenc);
+ uint8_t *const kRRCenc,
+ uint8_t *const kRRCint,
+ uint8_t *const kUPenc);
// internal prototypes
-void rrc_ue_process_securityModeCommand( const protocol_ctxt_t* const ctxt_pP, LTE_SecurityModeCommand_t* const securityModeCommand, const uint8_t eNB_index );
+void rrc_ue_process_securityModeCommand( const protocol_ctxt_t *const ctxt_pP, LTE_SecurityModeCommand_t *const securityModeCommand, const uint8_t eNB_index );
-static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index );
+static int decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index );
-static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t rsrq, const uint8_t rsrp );
+static int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t rsrq, const uint8_t rsrp );
/** \brief Generates/Encodes RRCConnnectionSetupComplete message at UE
* \param ctxt_pP Running context
* \param eNB_index Index of corresponding eNB/CH
* \param Transaction_id Transaction identifier
*/
-static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id );
+static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id );
/** \brief Generates/Encodes RRCConnectionReconfigurationComplete message at UE
* \param ctxt_pP Running context
* \param eNB_index Index of corresponding eNB/CH
* \param Transaction_id RRC transaction identifier
*/
-static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id );
+static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id );
-static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t* const ctxt_pP, uint8_t eNB_index );
+static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t eNB_index );
static uint8_t check_trigger_meas_event(
module_id_t module_idP,
@@ -144,7 +144,8 @@ static uint8_t check_trigger_meas_event(
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
static void decode_MBSFNAreaConfiguration(module_id_t module_idP, uint8_t eNB_index, frame_t frameP,uint8_t mbsfn_sync_area);
-uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,LTE_SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode);
+uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,LTE_SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq,
+ SL_TRIGGER_t mode);
#endif
@@ -157,36 +158,21 @@ uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt
/*------------------------------------------------------------------------------*/
/* to avoid gcc warnings when compiling with certain options */
#if defined(ENABLE_USE_MME) || ENABLE_RAL
-static Rrc_State_t rrc_get_state (module_id_t ue_mod_idP)
-{
+static Rrc_State_t rrc_get_state (module_id_t ue_mod_idP) {
return UE_rrc_inst[ue_mod_idP].RrcState;
}
#endif
-static Rrc_Sub_State_t rrc_get_sub_state (module_id_t ue_mod_idP)
-{
+static Rrc_Sub_State_t rrc_get_sub_state (module_id_t ue_mod_idP) {
return UE_rrc_inst[ue_mod_idP].RrcSubState;
}
-static int rrc_set_state (module_id_t ue_mod_idP, Rrc_State_t state)
-{
+static int rrc_set_state (module_id_t ue_mod_idP, Rrc_State_t state) {
AssertFatal ((RRC_STATE_FIRST <= state) && (state <= RRC_STATE_LAST),
"Invalid state %d!\n", state);
if (UE_rrc_inst[ue_mod_idP].RrcState != state) {
UE_rrc_inst[ue_mod_idP].RrcState = state;
-
-#if defined(ENABLE_ITTI)
- {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message(TASK_RRC_UE, RRC_STATE_IND);
- RRC_STATE_IND(msg_p).state = UE_rrc_inst[ue_mod_idP].RrcState;
- RRC_STATE_IND(msg_p).sub_state = UE_rrc_inst[ue_mod_idP].RrcSubState;
-
- itti_send_msg_to_task(TASK_UNKNOWN, UE_MODULE_ID_TO_INSTANCE(ue_mod_idP), msg_p);
- }
-#endif
return (1);
}
@@ -194,43 +180,30 @@ static int rrc_set_state (module_id_t ue_mod_idP, Rrc_State_t state)
}
//-----------------------------------------------------------------------------
-static int rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_t subState )
-{
+static int rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_t subState ) {
#if (defined(ENABLE_ITTI) && (defined(ENABLE_USE_MME) || ENABLE_RAL))
switch (UE_rrc_inst[ue_mod_idP].RrcState) {
- case RRC_STATE_INACTIVE:
- AssertFatal ((RRC_SUB_STATE_INACTIVE_FIRST <= subState) && (subState <= RRC_SUB_STATE_INACTIVE_LAST),
- "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState);
- break;
+ case RRC_STATE_INACTIVE:
+ AssertFatal ((RRC_SUB_STATE_INACTIVE_FIRST <= subState) && (subState <= RRC_SUB_STATE_INACTIVE_LAST),
+ "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState);
+ break;
- case RRC_STATE_IDLE:
- AssertFatal ((RRC_SUB_STATE_IDLE_FIRST <= subState) && (subState <= RRC_SUB_STATE_IDLE_LAST),
- "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState);
- break;
+ case RRC_STATE_IDLE:
+ AssertFatal ((RRC_SUB_STATE_IDLE_FIRST <= subState) && (subState <= RRC_SUB_STATE_IDLE_LAST),
+ "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState);
+ break;
- case RRC_STATE_CONNECTED:
- AssertFatal ((RRC_SUB_STATE_CONNECTED_FIRST <= subState) && (subState <= RRC_SUB_STATE_CONNECTED_LAST),
- "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState);
- break;
+ case RRC_STATE_CONNECTED:
+ AssertFatal ((RRC_SUB_STATE_CONNECTED_FIRST <= subState) && (subState <= RRC_SUB_STATE_CONNECTED_LAST),
+ "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState);
+ break;
}
#endif
if (UE_rrc_inst[ue_mod_idP].RrcSubState != subState) {
UE_rrc_inst[ue_mod_idP].RrcSubState = subState;
-
-#if defined(ENABLE_ITTI)
- {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message(TASK_RRC_UE, RRC_STATE_IND);
- RRC_STATE_IND(msg_p).state = UE_rrc_inst[ue_mod_idP].RrcState;
- RRC_STATE_IND(msg_p).sub_state = UE_rrc_inst[ue_mod_idP].RrcSubState;
-
- itti_send_msg_to_task(TASK_UNKNOWN, UE_MODULE_ID_TO_INSTANCE(ue_mod_idP), msg_p);
- }
-#endif
return (1);
}
@@ -240,33 +213,30 @@ static int rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_t subState )
//-----------------------------------------------------------------------------
void
openair_rrc_on_ue(
- const protocol_ctxt_t* const ctxt_pP
+ const protocol_ctxt_t *const ctxt_pP
)
//-----------------------------------------------------------------------------
{
unsigned short i;
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" UE?:OPENAIR RRC IN....\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
-
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" UE?:OPENAIR RRC IN....\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
-
- for (i = 0; i < NB_eNB_INST; i++) {
- LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" Activating CCCH (eNB %d)\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i);
- UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Srb_id = CCCH;
- memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[0], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
- memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[1], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
- rrc_config_buffer (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i], CCCH, 1);
- UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Active = 1;
- }
+ for (i = 0; i < NB_eNB_INST; i++) {
+ LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" Activating CCCH (eNB %d)\n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i);
+ UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Srb_id = CCCH;
+ memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[0], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
+ memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[1], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
+ rrc_config_buffer (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i], CCCH, 1);
+ UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Active = 1;
+ }
}
//-----------------------------------------------------------------------------
-static void init_SI_UE( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index )
-{
+static void init_SI_UE( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) {
UE_rrc_inst[ctxt_pP->module_id].sizeof_SIB1[eNB_index] = 0;
UE_rrc_inst[ctxt_pP->module_id].sizeof_SI[eNB_index] = 0;
- UE_rrc_inst[ctxt_pP->module_id].SIB1[eNB_index] = (uint8_t*)malloc16_clear( 32 );
+ UE_rrc_inst[ctxt_pP->module_id].SIB1[eNB_index] = (uint8_t *)malloc16_clear( 32 );
UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType1_t) );
UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType2_t) );
UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType3_t) );
@@ -284,21 +254,16 @@ static void init_SI_UE( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_
UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType18_r12_t) );
UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType19_r12_t) );
UE_rrc_inst[ctxt_pP->module_id].sib21[eNB_index] = malloc16_clear( sizeof(LTE_SystemInformationBlockType21_r14_t) );
-
#endif
- UE_rrc_inst[ctxt_pP->module_id].SI[eNB_index] = (uint8_t*)malloc16_clear( 64 );
-
- UE_rrc_inst[ctxt_pP->module_id].si[eNB_index] = (LTE_SystemInformation_t*)malloc16_clear( sizeof(LTE_SystemInformation_t) );
-
+ UE_rrc_inst[ctxt_pP->module_id].SI[eNB_index] = (uint8_t *)malloc16_clear( 64 );
+ UE_rrc_inst[ctxt_pP->module_id].si[eNB_index] = (LTE_SystemInformation_t *)malloc16_clear( sizeof(LTE_SystemInformation_t) );
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus = 0;
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt = 0;
}
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
-void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index )
-{
+void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) {
LOG_I(RRC,"Initializing Sidelink Pre-configuration for UE\n");
-
UE->SL_Preconfiguration[eNB_index] = malloc16_clear( sizeof(struct LTE_SL_Preconfiguration_r12) );
UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.rohc_Profiles_r12.profile0x0001_r12 = true;
UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.carrierFreq_r12 = 3350;
@@ -306,7 +271,6 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index )
UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.additionalSpectrumEmission_r12 = 0;
UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.sl_bandwidth_r12 = LTE_SL_PreconfigGeneral_r12__sl_bandwidth_r12_n50;
UE->SL_Preconfiguration[eNB_index]->preconfigGeneral_r12.tdd_ConfigSL_r12.subframeAssignmentSL_r12 = LTE_TDD_ConfigSL_r12__subframeAssignmentSL_r12_none;
-
UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncCP_Len_r12 = LTE_SL_CP_Len_r12_normal;
UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncOffsetIndicator1_r12 = 0;
UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncOffsetIndicator2_r12 = 0;
@@ -317,7 +281,6 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index )
UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.syncRefDiffHyst_r12 = LTE_SL_PreconfigSync_r12__syncRefDiffHyst_r12_dB0;
UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.ext1 = malloc16_clear(sizeof(struct LTE_SL_PreconfigSync_r12__ext1));
UE->SL_Preconfiguration[eNB_index]->preconfigSync_r12.ext1->syncTxPeriodic_r13 = NULL;
-
struct LTE_SL_PreconfigCommPool_r12 *preconfigpool = malloc16_clear(sizeof(struct LTE_SL_PreconfigCommPool_r12));
preconfigpool->sc_CP_Len_r12 = LTE_SL_CP_Len_r12_normal;
preconfigpool->sc_Period_r12 = LTE_SL_PeriodComm_r12_sf40;
@@ -340,7 +303,6 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index )
preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[3] = 0;
preconfigpool->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[4] = 0;
preconfigpool->sc_TxParameters_r12 = 0;
-
preconfigpool->data_CP_Len_r12 = LTE_SL_CP_Len_r12_normal;
// 20 PRBs for SL communications
preconfigpool->data_TF_ResourceConfig_r12.prb_Num_r12 = 20;
@@ -360,123 +322,117 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index )
preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[2] = 0xFF;
preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[3] = 0xFF;
preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[5] = 0xFF;
-
preconfigpool->dataHoppingConfig_r12.hoppingParameter_r12 = 0;
preconfigpool->dataHoppingConfig_r12.numSubbands_r12 = LTE_SL_HoppingConfigComm_r12__numSubbands_r12_ns1;
preconfigpool->dataHoppingConfig_r12.rb_Offset_r12 = 0;
-
preconfigpool->dataTxParameters_r12 = 0;
-
ASN_SEQUENCE_ADD(&UE->SL_Preconfiguration[eNB_index]->preconfigComm_r12.list,preconfigpool);
-
// Rel13 extensions
UE->SL_Preconfiguration[eNB_index]->ext1 = NULL;
-/*
- // Establish a SLRB (using DRB 3 for now)
- protocol_ctxt_t ctxt;
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
+ /*
+ // Establish a SLRB (using DRB 3 for now)
+ protocol_ctxt_t ctxt;
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
- UE->DRB_config[0][0] = CALLOC(1,sizeof(struct DRB_ToAddMod));
- UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
- UE->DRB_config[0][0]->drb_Identity = 3;
- UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
- // allowed value 5..15, value : x+4
- *(UE->DRB_config[0][0]->eps_BearerIdentity) = 3;
- UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long));
- *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
+ UE->DRB_config[0][0] = CALLOC(1,sizeof(struct DRB_ToAddMod));
+ UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
+ UE->DRB_config[0][0]->drb_Identity = 3;
+ UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
+ // allowed value 5..15, value : x+4
+ *(UE->DRB_config[0][0]->eps_BearerIdentity) = 3;
+ UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long));
+ *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
- // TTN - Establish a new SLRB for PC5-S (using DRB 10 for now)
- UE->DRB_config[0][1] = CALLOC(1,sizeof(struct DRB_ToAddMod));
- UE->DRB_config[0][1]->eps_BearerIdentity = CALLOC(1, sizeof(long));
- UE->DRB_config[0][1]->drb_Identity = 10;
- UE->DRB_config[0][1]->eps_BearerIdentity = CALLOC(1, sizeof(long));
- // allowed value 5..15, value : x+4
- *(UE->DRB_config[0][1]->eps_BearerIdentity) = 10;
- UE->DRB_config[0][1]->logicalChannelIdentity = CALLOC(1, sizeof(long));
- *(UE->DRB_config[0][1]->logicalChannelIdentity) = UE->DRB_config[0][1]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
+ // TTN - Establish a new SLRB for PC5-S (using DRB 10 for now)
+ UE->DRB_config[0][1] = CALLOC(1,sizeof(struct DRB_ToAddMod));
+ UE->DRB_config[0][1]->eps_BearerIdentity = CALLOC(1, sizeof(long));
+ UE->DRB_config[0][1]->drb_Identity = 10;
+ UE->DRB_config[0][1]->eps_BearerIdentity = CALLOC(1, sizeof(long));
+ // allowed value 5..15, value : x+4
+ *(UE->DRB_config[0][1]->eps_BearerIdentity) = 10;
+ UE->DRB_config[0][1]->logicalChannelIdentity = CALLOC(1, sizeof(long));
+ *(UE->DRB_config[0][1]->logicalChannelIdentity) = UE->DRB_config[0][1]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
- struct RLC_Config *DRB_rlc_config = CALLOC(1,sizeof(struct RLC_Config));
- struct PDCP_Config *DRB_pdcp_config = CALLOC(1,sizeof(struct PDCP_Config));
- struct PDCP_Config__rlc_UM *PDCP_rlc_UM = CALLOC(1,sizeof(struct PDCP_Config__rlc_UM));
- struct LogicalChannelConfig *DRB_lchan_config = CALLOC(1,sizeof(struct LogicalChannelConfig));
- struct LogicalChannelConfig__ul_SpecificParameters
- *DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
- long *logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+ struct RLC_Config *DRB_rlc_config = CALLOC(1,sizeof(struct RLC_Config));
+ struct PDCP_Config *DRB_pdcp_config = CALLOC(1,sizeof(struct PDCP_Config));
+ struct PDCP_Config__rlc_UM *PDCP_rlc_UM = CALLOC(1,sizeof(struct PDCP_Config__rlc_UM));
+ struct LogicalChannelConfig *DRB_lchan_config = CALLOC(1,sizeof(struct LogicalChannelConfig));
+ struct LogicalChannelConfig__ul_SpecificParameters
+ *DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
+ long *logicalchannelgroup_drb = CALLOC(1, sizeof(long));
- DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
- DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
- DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
- DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
- UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config;
- UE->DRB_config[0][1]->rlc_Config = DRB_rlc_config;
+ DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
+ DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+ DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
+ DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
+ UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config;
+ UE->DRB_config[0][1]->rlc_Config = DRB_rlc_config;
- DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
- UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config;
- UE->DRB_config[0][1]->pdcp_Config = DRB_pdcp_config;
- DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
- *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
- DRB_pdcp_config->rlc_AM = NULL;
- DRB_pdcp_config->rlc_UM = NULL;
+ DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
+ UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config;
+ UE->DRB_config[0][1]->pdcp_Config = DRB_pdcp_config;
+ DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
+ *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
+ DRB_pdcp_config->rlc_AM = NULL;
+ DRB_pdcp_config->rlc_UM = NULL;
- // avoid gcc warnings
- (void)PDCP_rlc_UM;
+ // avoid gcc warnings
+ (void)PDCP_rlc_UM;
- DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
- PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
- DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
+ DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+ PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+ DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed;
- UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config;
- UE->DRB_config[0][1]->logicalChannelConfig = DRB_lchan_config;
- DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
- DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
+ UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config;
+ UE->DRB_config[0][1]->logicalChannelConfig = DRB_lchan_config;
+ DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
+ DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
- DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer
- DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
- //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
- DRB_ul_SpecificParameters->bucketSizeDuration =
- LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+ DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer
+ DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
+ //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+ DRB_ul_SpecificParameters->bucketSizeDuration =
+ LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
- // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
+ // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
- *logicalchannelgroup_drb = 1;
- DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
+ *logicalchannelgroup_drb = 1;
+ DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
- UE->DRB_configList = CALLOC(1,sizeof(DRB_ToAddModList_t));
- ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]);
- ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][1]);
+ UE->DRB_configList = CALLOC(1,sizeof(DRB_ToAddModList_t));
+ ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]);
+ ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][1]);
- rrc_pdcp_config_asn1_req(&ctxt,
- (SRB_ToAddModList_t *) NULL,
- UE->DRB_configList,
- (DRB_ToReleaseList_t*) NULL,
- 0xff, NULL, NULL, NULL
-#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- , (LTE_PMCH_InfoList_r9_t *) NULL
-#endif
- ,NULL);
+ rrc_pdcp_config_asn1_req(&ctxt,
+ (SRB_ToAddModList_t *) NULL,
+ UE->DRB_configList,
+ (DRB_ToReleaseList_t*) NULL,
+ 0xff, NULL, NULL, NULL
+ #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+ , (LTE_PMCH_InfoList_r9_t *) NULL
+ #endif
+ ,NULL);
- rrc_rlc_config_asn1_req(&ctxt,
- (SRB_ToAddModList_t*)NULL,
- UE->DRB_configList,
- (DRB_ToReleaseList_t*)NULL
-#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,(LTE_PMCH_InfoList_r9_t *)NULL
-#endif
- );
-*/
+ rrc_rlc_config_asn1_req(&ctxt,
+ (SRB_ToAddModList_t*)NULL,
+ UE->DRB_configList,
+ (DRB_ToReleaseList_t*)NULL
+ #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+ ,(LTE_PMCH_InfoList_r9_t *)NULL
+ #endif
+ );
+ */
}
#endif
//-----------------------------------------------------------------------------
-void openair_rrc_ue_init_security( const protocol_ctxt_t* const ctxt_pP )
-{
+void openair_rrc_ue_init_security( const protocol_ctxt_t *const ctxt_pP ) {
#if defined(ENABLE_SECURITY)
// uint8_t *kRRCenc;
// uint8_t *kRRCint;
char ascii_buffer[65];
uint8_t i;
-
memset(UE_rrc_inst[ctxt_pP->module_id].kenb, ctxt_pP->module_id, 32);
for (i = 0; i < 32; i++) {
@@ -490,8 +446,7 @@ void openair_rrc_ue_init_security( const protocol_ctxt_t* const ctxt_pP )
}
//-----------------------------------------------------------------------------
-char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_index )
-{
+char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_index ) {
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_idP, ENB_FLAG_NO, NOT_A_RNTI, 0, 0,eNB_index);
LOG_I(RRC,
@@ -499,7 +454,6 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_
PROTOCOL_RRC_CTXT_ARGS(&ctxt));
rrc_set_state (ue_mod_idP, RRC_STATE_INACTIVE);
rrc_set_sub_state (ue_mod_idP, RRC_SUB_STATE_INACTIVE);
-
LOG_I(RRC,"[UE %d] INIT State = RRC_IDLE (eNB %d)\n",ctxt.module_id,eNB_index);
UE_rrc_inst[ctxt.module_id].Info[eNB_index].State=RRC_IDLE;
UE_rrc_inst[ctxt.module_id].Info[eNB_index].T300_active = 0;
@@ -516,22 +470,16 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_
#else
UE_rrc_inst[ctxt.module_id].integrity_algorithm = LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_reserved;
#endif
-
openair_rrc_ue_init_security(&ctxt);
init_SI_UE(&ctxt,eNB_index);
LOG_D(RRC,PROTOCOL_RRC_CTXT_FMT" INIT: phy_sync_2_ch_ind\n",
PROTOCOL_RRC_CTXT_ARGS(&ctxt));
-
-
-
#ifndef NO_RRM
send_msg(&S_rrc,msg_rrc_phy_synch_to_CH_ind(ctxt.module_id,eNB_index,UE_rrc_inst[ctxt.module_id].Mac_id));
#endif
-
#ifndef NO_RRM
send_msg(&S_rrc,msg_rrc_phy_synch_to_CH_ind(ctxt.module_id,eNB_index,UE_rrc_inst[ctxt.module_id].Mac_id));
#endif
-
#ifdef NO_RRM //init ch SRB0, SRB1 & BDTCH
openair_rrc_on_ue(&ctxt);
#endif
@@ -544,18 +492,14 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_
UE_rrc_inst[ue_mod_idP].num_active_cba_groups = 0;
#endif
-
return 0;
}
//-----------------------------------------------------------------------------
-void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index )
-{
-
+void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) {
uint8_t i=0,rv[6];
if(UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size ==0) {
-
// Get RRCConnectionRequest, fill random for now
// Generate random byte stream for contention resolution
for (i=0; i<6; i++) {
@@ -572,9 +516,8 @@ void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t* const ctxt_pP,
UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size =
do_RRCConnectionRequest(
ctxt_pP->module_id,
- (uint8_t*)UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.Payload,
+ (uint8_t *)UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.Payload,
rv);
-
LOG_I(RRC,"[UE %d] : Frame %d, Logical Channel UL-CCCH (SRB0), Generating RRCConnectionRequest (bytes %d, eNB %d)\n",
ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size, eNB_index);
@@ -585,7 +528,6 @@ void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t* const ctxt_pP,
LOG_T(RRC,"\n");
/*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff;
UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */
-
}
}
@@ -611,12 +553,11 @@ static const char const nas_attach_req_imsi[] = {
//-----------------------------------------------------------------------------
void
rrc_t310_expiration(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const uint8_t eNB_index
)
//-----------------------------------------------------------------------------
{
-
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED) {
LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE;
@@ -628,7 +569,7 @@ rrc_t310_expiration(
if (UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active == 1) {
LOG_D (RRC,"[Inst %d] eNB_index %d, Remove RB %d\n ", ctxt_pP->module_id, eNB_index,
- UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id);
+ UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id);
rrc_pdcp_config_req (ctxt_pP,
SRB_FLAG_YES,
CONFIG_ACTION_REMOVE,
@@ -650,43 +591,36 @@ rrc_t310_expiration(
}
//-----------------------------------------------------------------------------
-static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id )
-{
-
+static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ) {
uint8_t buffer[100];
uint8_t size;
- const char * nas_msg;
+ const char *nas_msg;
int nas_msg_length;
-
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
- nas_msg = (char*) UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data;
+ nas_msg = (char *) UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data;
nas_msg_length = UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length;
#else
nas_msg = nas_attach_req_imsi;
nas_msg_length = sizeof(nas_attach_req_imsi);
#endif
-
size = do_RRCConnectionSetupComplete(ctxt_pP->module_id, buffer, Transaction_id, nas_msg_length, nas_msg);
-
LOG_I(RRC,"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRCConnectionSetupComplete (bytes%d, eNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index);
LOG_D(RLC,
"[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
ctxt_pP->frame, ctxt_pP->module_id+NB_eNB_INST, size, eNB_index, rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH);
rrc_data_req_ue (
- ctxt_pP,
- DCCH,
- rrc_mui++,
- SDU_CONFIRM_NO,
- size,
- buffer,
- PDCP_TRANSMISSION_MODE_CONTROL);
+ ctxt_pP,
+ DCCH,
+ rrc_mui++,
+ SDU_CONFIRM_NO,
+ size,
+ buffer,
+ PDCP_TRANSMISSION_MODE_CONTROL);
}
//-----------------------------------------------------------------------------
-void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id )
-{
-
+void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ) {
uint8_t buffer[32], size;
size = do_RRCConnectionReconfigurationComplete(ctxt_pP, buffer, Transaction_id);
LOG_I(RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCConnectionReconfigurationComplete (bytes %d, eNB_index %d)\n",
@@ -701,66 +635,35 @@ void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t
UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
DCCH);
rrc_data_req_ue (
- ctxt_pP,
- DCCH,
- rrc_mui++,
- SDU_CONFIRM_NO,
- size,
- buffer,
- PDCP_TRANSMISSION_MODE_CONTROL);
+ ctxt_pP,
+ DCCH,
+ rrc_mui++,
+ SDU_CONFIRM_NO,
+ size,
+ buffer,
+ PDCP_TRANSMISSION_MODE_CONTROL);
}
//-----------------------------------------------------------------------------
// Called by L2 interface (MAC)
-int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* const Srb_info, const uint8_t eNB_index )
-{
- LTE_DL_CCCH_Message_t* dl_ccch_msg=NULL;
+int rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_INFO *const Srb_info, const uint8_t eNB_index ) {
+ LTE_DL_CCCH_Message_t *dl_ccch_msg=NULL;
asn_dec_rval_t dec_rval;
int rval=0;
-
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_IN);
// LOG_D(RRC,"[UE %d] Decoding DL-CCCH message (%d bytes), State %d\n",ue_mod_idP,Srb_info->Rx_buffer.payload_size,
// UE_rrc_inst[ue_mod_idP].Info[eNB_index].State);
-
dec_rval = uper_decode(NULL,
&asn_DEF_LTE_DL_CCCH_Message,
- (void**)&dl_ccch_msg,
- (uint8_t*)Srb_info->Rx_buffer.Payload,
+ (void **)&dl_ccch_msg,
+ (uint8_t *)Srb_info->Rx_buffer.Payload,
100,0,0);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout,&asn_DEF_LTE_DL_CCCH_Message,(void*)dl_ccch_msg);
+ xer_fprint(stdout,&asn_DEF_LTE_DL_CCCH_Message,(void *)dl_ccch_msg);
}
-#if defined(ENABLE_ITTI)
-# if defined(DISABLE_ITTI_XER_PRINT)
- {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message (TASK_RRC_UE, RRC_DL_CCCH_MESSAGE);
- memcpy (&msg_p->ittiMsg, (void *) dl_ccch_msg, sizeof(RrcDlCcchMessage));
-
- itti_send_msg_to_task (TASK_UNKNOWN, ctxt_pP->instance, msg_p);
- }
-# else
- {
- char message_string[10000];
- size_t message_string_size;
-
- if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_CCCH_Message, (void *)dl_ccch_msg)) > 0) {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
- }
- }
-# endif
-#endif
-
if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) {
LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT);
@@ -768,74 +671,68 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co
}
if (dl_ccch_msg->message.present == LTE_DL_CCCH_MessageType_PR_c1) {
-
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_SI_RECEIVED) {
-
switch (dl_ccch_msg->message.choice.c1.present) {
+ case LTE_DL_CCCH_MessageType__c1_PR_NOTHING:
+ LOG_I(RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n",
+ ctxt_pP->module_id,
+ ctxt_pP->frame);
+ rval = 0;
+ break;
- case LTE_DL_CCCH_MessageType__c1_PR_NOTHING:
- LOG_I(RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n",
- ctxt_pP->module_id,
- ctxt_pP->frame);
- rval = 0;
- break;
+ case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment:
+ LOG_I(RRC,
+ "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n",
+ ctxt_pP->module_id,
+ ctxt_pP->frame);
+ rval = 0;
+ break;
- case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment:
- LOG_I(RRC,
- "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n",
- ctxt_pP->module_id,
- ctxt_pP->frame);
- rval = 0;
- break;
+ case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject:
+ LOG_I(RRC,
+ "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n",
+ ctxt_pP->module_id,
+ ctxt_pP->frame);
+ rval = 0;
+ break;
- case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject:
- LOG_I(RRC,
- "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n",
- ctxt_pP->module_id,
- ctxt_pP->frame);
- rval = 0;
- break;
+ case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReject:
+ LOG_I(RRC,
+ "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n",
+ ctxt_pP->module_id,
+ ctxt_pP->frame);
+ rval = 0;
+ break;
- case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionReject:
- LOG_I(RRC,
- "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n",
- ctxt_pP->module_id,
- ctxt_pP->frame);
- rval = 0;
- break;
+ case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionSetup:
+ LOG_I(RRC,
+ "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n",
+ ctxt_pP->module_id,
+ ctxt_pP->frame,
+ ctxt_pP->rnti);
+ // Get configuration
+ // Release T300 timer
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].T300_active = 0;
+ rrc_ue_process_radioResourceConfigDedicated(
+ ctxt_pP,
+ eNB_index,
+ &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup.criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated);
+ rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED);
+ rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED);
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].rnti = ctxt_pP->rnti;
+ rrc_ue_generate_RRCConnectionSetupComplete(
+ ctxt_pP,
+ eNB_index,
+ dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup.rrc_TransactionIdentifier);
+ rval = 0;
+ break;
- case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionSetup:
- LOG_I(RRC,
- "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n",
- ctxt_pP->module_id,
- ctxt_pP->frame,
- ctxt_pP->rnti);
- // Get configuration
-
- // Release T300 timer
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].T300_active = 0;
- rrc_ue_process_radioResourceConfigDedicated(
- ctxt_pP,
- eNB_index,
- &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup.criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated);
-
- rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED);
- rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED);
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].rnti = ctxt_pP->rnti;
- rrc_ue_generate_RRCConnectionSetupComplete(
- ctxt_pP,
- eNB_index,
- dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup.rrc_TransactionIdentifier);
-
- rval = 0;
- break;
-
- default:
- LOG_E(RRC, "[UE%d] Frame %d : Unknown message\n",
- ctxt_pP->module_id,
- ctxt_pP->frame);
- rval = -1;
- break;
+ default:
+ LOG_E(RRC, "[UE%d] Frame %d : Unknown message\n",
+ ctxt_pP->module_id,
+ ctxt_pP->frame);
+ rval = -1;
+ break;
}
}
}
@@ -850,30 +747,21 @@ rrc_ue_establish_srb1(
module_id_t ue_mod_idP,
frame_t frameP,
uint8_t eNB_index,
- struct LTE_SRB_ToAddMod* SRB_config
+ struct LTE_SRB_ToAddMod *SRB_config
)
//-----------------------------------------------------------------------------
{
// add descriptor from RRC PDU
-
-
UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Active = 1;
UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG
UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Srb_id = 1;
-
// copy default configuration for now
// memcpy(&UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Lchan_desc[0],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE);
// memcpy(&UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Lchan_desc[1],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE);
-
-
LOG_I(RRC,"[UE %d], CONFIG_SRB1 %d corresponding to eNB_index %d\n", ue_mod_idP,DCCH,eNB_index);
-
//rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, lchan_id,UNDEF_SECURITY_MODE);
// rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,lchan_id,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
-
// UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size=DEFAULT_MEAS_IND_SIZE+1;
-
-
return(0);
}
@@ -883,30 +771,21 @@ rrc_ue_establish_srb2(
module_id_t ue_mod_idP,
frame_t frameP,
uint8_t eNB_index,
- struct LTE_SRB_ToAddMod* SRB_config
+ struct LTE_SRB_ToAddMod *SRB_config
)
//-----------------------------------------------------------------------------
{
// add descriptor from RRC PDU
-
-
UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Active = 1;
UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG
UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Srb_info.Srb_id = 2;
-
// copy default configuration for now
// memcpy(&UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Srb_info.Lchan_desc[0],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE);
// memcpy(&UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Srb_info.Lchan_desc[1],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE);
-
-
LOG_I(RRC,"[UE %d], CONFIG_SRB2 %d corresponding to eNB_index %d\n",ue_mod_idP,DCCH1,eNB_index);
-
//rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, lchan_id, UNDEF_SECURITY_MODE);
// rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,lchan_id,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
-
// UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size=DEFAULT_MEAS_IND_SIZE+1;
-
-
return(0);
}
@@ -916,7 +795,7 @@ rrc_ue_establish_drb(
module_id_t ue_mod_idP,
frame_t frameP,
uint8_t eNB_index,
- struct LTE_DRB_ToAddMod* DRB_config
+ struct LTE_DRB_ToAddMod *DRB_config
)
//-----------------------------------------------------------------------------
{
@@ -928,7 +807,6 @@ rrc_ue_establish_drb(
(void)ip_addr_offset3;
(void)ip_addr_offset4;
#endif
-
LOG_I(RRC,"[UE %d] Frame %d: processing RRCConnectionReconfiguration: reconfiguring DRB %ld/LCID %d\n",
ue_mod_idP, frameP, DRB_config->drb_Identity, (int)*DRB_config->logicalChannelIdentity);
/*
@@ -954,7 +832,6 @@ rrc_ue_establish_drb(
ue_mod_idP,
ip_addr_offset3+ue_mod_idP,
(long int)((eNB_index * maxDRB) + DRB_config->drb_Identity));
-
rb_conf_ipv4(0,//add
ue_mod_idP,//cx align with the UE index
ip_addr_offset3+ue_mod_idP,//inst num_enb+ue_index
@@ -967,7 +844,6 @@ rrc_ue_establish_drb(
# endif
#endif
-
return(0);
}
@@ -975,13 +851,12 @@ rrc_ue_establish_drb(
//-----------------------------------------------------------------------------
void
rrc_ue_process_measConfig(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const uint8_t eNB_index,
- LTE_MeasConfig_t* const measConfig
+ LTE_MeasConfig_t *const measConfig
)
//-----------------------------------------------------------------------------
{
-
// This is the procedure described in 36.331 Section 5.5.2.1
int i;
long ind;
@@ -1003,8 +878,8 @@ rrc_ue_process_measConfig(
if (UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index][ind-1]) {
LOG_D(RRC,"Modifying measurement object %ld\n",ind);
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index][ind-1],
- (char*)measObj,
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index][ind-1],
+ (char *)measObj,
sizeof(LTE_MeasObjectToAddMod_t));
} else {
LOG_I(RRC,"Adding measurement object %ld\n",ind);
@@ -1021,45 +896,43 @@ rrc_ue_process_measConfig(
}
LOG_I(RRC,"call rrc_mac_config_req \n");
-
rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index,
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- (struct LTE_PhysicalConfigDedicated *)NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
#endif
- UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index],
- (LTE_MAC_MainConfig_t *)NULL,
- 0,
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- (LTE_TDD_Config_t *)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index],
+ (LTE_MAC_MainConfig_t *)NULL,
+ 0,
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- ,0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
-
+ ,0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,
- 0,
- 0
+ ,
+ 0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,
- 0,
- NULL,
- NULL
+ ,
+ 0,
+ NULL,
+ NULL
#endif
- );
+ );
}
if (measConfig->reportConfigToRemoveList != NULL) {
@@ -1077,8 +950,8 @@ rrc_ue_process_measConfig(
if (UE_rrc_inst[ctxt_pP->module_id].ReportConfig[eNB_index][ind-1]) {
LOG_I(RRC,"Modifying Report Configuration %ld\n",ind-1);
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].ReportConfig[eNB_index][ind-1],
- (char*)measConfig->reportConfigToAddModList->list.array[i],
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].ReportConfig[eNB_index][ind-1],
+ (char *)measConfig->reportConfigToAddModList->list.array[i],
sizeof(LTE_ReportConfigToAddMod_t));
} else {
LOG_D(RRC,"Adding Report Configuration %ld %p \n",ind-1,measConfig->reportConfigToAddModList->list.array[i]);
@@ -1090,8 +963,8 @@ rrc_ue_process_measConfig(
if (measConfig->quantityConfig != NULL) {
if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index]) {
LOG_D(RRC,"Modifying Quantity Configuration \n");
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index],
- (char*)measConfig->quantityConfig,
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index],
+ (char *)measConfig->quantityConfig,
sizeof(LTE_QuantityConfig_t));
} else {
LOG_D(RRC,"Adding Quantity configuration\n");
@@ -1112,8 +985,8 @@ rrc_ue_process_measConfig(
if (UE_rrc_inst[ctxt_pP->module_id].MeasId[eNB_index][ind-1]) {
LOG_D(RRC,"Modifying Measurement ID %ld\n",ind-1);
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].MeasId[eNB_index][ind-1],
- (char*)measConfig->measIdToAddModList->list.array[i],
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].MeasId[eNB_index][ind-1],
+ (char *)measConfig->measIdToAddModList->list.array[i],
sizeof(LTE_MeasIdToAddMod_t));
} else {
LOG_D(RRC,"Adding Measurement ID %ld %p\n",ind-1,measConfig->measIdToAddModList->list.array[i]);
@@ -1124,8 +997,8 @@ rrc_ue_process_measConfig(
if (measConfig->measGapConfig !=NULL) {
if (UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index]) {
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index],
- (char*)measConfig->measGapConfig,
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index],
+ (char *)measConfig->measGapConfig,
sizeof(LTE_MeasGapConfig_t));
} else {
UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index] = measConfig->measGapConfig;
@@ -1135,8 +1008,8 @@ rrc_ue_process_measConfig(
if (measConfig->quantityConfig != NULL) {
if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index]) {
LOG_I(RRC,"Modifying Quantity Configuration \n");
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index],
- (char*)measConfig->quantityConfig,
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index],
+ (char *)measConfig->quantityConfig,
sizeof(LTE_QuantityConfig_t));
} else {
LOG_I(RRC,"Adding Quantity configuration\n");
@@ -1147,7 +1020,6 @@ rrc_ue_process_measConfig(
(*UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index]->quantityConfigEUTRA->filterCoefficientRSRP)/4);
UE_rrc_inst[ctxt_pP->module_id].filter_coeff_rsrq = 1./pow(2,
(*UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index]->quantityConfigEUTRA->filterCoefficientRSRQ)/4);
-
LOG_I(RRC,"[UE %d] set rsrp-coeff for eNB %d: %ld rsrq-coeff: %ld rsrp_factor: %f rsrq_factor: %f \n",
ctxt_pP->module_id, eNB_index, // UE_rrc_inst[ue_mod_idP].Info[eNB_index].UE_index,
*UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index]->quantityConfigEUTRA->filterCoefficientRSRP,
@@ -1162,7 +1034,7 @@ rrc_ue_process_measConfig(
if (measConfig->speedStatePars != NULL) {
if (UE_rrc_inst[ctxt_pP->module_id].speedStatePars) {
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].speedStatePars,(char*)measConfig->speedStatePars,sizeof(struct LTE_MeasConfig__speedStatePars));
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].speedStatePars,(char *)measConfig->speedStatePars,sizeof(struct LTE_MeasConfig__speedStatePars));
} else {
UE_rrc_inst[ctxt_pP->module_id].speedStatePars = measConfig->speedStatePars;
}
@@ -1174,231 +1046,192 @@ rrc_ue_process_measConfig(
void
-rrc_ue_update_radioResourceConfigDedicated(LTE_RadioResourceConfigDedicated_t* radioResourceConfigDedicated,
- const protocol_ctxt_t* const ctxt_pP,
- uint8_t eNB_index)
-{
- LTE_PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL;
+rrc_ue_update_radioResourceConfigDedicated(LTE_RadioResourceConfigDedicated_t *radioResourceConfigDedicated,
+ const protocol_ctxt_t *const ctxt_pP,
+ uint8_t eNB_index) {
+ LTE_PhysicalConfigDedicated_t *physicalConfigDedicated2 = NULL;
+ physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2));
+ physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated));
+ physicalConfigDedicated2->pusch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated));
+ physicalConfigDedicated2->pucch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated));
+ physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig));
+ physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic
+ = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic));
+ physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated));
+ physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig));
+ physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo));
+ physicalConfigDedicated2->uplinkPowerControlDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated));
+ physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH));
+ physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH));
- physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2));
- physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated));
- physicalConfigDedicated2->pusch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated));
- physicalConfigDedicated2->pucch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated));
- physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig));
- physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic
- = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic));
- physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated));
- physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig));
- physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo));
+ // Update pdsch_ConfigDedicated
+ if(radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated != NULL) {
+ LOG_I(RRC,"Update pdsch_ConfigDedicated config \n");
- physicalConfigDedicated2->uplinkPowerControlDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated));
- physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH));
- physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH));
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated = CALLOC(1,sizeof(LTE_PDSCH_ConfigDedicated_t));
- // Update pdsch_ConfigDedicated
- if(radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated != NULL)
- {
- LOG_I(RRC,"Update pdsch_ConfigDedicated config \n");
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated,
+ sizeof(physicalConfigDedicated2->pdsch_ConfigDedicated));
+ } else {
+ LOG_I(RRC,"Keep old config for pdsch_ConfigDedicated\n");
+ }
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated = CALLOC(1,sizeof(LTE_PDSCH_ConfigDedicated_t));
+ // Update pusch_ConfigDedicated
+ if(radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated != NULL) {
+ LOG_I(RRC,"Update pusch_ConfigDedicated config \n");
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated,
- sizeof(physicalConfigDedicated2->pdsch_ConfigDedicated));
- }
- else
- {
- LOG_I(RRC,"Keep old config for pdsch_ConfigDedicated\n");
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated = CALLOC(1,sizeof(LTE_PUSCH_ConfigDedicated_t));
+
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated,
+ sizeof(physicalConfigDedicated2->pusch_ConfigDedicated));
+ } else {
+ LOG_I(RRC,"Keep old config for pusch_ConfigDedicated\n");
+ }
+
+ // Update pucch_ConfigDedicated
+ if(radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated != NULL) {
+ LOG_I(RRC,"Update pucch_ConfigDedicated config \n");
+
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated = CALLOC(1,sizeof(LTE_PUCCH_ConfigDedicated_t));
+
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated,
+ sizeof(physicalConfigDedicated2->pucch_ConfigDedicated));
+ } else {
+ LOG_I(RRC,"Keep old config for pucch_ConfigDedicated\n");
+ }
+
+ // Update cqi_ReportConfig
+ if(radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig != NULL) {
+ LOG_I(RRC,"Update cqi_ReportConfig config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig), sizeof(LTE_CQI_ReportConfig_t));
+
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig = CALLOC(1,sizeof(LTE_CQI_ReportConfig_t));
+
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig,
+ sizeof(*physicalConfigDedicated2->cqi_ReportConfig));
+
+ if (radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic != NULL) {
+ LOG_I(RRC,"Update cqi_ReportPeriodic config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic), sizeof(LTE_CQI_ReportPeriodic_t));
+
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic = CALLOC(1,sizeof(LTE_CQI_ReportPeriodic_t));
+
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic,
+ sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic));
}
+ } else {
+ LOG_I(RRC,"Keep old config for cqi_ReportConfig\n");
+ }
- // Update pusch_ConfigDedicated
- if(radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated != NULL)
- {
- LOG_I(RRC,"Update pusch_ConfigDedicated config \n");
+ // Update schedulingRequestConfig
+ if(radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig != NULL) {
+ LOG_I(RRC,"Update schedulingRequestConfig config \n");
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated = CALLOC(1,sizeof(LTE_PUSCH_ConfigDedicated_t));
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig = CALLOC(1,sizeof(LTE_SchedulingRequestConfig_t));
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated,
- sizeof(physicalConfigDedicated2->pusch_ConfigDedicated));
- }
- else
- {
- LOG_I(RRC,"Keep old config for pusch_ConfigDedicated\n");
- }
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig,
+ sizeof(physicalConfigDedicated2->schedulingRequestConfig));
+ } else {
+ LOG_I(RRC,"Keep old config for schedulingRequestConfig\n");
+ }
- // Update pucch_ConfigDedicated
- if(radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated != NULL)
- {
- LOG_I(RRC,"Update pucch_ConfigDedicated config \n");
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated = CALLOC(1,sizeof(LTE_PUCCH_ConfigDedicated_t));
+ // Update soundingRS_UL_ConfigDedicated
+ if(radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated != NULL) {
+ LOG_I(RRC,"Update soundingRS_UL_ConfigDedicated config \n");
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated,
- sizeof(physicalConfigDedicated2->pucch_ConfigDedicated));
- }
- else
- {
- LOG_I(RRC,"Keep old config for pucch_ConfigDedicated\n");
- }
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(LTE_SoundingRS_UL_ConfigDedicated_t));
- // Update cqi_ReportConfig
- if(radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig != NULL)
- {
- LOG_I(RRC,"Update cqi_ReportConfig config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig), sizeof(LTE_CQI_ReportConfig_t));
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated,
+ sizeof(physicalConfigDedicated2->soundingRS_UL_ConfigDedicated));
+ } else {
+ LOG_I(RRC,"Keep old config for soundingRS_UL_ConfigDedicated\n");
+ }
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig = CALLOC(1,sizeof(LTE_CQI_ReportConfig_t));
+ // Update antennaInfo
+ if(radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo != NULL) {
+ LOG_I(RRC,"Update antennaInfo config \n");
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig,
- sizeof(*physicalConfigDedicated2->cqi_ReportConfig));
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo = CALLOC(1,sizeof(struct LTE_PhysicalConfigDedicated__antennaInfo));
- if (radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic != NULL) {
- LOG_I(RRC,"Update cqi_ReportPeriodic config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic), sizeof(LTE_CQI_ReportPeriodic_t));
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo,
+ sizeof(physicalConfigDedicated2->antennaInfo));
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.transmissionMode =
+ radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode;
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.codebookSubsetRestriction =
+ radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.codebookSubsetRestriction;
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection =
+ radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection;
+ LOG_I(PHY,"New Transmission Mode %ld \n",radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
+ LOG_I(PHY,"Configured Transmission Mode %ld \n",UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.transmissionMode);
+ } else {
+ LOG_I(RRC,"Keep old config for antennaInfo\n");
+ }
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic = CALLOC(1,sizeof(LTE_CQI_ReportPeriodic_t));
+ // Update uplinkPowerControlDedicated
+ if(radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated != NULL) {
+ LOG_I(RRC,"Update uplinkPowerControlDedicated config \n");
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic,
- sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic));
- }
- }
- else
- {
- LOG_I(RRC,"Keep old config for cqi_ReportConfig\n");
- }
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated = CALLOC(1,sizeof(LTE_UplinkPowerControlDedicated_t));
- // Update schedulingRequestConfig
- if(radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig != NULL)
- {
- LOG_I(RRC,"Update schedulingRequestConfig config \n");
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated,
+ sizeof(physicalConfigDedicated2->uplinkPowerControlDedicated));
+ } else {
+ LOG_I(RRC,"Keep old config for uplinkPowerControlDedicated\n");
+ }
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig = CALLOC(1,sizeof(LTE_SchedulingRequestConfig_t));
+ // Update tpc_PDCCH_ConfigPUCCH
+ if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH != NULL) {
+ LOG_I(RRC,"Update tpc_PDCCH_ConfigPUCCH config \n");
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig,
- sizeof(physicalConfigDedicated2->schedulingRequestConfig));
- }
- else
- {
- LOG_I(RRC,"Keep old config for schedulingRequestConfig\n");
- }
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(LTE_TPC_PDCCH_Config_t));
- // Update soundingRS_UL_ConfigDedicated
- if(radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated != NULL)
- {
- LOG_I(RRC,"Update soundingRS_UL_ConfigDedicated config \n");
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH,
+ sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH));
+ } else {
+ LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUCCH\n");
+ }
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(LTE_SoundingRS_UL_ConfigDedicated_t));
+ // Update tpc_PDCCH_ConfigPUSCH
+ if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH != NULL) {
+ LOG_I(RRC,"Update tpc_PDCCH_ConfigPUSCH config \n");
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated,
- sizeof(physicalConfigDedicated2->soundingRS_UL_ConfigDedicated));
- }
- else
- {
- LOG_I(RRC,"Keep old config for soundingRS_UL_ConfigDedicated\n");
- }
-
- // Update antennaInfo
- if(radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo != NULL)
- {
- LOG_I(RRC,"Update antennaInfo config \n");
-
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo = CALLOC(1,sizeof(struct LTE_PhysicalConfigDedicated__antennaInfo));
-
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo,
- sizeof(physicalConfigDedicated2->antennaInfo));
-
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.transmissionMode =
- radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode;
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.codebookSubsetRestriction =
- radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.codebookSubsetRestriction;
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection =
- radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection;
-
- LOG_I(PHY,"New Transmission Mode %ld \n",radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
- LOG_I(PHY,"Configured Transmission Mode %ld \n",UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.transmissionMode);
-
- }
- else
- {
- LOG_I(RRC,"Keep old config for antennaInfo\n");
- }
-
-
- // Update uplinkPowerControlDedicated
- if(radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated != NULL)
- {
- LOG_I(RRC,"Update uplinkPowerControlDedicated config \n");
-
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated = CALLOC(1,sizeof(LTE_UplinkPowerControlDedicated_t));
-
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated,
- sizeof(physicalConfigDedicated2->uplinkPowerControlDedicated));
- }
- else
- {
- LOG_I(RRC,"Keep old config for uplinkPowerControlDedicated\n");
- }
-
- // Update tpc_PDCCH_ConfigPUCCH
- if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH != NULL)
- {
- LOG_I(RRC,"Update tpc_PDCCH_ConfigPUCCH config \n");
-
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(LTE_TPC_PDCCH_Config_t));
-
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH,
- sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH));
- }
- else
- {
- LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUCCH\n");
- }
-
- // Update tpc_PDCCH_ConfigPUSCH
- if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH != NULL)
- {
- LOG_I(RRC,"Update tpc_PDCCH_ConfigPUSCH config \n");
-
- if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH == NULL)
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(LTE_TPC_PDCCH_Config_t));
-
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH,
- (char*)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH,
- sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH));
-
- }
- else
- {
- LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUSCH\n");
- }
+ if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH == NULL)
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(LTE_TPC_PDCCH_Config_t));
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH,
+ (char *)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH,
+ sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH));
+ } else {
+ LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUSCH\n");
+ }
}
//-----------------------------------------------------------------------------
void
rrc_ue_process_radioResourceConfigDedicated(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
uint8_t eNB_index,
- LTE_RadioResourceConfigDedicated_t* radioResourceConfigDedicated
+ LTE_RadioResourceConfigDedicated_t *radioResourceConfigDedicated
)
//-----------------------------------------------------------------------------
{
-
long SRB_id,DRB_id;
int i,cnt;
LTE_LogicalChannelConfig_t *SRB1_logicalChannelConfig,*SRB2_logicalChannelConfig;
@@ -1413,9 +1246,9 @@ rrc_ue_process_radioResourceConfigDedicated(
if (UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]) {
#if 1
- rrc_ue_update_radioResourceConfigDedicated(radioResourceConfigDedicated, ctxt_pP, eNB_index);
+ rrc_ue_update_radioResourceConfigDedicated(radioResourceConfigDedicated, ctxt_pP, eNB_index);
#else
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],(char*)radioResourceConfigDedicated->physicalConfigDedicated,
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],(char *)radioResourceConfigDedicated->physicalConfigDedicated,
sizeof(struct PhysicalConfigDedicated));
#endif
} else {
@@ -1428,7 +1261,7 @@ rrc_ue_process_radioResourceConfigDedicated(
if (radioResourceConfigDedicated->mac_MainConfig) {
if (radioResourceConfigDedicated->mac_MainConfig->present == LTE_RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue) {
if (UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index]) {
- memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],(char*)&radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue,
+ memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],(char *)&radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue,
sizeof(LTE_MAC_MainConfig_t));
} else {
UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index] = &radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue;
@@ -1476,7 +1309,6 @@ rrc_ue_process_radioResourceConfigDedicated(
if (radioResourceConfigDedicated->srb_ToAddModList) {
uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL;
-
#if defined(ENABLE_SECURITY)
derive_key_rrc_enc(UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm,
UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCenc);
@@ -1486,8 +1318,8 @@ rrc_ue_process_radioResourceConfigDedicated(
// Refresh SRBs
rrc_pdcp_config_asn1_req(ctxt_pP,
radioResourceConfigDedicated->srb_ToAddModList,
- (LTE_DRB_ToAddModList_t*)NULL,
- (LTE_DRB_ToReleaseList_t*)NULL,
+ (LTE_DRB_ToAddModList_t *)NULL,
+ (LTE_DRB_ToReleaseList_t *)NULL,
UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm |
(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4),
kRRCenc,
@@ -1497,18 +1329,16 @@ rrc_ue_process_radioResourceConfigDedicated(
,(LTE_PMCH_InfoList_r9_t *)NULL
#endif
,NULL);
-
// Refresh SRBs
rrc_rlc_config_asn1_req(ctxt_pP,
radioResourceConfigDedicated->srb_ToAddModList,
- (LTE_DRB_ToAddModList_t*)NULL,
- (LTE_DRB_ToReleaseList_t*)NULL
+ (LTE_DRB_ToAddModList_t *)NULL,
+ (LTE_DRB_ToReleaseList_t *)NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
,(LTE_PMCH_InfoList_r9_t *)NULL
, 0, 0
#endif
);
-
#if ENABLE_RAL
// first msg that includes srb config
UE_rrc_inst[ctxt_pP->module_id].num_srb=radioResourceConfigDedicated->srb_ToAddModList->list.count;
@@ -1530,7 +1360,6 @@ rrc_ue_process_radioResourceConfigDedicated(
if (UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]->logicalChannelConfig) {
if (UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]->logicalChannelConfig->present == LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) {
SRB1_logicalChannelConfig = &UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]->logicalChannelConfig->choice.explicitValue;
-
} else {
SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
}
@@ -1540,45 +1369,44 @@ rrc_ue_process_radioResourceConfigDedicated(
LOG_I(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 eNB %d) --->][MAC_UE][MOD %02d][]\n",
ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id);
-
rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index,
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],
- 1,
- SRB1_logicalChannelConfig,
- (LTE_MeasGapConfig_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],
+ 1,
+ SRB1_logicalChannelConfig,
+ (LTE_MeasGapConfig_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- ,
- 0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
+ ,
+ 0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,
- 0,
- 0
+ ,
+ 0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,
- 0,
- NULL,
- NULL
+ ,
+ 0,
+ NULL,
+ NULL
#endif
- );
+ );
}
} else {
if (UE_rrc_inst[ctxt_pP->module_id].SRB2_config[eNB_index]) {
@@ -1606,44 +1434,43 @@ rrc_ue_process_radioResourceConfigDedicated(
eNB_index,
ctxt_pP->module_id);
rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index,
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],
- 2,
- SRB2_logicalChannelConfig,
- UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index],
- (LTE_TDD_Config_t *)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],
+ 2,
+ SRB2_logicalChannelConfig,
+ UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index],
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- ,
- 0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
-
+ ,
+ 0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,
- 0,
- 0
+ ,
+ 0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,
- 0,
- NULL,
- NULL
+ ,
+ 0,
+ NULL,
+ NULL
#endif
- );
+ );
}
}
}
@@ -1651,22 +1478,19 @@ rrc_ue_process_radioResourceConfigDedicated(
// Establish DRBs if present
if (radioResourceConfigDedicated->drb_ToAddModList) {
-
if ( (UE_rrc_inst[ctxt_pP->module_id].defaultDRB == NULL) &&
(radioResourceConfigDedicated->drb_ToAddModList->list.count >= 1) ) {
- // configure the first DRB ID as the default DRB ID
- UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t));
- *UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioResourceConfigDedicated->drb_ToAddModList->list.array[0]->drb_Identity;
- LOG_I(RRC,"[UE %d] default DRB = %d\n",ctxt_pP->module_id, *UE_rrc_inst[ctxt_pP->module_id].defaultDRB);
- }
+ // configure the first DRB ID as the default DRB ID
+ UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t));
+ *UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioResourceConfigDedicated->drb_ToAddModList->list.array[0]->drb_Identity;
+ LOG_I(RRC,"[UE %d] default DRB = %d\n",ctxt_pP->module_id, *UE_rrc_inst[ctxt_pP->module_id].defaultDRB);
+ }
uint8_t *kUPenc = NULL;
-
#if defined(ENABLE_SECURITY)
derive_key_up_enc(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm,
UE_rrc_inst[ctxt_pP->module_id].kenb, &kUPenc);
#endif
-
MSC_LOG_TX_MESSAGE(
MSC_RRC_UE,
MSC_PDCP_UE,
@@ -1677,12 +1501,11 @@ rrc_ue_process_radioResourceConfigDedicated(
ctxt_pP->rnti,
UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm |
(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4));
-
// Refresh DRBs
rrc_pdcp_config_asn1_req(ctxt_pP,
- (LTE_SRB_ToAddModList_t*)NULL,
+ (LTE_SRB_ToAddModList_t *)NULL,
radioResourceConfigDedicated->drb_ToAddModList,
- (LTE_DRB_ToReleaseList_t*)NULL,
+ (LTE_DRB_ToReleaseList_t *)NULL,
UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm |
(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4),
NULL,
@@ -1692,12 +1515,11 @@ rrc_ue_process_radioResourceConfigDedicated(
,(LTE_PMCH_InfoList_r9_t *)NULL
#endif
, UE_rrc_inst[ctxt_pP->module_id].defaultDRB);
-
// Refresh DRBs
rrc_rlc_config_asn1_req(ctxt_pP,
- (LTE_SRB_ToAddModList_t*)NULL,
+ (LTE_SRB_ToAddModList_t *)NULL,
radioResourceConfigDedicated->drb_ToAddModList,
- (LTE_DRB_ToReleaseList_t*)NULL
+ (LTE_DRB_ToReleaseList_t *)NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
,(LTE_PMCH_InfoList_r9_t *)NULL
, 0, 0
@@ -1721,44 +1543,43 @@ rrc_ue_process_radioResourceConfigDedicated(
eNB_index,
ctxt_pP->module_id);
rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index,
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],
- *UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]->logicalChannelIdentity,
- UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]->logicalChannelConfig,
- UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index],
- (LTE_TDD_Config_t*)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],
+ *UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]->logicalChannelIdentity,
+ UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]->logicalChannelConfig,
+ UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index],
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- ,
- 0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
+ ,
+ 0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,
- UE_rrc_inst[ue_mod_idP].num_active_cba_groups, //
- UE_rrc_inst[ue_mod_idP].cba_rnti[0]
+ ,
+ UE_rrc_inst[ue_mod_idP].num_active_cba_groups, //
+ UE_rrc_inst[ue_mod_idP].cba_rnti[0]
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,
- 0,
- NULL,
- NULL
+ ,
+ 0,
+ NULL,
+ NULL
#endif
- );
-
+ );
}
}
}
@@ -1771,86 +1592,79 @@ rrc_ue_process_radioResourceConfigDedicated(
//-----------------------------------------------------------------------------
void
rrc_ue_process_securityModeCommand(
- const protocol_ctxt_t* const ctxt_pP,
- LTE_SecurityModeCommand_t* const securityModeCommand,
+ const protocol_ctxt_t *const ctxt_pP,
+ LTE_SecurityModeCommand_t *const securityModeCommand,
const uint8_t eNB_index
)
//-----------------------------------------------------------------------------
{
-
asn_enc_rval_t enc_rval;
-
LTE_UL_DCCH_Message_t ul_dcch_msg;
// SecurityModeCommand_t SecurityModeCommand;
uint8_t buffer[200];
int i, securityMode;
-
LOG_I(RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), Processing securityModeCommand (eNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, eNB_index);
switch (securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm) {
- case LTE_CipheringAlgorithm_r12_eea0:
- LOG_I(RRC,"[UE %d] Security algorithm is set to eea0\n",
- ctxt_pP->module_id);
- securityMode= LTE_CipheringAlgorithm_r12_eea0;
- break;
+ case LTE_CipheringAlgorithm_r12_eea0:
+ LOG_I(RRC,"[UE %d] Security algorithm is set to eea0\n",
+ ctxt_pP->module_id);
+ securityMode= LTE_CipheringAlgorithm_r12_eea0;
+ break;
- case LTE_CipheringAlgorithm_r12_eea1:
- LOG_I(RRC,"[UE %d] Security algorithm is set to eea1\n",ctxt_pP->module_id);
- securityMode= LTE_CipheringAlgorithm_r12_eea1;
- break;
+ case LTE_CipheringAlgorithm_r12_eea1:
+ LOG_I(RRC,"[UE %d] Security algorithm is set to eea1\n",ctxt_pP->module_id);
+ securityMode= LTE_CipheringAlgorithm_r12_eea1;
+ break;
- case LTE_CipheringAlgorithm_r12_eea2:
- LOG_I(RRC,"[UE %d] Security algorithm is set to eea2\n",
- ctxt_pP->module_id);
- securityMode = LTE_CipheringAlgorithm_r12_eea2;
- break;
+ case LTE_CipheringAlgorithm_r12_eea2:
+ LOG_I(RRC,"[UE %d] Security algorithm is set to eea2\n",
+ ctxt_pP->module_id);
+ securityMode = LTE_CipheringAlgorithm_r12_eea2;
+ break;
- default:
- LOG_I(RRC,"[UE %d] Security algorithm is set to none\n",ctxt_pP->module_id);
- securityMode = LTE_CipheringAlgorithm_r12_spare1;
- break;
+ default:
+ LOG_I(RRC,"[UE %d] Security algorithm is set to none\n",ctxt_pP->module_id);
+ securityMode = LTE_CipheringAlgorithm_r12_spare1;
+ break;
}
switch (securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm) {
- case LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia1:
- LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to eia1\n",ctxt_pP->module_id);
- securityMode |= 1 << 5;
- break;
+ case LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia1:
+ LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to eia1\n",ctxt_pP->module_id);
+ securityMode |= 1 << 5;
+ break;
- case LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia2:
- LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to eia2\n",ctxt_pP->module_id);
- securityMode |= 1 << 6;
- break;
+ case LTE_SecurityAlgorithmConfig__integrityProtAlgorithm_eia2:
+ LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to eia2\n",ctxt_pP->module_id);
+ securityMode |= 1 << 6;
+ break;
- default:
- LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to none\n",ctxt_pP->module_id);
- securityMode |= 0x70 ;
- break;
+ default:
+ LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to none\n",ctxt_pP->module_id);
+ securityMode |= 0x70 ;
+ break;
}
LOG_D(RRC,"[UE %d] security mode is %x \n",ctxt_pP->module_id, securityMode);
-
/* Store the parameters received */
UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm =
securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm;
UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm =
securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm;
-
memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t));
//memset((void *)&SecurityModeCommand,0,sizeof(SecurityModeCommand_t));
-
ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1;
if (securityMode >= NO_SECURITY_MODE) {
- LOG_I(RRC, "rrc_ue_process_securityModeCommand, security mode complete case \n");
+ LOG_I(RRC, "rrc_ue_process_securityModeCommand, security mode complete case \n");
ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_securityModeComplete;
} else {
- LOG_I(RRC, "rrc_ue_process_securityModeCommand, security mode failure case \n");
+ LOG_I(RRC, "rrc_ue_process_securityModeCommand, security mode failure case \n");
ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_securityModeFailure;
}
-
#if defined(ENABLE_SECURITY)
uint8_t *kRRCenc = NULL;
uint8_t *kUPenc = NULL;
@@ -1858,47 +1672,44 @@ rrc_ue_process_securityModeCommand(
pdcp_t *pdcp_p = NULL;
hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE;
hashtable_rc_t h_rc;
-
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti,
- ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES);
- h_rc = hashtable_get(pdcp_coll_p, key, (void**) &pdcp_p);
+ ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES);
+ h_rc = hashtable_get(pdcp_coll_p, key, (void **) &pdcp_p);
if (h_rc == HASH_TABLE_OK) {
LOG_D(RRC, "PDCP_COLL_KEY_VALUE() returns valid key = %ld\n", key);
-
LOG_D(RRC, "driving kRRCenc, kRRCint and kUPenc from KeNB="
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x\n",
- UE_rrc_inst[ctxt_pP->module_id].kenb[0], UE_rrc_inst[ctxt_pP->module_id].kenb[1], UE_rrc_inst[ctxt_pP->module_id].kenb[2], UE_rrc_inst[ctxt_pP->module_id].kenb[3],
- UE_rrc_inst[ctxt_pP->module_id].kenb[4], UE_rrc_inst[ctxt_pP->module_id].kenb[5], UE_rrc_inst[ctxt_pP->module_id].kenb[6], UE_rrc_inst[ctxt_pP->module_id].kenb[7],
- UE_rrc_inst[ctxt_pP->module_id].kenb[8], UE_rrc_inst[ctxt_pP->module_id].kenb[9], UE_rrc_inst[ctxt_pP->module_id].kenb[10], UE_rrc_inst[ctxt_pP->module_id].kenb[11],
- UE_rrc_inst[ctxt_pP->module_id].kenb[12], UE_rrc_inst[ctxt_pP->module_id].kenb[13], UE_rrc_inst[ctxt_pP->module_id].kenb[14], UE_rrc_inst[ctxt_pP->module_id].kenb[15],
- UE_rrc_inst[ctxt_pP->module_id].kenb[16], UE_rrc_inst[ctxt_pP->module_id].kenb[17], UE_rrc_inst[ctxt_pP->module_id].kenb[18], UE_rrc_inst[ctxt_pP->module_id].kenb[19],
- UE_rrc_inst[ctxt_pP->module_id].kenb[20], UE_rrc_inst[ctxt_pP->module_id].kenb[21], UE_rrc_inst[ctxt_pP->module_id].kenb[22], UE_rrc_inst[ctxt_pP->module_id].kenb[23],
- UE_rrc_inst[ctxt_pP->module_id].kenb[24], UE_rrc_inst[ctxt_pP->module_id].kenb[25], UE_rrc_inst[ctxt_pP->module_id].kenb[26], UE_rrc_inst[ctxt_pP->module_id].kenb[27],
- UE_rrc_inst[ctxt_pP->module_id].kenb[28], UE_rrc_inst[ctxt_pP->module_id].kenb[29], UE_rrc_inst[ctxt_pP->module_id].kenb[30], UE_rrc_inst[ctxt_pP->module_id].kenb[31]);
-
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x\n",
+ UE_rrc_inst[ctxt_pP->module_id].kenb[0], UE_rrc_inst[ctxt_pP->module_id].kenb[1], UE_rrc_inst[ctxt_pP->module_id].kenb[2], UE_rrc_inst[ctxt_pP->module_id].kenb[3],
+ UE_rrc_inst[ctxt_pP->module_id].kenb[4], UE_rrc_inst[ctxt_pP->module_id].kenb[5], UE_rrc_inst[ctxt_pP->module_id].kenb[6], UE_rrc_inst[ctxt_pP->module_id].kenb[7],
+ UE_rrc_inst[ctxt_pP->module_id].kenb[8], UE_rrc_inst[ctxt_pP->module_id].kenb[9], UE_rrc_inst[ctxt_pP->module_id].kenb[10], UE_rrc_inst[ctxt_pP->module_id].kenb[11],
+ UE_rrc_inst[ctxt_pP->module_id].kenb[12], UE_rrc_inst[ctxt_pP->module_id].kenb[13], UE_rrc_inst[ctxt_pP->module_id].kenb[14], UE_rrc_inst[ctxt_pP->module_id].kenb[15],
+ UE_rrc_inst[ctxt_pP->module_id].kenb[16], UE_rrc_inst[ctxt_pP->module_id].kenb[17], UE_rrc_inst[ctxt_pP->module_id].kenb[18], UE_rrc_inst[ctxt_pP->module_id].kenb[19],
+ UE_rrc_inst[ctxt_pP->module_id].kenb[20], UE_rrc_inst[ctxt_pP->module_id].kenb[21], UE_rrc_inst[ctxt_pP->module_id].kenb[22], UE_rrc_inst[ctxt_pP->module_id].kenb[23],
+ UE_rrc_inst[ctxt_pP->module_id].kenb[24], UE_rrc_inst[ctxt_pP->module_id].kenb[25], UE_rrc_inst[ctxt_pP->module_id].kenb[26], UE_rrc_inst[ctxt_pP->module_id].kenb[27],
+ UE_rrc_inst[ctxt_pP->module_id].kenb[28], UE_rrc_inst[ctxt_pP->module_id].kenb[29], UE_rrc_inst[ctxt_pP->module_id].kenb[30], UE_rrc_inst[ctxt_pP->module_id].kenb[31]);
derive_key_rrc_enc(UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm,
- UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCenc);
+ UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCenc);
derive_key_rrc_int(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm,
- UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCint);
+ UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCint);
derive_key_up_enc(UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm,
- UE_rrc_inst[ctxt_pP->module_id].kenb, &kUPenc);
+ UE_rrc_inst[ctxt_pP->module_id].kenb, &kUPenc);
if (securityMode != 0xff) {
pdcp_config_set_security(ctxt_pP, pdcp_p, 0, 0,
- UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm
- | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4),
- kRRCenc, kRRCint, kUPenc);
+ UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm
+ | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4),
+ kRRCenc, kRRCint, kUPenc);
} else {
LOG_I(RRC, "skipped pdcp_config_set_security() as securityMode == 0x%02x",
- securityMode);
+ securityMode);
}
} else {
LOG_I(RRC, "Could not get PDCP instance where key=0x%ld\n", key);
@@ -1909,174 +1720,110 @@ rrc_ue_process_securityModeCommand(
if (securityModeCommand->criticalExtensions.present == LTE_SecurityModeCommand__criticalExtensions_PR_c1) {
if (securityModeCommand->criticalExtensions.choice.c1.present != LTE_SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8)
LOG_W(RRC,"securityModeCommand->criticalExtensions.choice.c1.present (%d) != SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8\n",
- securityModeCommand->criticalExtensions.choice.c1.present);
-
-
+ securityModeCommand->criticalExtensions.choice.c1.present);
+
ul_dcch_msg.message.choice.c1.choice.securityModeComplete.rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier;
ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.present = LTE_SecurityModeCommand__criticalExtensions_PR_c1;
ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.choice.securityModeComplete_r8.nonCriticalExtension =NULL;
-
LOG_I(RRC,"[UE %d] SFN/SF %d/%d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (eNB %d), rrc_TransactionIdentifier: %ld\n",
- ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, eNB_index, securityModeCommand->rrc_TransactionIdentifier);
-
+ ctxt_pP->module_id,ctxt_pP->frame, ctxt_pP->subframe, eNB_index, securityModeCommand->rrc_TransactionIdentifier);
enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message,
NULL,
- (void*)&ul_dcch_msg,
- buffer,
- 100);
+ (void *)&ul_dcch_msg,
+ buffer,
+ 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
-
+ enc_rval.failed_type->name, enc_rval.encoded);
+
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void*)&ul_dcch_msg);
+ xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg);
}
-
-#if defined(ENABLE_ITTI)
-# if !defined(DISABLE_XER_SPRINT)
- {
- char message_string[20000];
- size_t message_string_size;
-
- if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
- }
+
+ LOG_D(RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
+
+ for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) {
+ LOG_T(RRC, "%02x.", buffer[i]);
}
-# endif
-#endif
- LOG_D(RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8);
-
- for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) {
- LOG_T(RRC, "%02x.", buffer[i]);
- }
-
- LOG_T(RRC, "\n");
- rrc_data_req (
- ctxt_pP,
- DCCH,
- rrc_mui++,
- SDU_CONFIRM_NO,
- (enc_rval.encoded + 7) / 8,
- buffer,
- PDCP_TRANSMISSION_MODE_CONTROL);
- }
-
- else LOG_W(RRC,"securityModeCommand->criticalExtensions.present (%d) != SecurityModeCommand__criticalExtensions_PR_c1\n",
- securityModeCommand->criticalExtensions.present);
+ LOG_T(RRC, "\n");
+ rrc_data_req (
+ ctxt_pP,
+ DCCH,
+ rrc_mui++,
+ SDU_CONFIRM_NO,
+ (enc_rval.encoded + 7) / 8,
+ buffer,
+ PDCP_TRANSMISSION_MODE_CONTROL);
+ } else LOG_W(RRC,"securityModeCommand->criticalExtensions.present (%d) != SecurityModeCommand__criticalExtensions_PR_c1\n",
+ securityModeCommand->criticalExtensions.present);
}
//-----------------------------------------------------------------------------
void
rrc_ue_process_ueCapabilityEnquiry(
- const protocol_ctxt_t* const ctxt_pP,
- LTE_UECapabilityEnquiry_t* UECapabilityEnquiry,
+ const protocol_ctxt_t *const ctxt_pP,
+ LTE_UECapabilityEnquiry_t *UECapabilityEnquiry,
uint8_t eNB_index
)
//-----------------------------------------------------------------------------
{
-
asn_enc_rval_t enc_rval;
-
LTE_UL_DCCH_Message_t ul_dcch_msg;
-
-
LTE_UE_CapabilityRAT_Container_t ue_CapabilityRAT_Container;
-
uint8_t buffer[200];
int i;
-
LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing UECapabilityEnquiry (eNB %d)\n",
ctxt_pP->module_id,
ctxt_pP->frame,
eNB_index);
-
-
memset((void *)&ul_dcch_msg,0,sizeof(LTE_UL_DCCH_Message_t));
memset((void *)&ue_CapabilityRAT_Container,0,sizeof(LTE_UE_CapabilityRAT_Container_t));
-
ul_dcch_msg.message.present = LTE_UL_DCCH_MessageType_PR_c1;
ul_dcch_msg.message.choice.c1.present = LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation;
ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.rrc_TransactionIdentifier = UECapabilityEnquiry->rrc_TransactionIdentifier;
-
ue_CapabilityRAT_Container.rat_Type = LTE_RAT_Type_eutra;
OCTET_STRING_fromBuf(&ue_CapabilityRAT_Container.ueCapabilityRAT_Container,
- (const char*)UE_rrc_inst[ctxt_pP->module_id].UECapability,
+ (const char *)UE_rrc_inst[ctxt_pP->module_id].UECapability,
UE_rrc_inst[ctxt_pP->module_id].UECapability_size);
// ue_CapabilityRAT_Container.ueCapabilityRAT_Container.buf = UE_rrc_inst[ue_mod_idP].UECapability;
// ue_CapabilityRAT_Container.ueCapabilityRAT_Container.size = UE_rrc_inst[ue_mod_idP].UECapability_size;
-
-
AssertFatal(UECapabilityEnquiry->criticalExtensions.present == LTE_UECapabilityEnquiry__criticalExtensions_PR_c1,
- "UECapabilityEnquiry->criticalExtensions.present (%d) != UECapabilityEnquiry__criticalExtensions_PR_c1 (%d)\n",
- UECapabilityEnquiry->criticalExtensions.present,LTE_UECapabilityEnquiry__criticalExtensions_PR_c1);
+ "UECapabilityEnquiry->criticalExtensions.present (%d) != UECapabilityEnquiry__criticalExtensions_PR_c1 (%d)\n",
+ UECapabilityEnquiry->criticalExtensions.present,LTE_UECapabilityEnquiry__criticalExtensions_PR_c1);
if (UECapabilityEnquiry->criticalExtensions.choice.c1.present != LTE_UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8)
LOG_I(RRC,"UECapabilityEnquiry->criticalExtensions.choice.c1.present (%d) != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8)\n",
- UECapabilityEnquiry->criticalExtensions.choice.c1.present);
-
+ UECapabilityEnquiry->criticalExtensions.choice.c1.present);
+
ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.present = LTE_UECapabilityInformation__criticalExtensions_PR_c1;
ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.present =
LTE_UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8;
ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count
=0;
-
+
for (i=0; icriticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count; i++) {
-
if (*UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.array[i]
- == LTE_RAT_Type_eutra) {
+ == LTE_RAT_Type_eutra) {
ASN_SEQUENCE_ADD(
- &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list,
- &ue_CapabilityRAT_Container);
-
- enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message, NULL, (void*) &ul_dcch_msg, buffer, 100);
+ &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list,
+ &ue_CapabilityRAT_Container);
+ enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_UL_DCCH_Message, NULL, (void *) &ul_dcch_msg, buffer, 100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
- enc_rval.failed_type->name, enc_rval.encoded);
-
+ enc_rval.failed_type->name, enc_rval.encoded);
+
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void*)&ul_dcch_msg);
+ xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg);
}
-
-#if defined(ENABLE_ITTI)
-# if !defined(DISABLE_XER_SPRINT)
- {
- char message_string[20000];
- size_t message_string_size;
-
- if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
- }
- }
-# endif
-#endif
-
- LOG_I(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-
- for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) {
- LOG_T(RRC, "%02x.", buffer[i]);
- }
-
- LOG_T(RRC, "\n");
+ LOG_I(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
rrc_data_req_ue (
- ctxt_pP,
- DCCH,
- rrc_mui++,
- SDU_CONFIRM_NO,
- (enc_rval.encoded + 7) / 8,
- buffer,
- PDCP_TRANSMISSION_MODE_CONTROL);
+ ctxt_pP,
+ DCCH,
+ rrc_mui++,
+ SDU_CONFIRM_NO,
+ (enc_rval.encoded + 7) / 8,
+ buffer,
+ PDCP_TRANSMISSION_MODE_CONTROL);
}
}
}
@@ -2085,20 +1832,19 @@ rrc_ue_process_ueCapabilityEnquiry(
//-----------------------------------------------------------------------------
void
rrc_ue_process_rrcConnectionReconfiguration(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,
uint8_t eNB_index
)
//-----------------------------------------------------------------------------
{
-
LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCConnectionReconfiguration (eNB %d)\n",
ctxt_pP->module_id,ctxt_pP->frame,eNB_index);
if (rrcConnectionReconfiguration->criticalExtensions.present == LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1) {
if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present ==
LTE_RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) {
- LTE_RRCConnectionReconfiguration_r8_IEs_t* rrcConnectionReconfiguration_r8 =
+ LTE_RRCConnectionReconfiguration_r8_IEs_t *rrcConnectionReconfiguration_r8 =
&rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8;
if (rrcConnectionReconfiguration_r8->mobilityControlInfo) {
@@ -2124,42 +1870,42 @@ rrc_ue_process_rrcConnectionReconfiguration(
//TTN for D2D
//if RRCConnectionReconfiguration message includes the sl-CommConfig
if ((rrcConnectionReconfiguration_r8->nonCriticalExtension != NULL)
- && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension
- != NULL)
- && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension
- != NULL)
- && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension
- != NULL)
- && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension
- != NULL)
- && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12
- != NULL)) {
- if (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12->commTxResources_r12->present != LTE_SL_CommConfig_r12__commTxResources_r12_PR_NOTHING){
- LOG_I(RRC,"sl-CommConfig is present\n");
- //process sl-CommConfig
- rrc_ue_process_sidelink_radioResourceConfig(ctxt_pP->module_id,eNB_index,
- (LTE_SystemInformationBlockType18_r12_t *)NULL,
- (LTE_SystemInformationBlockType19_r12_t *)NULL,
- rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12,
- (LTE_SL_DiscConfig_r12_t *)NULL
- );
- }
+ && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension
+ != NULL)
+ && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension
+ != NULL)
+ && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension
+ != NULL)
+ && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension
+ != NULL)
+ && (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12
+ != NULL)) {
+ if (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12->commTxResources_r12->present !=
+ LTE_SL_CommConfig_r12__commTxResources_r12_PR_NOTHING) {
+ LOG_I(RRC,"sl-CommConfig is present\n");
+ //process sl-CommConfig
+ rrc_ue_process_sidelink_radioResourceConfig(ctxt_pP->module_id,eNB_index,
+ (LTE_SystemInformationBlockType18_r12_t *)NULL,
+ (LTE_SystemInformationBlockType19_r12_t *)NULL,
+ rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_CommConfig_r12,
+ (LTE_SL_DiscConfig_r12_t *)NULL
+ );
+ }
}
-/*
- //if RRCConnectionReconfiguration message includes the sl-DiscConfig
- if (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12->discTxResources_r12->present != SL_DiscConfig_r12__discTxResources_r12_PR_NOTHING ){
- LOG_I(RRC,"sl-DiscConfig is present\n");
- //process sl-DiscConfig
- rrc_ue_process_sidelink_radioResourceConfig(ctxt_pP->module_id,eNB_index,
- (SystemInformationBlockType18_r12_t *)NULL,
- (SystemInformationBlockType19_r12_t *)NULL,
- (SL_CommConfig_r12_t* )NULL,
- rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12
- );
- }
-*/
-
+ /*
+ //if RRCConnectionReconfiguration message includes the sl-DiscConfig
+ if (rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12->discTxResources_r12->present != SL_DiscConfig_r12__discTxResources_r12_PR_NOTHING ){
+ LOG_I(RRC,"sl-DiscConfig is present\n");
+ //process sl-DiscConfig
+ rrc_ue_process_sidelink_radioResourceConfig(ctxt_pP->module_id,eNB_index,
+ (SystemInformationBlockType18_r12_t *)NULL,
+ (SystemInformationBlockType19_r12_t *)NULL,
+ (SL_CommConfig_r12_t* )NULL,
+ rrcConnectionReconfiguration_r8->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->sl_DiscConfig_r12
+ );
+ }
+ */
#if defined(ENABLE_ITTI)
/* Check if there is dedicated NAS information to forward to NAS */
@@ -2172,12 +1918,10 @@ rrc_ue_process_rrcConnectionReconfiguration(
for (list_count = 0; list_count < rrcConnectionReconfiguration_r8->dedicatedInfoNASList->list.count; list_count++) {
pdu_length = rrcConnectionReconfiguration_r8->dedicatedInfoNASList->list.array[list_count]->size;
pdu_buffer = rrcConnectionReconfiguration_r8->dedicatedInfoNASList->list.array[list_count]->buf;
-
msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_ESTABLI_CNF);
NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length;
NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer;
-
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
}
@@ -2189,7 +1933,6 @@ rrc_ue_process_rrcConnectionReconfiguration(
MessageDef *message_ral_p = NULL;
rrc_ral_connection_reestablishment_ind_t connection_reestablishment_ind;
int i;
-
message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_REESTABLISHMENT_IND);
memset(&connection_reestablishment_ind, 0, sizeof(rrc_ral_connection_reestablishment_ind_t));
// TO DO ral_si_ind.plmn_id = 0;
@@ -2214,7 +1957,6 @@ rrc_ue_process_rrcConnectionReconfiguration(
connection_reestablishment_ind.num_srb =
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList->list.count +
UE_rrc_inst[ctxt_pP->module_id].num_srb;
-
} else {
connection_reestablishment_ind.num_srb += UE_rrc_inst[ctxt_pP->module_id].num_srb;
}
@@ -2238,9 +1980,9 @@ rrc_ue_process_rrcConnectionReconfiguration(
//-----------------------------------------------------------------------------
void
rrc_ue_process_mobilityControlInfo(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const uint8_t eNB_index,
- struct LTE_MobilityControlInfo* const mobilityControlInfo
+ struct LTE_MobilityControlInfo *const mobilityControlInfo
)
//-----------------------------------------------------------------------------
{
@@ -2256,7 +1998,6 @@ rrc_ue_process_mobilityControlInfo(
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].T304_active = 1;
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].T304_cnt = T304[mobilityControlInfo->t304];
-
/*
drb2release_list = CALLOC (1, sizeof (*drb2release_list));
lcid= CALLOC (1, sizeof (DRB_Identity_t)); // long
@@ -2282,22 +2023,20 @@ rrc_ue_process_mobilityControlInfo(
NULL, // key rrc encryption
NULL, // key rrc integrity
NULL // key encryption
-#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+ #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
,NULL
-#endif
+ #endif
,NULL);
rrc_rlc_config_asn1_req(NB_eNB_INST+ue_mod_idP, frameP,0,eNB_index,
NULL,// SRB_ToAddModList
NULL,// DRB_ToAddModList
drb2release_list // DRB_ToReleaseList
-#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+ #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
,NULL
-#endif
+ #endif
,NULL);
*/
-
-
//A little cleanup at RRC...
//Copying current queue config to free RRC index
/*
@@ -2319,53 +2058,49 @@ rrc_ue_process_mobilityControlInfo(
LOG_I(RRC,
"HO: Reset PDCP and RLC for configured RBs.. \n[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 eNB %d) --->][MAC_UE][MOD %02d][]\n",
ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id);
-
// Reset MAC and configure PHY
rrc_mac_config_req_ue(ctxt_pP->module_id,
- 0,
- eNB_index,
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- (struct LTE_PhysicalConfigDedicated *)NULL,
+ 0,
+ eNB_index,
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- (LTE_MAC_MainConfig_t *)NULL,
- 0,
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- (LTE_TDD_Config_t *)NULL,
- mobilityControlInfo,
- (uint8_t *)NULL,
- (uint16_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ (LTE_MAC_MainConfig_t *)NULL,
+ 0,
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ (LTE_TDD_Config_t *)NULL,
+ mobilityControlInfo,
+ (uint8_t *)NULL,
+ (uint16_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- ,0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
+ ,0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,0,
- 0
+ ,0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,
- 0,
- NULL,
- NULL
+ ,
+ 0,
+ NULL,
+ NULL
#endif
- );
-
+ );
// Re-establish PDCP for all RBs that are established
// rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, ue_mod_idP+DCCH);
// rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, ue_mod_idP+DCCH1);
// rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, ue_mod_idP+DTCH);
-
-
// Re-establish RLC for all RBs that are established
// rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
// rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
@@ -2387,14 +2122,13 @@ rrc_detach_from_eNB(
//-----------------------------------------------------------------------------
void
rrc_ue_decode_dcch(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const rb_id_t Srb_id,
- const uint8_t* const Buffer,
+ const uint8_t *const Buffer,
const uint8_t eNB_indexP
)
//-----------------------------------------------------------------------------
{
-
//DL_DCCH_Message_t dldcchmsg;
LTE_DL_DCCH_Message_t *dl_dcch_msg=NULL;//&dldcchmsg;
// asn_dec_rval_t dec_rval;
@@ -2410,336 +2144,296 @@ rrc_ue_decode_dcch(
return;
}
- //memset(dl_dcch_msg,0,sizeof(DL_DCCH_Message_t));
-
- // decode messages
- // LOG_D(RRC,"[UE %d] Decoding DL-DCCH message\n",ue_mod_idP);
- /*
- for (i=0;i<30;i++)
- LOG_T(RRC,"%x.",Buffer[i]);
- LOG_T(RRC, "\n");
- */
uper_decode(NULL,
&asn_DEF_LTE_DL_DCCH_Message,
- (void**)&dl_dcch_msg,
- (uint8_t*)Buffer,
+ (void **)&dl_dcch_msg,
+ (uint8_t *)Buffer,
RRC_BUF_SIZE,0,0);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message,(void*)dl_dcch_msg);
+ xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message,(void *)dl_dcch_msg);
}
-#if defined(ENABLE_ITTI)
-# if defined(DISABLE_ITTI_XER_PRINT)
- {
- msg_p = itti_alloc_new_message (TASK_RRC_UE, RRC_DL_DCCH_MESSAGE);
- memcpy (&msg_p->ittiMsg, (void *) dl_dcch_msg, sizeof(RrcDlDcchMessage));
-
- itti_send_msg_to_task (TASK_UNKNOWN, ctxt_pP->instance, msg_p);
- }
-# else
- {
- char message_string[30000];
- size_t message_string_size;
-
- if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_DCCH_Message, (void *)dl_dcch_msg)) > 0) {
- msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
- }
- }
-# endif
-#endif
-
if (dl_dcch_msg->message.present == LTE_DL_DCCH_MessageType_PR_c1) {
-
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State >= RRC_CONNECTED) {
-
switch (dl_dcch_msg->message.choice.c1.present) {
+ case LTE_DL_DCCH_MessageType__c1_PR_NOTHING:
+ LOG_I(RRC, "[UE %d] Frame %d : Received PR_NOTHING on DL-DCCH-Message\n",
+ ctxt_pP->module_id, ctxt_pP->frame);
+ return;
- case LTE_DL_DCCH_MessageType__c1_PR_NOTHING:
- LOG_I(RRC, "[UE %d] Frame %d : Received PR_NOTHING on DL-DCCH-Message\n",
- ctxt_pP->module_id, ctxt_pP->frame);
- return;
+ case LTE_DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000:
+ break;
- case LTE_DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000:
- break;
-
- case LTE_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: {
+ case LTE_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: {
#if defined(ENABLE_ITTI)
- LTE_DLInformationTransfer_t *dlInformationTransfer = &dl_dcch_msg->message.choice.c1.choice.dlInformationTransfer;
+ LTE_DLInformationTransfer_t *dlInformationTransfer = &dl_dcch_msg->message.choice.c1.choice.dlInformationTransfer;
- if ((dlInformationTransfer->criticalExtensions.present == LTE_DLInformationTransfer__criticalExtensions_PR_c1)
- && (dlInformationTransfer->criticalExtensions.choice.c1.present
- == LTE_DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8)
- && (dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.present
- == LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) {
- /* This message hold a dedicated info NAS payload, forward it to NAS */
- struct LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType =
+ if ((dlInformationTransfer->criticalExtensions.present == LTE_DLInformationTransfer__criticalExtensions_PR_c1)
+ && (dlInformationTransfer->criticalExtensions.choice.c1.present
+ == LTE_DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8)
+ && (dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.present
+ == LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) {
+ /* This message hold a dedicated info NAS payload, forward it to NAS */
+ struct LTE_DLInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType =
&dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType;
- uint32_t pdu_length;
- uint8_t *pdu_buffer;
- MessageDef *msg_p;
+ uint32_t pdu_length;
+ uint8_t *pdu_buffer;
+ MessageDef *msg_p;
+ pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size;
+ pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf;
+ msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_DOWNLINK_DATA_IND);
+ NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ?
+ NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length;
+ NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer;
+ itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
+ }
- pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size;
- pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf;
+#endif
+ break;
+ }
- msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_DOWNLINK_DATA_IND);
- NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ?
- NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length;
- NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer;
+ case LTE_DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest:
+ break;
+
+ case LTE_DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand:
+ break;
+
+ case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration:
+
+ // first check if mobilityControlInfo is present
+ if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo
+ != NULL) {
+ /* 36.331, 5.3.5.4 Reception of an RRCConnectionReconfiguration including the mobilityControlInfo by the UE (handover)*/
+ if (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId
+ != dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo->targetPhysCellId) {
+ LOG_W(RRC,
+ "[UE %d] Frame %d: Handover target (%ld) is different from RSRP measured target (%ld)..\n",
+ ctxt_pP->module_id,
+ ctxt_pP->frame,
+ dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo->targetPhysCellId,
+ UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId);
+ return;
+ } else if ((target_eNB_index = get_adjacent_cell_mod_id(UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId))
+ == 0xFF) {
+ LOG_W(RRC,
+ "[UE %d] Frame %d: ue_mod_idP of the target eNB not found, check the network topology\n",
+ ctxt_pP->module_id,
+ ctxt_pP->frame);
+ return;
+ } else {
+ LOG_I(RRC,
+ "[UE% d] Frame %d: Received rrcConnectionReconfiguration with mobilityControlInfo \n",
+ ctxt_pP->module_id,
+ ctxt_pP->frame);
+ UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1; // Ready to send more MeasReports if required
+ }
+ }
+
+ rrc_ue_process_rrcConnectionReconfiguration(
+ ctxt_pP,
+ &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration,
+ eNB_indexP);
+
+ if (target_eNB_index != 0xFF) {
+ rrc_ue_generate_RRCConnectionReconfigurationComplete(
+ ctxt_pP,
+ target_eNB_index,
+ dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.rrc_TransactionIdentifier);
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State = RRC_HO_EXECUTION;
+ UE_rrc_inst[ctxt_pP->module_id].Info[target_eNB_index].State = RRC_RECONFIGURED;
+ LOG_I(RRC, "[UE %d] State = RRC_RECONFIGURED during HO (eNB %d)\n",
+ ctxt_pP->module_id, target_eNB_index);
+#if defined(ENABLE_ITTI)
+#if ENABLE_RAL
+ {
+ MessageDef *message_ral_p = NULL;
+ rrc_ral_connection_reconfiguration_ho_ind_t connection_reconfiguration_ho_ind;
+ int i;
+ message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND);
+ memset(&connection_reconfiguration_ho_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ho_ind_t));
+ connection_reconfiguration_ho_ind.ue_id = ctxt_pP->module_id;
+
+ if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList
+ != NULL) {
+ connection_reconfiguration_ho_ind.num_drb =
+ dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count;
+
+ for (i=0; (
+ imessage.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count)
+ && (i < maxDRB); i++) {
+ // why minus 1 in RRC code for drb_identity ?
+ connection_reconfiguration_ho_ind.drb_id[i] =
+ dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity;
+ }
+ } else {
+ connection_reconfiguration_ho_ind.num_drb = 0;
+ }
+
+ if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList
+ != NULL) {
+ connection_reconfiguration_ho_ind.num_srb =
+ dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList->list.count
+ +
+ UE_rrc_inst[ctxt_pP->module_id].num_srb;
+ } else {
+ connection_reconfiguration_ho_ind.num_srb += UE_rrc_inst[ctxt_pP->module_id].num_srb;
+ }
+
+ if (connection_reconfiguration_ho_ind.num_srb > 2 ) {
+ connection_reconfiguration_ho_ind.num_srb =2;
+ }
+
+ memcpy (&message_ral_p->ittiMsg, (void *) &connection_reconfiguration_ho_ind, sizeof(rrc_ral_connection_reconfiguration_ho_ind_t));
+ //#warning "ue_mod_idP ? for instance ? => YES"
+ LOG_I(RRC, "Sending RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND to mRAL\n");
+ itti_send_msg_to_task (TASK_RAL_UE, ctxt_pP->instance, message_ral_p);
+ }
+#endif
+#endif
+ } else {
+ rrc_ue_generate_RRCConnectionReconfigurationComplete(
+ ctxt_pP,
+ eNB_indexP,
+ dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.rrc_TransactionIdentifier);
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State = RRC_RECONFIGURED;
+ LOG_I(RRC, "[UE %d] State = RRC_RECONFIGURED (eNB %d)\n",
+ ctxt_pP->module_id,
+ eNB_indexP);
+#if defined(ENABLE_ITTI)
+#if ENABLE_RAL
+ {
+ MessageDef *message_ral_p = NULL;
+ rrc_ral_connection_reconfiguration_ind_t connection_reconfiguration_ind;
+ int i;
+ message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_RECONFIGURATION_IND);
+ memset(&connection_reconfiguration_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ind_t));
+ connection_reconfiguration_ind.ue_id = ctxt_pP->module_id;
+
+ if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList
+ != NULL) {
+ connection_reconfiguration_ind.num_drb =
+ dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count;
+
+ for (i=0; (
+ imessage.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count)
+ && (i < maxDRB); i++) {
+ // why minus 1 in RRC code for drb_identity ?
+ connection_reconfiguration_ind.drb_id[i] =
+ dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity;
+ }
+ } else {
+ connection_reconfiguration_ind.num_drb = 0;
+ }
+
+ if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList
+ != NULL) {
+ connection_reconfiguration_ind.num_srb =
+ dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList->list.count
+ +
+ UE_rrc_inst[ctxt_pP->module_id].num_srb;
+ } else {
+ connection_reconfiguration_ind.num_srb +=UE_rrc_inst[ctxt_pP->module_id].num_srb;
+ }
+
+ if (connection_reconfiguration_ind.num_srb > 2 ) {
+ connection_reconfiguration_ind.num_srb =2;
+ }
+
+ memcpy (&message_ral_p->ittiMsg, (void *) &connection_reconfiguration_ind, sizeof(rrc_ral_connection_reconfiguration_ind_t));
+ //#warning "ue_mod_idP ? for instance ? => YES"
+ LOG_I(RRC, "Sending RRC_RAL_CONNECTION_RECONFIGURATION_IND to mRAL\n");
+ itti_send_msg_to_task (TASK_RAL_UE, ctxt_pP->instance, message_ral_p);
+ }
+#endif
+#endif
+ }
+
+ //TTN test D2D (should not be here - in reality, this message will be triggered from ProSeApp)
+ if (send_ue_information == 0) {
+ LOG_I(RRC, "TEST SidelinkUEInformation [UE %d] Received (eNB %d)\n",
+ ctxt_pP->module_id, eNB_indexP);
+ LTE_SL_DestinationInfoList_r12_t *destinationInfoList = CALLOC(1, sizeof(LTE_SL_DestinationInfoList_r12_t));
+ LTE_SL_DestinationIdentity_r12_t *sl_destination_identity = CALLOC(1, sizeof(LTE_SL_DestinationIdentity_r12_t));
+ sl_destination_identity->size = 3;
+ sl_destination_identity->buf = CALLOC(1,3);
+ sl_destination_identity->buf[0] = 0x00;
+ sl_destination_identity->buf[1] = 0x00;
+ sl_destination_identity->buf[2] = 0x01;
+ sl_destination_identity->bits_unused = 0;
+ ASN_SEQUENCE_ADD(&destinationInfoList->list,sl_destination_identity);
+ rrc_ue_generate_SidelinkUEInformation(ctxt_pP, eNB_indexP, destinationInfoList, NULL, SL_TRANSMIT_NON_RELAY_ONE_TO_ONE);
+ send_ue_information ++;
+ }
+
+ break;
+
+ case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionRelease:
+#if defined(ENABLE_ITTI)
+ msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_RELEASE_IND);
+
+ if ((dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.present
+ == LTE_RRCConnectionRelease__criticalExtensions_PR_c1)
+ && (dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.choice.c1.present
+ == LTE_RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8)) {
+ NAS_CONN_RELEASE_IND(msg_p).cause =
+ dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.releaseCause;
+ }
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
- }
-
-#endif
- break;
- }
-
- case LTE_DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest:
- break;
-
- case LTE_DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand:
- break;
-
- case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration:
-
- // first check if mobilityControlInfo is present
- if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo
- != NULL) {
- /* 36.331, 5.3.5.4 Reception of an RRCConnectionReconfiguration including the mobilityControlInfo by the UE (handover)*/
- if (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId
- != dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo->targetPhysCellId) {
- LOG_W(RRC,
- "[UE %d] Frame %d: Handover target (%ld) is different from RSRP measured target (%ld)..\n",
- ctxt_pP->module_id,
- ctxt_pP->frame,
- dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo->targetPhysCellId,
- UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId);
- return;
- } else if ((target_eNB_index = get_adjacent_cell_mod_id(UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId))
- == 0xFF) {
- LOG_W(RRC,
- "[UE %d] Frame %d: ue_mod_idP of the target eNB not found, check the network topology\n",
- ctxt_pP->module_id,
- ctxt_pP->frame);
- return;
- } else {
- LOG_I(RRC,
- "[UE% d] Frame %d: Received rrcConnectionReconfiguration with mobilityControlInfo \n",
- ctxt_pP->module_id,
- ctxt_pP->frame);
- UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1; // Ready to send more MeasReports if required
- }
- }
-
- rrc_ue_process_rrcConnectionReconfiguration(
- ctxt_pP,
- &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration,
- eNB_indexP);
-
- if (target_eNB_index != 0xFF) {
- rrc_ue_generate_RRCConnectionReconfigurationComplete(
- ctxt_pP,
- target_eNB_index,
- dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.rrc_TransactionIdentifier);
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State = RRC_HO_EXECUTION;
- UE_rrc_inst[ctxt_pP->module_id].Info[target_eNB_index].State = RRC_RECONFIGURED;
- LOG_I(RRC, "[UE %d] State = RRC_RECONFIGURED during HO (eNB %d)\n",
- ctxt_pP->module_id, target_eNB_index);
-#if defined(ENABLE_ITTI)
#if ENABLE_RAL
- {
- MessageDef *message_ral_p = NULL;
- rrc_ral_connection_reconfiguration_ho_ind_t connection_reconfiguration_ho_ind;
- int i;
-
- message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND);
- memset(&connection_reconfiguration_ho_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ho_ind_t));
- connection_reconfiguration_ho_ind.ue_id = ctxt_pP->module_id;
-
- if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList
- != NULL) {
- connection_reconfiguration_ho_ind.num_drb =
- dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count;
-
- for (i=0; (
- imessage.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count)
- && (i < maxDRB); i++) {
- // why minus 1 in RRC code for drb_identity ?
- connection_reconfiguration_ho_ind.drb_id[i] =
- dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity;
- }
- } else {
- connection_reconfiguration_ho_ind.num_drb = 0;
- }
-
- if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList
- != NULL) {
- connection_reconfiguration_ho_ind.num_srb =
- dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList->list.count
- +
- UE_rrc_inst[ctxt_pP->module_id].num_srb;
- } else {
- connection_reconfiguration_ho_ind.num_srb += UE_rrc_inst[ctxt_pP->module_id].num_srb;
- }
-
- if (connection_reconfiguration_ho_ind.num_srb > 2 ) {
- connection_reconfiguration_ho_ind.num_srb =2;
- }
-
- memcpy (&message_ral_p->ittiMsg, (void *) &connection_reconfiguration_ho_ind, sizeof(rrc_ral_connection_reconfiguration_ho_ind_t));
- //#warning "ue_mod_idP ? for instance ? => YES"
- LOG_I(RRC, "Sending RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND to mRAL\n");
- itti_send_msg_to_task (TASK_RAL_UE, ctxt_pP->instance, message_ral_p);
- }
+ msg_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_CONNECTION_RELEASE_IND);
+ RRC_RAL_CONNECTION_RELEASE_IND(msg_p).ue_id = ctxt_pP->module_id;
+ itti_send_msg_to_task(TASK_RAL_UE, ctxt_pP->instance, msg_p);
#endif
#endif
- } else {
- rrc_ue_generate_RRCConnectionReconfigurationComplete(
+ break;
+
+ case LTE_DL_DCCH_MessageType__c1_PR_securityModeCommand:
+ LOG_I(RRC, "[UE %d] Received securityModeCommand (eNB %d)\n",
+ ctxt_pP->module_id, eNB_indexP);
+ rrc_ue_process_securityModeCommand(
ctxt_pP,
- eNB_indexP,
- dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.rrc_TransactionIdentifier);
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State = RRC_RECONFIGURED;
- LOG_I(RRC, "[UE %d] State = RRC_RECONFIGURED (eNB %d)\n",
+ &dl_dcch_msg->message.choice.c1.choice.securityModeCommand,
+ eNB_indexP);
+ break;
+
+ case LTE_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
+ LOG_I(RRC, "[UE %d] Received Capability Enquiry (eNB %d)\n",
ctxt_pP->module_id,
eNB_indexP);
-#if defined(ENABLE_ITTI)
-#if ENABLE_RAL
- {
- MessageDef *message_ral_p = NULL;
- rrc_ral_connection_reconfiguration_ind_t connection_reconfiguration_ind;
- int i;
-
- message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_RECONFIGURATION_IND);
- memset(&connection_reconfiguration_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ind_t));
- connection_reconfiguration_ind.ue_id = ctxt_pP->module_id;
-
- if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList
- != NULL) {
- connection_reconfiguration_ind.num_drb =
- dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count;
-
- for (i=0; (
- imessage.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count)
- && (i < maxDRB); i++) {
- // why minus 1 in RRC code for drb_identity ?
- connection_reconfiguration_ind.drb_id[i] =
- dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity;
- }
- } else {
- connection_reconfiguration_ind.num_drb = 0;
- }
-
- if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList
- != NULL) {
- connection_reconfiguration_ind.num_srb =
- dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList->list.count
- +
- UE_rrc_inst[ctxt_pP->module_id].num_srb;
- } else {
- connection_reconfiguration_ind.num_srb +=UE_rrc_inst[ctxt_pP->module_id].num_srb;
- }
-
- if (connection_reconfiguration_ind.num_srb > 2 ) {
- connection_reconfiguration_ind.num_srb =2;
- }
-
- memcpy (&message_ral_p->ittiMsg, (void *) &connection_reconfiguration_ind, sizeof(rrc_ral_connection_reconfiguration_ind_t));
- //#warning "ue_mod_idP ? for instance ? => YES"
- LOG_I(RRC, "Sending RRC_RAL_CONNECTION_RECONFIGURATION_IND to mRAL\n");
- itti_send_msg_to_task (TASK_RAL_UE, ctxt_pP->instance, message_ral_p);
- }
-#endif
-#endif
-
- }
-
- //TTN test D2D (should not be here - in reality, this message will be triggered from ProSeApp)
- if (send_ue_information == 0) {
- LOG_I(RRC, "TEST SidelinkUEInformation [UE %d] Received (eNB %d)\n",
- ctxt_pP->module_id, eNB_indexP);
- LTE_SL_DestinationInfoList_r12_t *destinationInfoList = CALLOC(1, sizeof(LTE_SL_DestinationInfoList_r12_t));
- LTE_SL_DestinationIdentity_r12_t *sl_destination_identity = CALLOC(1, sizeof(LTE_SL_DestinationIdentity_r12_t));
- sl_destination_identity->size = 3;
- sl_destination_identity->buf = CALLOC(1,3);
- sl_destination_identity->buf[0] = 0x00;
- sl_destination_identity->buf[1] = 0x00;
- sl_destination_identity->buf[2] = 0x01;
- sl_destination_identity->bits_unused = 0;
- ASN_SEQUENCE_ADD(&destinationInfoList->list,sl_destination_identity);
- rrc_ue_generate_SidelinkUEInformation(ctxt_pP, eNB_indexP, destinationInfoList, NULL, SL_TRANSMIT_NON_RELAY_ONE_TO_ONE);
- send_ue_information ++;
- }
- break;
-
- case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionRelease:
-#if defined(ENABLE_ITTI)
- msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_RELEASE_IND);
-
- if ((dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.present
- == LTE_RRCConnectionRelease__criticalExtensions_PR_c1)
- && (dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.choice.c1.present
- == LTE_RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8)) {
- NAS_CONN_RELEASE_IND(msg_p).cause =
- dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.releaseCause;
- }
-
- itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
-#if ENABLE_RAL
- msg_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_CONNECTION_RELEASE_IND);
- RRC_RAL_CONNECTION_RELEASE_IND(msg_p).ue_id = ctxt_pP->module_id;
- itti_send_msg_to_task(TASK_RAL_UE, ctxt_pP->instance, msg_p);
-#endif
-#endif
- break;
-
- case LTE_DL_DCCH_MessageType__c1_PR_securityModeCommand:
- LOG_I(RRC, "[UE %d] Received securityModeCommand (eNB %d)\n",
- ctxt_pP->module_id, eNB_indexP);
- rrc_ue_process_securityModeCommand(
- ctxt_pP,
- &dl_dcch_msg->message.choice.c1.choice.securityModeCommand,
- eNB_indexP);
- break;
-
- case LTE_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
- LOG_I(RRC, "[UE %d] Received Capability Enquiry (eNB %d)\n",
- ctxt_pP->module_id,
- eNB_indexP);
- rrc_ue_process_ueCapabilityEnquiry(
- ctxt_pP,
- &dl_dcch_msg->message.choice.c1.choice.ueCapabilityEnquiry,
- eNB_indexP);
- break;
-
- case LTE_DL_DCCH_MessageType__c1_PR_counterCheck:
- break;
+ rrc_ue_process_ueCapabilityEnquiry(
+ ctxt_pP,
+ &dl_dcch_msg->message.choice.c1.choice.ueCapabilityEnquiry,
+ eNB_indexP);
+ break;
+ case LTE_DL_DCCH_MessageType__c1_PR_counterCheck:
+ break;
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- case LTE_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r9:
- break;
+
+ case LTE_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r9:
+ break;
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- case LTE_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10:
- break;
- case LTE_DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10:
- break;
+ case LTE_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10:
+ break;
+
+ case LTE_DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10:
+ break;
#endif
- case LTE_DL_DCCH_MessageType__c1_PR_spare1:
- case LTE_DL_DCCH_MessageType__c1_PR_spare2:
- case LTE_DL_DCCH_MessageType__c1_PR_spare3:
+ case LTE_DL_DCCH_MessageType__c1_PR_spare1:
+ case LTE_DL_DCCH_MessageType__c1_PR_spare2:
+ case LTE_DL_DCCH_MessageType__c1_PR_spare3:
#if (LTE_RRC_VERSION < MAKE_VERSION(14, 0, 0))
- case LTE_DL_DCCH_MessageType__c1_PR_spare4:
+ case LTE_DL_DCCH_MessageType__c1_PR_spare4:
#endif
- break;
+ break;
- default:
- break;
+ default:
+ break;
}
}
}
@@ -2756,8 +2450,7 @@ const char SIBType[12][6] = {"SIB3","SIB4","SIB5","SIB6","SIB7","SIB8","SIB9","S
const char SIBPeriod[8][6]= {"rf8","rf16","rf32","rf64","rf128","rf256","rf512","ERR"};
int siPeriod_int[7] = {80,160,320,640,1280,2560,5120};
-const char* SIBreserved( long value )
-{
+const char *SIBreserved( long value ) {
if (value < 0 || value > 1)
return "ERR";
@@ -2766,8 +2459,7 @@ const char* SIBreserved( long value )
return "reserved";
}
-const char* SIBbarred( long value )
-{
+const char *SIBbarred( long value ) {
if (value < 0 || value > 1)
return "ERR";
@@ -2776,8 +2468,7 @@ const char* SIBbarred( long value )
return "barred";
}
-const char* SIBallowed( long value )
-{
+const char *SIBallowed( long value ) {
if (value < 0 || value > 1)
return "ERR";
@@ -2786,23 +2477,21 @@ const char* SIBallowed( long value )
return "allowed";
}
-const char* SIB2SoundingPresent( int value )
-{
+const char *SIB2SoundingPresent( int value ) {
switch (value) {
- case LTE_SoundingRS_UL_ConfigCommon_PR_NOTHING:
- return "NOTHING";
+ case LTE_SoundingRS_UL_ConfigCommon_PR_NOTHING:
+ return "NOTHING";
- case LTE_SoundingRS_UL_ConfigCommon_PR_release:
- return "release";
+ case LTE_SoundingRS_UL_ConfigCommon_PR_release:
+ return "release";
- case LTE_SoundingRS_UL_ConfigCommon_PR_setup:
- return "setup";
+ case LTE_SoundingRS_UL_ConfigCommon_PR_setup:
+ return "setup";
}
return "ERR";
}
-const char* SIB2numberOfRA_Preambles( long value )
-{
+const char *SIB2numberOfRA_Preambles( long value ) {
static char temp[4] = {0};
if (value < 0 || value > 15)
@@ -2812,16 +2501,14 @@ const char* SIB2numberOfRA_Preambles( long value )
temp[3] = 0; // terminate string
return temp;
}
-const char* SIB2powerRampingStep( long value )
-{
+const char *SIB2powerRampingStep( long value ) {
if (value < 0 || value > 3)
return "ERR";
static const char str[4][4] = {"dB0","dB2","dB4","dB6"};
return str[value];
}
-const char* SIB2preambleInitialReceivedTargetPower( long value )
-{
+const char *SIB2preambleInitialReceivedTargetPower( long value ) {
static char temp[8] = {0};
if (value < 0 || value > 15)
@@ -2831,8 +2518,7 @@ const char* SIB2preambleInitialReceivedTargetPower( long value )
temp[7] = 0; // terminate string
return temp;
}
-const char* SIB2preambleTransMax( long value )
-{
+const char *SIB2preambleTransMax( long value ) {
static char temp[5] = {0};
if (value < 0 || value > 10)
@@ -2844,27 +2530,26 @@ const char* SIB2preambleTransMax( long value )
}
switch (value) {
- case 6:
- return "n10";
+ case 6:
+ return "n10";
- case 7:
- return "n20";
+ case 7:
+ return "n20";
- case 8:
- return "n50";
+ case 8:
+ return "n50";
- case 9:
- return "n100";
+ case 9:
+ return "n100";
- case 10:
- return "n200";
+ case 10:
+ return "n200";
}
/* unreachable but gcc warns... */
return "ERR";
}
-const char* SIB2ra_ResponseWindowSize( long value )
-{
+const char *SIB2ra_ResponseWindowSize( long value ) {
static char temp[4] = {0};
if (value < 0 || value > 7)
@@ -2876,8 +2561,7 @@ const char* SIB2ra_ResponseWindowSize( long value )
snprintf( temp, sizeof(temp), "sf%ld", value+2 );
return temp;
}
-const char* SIB2mac_ContentionResolutionTimer( long value )
-{
+const char *SIB2mac_ContentionResolutionTimer( long value ) {
static char temp[5] = {0};
if (value < 0 || value > 7)
@@ -2886,8 +2570,7 @@ const char* SIB2mac_ContentionResolutionTimer( long value )
snprintf( temp, sizeof(temp), "sf%ld", 8 + value*8 );
return temp;
}
-const char* SIB2modificationPeriodCoeff( long value )
-{
+const char *SIB2modificationPeriodCoeff( long value ) {
static char temp[32] = {0};
if (value < 0 || value > 3)
@@ -2896,8 +2579,7 @@ const char* SIB2modificationPeriodCoeff( long value )
snprintf( temp, sizeof(temp), "n%d", (int)pow(2,value+1) );
return temp;
}
-const char* SIB2defaultPagingCycle( long value )
-{
+const char *SIB2defaultPagingCycle( long value ) {
static char temp[32] = {0};
if (value < 0 || value > 3)
@@ -2906,8 +2588,7 @@ const char* SIB2defaultPagingCycle( long value )
snprintf( temp, sizeof(temp), "rf%d", (int)pow(2,value+4) );
return temp;
}
-const char* SIB2nB( long value )
-{
+const char *SIB2nB( long value ) {
if (value < 0 || value > 7)
return "ERR";
@@ -2920,17 +2601,14 @@ const char* SIB2nB( long value )
//-----------------------------------------------------------------------------
int decode_BCCH_DLSCH_Message(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const uint8_t eNB_index,
- uint8_t* const Sdu,
+ uint8_t *const Sdu,
const uint8_t Sdu_len,
const uint8_t rsrq,
- const uint8_t rsrp )
-{
+ const uint8_t rsrp ) {
LTE_BCCH_DL_SCH_Message_t *bcch_message = NULL;
- LTE_SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index];
- int i;
-
+ LTE_SystemInformationBlockType1_t *sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index];
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN );
if (((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 1) && // SIB1 received
@@ -2943,6 +2621,10 @@ int decode_BCCH_DLSCH_Message(
rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_RECEIVING_SIB );
+ if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+ xer_fprint(stdout, &asn_DEF_LTE_BCCH_DL_SCH_Message,(void *)bcch_message );
+ }
+
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_LTE_BCCH_DL_SCH_Message,
(void **)&bcch_message,
@@ -2953,83 +2635,50 @@ int decode_BCCH_DLSCH_Message(
LOG_E( RRC, "[UE %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n",
ctxt_pP->module_id,
dec_rval.consumed );
- for (i=0;iittiMsg, (void *) bcch_message, sizeof(RrcDlBcchMessage));
-
- itti_send_msg_to_task (TASK_UNKNOWN, ctxt_pP->instance, msg_p);
- }
-# else
- {
- char message_string[15000];
- size_t message_string_size;
-
- if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText));
- msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
- }
- }
-# endif
-#endif
-
if (bcch_message->message.present == LTE_BCCH_DL_SCH_MessageType_PR_c1) {
switch (bcch_message->message.choice.c1.present) {
- case LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
- if ((ctxt_pP->frame % 2) == 0) {
- // even frame
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 0) {
- LTE_SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index];
- memcpy( (void*)sib1,
- (void*)&bcch_message->message.choice.c1.choice.systemInformationBlockType1,
- sizeof(LTE_SystemInformationBlockType1_t) );
- LOG_D( RRC, "[UE %"PRIu8"] Decoding First SIB1\n", ctxt_pP->module_id );
-
- decode_SIB1( ctxt_pP, eNB_index, rsrq, rsrp );
+ case LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1:
+ if ((ctxt_pP->frame % 2) == 0) {
+ // even frame
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 0) {
+ LTE_SystemInformationBlockType1_t *sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index];
+ memcpy( (void *)sib1,
+ (void *)&bcch_message->message.choice.c1.choice.systemInformationBlockType1,
+ sizeof(LTE_SystemInformationBlockType1_t) );
+ LOG_D( RRC, "[UE %"PRIu8"] Decoding First SIB1\n", ctxt_pP->module_id );
+ decode_SIB1( ctxt_pP, eNB_index, rsrq, rsrp );
+ }
}
- }
- break;
+ break;
- case LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 1) {
- // SIB1 with schedulingInfoList is available
+ case LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 1) {
+ // SIB1 with schedulingInfoList is available
+ LTE_SystemInformation_t *si = UE_rrc_inst[ctxt_pP->module_id].si[eNB_index];
+ memcpy( si,
+ &bcch_message->message.choice.c1.choice.systemInformation,
+ sizeof(LTE_SystemInformation_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Decoding SI for frameP %"PRIu32"\n",
+ ctxt_pP->module_id,
+ ctxt_pP->frame );
+ decode_SI( ctxt_pP, eNB_index );
+ //if (nfapi_mode == 3)
+ UE_mac_inst[ctxt_pP->module_id].SI_Decoded = 1;
+ }
- LTE_SystemInformation_t* si = UE_rrc_inst[ctxt_pP->module_id].si[eNB_index];
- memcpy( si,
- &bcch_message->message.choice.c1.choice.systemInformation,
- sizeof(LTE_SystemInformation_t) );
+ break;
- LOG_I( RRC, "[UE %"PRIu8"] Decoding SI for frameP %"PRIu32"\n",
- ctxt_pP->module_id,
- ctxt_pP->frame );
- decode_SI( ctxt_pP, eNB_index );
- //if (nfapi_mode == 3)
- UE_mac_inst[ctxt_pP->module_id].SI_Decoded = 1;
- }
-
- break;
-
- case LTE_BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
- default:
- break;
+ case LTE_BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
+ default:
+ break;
}
}
@@ -3043,22 +2692,18 @@ int decode_BCCH_DLSCH_Message(
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT );
-
return 0;
}
//-----------------------------------------------------------------------------
int decode_PCCH_DLSCH_Message(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const uint8_t eNB_index,
- uint8_t* const Sdu,
- const uint8_t Sdu_len)
-{
+ uint8_t *const Sdu,
+ const uint8_t Sdu_len) {
LTE_PCCH_Message_t *pcch_message = NULL;
int i;
-
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_IN );
-
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_LTE_PCCH_Message,
(void **)&pcch_message,
@@ -3069,11 +2714,13 @@ int decode_PCCH_DLSCH_Message(
LOG_E( RRC, "[UE %"PRIu8"] Failed to decode PCCH_MESSAGE (%zu bits)\n",
ctxt_pP->module_id,
dec_rval.consumed );
- for (i=0;imodule_id].sib1[eNB_index];
-
+int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t rsrq, const uint8_t rsrp ) {
+ LTE_SystemInformationBlockType1_t *sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index];
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_IN );
-
LOG_I( RRC, "[UE %d] : Dumping SIB 1\n", ctxt_pP->module_id );
-
LTE_PLMN_Identity_t *PLMN_identity = &sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->plmn_Identity;
-
int mccdigits = PLMN_identity->mcc->list.count;
int mncdigits = PLMN_identity->mnc.list.count;
-
int mcc;
if (mccdigits == 2) {
@@ -3111,10 +2752,10 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
mnc = *PLMN_identity->mnc.list.array[0]*100 + *PLMN_identity->mnc.list.array[1]*10 + *PLMN_identity->mnc.list.array[2];
}
- LOG_I( RRC, "PLMN MCC %0*d, MNC %0*d, TAC 0x%04x\n", mccdigits, mcc, mncdigits, mnc,
- ((sib1->cellAccessRelatedInfo.trackingAreaCode.size == 2)?((sib1->cellAccessRelatedInfo.trackingAreaCode.buf[0]<<8) + sib1->cellAccessRelatedInfo.trackingAreaCode.buf[1]):0));
- LOG_I( RRC, "cellReservedForOperatorUse : raw:%ld decoded:%s\n", sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->cellReservedForOperatorUse, SIBreserved(sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->cellReservedForOperatorUse) );
-
+ LOG_I( RRC, "PLMN MCC %0*d, MNC %0*d, TAC 0x%04x\n", mccdigits, mcc, mncdigits, mnc,
+ ((sib1->cellAccessRelatedInfo.trackingAreaCode.size == 2)?((sib1->cellAccessRelatedInfo.trackingAreaCode.buf[0]<<8) + sib1->cellAccessRelatedInfo.trackingAreaCode.buf[1]):0));
+ LOG_I( RRC, "cellReservedForOperatorUse : raw:%ld decoded:%s\n", sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->cellReservedForOperatorUse,
+ SIBreserved(sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->cellReservedForOperatorUse) );
// search internal table for provider name
int plmn_ind = 0;
@@ -3137,7 +2778,6 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
sib1->cellAccessRelatedInfo.cellIdentity.buf[1],
sib1->cellAccessRelatedInfo.cellIdentity.buf[2],
sib1->cellAccessRelatedInfo.cellIdentity.buf[3] >> sib1->cellAccessRelatedInfo.cellIdentity.bits_unused);
-
LOG_I( RRC, "cellAccessRelatedInfo.cellBarred : raw:%ld decoded:%s\n", sib1->cellAccessRelatedInfo.cellBarred, SIBbarred(sib1->cellAccessRelatedInfo.cellBarred) );
LOG_I( RRC, "cellAccessRelatedInfo.intraFreqReselection : raw:%ld decoded:%s\n", sib1->cellAccessRelatedInfo.intraFreqReselection, SIBallowed(sib1->cellAccessRelatedInfo.intraFreqReselection) );
LOG_I( RRC, "cellAccessRelatedInfo.csg_Indication : %d\n", sib1->cellAccessRelatedInfo.csg_Indication );
@@ -3189,55 +2829,50 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
LOG_I( RRC, "siWindowLength : %s\n", siWindowLength[min(sib1->si_WindowLength,7)] );
LOG_I( RRC, "systemInfoValueTag : %ld\n", sib1->systemInfoValueTag );
-
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod = siPeriod_int[sib1->schedulingInfoList.list.array[0]->si_Periodicity];
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize = siWindowLength_int[sib1->si_WindowLength];
LOG_I( RRC, "[FRAME unknown][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB1 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n",
ctxt_pP->module_id, eNB_index, ctxt_pP->module_id );
-
rrc_mac_config_req_ue(ctxt_pP->module_id, 0, eNB_index,
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- (struct LTE_PhysicalConfigDedicated *)NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- (LTE_MAC_MainConfig_t *)NULL,
- 0,
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config,
- (LTE_MobilityControlInfo_t *) NULL,
- &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize,
- &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod,
- NULL,
- NULL,
- NULL,
- (LTE_MBSFN_SubframeConfigList_t *)NULL
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ (LTE_MAC_MainConfig_t *)NULL,
+ 0,
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config,
+ (LTE_MobilityControlInfo_t *) NULL,
+ &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize,
+ &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod,
+ NULL,
+ NULL,
+ NULL,
+ (LTE_MBSFN_SubframeConfigList_t *)NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- ,0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
-
+ ,0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,
- 0,
- 0
+ ,
+ 0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,
- 0,
- NULL,
- NULL
+ ,
+ 0,
+ NULL,
+ NULL
#endif
- );
-
+ );
LOG_I(RRC,"Setting SIStatus bit 0 to 1\n");
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus = 1;
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1systemInfoValueTag = sib1->systemInfoValueTag;
-
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
{
int cell_valid = 0;
@@ -3246,13 +2881,11 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
/* Cell is not barred */
int plmn;
int plmn_number;
-
plmn_number = sib1->cellAccessRelatedInfo.plmn_IdentityList.list.count;
/* Compare requested PLMN and PLMNs from SIB1*/
for (plmn = 0; plmn < plmn_number; plmn++) {
LTE_PLMN_Identity_t *plmn_Identity;
-
plmn_Identity = &sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[plmn]->plmn_Identity;
if (
@@ -3278,7 +2911,6 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
) {
/* PLMN match, send a confirmation to NAS */
MessageDef *msg_p;
-
msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CELL_SELECTION_CNF);
NAS_CELL_SELECTION_CNF (msg_p).errCode = AS_SUCCESS;
NAS_CELL_SELECTION_CNF (msg_p).cellID = BIT_STRING_to_uint32(&sib1->cellAccessRelatedInfo.cellIdentity);
@@ -3286,7 +2918,6 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
NAS_CELL_SELECTION_CNF (msg_p).rat = 0xFF;
NAS_CELL_SELECTION_CNF (msg_p).rsrq = rsrq;
NAS_CELL_SELECTION_CNF (msg_p).rsrp = rsrp;
-
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
cell_valid = 1;
break;
@@ -3297,24 +2928,19 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
if (cell_valid == 0) {
/* Cell can not be used, ask PHY to try the next one */
MessageDef *msg_p;
-
msg_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_NEXT_CELL_REQ);
-
itti_send_msg_to_task(TASK_PHY_UE, ctxt_pP->instance, msg_p);
- LOG_E(RRC, "Synched with a cell, but PLMN doesn't match our SIM, the message PHY_FIND_NEXT_CELL_REQ is sent but lost in current UE implementation! \n");
+ LOG_E(RRC, "Synched with a cell, but PLMN doesn't match our SIM, the message PHY_FIND_NEXT_CELL_REQ is sent but lost in current UE implementation! \n");
}
}
#endif
-
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_OUT );
-
return 0;
}
//-----------------------------------------------------------------------------
- void dump_sib2( LTE_SystemInformationBlockType2_t *sib2 )
-{
+void dump_sib2( LTE_SystemInformationBlockType2_t *sib2 ) {
// ac_BarringInfo
if (sib2->ac_BarringInfo) {
LOG_I( RRC, "ac_BarringInfo->ac_BarringForEmergency : %d\n",
@@ -3364,7 +2990,6 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower : raw:%ld decoded:%s\n",
sib2->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower,
SIB2preambleInitialReceivedTargetPower(sib2->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower) );
-
LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax : raw:%ld decoded:%s\n",
sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax,
SIB2preambleTransMax(sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax) );
@@ -3374,15 +2999,12 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer : raw:%ld decoded:%s\n",
sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer,
SIB2mac_ContentionResolutionTimer(sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer) );
-
LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx : %ld\n",
sib2->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx );
-
// BCCH
LOG_I( RRC, "radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff : raw:%ld decoded:%s\n",
sib2->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff,
SIB2modificationPeriodCoeff(sib2->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff) );
-
// PCCH
LOG_I( RRC, "radioResourceConfigCommon.pcch_Config.defaultPagingCycle : raw:%ld decoded:%s\n",
sib2->radioResourceConfigCommon.pcch_Config.defaultPagingCycle,
@@ -3390,7 +3012,6 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
LOG_I( RRC, "radioResourceConfigCommon.pcch_Config.nB : raw:%ld decoded:%s\n",
sib2->radioResourceConfigCommon.pcch_Config.nB,
SIB2nB(sib2->radioResourceConfigCommon.pcch_Config.nB) );
-
// PRACH
LOG_I( RRC, "radioResourceConfigCommon.prach_Config.rootSequenceIndex : %ld\n",
sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex );
@@ -3402,13 +3023,11 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig );
LOG_I( RRC, "radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset : %ld\n",
sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset );
-
// PDSCH-Config
LOG_I( RRC, "radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower : %ld\n",
sib2->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower );
LOG_I( RRC, "radioResourceConfigCommon.pdsch_ConfigCommon.p_b : %ld\n",
sib2->radioResourceConfigCommon.pdsch_ConfigCommon.p_b );
-
// PUSCH-Config
LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB : %ld\n",
sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB );
@@ -3426,7 +3045,6 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled );
LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift : %ld\n",
sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift );
-
// PUCCH-Config
LOG_I( RRC, "radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift : %ld\n",
sib2->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift );
@@ -3436,7 +3054,6 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
sib2->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN );
LOG_I( RRC, "radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN : %ld\n",
sib2->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN );
-
// SoundingRS_UL_Config
LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present : raw:%d decoded:%s\n",
sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present,
@@ -3450,11 +3067,10 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission : %d\n",
sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission );
- if(sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
- {
- LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts : %ld\n",
- /* TODO: check that it's okay to access [0] */
- sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts[0] );
+ if(sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts) {
+ LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts : %ld\n",
+ /* TODO: check that it's okay to access [0] */
+ sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts[0] );
}
}
@@ -3477,15 +3093,12 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b );
LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 : %ld\n",
sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 );
-
LOG_I( RRC, "radioResourceConfigCommon.ul_CyclicPrefixLength : %ld\n",
sib2->radioResourceConfigCommon.ul_CyclicPrefixLength );
-
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 2, 0))
// UplinkPowerControlCommon_v1020
// ...
#endif
-
LOG_I( RRC, "ue_TimersAndConstants.t300 : %ld\n", sib2->ue_TimersAndConstants.t300 );
LOG_I( RRC, "ue_TimersAndConstants.t301 : %ld\n", sib2->ue_TimersAndConstants.t301 );
LOG_I( RRC, "ue_TimersAndConstants.t310 : %ld\n", sib2->ue_TimersAndConstants.t310 );
@@ -3512,15 +3125,16 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
LOG_I( RRC, "mbsfn_SubframeConfigList : not defined\n" );
LOG_I( RRC, "timeAlignmentTimerCommon : %ld\n", sib2->timeAlignmentTimerCommon );
-
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
+
if (sib2->lateNonCriticalExtension) {
LOG_I( RRC, "lateNonCriticalExtension : %p\n", sib2->lateNonCriticalExtension );
} else
LOG_I( RRC, "lateNonCriticalExtension : not defined\n" );
-#endif
+#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
+
if (sib2->ext1 && sib2->ext1->ssac_BarringForMMTEL_Voice_r9) {
LOG_I( RRC, "ssac_BarringForMMTEL_Voice_r9->ac_BarringFactor : %ld\n",
sib2->ext1->ssac_BarringForMMTEL_Voice_r9->ac_BarringFactor );
@@ -3540,9 +3154,10 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
BIT_STRING_to_uint32(&sib2->ext1->ssac_BarringForMMTEL_Video_r9->ac_BarringForSpecialAC) );
} else
LOG_I( RRC, "ssac_BarringForMMTEL_Video_r9 : not defined\n" );
-#endif
+#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+
if (sib2->ext2 && sib2->ext2->ac_BarringForCSFB_r10) {
LOG_I( RRC, "ac_BarringForCSFB_r10->ac_BarringFactor : %ld\n",
sib2->ext2->ac_BarringForCSFB_r10->ac_BarringFactor );
@@ -3557,10 +3172,8 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
}
//-----------------------------------------------------------------------------
- void dump_sib3( LTE_SystemInformationBlockType3_t *sib3 )
-{
+void dump_sib3( LTE_SystemInformationBlockType3_t *sib3 ) {
LOG_I( RRC, "Dumping SIB3 (see TS36.331 V8.21.0)\n" );
-
int q_Hyst_dB = sib3->cellReselectionInfoCommon.q_Hyst; // sib3->cellReselectionInfoCommon.q_Hyst is a enumerated value
if (q_Hyst_dB > 6)
@@ -3593,7 +3206,6 @@ int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
LOG_I( RRC, "cellReselectionServingFreqInfo.threshServingLow : %ld\n", sib3->cellReselectionServingFreqInfo.threshServingLow );
LOG_I( RRC, "cellReselectionServingFreqInfo.cellReselectionPriority : %ld\n", sib3->cellReselectionServingFreqInfo.cellReselectionPriority );
-
LOG_I( RRC, "intraFreqCellReselectionInfo.q_RxLevMin : %ld\n", sib3->intraFreqCellReselectionInfo.q_RxLevMin );
if (sib3->intraFreqCellReselectionInfo.p_Max) {
@@ -3630,7 +3242,6 @@ int Qoffsettab[31] = {-24,-22,-20,-18,-16,-14,-12,-10,-8,-6,-5,-4,-3,-2,-1,0,1,2
int PhysCellIdRange[16] = {4,8,12,16,24,32,48,64,84,96,128,168,252,504,0,0};
uint64_t arfcn_to_freq(long arfcn) {
-
if (arfcn < 600) // Band 1
return((uint64_t)2110000000 + (arfcn*100000));
else if (arfcn <1200) // Band 2
@@ -3704,86 +3315,102 @@ uint64_t arfcn_to_freq(long arfcn) {
exit(1);
}
}
- void dump_sib5( LTE_SystemInformationBlockType5_t *sib5 )
-{
+void dump_sib5( LTE_SystemInformationBlockType5_t *sib5 ) {
LTE_InterFreqCarrierFreqList_t interFreqCarrierFreqList = sib5->interFreqCarrierFreqList;
int i,j;
LTE_InterFreqCarrierFreqInfo_t *ifcfInfo;
-
LOG_I( RRC, "Dumping SIB5 (see TS36.331 V8.21.0)\n" );
- for (i=0;idl_CarrierFreq),
- ifcfInfo->dl_CarrierFreq);
+ arfcn_to_freq(ifcfInfo->dl_CarrierFreq),
+ ifcfInfo->dl_CarrierFreq);
LOG_I(RRC," Q_RXLevMin : %ld\n", ifcfInfo->q_RxLevMin);
+
if (ifcfInfo->p_Max != NULL)
LOG_I(RRC," P_max : %ld\n", *ifcfInfo->p_Max);
+
LOG_I(RRC," T_ReselectionEUTRA : %ld\n",ifcfInfo->t_ReselectionEUTRA);
+
if (ifcfInfo->t_ReselectionEUTRA_SF) {
LOG_I(RRC," t_ReselectionEUTRA_SF.sf_Medium %ld, t_ReselectionEUTRA_SF.sf_High %ld",
- ifcfInfo->t_ReselectionEUTRA_SF->sf_Medium,
- ifcfInfo->t_ReselectionEUTRA_SF->sf_High);
+ ifcfInfo->t_ReselectionEUTRA_SF->sf_Medium,
+ ifcfInfo->t_ReselectionEUTRA_SF->sf_High);
}
+
LOG_I(RRC," threshX_High : %ld\n",ifcfInfo->threshX_High);
LOG_I(RRC," threshX_Low : %ld\n",ifcfInfo->threshX_Low);
+
switch(ifcfInfo->allowedMeasBandwidth) {
- case LTE_AllowedMeasBandwidth_mbw6:
- LOG_I(RRC," AllowedMeasBandwidth : 6\n");
- break;
- case LTE_AllowedMeasBandwidth_mbw15:
- LOG_I(RRC," AllowedMeasBandwidth : 15\n");
- break;
- case LTE_AllowedMeasBandwidth_mbw25:
- LOG_I(RRC," AllowedMeasBandwidth : 25\n");
- break;
- case LTE_AllowedMeasBandwidth_mbw50:
- LOG_I(RRC," AllowedMeasBandwidth : 50\n");
- break;
- case LTE_AllowedMeasBandwidth_mbw75:
- LOG_I(RRC," AllowedMeasBandwidth : 75\n");
- break;
- case LTE_AllowedMeasBandwidth_mbw100:
- LOG_I(RRC," AllowedMeasBandwidth : 100\n");
- break;
+ case LTE_AllowedMeasBandwidth_mbw6:
+ LOG_I(RRC," AllowedMeasBandwidth : 6\n");
+ break;
+
+ case LTE_AllowedMeasBandwidth_mbw15:
+ LOG_I(RRC," AllowedMeasBandwidth : 15\n");
+ break;
+
+ case LTE_AllowedMeasBandwidth_mbw25:
+ LOG_I(RRC," AllowedMeasBandwidth : 25\n");
+ break;
+
+ case LTE_AllowedMeasBandwidth_mbw50:
+ LOG_I(RRC," AllowedMeasBandwidth : 50\n");
+ break;
+
+ case LTE_AllowedMeasBandwidth_mbw75:
+ LOG_I(RRC," AllowedMeasBandwidth : 75\n");
+ break;
+
+ case LTE_AllowedMeasBandwidth_mbw100:
+ LOG_I(RRC," AllowedMeasBandwidth : 100\n");
+ break;
}
+
if (ifcfInfo->presenceAntennaPort1)
LOG_I(RRC," PresenceAntennaPort1 : True\n");
else
LOG_I(RRC," PresenceAntennaPort1 : False\n");
+
if (ifcfInfo->cellReselectionPriority) {
LOG_I(RRC," CellReselectionPriority : %ld\n",
- *ifcfInfo->cellReselectionPriority);
+ *ifcfInfo->cellReselectionPriority);
}
+
LOG_I(RRC," NeighCellConfig : ");
- for (j=0;jneighCellConfig.size;j++) {
+
+ for (j=0; jneighCellConfig.size; j++) {
printf("%2x ",ifcfInfo->neighCellConfig.buf[j]);
}
+
printf("\n");
+
if (ifcfInfo->q_OffsetFreq)
LOG_I(RRC," Q_OffsetFreq : %d\n",Qoffsettab[*ifcfInfo->q_OffsetFreq]);
+
if (ifcfInfo->interFreqNeighCellList) {
-
- for (j=0;jinterFreqNeighCellList->list.count;j++) {
- LOG_I(RRC," Cell %d\n", j);
- LOG_I(RRC," PhysCellId : %ld\n",ifcfInfo->interFreqNeighCellList->list.array[j]->physCellId);
- LOG_I(RRC," Q_OffsetRange : %ld\n",ifcfInfo->interFreqNeighCellList->list.array[j]->q_OffsetCell);
-
+ for (j=0; jinterFreqNeighCellList->list.count; j++) {
+ LOG_I(RRC," Cell %d\n", j);
+ LOG_I(RRC," PhysCellId : %ld\n",ifcfInfo->interFreqNeighCellList->list.array[j]->physCellId);
+ LOG_I(RRC," Q_OffsetRange : %ld\n",ifcfInfo->interFreqNeighCellList->list.array[j]->q_OffsetCell);
}
}
+
if (ifcfInfo->interFreqBlackCellList) {
+ for (j=0; jinterFreqBlackCellList->list.count; j++) {
+ LOG_I(RRC," Cell %d\n", j);
+ LOG_I(RRC," PhysCellId start: %ld\n",ifcfInfo->interFreqBlackCellList->list.array[j]->start);
- for (j=0;jinterFreqBlackCellList->list.count;j++) {
- LOG_I(RRC," Cell %d\n", j);
- LOG_I(RRC," PhysCellId start: %ld\n",ifcfInfo->interFreqBlackCellList->list.array[j]->start);
- if (ifcfInfo->interFreqBlackCellList->list.array[i]->range) {
- LOG_I(RRC," PhysCellId Range : %ld\n",*ifcfInfo->interFreqBlackCellList->list.array[j]->range);
- }
+ if (ifcfInfo->interFreqBlackCellList->list.array[i]->range) {
+ LOG_I(RRC," PhysCellId Range : %ld\n",*ifcfInfo->interFreqBlackCellList->list.array[j]->range);
+ }
}
}
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
+
if (ifcfInfo->ext1 && ifcfInfo->ext1->q_QualMin_r9)
LOG_I(RRC," Q_QualMin_r9 : %ld\n",*ifcfInfo->ext1->q_QualMin_r9);
@@ -3791,14 +3418,13 @@ uint64_t arfcn_to_freq(long arfcn) {
LOG_I(RRC," threshX_HighQ_r9 : %ld\n",ifcfInfo->ext1->threshX_Q_r9->threshX_HighQ_r9);
LOG_I(RRC," threshX_LowQ_r9: %ld\n",ifcfInfo->ext1->threshX_Q_r9->threshX_LowQ_r9);
}
+
#endif
}
-
}
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- void dump_sib13( LTE_SystemInformationBlockType13_r9_t *sib13 )
-{
+void dump_sib13( LTE_SystemInformationBlockType13_r9_t *sib13 ) {
LOG_I( RRC, "[UE] Dumping SIB13\n" );
LOG_I( RRC, "[UE] dumping sib13 second time\n" );
LOG_I( RRC, "[UE] NotificationRepetitionCoeff-r9 : %ld\n", sib13->notificationConfig_r9.notificationRepetitionCoeff_r9 );
@@ -3809,72 +3435,73 @@ uint64_t arfcn_to_freq(long arfcn) {
//TTN - SIB18
//-----------------------------------------------------------------------------
- void dump_sib18(LTE_SystemInformationBlockType18_r12_t *sib18){
- LOG_I( RRC, "[UE] Dumping SIB18\n" );
- for (int i = 0; i < sib18->commConfig_r12->commRxPool_r12.list.count; i++) {
- LOG_I(RRC, " Contents of SIB18 %d/%d \n", i+1, sib18->commConfig_r12->commRxPool_r12.list.count);
- LOG_I(RRC, " SIB18 rxPool_sc_CP_Len: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_CP_Len_r12);
- LOG_I(RRC, " SIB18 sc_Period_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_Period_r12);
- LOG_I(RRC, " SIB18 data_CP_Len_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->data_CP_Len_r12);
- LOG_I(RRC, " SIB18 prb_Num_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_Num_r12);
- LOG_I(RRC, " SIB18 prb_Start_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_Start_r12);
- LOG_I(RRC, " SIB18 prb_End_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_End_r12);
- //to add more log
- }
+void dump_sib18(LTE_SystemInformationBlockType18_r12_t *sib18) {
+ LOG_I( RRC, "[UE] Dumping SIB18\n" );
+
+ for (int i = 0; i < sib18->commConfig_r12->commRxPool_r12.list.count; i++) {
+ LOG_I(RRC, " Contents of SIB18 %d/%d \n", i+1, sib18->commConfig_r12->commRxPool_r12.list.count);
+ LOG_I(RRC, " SIB18 rxPool_sc_CP_Len: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_CP_Len_r12);
+ LOG_I(RRC, " SIB18 sc_Period_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_Period_r12);
+ LOG_I(RRC, " SIB18 data_CP_Len_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->data_CP_Len_r12);
+ LOG_I(RRC, " SIB18 prb_Num_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_Num_r12);
+ LOG_I(RRC, " SIB18 prb_Start_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_Start_r12);
+ LOG_I(RRC, " SIB18 prb_End_r12: %ld \n", sib18->commConfig_r12->commRxPool_r12.list.array[i]->sc_TF_ResourceConfig_r12.prb_End_r12);
+ //to add more log
+ }
}
//TTN - SIB19
//-----------------------------------------------------------------------------
- void dump_sib19(LTE_SystemInformationBlockType19_r12_t *sib19){
- LOG_I( RRC, "[UE] Dumping SIB19\n" );
- for (int i = 0; i < sib19->discConfig_r12->discRxPool_r12.list.count; i++) {
- LOG_I(RRC, " Contents of SIB19 %d/%d \n", i+1, sib19->discConfig_r12->discRxPool_r12.list.count);
- LOG_I(RRC, " SIB19 cp_Len_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->cp_Len_r12);
- LOG_I(RRC, " SIB19 discPeriod_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->discPeriod_r12);
- LOG_I(RRC, " SIB19 numRetx_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->numRetx_r12);
- LOG_I(RRC, " SIB19 numRepetition_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->numRepetition_r12);
- LOG_I(RRC, " SIB19 prb_Num_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_Num_r12);
- LOG_I(RRC, " SIB19 prb_Start_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_Start_r12);
- LOG_I(RRC, " SIB19 prb_End_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_End_r12);
- //to add more log
- }
+void dump_sib19(LTE_SystemInformationBlockType19_r12_t *sib19) {
+ LOG_I( RRC, "[UE] Dumping SIB19\n" );
+
+ for (int i = 0; i < sib19->discConfig_r12->discRxPool_r12.list.count; i++) {
+ LOG_I(RRC, " Contents of SIB19 %d/%d \n", i+1, sib19->discConfig_r12->discRxPool_r12.list.count);
+ LOG_I(RRC, " SIB19 cp_Len_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->cp_Len_r12);
+ LOG_I(RRC, " SIB19 discPeriod_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->discPeriod_r12);
+ LOG_I(RRC, " SIB19 numRetx_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->numRetx_r12);
+ LOG_I(RRC, " SIB19 numRepetition_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->numRepetition_r12);
+ LOG_I(RRC, " SIB19 prb_Num_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_Num_r12);
+ LOG_I(RRC, " SIB19 prb_Start_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_Start_r12);
+ LOG_I(RRC, " SIB19 prb_End_r12: %ld \n", sib19->discConfig_r12->discRxPool_r12.list.array[i]->tf_ResourceConfig_r12.prb_End_r12);
+ //to add more log
+ }
}
- void dump_sib21(LTE_SystemInformationBlockType21_r14_t *sib21){
- if ((sib21->sl_V2X_ConfigCommon_r14 != NULL) && (sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14 !=NULL) ){
- for (int i = 0; i < sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.count; i++) {
- LOG_I(RRC, " Contents of SIB21 %d/%d \n", i+1, sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.count);
- LOG_I(RRC, " SIB21 sl_Subframe_r14: %d \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->sl_Subframe_r14.present);
- LOG_I(RRC, " SIB21 adjacencyPSCCH_PSSCH_r14: %d \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->adjacencyPSCCH_PSSCH_r14);
- LOG_I(RRC, " SIB21 sizeSubchannel_r14: %ld \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->sizeSubchannel_r14);
- LOG_I(RRC, " SIB21 numSubchannel_r14: %ld \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->numSubchannel_r14);
- LOG_I(RRC, " SIB21 startRB_Subchannel_r14: %ld \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->startRB_Subchannel_r14);
- //to add more log
- }
+void dump_sib21(LTE_SystemInformationBlockType21_r14_t *sib21) {
+ if ((sib21->sl_V2X_ConfigCommon_r14 != NULL) && (sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14 !=NULL) ) {
+ for (int i = 0; i < sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.count; i++) {
+ LOG_I(RRC, " Contents of SIB21 %d/%d \n", i+1, sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.count);
+ LOG_I(RRC, " SIB21 sl_Subframe_r14: %d \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->sl_Subframe_r14.present);
+ LOG_I(RRC, " SIB21 adjacencyPSCCH_PSSCH_r14: %d \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->adjacencyPSCCH_PSSCH_r14);
+ LOG_I(RRC, " SIB21 sizeSubchannel_r14: %ld \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->sizeSubchannel_r14);
+ LOG_I(RRC, " SIB21 numSubchannel_r14: %ld \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->numSubchannel_r14);
+ LOG_I(RRC, " SIB21 startRB_Subchannel_r14: %ld \n", sib21->sl_V2X_ConfigCommon_r14->v2x_CommRxPool_r14->list.array[i]->startRB_Subchannel_r14);
+ //to add more log
}
- }
+ }
+}
#endif
//-----------------------------------------------------------------------------
- int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index )
-{
- LTE_SystemInformation_t** si = &UE_rrc_inst[ctxt_pP->module_id].si[eNB_index];
+int decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) {
+ LTE_SystemInformation_t **si = &UE_rrc_inst[ctxt_pP->module_id].si[eNB_index];
int new_sib = 0;
- LTE_SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index];
-
+ LTE_SystemInformationBlockType1_t *sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index];
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN );
// Dump contents
if ((*si)->criticalExtensions.present == LTE_SystemInformation__criticalExtensions_PR_systemInformation_r8 ||
#if (LTE_RRC_VERSION >= MAKE_VERSION(15, 3, 0))
- (*si)->criticalExtensions.present == LTE_SystemInformation__criticalExtensions_PR_criticalExtensionsFuture_r15) {
+ (*si)->criticalExtensions.present == LTE_SystemInformation__criticalExtensions_PR_criticalExtensionsFuture_r15) {
#else
- (*si)->criticalExtensions.present == LTE_SystemInformation__criticalExtensions_PR_criticalExtensionsFuture) {
+ (*si)->criticalExtensions.present == LTE_SystemInformation__criticalExtensions_PR_criticalExtensionsFuture) {
#endif
LOG_D( RRC, "[UE] (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count %d\n",
(*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count );
- } else {
+ }
+ else {
LOG_D( RRC, "[UE] Unknown criticalExtension version (not Rel8)\n" );
return -1;
}
@@ -3884,311 +3511,310 @@ uint64_t arfcn_to_freq(long arfcn) {
typeandinfo = (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i];
switch(typeandinfo->present) {
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2;
- new_sib=1;
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index], &typeandinfo->choice.sib2, sizeof(LTE_SystemInformationBlockType2_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- dump_sib2( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] );
- LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB2 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n",
- ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id );
-
- rrc_mac_config_req_ue(ctxt_pP->module_id, 0, eNB_index,
- &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->radioResourceConfigCommon,
- (struct LTE_PhysicalConfigDedicated *)NULL,
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index], &typeandinfo->choice.sib2, sizeof(LTE_SystemInformationBlockType2_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ dump_sib2( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] );
+ LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB2 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n",
+ ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id );
+ rrc_mac_config_req_ue(ctxt_pP->module_id, 0, eNB_index,
+ &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->radioResourceConfigCommon,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- (LTE_MAC_MainConfig_t *)NULL,
- 0,
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- (LTE_TDD_Config_t *)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_CarrierFreq,
- UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth,
- &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.additionalSpectrumEmission,
- UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->mbsfn_SubframeConfigList
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ (LTE_MAC_MainConfig_t *)NULL,
+ 0,
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_CarrierFreq,
+ UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth,
+ &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.additionalSpectrumEmission,
+ UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->mbsfn_SubframeConfigList
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- ,0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
-
+ ,0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,0,
- 0
+ ,0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,
- 0,
- NULL,
- NULL
+ ,
+ 0,
+ NULL,
+ NULL
#endif
- );
- // After SI is received, prepare RRCConnectionRequest
+ );
+ // After SI is received, prepare RRCConnectionRequest
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- if (UE_rrc_inst[ctxt_pP->module_id].MBMS_flag < 3) // see -Q option
+ if (UE_rrc_inst[ctxt_pP->module_id].MBMS_flag < 3) // see -Q option
#endif
#if !(defined(ENABLE_ITTI) && defined(ENABLE_USE_MME))
- rrc_ue_generate_RRCConnectionRequest( ctxt_pP, eNB_index );
+ rrc_ue_generate_RRCConnectionRequest( ctxt_pP, eNB_index );
#endif
- if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_IDLE) {
- LOG_I( RRC, "[UE %d] Received SIB1/SIB2/SIB3 Switching to RRC_SI_RECEIVED\n", ctxt_pP->module_id );
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_SI_RECEIVED;
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_IDLE) {
+ LOG_I( RRC, "[UE %d] Received SIB1/SIB2/SIB3 Switching to RRC_SI_RECEIVED\n", ctxt_pP->module_id );
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_SI_RECEIVED;
#if ENABLE_RAL
- {
- MessageDef *message_ral_p = NULL;
- rrc_ral_system_information_ind_t ral_si_ind;
-
- message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_SYSTEM_INFORMATION_IND);
- memset(&ral_si_ind, 0, sizeof(rrc_ral_system_information_ind_t));
- ral_si_ind.plmn_id.MCCdigit2 = '0';
- ral_si_ind.plmn_id.MCCdigit1 = '2';
- ral_si_ind.plmn_id.MNCdigit3 = '0';
- ral_si_ind.plmn_id.MCCdigit3 = '8';
- ral_si_ind.plmn_id.MNCdigit2 = '9';
- ral_si_ind.plmn_id.MNCdigit1 = '9';
- ral_si_ind.cell_id = 1;
- ral_si_ind.dbm = 0;
- //ral_si_ind.dbm = fifo_dump_emos_UE.PHY_measurements->rx_rssi_dBm[eNB_index];
- // TO DO
- ral_si_ind.sinr = 0;
- //ral_si_ind.sinr = fifo_dump_emos_UE.PHY_measurements->subband_cqi_dB[eNB_index][phy_vars_ue->lte_frame_parms.nb_antennas_rx][0];
- // TO DO
- ral_si_ind.link_data_rate = 0;
- memcpy (&message_ral_p->ittiMsg, (void *) &ral_si_ind, sizeof(rrc_ral_system_information_ind_t));
+ {
+ MessageDef *message_ral_p = NULL;
+ rrc_ral_system_information_ind_t ral_si_ind;
+ message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_SYSTEM_INFORMATION_IND);
+ memset(&ral_si_ind, 0, sizeof(rrc_ral_system_information_ind_t));
+ ral_si_ind.plmn_id.MCCdigit2 = '0';
+ ral_si_ind.plmn_id.MCCdigit1 = '2';
+ ral_si_ind.plmn_id.MNCdigit3 = '0';
+ ral_si_ind.plmn_id.MCCdigit3 = '8';
+ ral_si_ind.plmn_id.MNCdigit2 = '9';
+ ral_si_ind.plmn_id.MNCdigit1 = '9';
+ ral_si_ind.cell_id = 1;
+ ral_si_ind.dbm = 0;
+ //ral_si_ind.dbm = fifo_dump_emos_UE.PHY_measurements->rx_rssi_dBm[eNB_index];
+ // TO DO
+ ral_si_ind.sinr = 0;
+ //ral_si_ind.sinr = fifo_dump_emos_UE.PHY_measurements->subband_cqi_dB[eNB_index][phy_vars_ue->lte_frame_parms.nb_antennas_rx][0];
+ // TO DO
+ ral_si_ind.link_data_rate = 0;
+ memcpy (&message_ral_p->ittiMsg, (void *) &ral_si_ind, sizeof(rrc_ral_system_information_ind_t));
#warning "ue_mod_idP ? for instance ?"
- itti_send_msg_to_task (TASK_RAL_UE, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_ral_p);
- }
+ itti_send_msg_to_task (TASK_RAL_UE, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_ral_p);
+ }
#endif
- }
- }
- break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2
+ }
+ }
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4;
- new_sib=1;
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index], &typeandinfo->choice.sib3, sizeof(LTE_SystemInformationBlockType3_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- dump_sib3( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] );
+ break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2
- }
- break;
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index], &typeandinfo->choice.sib3, sizeof(LTE_SystemInformationBlockType3_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ dump_sib3( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] );
+ }
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=8;
- new_sib=1;
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index], &typeandinfo->choice.sib4, sizeof(LTE_SystemInformationBlockType4_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- }
+ break;
- break;
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=8;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index], &typeandinfo->choice.sib4, sizeof(LTE_SystemInformationBlockType4_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ }
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=16;
- new_sib=1;
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index], &typeandinfo->choice.sib5, sizeof(LTE_SystemInformationBlockType5_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- dump_sib5(UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index]);
- }
- break;
+ break;
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&32) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=32;
- new_sib=1;
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=16;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index], &typeandinfo->choice.sib5, sizeof(LTE_SystemInformationBlockType5_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ dump_sib5(UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index]);
+ }
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index], &typeandinfo->choice.sib6, sizeof(LTE_SystemInformationBlockType6_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- }
- break;
+ break;
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&64) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=64;
- new_sib=1;
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index], &typeandinfo->choice.sib7, sizeof(LTE_SystemInformationBlockType7_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- }
- break;
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&32) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=32;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index], &typeandinfo->choice.sib6, sizeof(LTE_SystemInformationBlockType6_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ }
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&128) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=128;
- new_sib=1;
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index], &typeandinfo->choice.sib8, sizeof(LTE_SystemInformationBlockType8_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- }
- break;
+ break;
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&256) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=256;
- new_sib=1;
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index], &typeandinfo->choice.sib9, sizeof(LTE_SystemInformationBlockType9_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- }
- break;
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&64) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=64;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index], &typeandinfo->choice.sib7, sizeof(LTE_SystemInformationBlockType7_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ }
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&512) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=512;
- new_sib=1;
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index], &typeandinfo->choice.sib10, sizeof(LTE_SystemInformationBlockType10_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- }
- break;
+ break;
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1024) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=1024;
- new_sib=1;
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&128) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=128;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index], &typeandinfo->choice.sib8, sizeof(LTE_SystemInformationBlockType8_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ }
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index], &typeandinfo->choice.sib11, sizeof(LTE_SystemInformationBlockType11_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- }
- break;
+ break;
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&256) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=256;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index], &typeandinfo->choice.sib9, sizeof(LTE_SystemInformationBlockType9_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ }
+
+ break;
+
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&512) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=512;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index], &typeandinfo->choice.sib10, sizeof(LTE_SystemInformationBlockType10_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ }
+
+ break;
+
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1024) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=1024;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index], &typeandinfo->choice.sib11, sizeof(LTE_SystemInformationBlockType11_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ }
+
+ break;
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 2, 0))
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2048) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2048;
- new_sib=1;
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index], &typeandinfo->choice.sib12_v920, sizeof(LTE_SystemInformationBlockType12_r9_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- }
- break;
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2048) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2048;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index], &typeandinfo->choice.sib12_v920, sizeof(LTE_SystemInformationBlockType12_r9_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ }
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4096) == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4096;
- new_sib=1;
+ break;
- memcpy( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index], &typeandinfo->choice.sib13_v920, sizeof(LTE_SystemInformationBlockType13_r9_t) );
- LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
- dump_sib13( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] );
- // adding here function to store necessary parameters for using in decode_MCCH_Message + maybe transfer to PHY layer
- LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n",
- ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id);
- rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index,
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- (struct LTE_PhysicalConfigDedicated *)NULL,
- (LTE_SCellToAddMod_r10_t *)NULL,
- (LTE_MeasObjectToAddMod_t **)NULL,
- (LTE_MAC_MainConfig_t *)NULL,
- 0,
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- (LTE_TDD_Config_t *)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- (LTE_MBSFN_SubframeConfigList_t *)NULL,
- 0,
- &UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index]->mbsfn_AreaInfoList_r9,
- (LTE_PMCH_InfoList_r9_t *)NULL
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4096) == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4096;
+ new_sib=1;
+ memcpy( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index], &typeandinfo->choice.sib13_v920, sizeof(LTE_SystemInformationBlockType13_r9_t) );
+ LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
+ dump_sib13( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] );
+ // adding here function to store necessary parameters for using in decode_MCCH_Message + maybe transfer to PHY layer
+ LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n",
+ ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id);
+ rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index,
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ (LTE_MAC_MainConfig_t *)NULL,
+ 0,
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ (LTE_MBSFN_SubframeConfigList_t *)NULL,
+ 0,
+ &UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index]->mbsfn_AreaInfoList_r9,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#ifdef CBA
- ,0,
- 0
+ ,0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,
- 0,
- NULL,
- NULL
-#endif
- );
- break;
- }
+ ,
+ 0,
+ NULL,
+ NULL
#endif
+ );
+ break;
+ }
+#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+
//SIB18
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8192) == 0) {
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib18_v1250:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8192) == 0) {
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=8192;
new_sib=1;
-
memcpy( UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index], &typeandinfo->choice.sib18_v1250, sizeof(LTE_SystemInformationBlockType18_r12_t) );
LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB18 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
dump_sib18( UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index] );
// adding here function to store necessary parameters to transfer to PHY layer
LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB18 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n",
- ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id);
-
+ ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id);
//process SIB18 to transfer SL-related parameters to PHY
rrc_ue_process_sidelink_radioResourceConfig(ctxt_pP->module_id,eNB_index,
- UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index],
- (LTE_SystemInformationBlockType19_r12_t *)NULL,
- (LTE_SL_CommConfig_r12_t *)NULL,
- (LTE_SL_DiscConfig_r12_t *)NULL
- );
+ UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index],
+ (LTE_SystemInformationBlockType19_r12_t *)NULL,
+ (LTE_SL_CommConfig_r12_t *)NULL,
+ (LTE_SL_DiscConfig_r12_t *)NULL
+ );
+ }
- }
- break;
+ break;
- //SIB19
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16384) == 0) {
+ //SIB19
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib19_v1250:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16384) == 0) {
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=16384;
new_sib=1;
-
memcpy( UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index], &typeandinfo->choice.sib19_v1250, sizeof(LTE_SystemInformationBlockType19_r12_t) );
LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB19 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
dump_sib19( UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index] );
// adding here function to store necessary parameters to transfer to PHY layer
LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB19 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n",
- ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id);
+ ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id);
//process SIB19 to transfer SL-related parameters to PHY
rrc_ue_process_sidelink_radioResourceConfig(ctxt_pP->module_id,eNB_index,
- (LTE_SystemInformationBlockType18_r12_t *)NULL,
- UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index],
- (LTE_SL_CommConfig_r12_t *)NULL,
- (LTE_SL_DiscConfig_r12_t *)NULL
- );
+ (LTE_SystemInformationBlockType18_r12_t *)NULL,
+ UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index],
+ (LTE_SL_CommConfig_r12_t *)NULL,
+ (LTE_SL_DiscConfig_r12_t *)NULL
+ );
+ }
- }
- break;
+ break;
- //SIB21
- case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430:
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&32768) == 0) {
+ //SIB21
+ case LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib21_v1430:
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&32768) == 0) {
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=32768;
new_sib=1;
-
memcpy( UE_rrc_inst[ctxt_pP->module_id].sib21[eNB_index], &typeandinfo->choice.sib21_v1430, sizeof(LTE_SystemInformationBlockType21_r14_t) );
LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB21 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index );
dump_sib21( UE_rrc_inst[ctxt_pP->module_id].sib21[eNB_index] );
// adding here function to store necessary parameters to transfer to PHY layer
LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB21 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n",
- ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id);
+ ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id);
//process SIB21
//TODO
- }
- break;
-
+ }
+ break;
#endif
- default:
- break;
- }
+ default:
+ break;
+ }
}
+
if (new_sib == 1) {
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt++;
@@ -4196,9 +3822,9 @@ uint64_t arfcn_to_freq(long arfcn) {
rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE );
LOG_I(RRC,"SIStatus %x, SIcnt %d/%d\n",
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus,
- UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt,
- sib1->schedulingInfoList.list.count);
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus,
+ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt,
+ sib1->schedulingInfoList.list.count);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI , VCD_FUNCTION_OUT);
@@ -4207,8 +3833,7 @@ uint64_t arfcn_to_freq(long arfcn) {
// layer 3 filtering of RSRP (EUTRA) measurements: 36.331, Sec. 5.5.3.2
//-----------------------------------------------------------------------------
-void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index )
-{
+void ue_meas_filtering( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) {
float a = UE_rrc_inst[ctxt_pP->module_id].filter_coeff_rsrp; // 'a' in 36.331 Sec. 5.5.3.2
float a1 = UE_rrc_inst[ctxt_pP->module_id].filter_coeff_rsrq;
//float rsrp_db, rsrq_db;
@@ -4219,18 +3844,17 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_
if(UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP != NULL) {
for (eNB_offset = 0; eNB_offset<1+get_n_adj_cells(ctxt_pP->module_id,0); eNB_offset++) {
UE_rrc_inst[ctxt_pP->module_id].rsrp_db[eNB_offset] = get_RSRP(ctxt_pP->module_id,0,eNB_offset);
- /*
- (dB_fixed_times10(get_RSRP(ctxt_pP->module_id,0,eNB_offset))/10.0) -
- get_rx_total_gain_dB(ctxt_pP->module_id,0) -
- get_bw_gain_dB(ctxt_pP->module_id);
- */
+ /*
+ (dB_fixed_times10(get_RSRP(ctxt_pP->module_id,0,eNB_offset))/10.0) -
+ get_rx_total_gain_dB(ctxt_pP->module_id,0) -
+ get_bw_gain_dB(ctxt_pP->module_id);
+ */
UE_rrc_inst[ctxt_pP->module_id].rsrp_db_filtered[eNB_offset] =
(1.0-a)*UE_rrc_inst[ctxt_pP->module_id].rsrp_db_filtered[eNB_offset] +
a*UE_rrc_inst[ctxt_pP->module_id].rsrp_db[eNB_offset];
-
LOG_D(RRC,"RSRP_dBm: %3.2f \n",get_RSRP(ctxt_pP->module_id,0,eNB_offset));;
- /* LOG_D(RRC,"gain_loss_dB: %d \n",get_rx_total_gain_dB(ctxt_pP->module_id,0));
- LOG_D(RRC,"gain_fixed_dB: %d \n",dB_fixed(frame_parms->N_RB_DL*12));*/
+ /* LOG_D(RRC,"gain_loss_dB: %d \n",get_rx_total_gain_dB(ctxt_pP->module_id,0));
+ LOG_D(RRC,"gain_fixed_dB: %d \n",dB_fixed(frame_parms->N_RB_DL*12));*/
LOG_D(PHY,"[UE %d] Frame %d, RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB)\n",
ctxt_pP->module_id,
ctxt_pP->frame,
@@ -4268,9 +3892,7 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_
//Below routine implements Measurement Reporting procedure from 36.331 Section 5.5.5
//-----------------------------------------------------------------------------
- void rrc_ue_generate_MeasurementReport(protocol_ctxt_t* const ctxt_pP, uint8_t eNB_index )
-{
-
+void rrc_ue_generate_MeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t eNB_index ) {
uint8_t buffer[32], size;
uint8_t i;
uint8_t target_eNB_offset;
@@ -4282,7 +3904,6 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_
float rsrp_filtered, rsrq_filtered;
static frame_t pframe=0;
int result;
-
nElem = 98;
nElem1 = 35;
target_eNB_offset = UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget; // eNB_offset of target eNB: used to obtain the mod_id of target eNB
@@ -4290,14 +3911,11 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_
for (i=0; imodule_id].measReportList[0][i] != NULL) {
measId = UE_rrc_inst[ctxt_pP->module_id].measReportList[0][i]->measId;
-
// Note: Values in the meas report have to be the mapped values...to implement binary search for LUT
rsrp_filtered = UE_rrc_inst[ctxt_pP->module_id].rsrp_db_filtered[eNB_index];//nid_cell];
rsrp_s = binary_search_float(RSRP_meas_mapping,nElem, rsrp_filtered);
-
rsrq_filtered = UE_rrc_inst[ctxt_pP->module_id].rsrq_db_filtered[eNB_index];//nid_cell]; //RSRQ of serving cell
rsrq_s = binary_search_float(RSRQ_meas_mapping,nElem1,rsrq_filtered);//mapped RSRQ of serving cell
-
LOG_D(RRC,"[UE %d] Frame %d: source eNB %d :rsrp_s: %ld rsrq_s: %ld rsrp_filtered: %f rsrq_filtered: %f \n",
ctxt_pP->module_id,
ctxt_pP->frame,
@@ -4308,7 +3926,6 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_
rsrq_filtered);
rsrp_t = binary_search_float(RSRP_meas_mapping,nElem,UE_rrc_inst[ctxt_pP->module_id].rsrp_db_filtered[target_eNB_offset]); //RSRP of target cell
rsrq_t = binary_search_float(RSRQ_meas_mapping,nElem1,UE_rrc_inst[ctxt_pP->module_id].rsrq_db_filtered[target_eNB_offset]); //RSRQ of target cell
-
LOG_D(RRC,"[UE %d] Frame %d: target eNB %d :rsrp_t: %ld rsrq_t: %ld rsrp_filtered: %f rsrq_filtered: %f \n",
ctxt_pP->module_id,
ctxt_pP->frame,
@@ -4317,7 +3934,6 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_
rsrq_t,
UE_rrc_inst[ctxt_pP->module_id].rsrp_db_filtered[target_eNB_offset],
UE_rrc_inst[ctxt_pP->module_id].rsrq_db_filtered[target_eNB_offset]);
-
// if (measFlag == 1) {
targetCellId = UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId ;//get_adjacent_cell_id(ue_mod_idP,target_eNB_offset); //PhycellId of target cell
@@ -4339,7 +3955,7 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
,NULL, NULL
#endif
- );
+ );
AssertFatal (result == TRUE, "PDCP data request failed!\n");
//LOG_D(RRC, "[UE %d] Frame %d Sending MeasReport (%d bytes) through DCCH%d to PDCP \n",ue_mod_idP,frameP, size, DCCH);
}
@@ -4352,8 +3968,7 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_
// Measurement report triggering, described in 36.331 Section 5.5.4.1: called periodically
//-----------------------------------------------------------------------------
-void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index )
-{
+void ue_measurement_report_triggering(protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) {
uint8_t i,j;
LTE_Hysteresis_t hys;
LTE_TimeToTrigger_t ttt_ms;
@@ -4393,65 +4008,65 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint
-1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset;
switch (UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][reportConfigId-1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present) {
- case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1:
- LOG_D(RRC,"[UE %d] Frame %d : A1 event: check if serving becomes better than threshold\n",
- ctxt_pP->module_id, ctxt_pP->frame);
- break;
+ case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1:
+ LOG_D(RRC,"[UE %d] Frame %d : A1 event: check if serving becomes better than threshold\n",
+ ctxt_pP->module_id, ctxt_pP->frame);
+ break;
- case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2:
- LOG_D(RRC,"[UE %d] Frame %d : A2 event, check if serving becomes worse than a threshold\n",
- ctxt_pP->module_id, ctxt_pP->frame);
- break;
+ case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2:
+ LOG_D(RRC,"[UE %d] Frame %d : A2 event, check if serving becomes worse than a threshold\n",
+ ctxt_pP->module_id, ctxt_pP->frame);
+ break;
- case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3:
- LOG_D(RRC,"[UE %d] Frame %d : A3 event: check if a neighboring cell becomes offset better than serving to trigger a measurement event \n",
- ctxt_pP->module_id, ctxt_pP->frame);
+ case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3:
+ LOG_D(RRC,"[UE %d] Frame %d : A3 event: check if a neighboring cell becomes offset better than serving to trigger a measurement event \n",
+ ctxt_pP->module_id, ctxt_pP->frame);
- if ((check_trigger_meas_event(
- ctxt_pP->module_id,
- ctxt_pP->frame,
- eNB_index,
- i,j,ofn,ocn,hys,ofs,ocs,a3_offset,ttt_ms)) &&
- (UE_rrc_inst[ctxt_pP->module_id].Info[0].State >= RRC_CONNECTED) &&
- (UE_rrc_inst[ctxt_pP->module_id].Info[0].T304_active == 0 ) &&
- (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag == 1)) {
- //trigger measurement reporting procedure (36.331, section 5.5.5)
- if (UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] == NULL) {
- UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] = malloc(sizeof(MEAS_REPORT_LIST));
+ if ((check_trigger_meas_event(
+ ctxt_pP->module_id,
+ ctxt_pP->frame,
+ eNB_index,
+ i,j,ofn,ocn,hys,ofs,ocs,a3_offset,ttt_ms)) &&
+ (UE_rrc_inst[ctxt_pP->module_id].Info[0].State >= RRC_CONNECTED) &&
+ (UE_rrc_inst[ctxt_pP->module_id].Info[0].T304_active == 0 ) &&
+ (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag == 1)) {
+ //trigger measurement reporting procedure (36.331, section 5.5.5)
+ if (UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] == NULL) {
+ UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] = malloc(sizeof(MEAS_REPORT_LIST));
+ }
+
+ UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->measId = UE_rrc_inst[ctxt_pP->module_id].MeasId[i][j]->measId;
+ UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->numberOfReportsSent = 0;
+ rrc_ue_generate_MeasurementReport(
+ ctxt_pP,
+ eNB_index);
+ UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
+ LOG_I(RRC,"[UE %d] Frame %d: A3 event detected, state: %d \n",
+ ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[0].State);
+ } else {
+ if(UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] != NULL) {
+ free(UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]);
+ }
+
+ UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] = NULL;
}
- UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->measId = UE_rrc_inst[ctxt_pP->module_id].MeasId[i][j]->measId;
- UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->numberOfReportsSent = 0;
- rrc_ue_generate_MeasurementReport(
- ctxt_pP,
- eNB_index);
- UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
- LOG_I(RRC,"[UE %d] Frame %d: A3 event detected, state: %d \n",
- ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[0].State);
- } else {
- if(UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] != NULL) {
- free(UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]);
- }
+ break;
- UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] = NULL;
- }
+ case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4:
+ LOG_D(RRC,"[UE %d] Frame %d : received an A4 event, neighbor becomes offset better than a threshold\n",
+ ctxt_pP->module_id, ctxt_pP->frame);
+ break;
- break;
+ case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5:
+ LOG_D(RRC,"[UE %d] Frame %d: received an A5 event, serving becomes worse than threshold 1 and neighbor becomes better than threshold 2\n",
+ ctxt_pP->module_id, ctxt_pP->frame);
+ break;
- case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4:
- LOG_D(RRC,"[UE %d] Frame %d : received an A4 event, neighbor becomes offset better than a threshold\n",
- ctxt_pP->module_id, ctxt_pP->frame);
- break;
-
- case LTE_ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5:
- LOG_D(RRC,"[UE %d] Frame %d: received an A5 event, serving becomes worse than threshold 1 and neighbor becomes better than threshold 2\n",
- ctxt_pP->module_id, ctxt_pP->frame);
- break;
-
- default:
- LOG_D(RRC,"Invalid ReportConfigEUTRA__triggerType__event__eventId: %d",
- UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][j]->reportConfig.choice.reportConfigEUTRA.triggerType.present);
- break;
+ default:
+ LOG_D(RRC,"Invalid ReportConfigEUTRA__triggerType__event__eventId: %d",
+ UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][j]->reportConfig.choice.reportConfigEUTRA.triggerType.present);
+ break;
}
}
}
@@ -4464,7 +4079,7 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint
//check_trigger_meas_event(ue_mod_idP, frameP, eNB_index, i,j,ofn,ocn,hys,ofs,ocs,a3_offset,ttt_ms)
//-----------------------------------------------------------------------------
- uint8_t check_trigger_meas_event(
+uint8_t check_trigger_meas_event(
module_id_t ue_mod_idP,
frame_t frameP,
uint8_t eNB_index,
@@ -4476,12 +4091,10 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint
LTE_Q_OffsetRange_t ofs,
LTE_Q_OffsetRange_t ocs,
long a3_offset,
- LTE_TimeToTrigger_t ttt )
-{
+ LTE_TimeToTrigger_t ttt ) {
uint8_t eNB_offset;
// uint8_t currentCellIndex = frame_parms->Nid_cell;
uint8_t tmp_offset;
-
LOG_I(RRC,"[UE %d] ofn(%ld) ocn(%ld) hys(%ld) ofs(%ld) ocs(%ld) a3_offset(%ld) ttt(%ld) rssi %3.1f\n",
ue_mod_idP,
ofn,ocn,hys,ofs,ocs,a3_offset,ttt,
@@ -4511,8 +4124,8 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint
LOG_D(RRC,"[UE %d] Frame %d eNB %d: Handover triggered: targetCellId: %ld currentCellId: %d eNB_offset: %d rsrp source: %3.1f rsrp target: %3.1f\n",
ue_mod_idP, frameP, eNB_index,
UE_rrc_inst->HandoverInfoUe.targetCellId,ue_cnx_index,eNB_offset,
- get_RSRP(ue_mod_idP,0,0),
- get_RSRP(ue_mod_idP,0,1));
+ get_RSRP(ue_mod_idP,0,0),
+ get_RSRP(ue_mod_idP,0,1));
UE_rrc_inst->Info[0].handoverTarget = eNB_offset;
//LOG_D(RRC,"PHY_ID: %d \n",UE_rrc_inst->HandoverInfoUe.targetCellId);
return 1;
@@ -4529,12 +4142,9 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
//-----------------------------------------------------------------------------
-int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t* const Sdu, const uint8_t Sdu_len, const uint8_t mbsfn_sync_area )
-{
-
+int decode_MCCH_Message( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t *const Sdu, const uint8_t Sdu_len, const uint8_t mbsfn_sync_area ) {
LTE_MCCH_Message_t *mcch=NULL;
- LTE_MBSFNAreaConfiguration_r9_t** mcch_message=&UE_rrc_inst[ctxt_pP->module_id].mcch_message[eNB_index];
-
+ LTE_MBSFNAreaConfiguration_r9_t **mcch_message=&UE_rrc_inst[ctxt_pP->module_id].mcch_message[eNB_index];
asn_dec_rval_t dec_rval;
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].MCCHStatus[mbsfn_sync_area] == 1) {
@@ -4555,12 +4165,12 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB
ctxt_pP->module_id,
dec_rval.consumed);
//free the memory
- SEQUENCE_free(&asn_DEF_LTE_MCCH_Message, (void*)mcch, 1);
+ SEQUENCE_free(&asn_DEF_LTE_MCCH_Message, (void *)mcch, 1);
return -1;
}
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
- xer_fprint(stdout, &asn_DEF_LTE_MCCH_Message, (void*)mcch);
+ xer_fprint(stdout, &asn_DEF_LTE_MCCH_Message, (void *)mcch);
}
if (mcch->message.present == LTE_MCCH_MessageType_PR_c1) {
@@ -4582,7 +4192,6 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB
eNB_index,
ctxt_pP->frame,
mbsfn_sync_area);
-
}
}
}
@@ -4591,16 +4200,14 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB
}
//-----------------------------------------------------------------------------
- void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_index, frame_t frameP, uint8_t mbsfn_sync_area )
-{
+void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_index, frame_t frameP, uint8_t mbsfn_sync_area ) {
uint8_t i;
protocol_ctxt_t ctxt;
-
LOG_I(RRC,"[UE %d] Frame %d : Number of MCH(s) in the MBSFN Sync Area %d is %d\n",
ue_mod_idP, frameP, mbsfn_sync_area, UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9.list.count);
- // Configure commonSF_Alloc
- for(i=0; i< UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.count;i++){
+ // Configure commonSF_Alloc
+ for(i=0; i< UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.count; i++) {
LOG_W(RRC,"[UE %d] Frame %d, commonSF_Alloc_r9: radioframeAllocationPeriod(%ldn),radioframeAllocationOffset(%ld), subframeAllocation(%x,%x,%x)\n",
ue_mod_idP, frameP,
UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.array[i]->radioframeAllocationPeriod<<1,
@@ -4610,64 +4217,58 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB
UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.array[i]->subframeAllocation.choice.oneFrame.buf[2]);
UE_mac_inst[ue_mod_idP].commonSF_Alloc_r9_mbsfn_SubframeConfig[i] = UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_Alloc_r9.list.array[i];
}
+
LOG_W(RRC,"[UE %d] Frame %d, commonSF_AllocPeriod_r9 %drf \n",
ue_mod_idP, frameP,
4<commonSF_AllocPeriod_r9);
-
// Configure commonSF_AllocPeriod
UE_mac_inst[ue_mod_idP].commonSF_AllocPeriod_r9 = UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->commonSF_AllocPeriod_r9;
-
// store to MAC/PHY necessary parameters for receiving MTCHs
-
rrc_mac_config_req_ue(ue_mod_idP,0,eNB_index,
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- (struct LTE_PhysicalConfigDedicated *)NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- (LTE_MAC_MainConfig_t *)NULL,
- 0,
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- (LTE_TDD_Config_t *)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- (LTE_MBSFN_SubframeConfigList_t *)NULL
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ (LTE_MAC_MainConfig_t *)NULL,
+ 0,
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ (LTE_MBSFN_SubframeConfigList_t *)NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- ,
- 0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- &UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9
-
+ ,
+ 0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ &UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9
#endif
#ifdef CBA
- ,
- 0,
- 0
+ ,
+ 0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,
- 0,
- NULL,
- NULL
+ ,
+ 0,
+ NULL,
+ NULL
#endif
- );
-
+ );
UE_rrc_inst[ue_mod_idP].Info[eNB_index].MCCHStatus[mbsfn_sync_area] = 1;
-
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_idP, ENB_FLAG_NO, UE_rrc_inst[ue_mod_idP].Info[eNB_index].rnti, frameP, 0,eNB_index);
-
// Config Radio Bearer for MBMS user data (similar way to configure for eNB side in init_MBMS function)
rrc_pdcp_config_asn1_req(&ctxt,
NULL, // SRB_ToAddModList
NULL, // DRB_ToAddModList
- (LTE_DRB_ToReleaseList_t*)NULL,
+ (LTE_DRB_ToReleaseList_t *)NULL,
0, // security mode
NULL, // key rrc encryption
NULL, // key rrc integrity
@@ -4676,7 +4277,6 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB
,&(UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9)
#endif
,NULL);
-
rrc_rlc_config_asn1_req(&ctxt,
NULL,// SRB_ToAddModList
NULL,// DRB_ToAddModList
@@ -4687,490 +4287,433 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB
#endif
);
// */
-
}
#endif // rel10
#if defined(ENABLE_ITTI)
//-----------------------------------------------------------------------------
-void *rrc_ue_task( void *args_p )
-{
+void *rrc_ue_task( void *args_p ) {
MessageDef *msg_p;
instance_t instance;
unsigned int ue_mod_id;
int result;
SRB_INFO *srb_info_p;
-
protocol_ctxt_t ctxt;
itti_mark_task_ready (TASK_RRC_UE);
while(1) {
// Wait for a message
itti_receive_msg (TASK_RRC_UE, &msg_p);
-
instance = ITTI_MSG_INSTANCE (msg_p);
ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance);
switch (ITTI_MSG_ID(msg_p)) {
- case TERMINATE_MESSAGE:
- LOG_W(RRC, " *** Exiting RRC thread\n");
- itti_exit_task ();
- break;
+ case TERMINATE_MESSAGE:
+ LOG_W(RRC, " *** Exiting RRC thread\n");
+ itti_exit_task ();
+ break;
- case MESSAGE_TEST:
- break;
+ case MESSAGE_TEST:
+ break;
/* MAC messages */
- case RRC_MAC_IN_SYNC_IND:
- LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
- RRC_MAC_IN_SYNC_IND (msg_p).frame, RRC_MAC_IN_SYNC_IND (msg_p).enb_index);
+ case RRC_MAC_IN_SYNC_IND:
+ LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
+ RRC_MAC_IN_SYNC_IND (msg_p).frame, RRC_MAC_IN_SYNC_IND (msg_p).enb_index);
+ UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N310_cnt = 0;
- UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N310_cnt = 0;
+ if (UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].T310_active == 1) {
+ UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N311_cnt++;
+ }
- if (UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].T310_active == 1) {
- UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N311_cnt++;
- }
+ break;
- break;
+ case RRC_MAC_OUT_OF_SYNC_IND:
+ LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
+ RRC_MAC_OUT_OF_SYNC_IND (msg_p).frame, RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index);
+ UE_rrc_inst[ue_mod_id].Info[RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index].N310_cnt ++;
+ break;
- case RRC_MAC_OUT_OF_SYNC_IND:
- LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
- RRC_MAC_OUT_OF_SYNC_IND (msg_p).frame, RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index);
+ case RRC_MAC_BCCH_DATA_IND:
+ LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
+ RRC_MAC_BCCH_DATA_IND (msg_p).frame, RRC_MAC_BCCH_DATA_IND (msg_p).enb_index);
+ // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0);
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,RRC_MAC_BCCH_DATA_IND (msg_p).enb_index);
+ decode_BCCH_DLSCH_Message (&ctxt,
+ RRC_MAC_BCCH_DATA_IND (msg_p).enb_index,
+ RRC_MAC_BCCH_DATA_IND (msg_p).sdu,
+ RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size,
+ RRC_MAC_BCCH_DATA_IND (msg_p).rsrq,
+ RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
+ break;
- UE_rrc_inst[ue_mod_id].Info[RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index].N310_cnt ++;
- break;
-
- case RRC_MAC_BCCH_DATA_IND:
- LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
- RRC_MAC_BCCH_DATA_IND (msg_p).frame, RRC_MAC_BCCH_DATA_IND (msg_p).enb_index);
-
- // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0);
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,RRC_MAC_BCCH_DATA_IND (msg_p).enb_index);
- decode_BCCH_DLSCH_Message (&ctxt,
- RRC_MAC_BCCH_DATA_IND (msg_p).enb_index,
- RRC_MAC_BCCH_DATA_IND (msg_p).sdu,
- RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size,
- RRC_MAC_BCCH_DATA_IND (msg_p).rsrq,
- RRC_MAC_BCCH_DATA_IND (msg_p).rsrp);
- break;
-
- case RRC_MAC_CCCH_DATA_CNF:
- LOG_D(RRC, "[UE %d] Received %s: eNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
- RRC_MAC_CCCH_DATA_CNF (msg_p).enb_index);
-
- // reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds)
- UE_rrc_inst[ue_mod_id].Srb0[RRC_MAC_CCCH_DATA_CNF (msg_p).enb_index].Tx_buffer.payload_size = 0;
- break;
-
- case RRC_MAC_CCCH_DATA_IND:
- LOG_D(RRC, "[UE %d] RNTI %x Received %s: frameP %d, eNB %d\n",
- ue_mod_id,
- RRC_MAC_CCCH_DATA_IND (msg_p).rnti,
- ITTI_MSG_NAME (msg_p),
- RRC_MAC_CCCH_DATA_IND (msg_p).frame,
- RRC_MAC_CCCH_DATA_IND (msg_p).enb_index);
-
- srb_info_p = &UE_rrc_inst[ue_mod_id].Srb0[RRC_MAC_CCCH_DATA_IND (msg_p).enb_index];
-
- memcpy (srb_info_p->Rx_buffer.Payload, RRC_MAC_CCCH_DATA_IND (msg_p).sdu,
- RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size);
- srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size;
- // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, RRC_MAC_CCCH_DATA_IND (msg_p).rnti, RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0);
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, RRC_MAC_CCCH_DATA_IND (msg_p).rnti, RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0, RRC_MAC_CCCH_DATA_IND (msg_p).enb_index);
- rrc_ue_decode_ccch (&ctxt,
- srb_info_p,
- RRC_MAC_CCCH_DATA_IND (msg_p).enb_index);
- break;
+ case RRC_MAC_CCCH_DATA_CNF:
+ LOG_D(RRC, "[UE %d] Received %s: eNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
+ RRC_MAC_CCCH_DATA_CNF (msg_p).enb_index);
+ // reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds)
+ UE_rrc_inst[ue_mod_id].Srb0[RRC_MAC_CCCH_DATA_CNF (msg_p).enb_index].Tx_buffer.payload_size = 0;
+ break;
+ case RRC_MAC_CCCH_DATA_IND:
+ LOG_D(RRC, "[UE %d] RNTI %x Received %s: frameP %d, eNB %d\n",
+ ue_mod_id,
+ RRC_MAC_CCCH_DATA_IND (msg_p).rnti,
+ ITTI_MSG_NAME (msg_p),
+ RRC_MAC_CCCH_DATA_IND (msg_p).frame,
+ RRC_MAC_CCCH_DATA_IND (msg_p).enb_index);
+ srb_info_p = &UE_rrc_inst[ue_mod_id].Srb0[RRC_MAC_CCCH_DATA_IND (msg_p).enb_index];
+ memcpy (srb_info_p->Rx_buffer.Payload, RRC_MAC_CCCH_DATA_IND (msg_p).sdu,
+ RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size);
+ srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size;
+ // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, RRC_MAC_CCCH_DATA_IND (msg_p).rnti, RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0);
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, RRC_MAC_CCCH_DATA_IND (msg_p).rnti, RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0, RRC_MAC_CCCH_DATA_IND (msg_p).enb_index);
+ rrc_ue_decode_ccch (&ctxt,
+ srb_info_p,
+ RRC_MAC_CCCH_DATA_IND (msg_p).enb_index);
+ break;
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- case RRC_MAC_MCCH_DATA_IND:
- LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d, mbsfn SA %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
- RRC_MAC_MCCH_DATA_IND (msg_p).frame, RRC_MAC_MCCH_DATA_IND (msg_p).enb_index, RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area);
-
- //PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, M_RNTI, RRC_MAC_MCCH_DATA_IND (msg_p).frame, 0);
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, M_RNTI, RRC_MAC_MCCH_DATA_IND (msg_p).frame, 0,RRC_MAC_MCCH_DATA_IND (msg_p).enb_index);
- decode_MCCH_Message (
- &ctxt,
- RRC_MAC_MCCH_DATA_IND (msg_p).enb_index,
- RRC_MAC_MCCH_DATA_IND (msg_p).sdu,
- RRC_MAC_MCCH_DATA_IND (msg_p).sdu_size,
- RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area);
- break;
-
- /* //TTN (for D2D)
- case RRC_MAC_SL_DISCOVERY_DATA_IND:
- LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
- RRC_MAC_SL_DISCOVERY_DATA_IND (msg_p).frame, RRC_MAC_SL_DISCOVERY_DATA_IND (msg_p).enb_index);
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, M_RNTI, RRC_MAC_SL_DISCOVERY_DATA_IND (msg_p).frame, 0,RRC_MAC_SL_DISCOVERY_DATA_IND (msg_p).enb_index);
- //send to ProSeApp
- break;
-*/
+ case RRC_MAC_MCCH_DATA_IND:
+ LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d, mbsfn SA %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
+ RRC_MAC_MCCH_DATA_IND (msg_p).frame, RRC_MAC_MCCH_DATA_IND (msg_p).enb_index, RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area);
+ //PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, M_RNTI, RRC_MAC_MCCH_DATA_IND (msg_p).frame, 0);
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, M_RNTI, RRC_MAC_MCCH_DATA_IND (msg_p).frame, 0,RRC_MAC_MCCH_DATA_IND (msg_p).enb_index);
+ decode_MCCH_Message (
+ &ctxt,
+ RRC_MAC_MCCH_DATA_IND (msg_p).enb_index,
+ RRC_MAC_MCCH_DATA_IND (msg_p).sdu,
+ RRC_MAC_MCCH_DATA_IND (msg_p).sdu_size,
+ RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area);
+ break;
+ /* //TTN (for D2D)
+ case RRC_MAC_SL_DISCOVERY_DATA_IND:
+ LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p),
+ RRC_MAC_SL_DISCOVERY_DATA_IND (msg_p).frame, RRC_MAC_SL_DISCOVERY_DATA_IND (msg_p).enb_index);
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, M_RNTI, RRC_MAC_SL_DISCOVERY_DATA_IND (msg_p).frame, 0,RRC_MAC_SL_DISCOVERY_DATA_IND (msg_p).enb_index);
+ //send to ProSeApp
+ break;
+ */
# endif
/* PDCP messages */
- case RRC_DCCH_DATA_IND:
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, RRC_DCCH_DATA_IND (msg_p).module_id, ENB_FLAG_NO, RRC_DCCH_DATA_IND (msg_p).rnti, RRC_DCCH_DATA_IND (msg_p).frame, 0,RRC_DCCH_DATA_IND (msg_p).eNB_index);
- LOG_D(RRC, "[UE %d] Received %s: frameP %d, DCCH %d, eNB %d\n",
- RRC_DCCH_DATA_IND (msg_p).module_id,
- ITTI_MSG_NAME (msg_p),
- RRC_DCCH_DATA_IND (msg_p).frame,
- RRC_DCCH_DATA_IND (msg_p).dcch_index,
- RRC_DCCH_DATA_IND (msg_p).eNB_index);
-
- LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT"Received %s DCCH %d, eNB %d\n",
- PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt),
- ITTI_MSG_NAME (msg_p),
- RRC_DCCH_DATA_IND (msg_p).dcch_index,
- RRC_DCCH_DATA_IND (msg_p).eNB_index);
- rrc_ue_decode_dcch (
- &ctxt,
- RRC_DCCH_DATA_IND (msg_p).dcch_index,
- RRC_DCCH_DATA_IND (msg_p).sdu_p,
- RRC_DCCH_DATA_IND (msg_p).eNB_index);
- // Message buffer has been processed, free it now.
- result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND (msg_p).sdu_p);
- AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
- break;
-
+ case RRC_DCCH_DATA_IND:
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, RRC_DCCH_DATA_IND (msg_p).module_id, ENB_FLAG_NO, RRC_DCCH_DATA_IND (msg_p).rnti, RRC_DCCH_DATA_IND (msg_p).frame, 0,RRC_DCCH_DATA_IND (msg_p).eNB_index);
+ LOG_D(RRC, "[UE %d] Received %s: frameP %d, DCCH %d, eNB %d\n",
+ RRC_DCCH_DATA_IND (msg_p).module_id,
+ ITTI_MSG_NAME (msg_p),
+ RRC_DCCH_DATA_IND (msg_p).frame,
+ RRC_DCCH_DATA_IND (msg_p).dcch_index,
+ RRC_DCCH_DATA_IND (msg_p).eNB_index);
+ LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT"Received %s DCCH %d, eNB %d\n",
+ PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt),
+ ITTI_MSG_NAME (msg_p),
+ RRC_DCCH_DATA_IND (msg_p).dcch_index,
+ RRC_DCCH_DATA_IND (msg_p).eNB_index);
+ rrc_ue_decode_dcch (
+ &ctxt,
+ RRC_DCCH_DATA_IND (msg_p).dcch_index,
+ RRC_DCCH_DATA_IND (msg_p).sdu_p,
+ RRC_DCCH_DATA_IND (msg_p).eNB_index);
+ // Message buffer has been processed, free it now.
+ result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND (msg_p).sdu_p);
+ AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
+ break;
# if defined(ENABLE_USE_MME)
- case NAS_KENB_REFRESH_REQ:
- memcpy((void*)UE_rrc_inst[ue_mod_id].kenb, (void*)NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(UE_rrc_inst[ue_mod_id].kenb));
-
+ case NAS_KENB_REFRESH_REQ:
+ memcpy((void *)UE_rrc_inst[ue_mod_id].kenb, (void *)NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(UE_rrc_inst[ue_mod_id].kenb));
LOG_D(RRC, "[UE %d] Received %s: refreshed RRC::KeNB = "
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x\n",
- ue_mod_id, ITTI_MSG_NAME (msg_p),
- UE_rrc_inst[ue_mod_id].kenb[0], UE_rrc_inst[ue_mod_id].kenb[1], UE_rrc_inst[ue_mod_id].kenb[2], UE_rrc_inst[ue_mod_id].kenb[3],
- UE_rrc_inst[ue_mod_id].kenb[4], UE_rrc_inst[ue_mod_id].kenb[5], UE_rrc_inst[ue_mod_id].kenb[6], UE_rrc_inst[ue_mod_id].kenb[7],
- UE_rrc_inst[ue_mod_id].kenb[8], UE_rrc_inst[ue_mod_id].kenb[9], UE_rrc_inst[ue_mod_id].kenb[10], UE_rrc_inst[ue_mod_id].kenb[11],
- UE_rrc_inst[ue_mod_id].kenb[12], UE_rrc_inst[ue_mod_id].kenb[13], UE_rrc_inst[ue_mod_id].kenb[14], UE_rrc_inst[ue_mod_id].kenb[15],
- UE_rrc_inst[ue_mod_id].kenb[16], UE_rrc_inst[ue_mod_id].kenb[17], UE_rrc_inst[ue_mod_id].kenb[18], UE_rrc_inst[ue_mod_id].kenb[19],
- UE_rrc_inst[ue_mod_id].kenb[20], UE_rrc_inst[ue_mod_id].kenb[21], UE_rrc_inst[ue_mod_id].kenb[22], UE_rrc_inst[ue_mod_id].kenb[23],
- UE_rrc_inst[ue_mod_id].kenb[24], UE_rrc_inst[ue_mod_id].kenb[25], UE_rrc_inst[ue_mod_id].kenb[26], UE_rrc_inst[ue_mod_id].kenb[27],
- UE_rrc_inst[ue_mod_id].kenb[28], UE_rrc_inst[ue_mod_id].kenb[29], UE_rrc_inst[ue_mod_id].kenb[30], UE_rrc_inst[ue_mod_id].kenb[31]);
-
- break;
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x\n",
+ ue_mod_id, ITTI_MSG_NAME (msg_p),
+ UE_rrc_inst[ue_mod_id].kenb[0], UE_rrc_inst[ue_mod_id].kenb[1], UE_rrc_inst[ue_mod_id].kenb[2], UE_rrc_inst[ue_mod_id].kenb[3],
+ UE_rrc_inst[ue_mod_id].kenb[4], UE_rrc_inst[ue_mod_id].kenb[5], UE_rrc_inst[ue_mod_id].kenb[6], UE_rrc_inst[ue_mod_id].kenb[7],
+ UE_rrc_inst[ue_mod_id].kenb[8], UE_rrc_inst[ue_mod_id].kenb[9], UE_rrc_inst[ue_mod_id].kenb[10], UE_rrc_inst[ue_mod_id].kenb[11],
+ UE_rrc_inst[ue_mod_id].kenb[12], UE_rrc_inst[ue_mod_id].kenb[13], UE_rrc_inst[ue_mod_id].kenb[14], UE_rrc_inst[ue_mod_id].kenb[15],
+ UE_rrc_inst[ue_mod_id].kenb[16], UE_rrc_inst[ue_mod_id].kenb[17], UE_rrc_inst[ue_mod_id].kenb[18], UE_rrc_inst[ue_mod_id].kenb[19],
+ UE_rrc_inst[ue_mod_id].kenb[20], UE_rrc_inst[ue_mod_id].kenb[21], UE_rrc_inst[ue_mod_id].kenb[22], UE_rrc_inst[ue_mod_id].kenb[23],
+ UE_rrc_inst[ue_mod_id].kenb[24], UE_rrc_inst[ue_mod_id].kenb[25], UE_rrc_inst[ue_mod_id].kenb[26], UE_rrc_inst[ue_mod_id].kenb[27],
+ UE_rrc_inst[ue_mod_id].kenb[28], UE_rrc_inst[ue_mod_id].kenb[29], UE_rrc_inst[ue_mod_id].kenb[30], UE_rrc_inst[ue_mod_id].kenb[31]);
+ break;
/* NAS messages */
- case NAS_CELL_SELECTION_REQ:
+ case NAS_CELL_SELECTION_REQ:
+ LOG_D(RRC, "[UE %d] Received %s: state %d, plmnID (%d%d%d.%d%d%d), rat %x\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id),
+ NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit1,
+ NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit2,
+ NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit3,
+ NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit1,
+ NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit2,
+ NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit3,
+ NAS_CELL_SELECTION_REQ (msg_p).rat);
- LOG_D(RRC, "[UE %d] Received %s: state %d, plmnID (%d%d%d.%d%d%d), rat %x\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id),
- NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit1,
- NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit2,
- NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit3,
- NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit1,
- NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit2,
- NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit3,
- NAS_CELL_SELECTION_REQ (msg_p).rat);
-
- if (rrc_get_state(ue_mod_id) == RRC_STATE_INACTIVE) {
- // have a look at MAC/main.c void dl_phy_sync_success(...)
- openair_rrc_ue_init(ue_mod_id,0);
- }
-
- /* Save cell selection criterion */
- {
- UE_rrc_inst[ue_mod_id].plmnID = NAS_CELL_SELECTION_REQ (msg_p).plmnID;
- UE_rrc_inst[ue_mod_id].rat = NAS_CELL_SELECTION_REQ (msg_p).rat;
- LOG_D(RRC, "[UE %d] Save cell selection criterion MCC %X%X%X MNC %X%X%X\n",
- ue_mod_id,
- UE_rrc_inst[ue_mod_id].plmnID.MCCdigit1,
- UE_rrc_inst[ue_mod_id].plmnID.MCCdigit2,
- UE_rrc_inst[ue_mod_id].plmnID.MCCdigit3,
- UE_rrc_inst[ue_mod_id].plmnID.MNCdigit1,
- UE_rrc_inst[ue_mod_id].plmnID.MNCdigit2,
- UE_rrc_inst[ue_mod_id].plmnID.MNCdigit3);
-
- }
-
- switch (rrc_get_state(ue_mod_id)) {
- case RRC_STATE_INACTIVE: {
- /* Need to first activate lower layers */
- MessageDef *message_p;
-
- message_p = itti_alloc_new_message(TASK_RRC_UE, ACTIVATE_MESSAGE);
-
- itti_send_msg_to_task(TASK_L2L1, UE_MODULE_ID_TO_INSTANCE(ue_mod_id), message_p);
-
- rrc_set_state (ue_mod_id, RRC_STATE_IDLE);
- /* Fall through to next case */
- }
-
- case RRC_STATE_IDLE: {
- /* Ask to layer 1 to find a cell matching the criterion */
- MessageDef *message_p;
-
- message_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_CELL_REQ);
-
- PHY_FIND_CELL_REQ (message_p).earfcn_start = 1;
- PHY_FIND_CELL_REQ (message_p).earfcn_end = 1;
-
- itti_send_msg_to_task(TASK_PHY_UE, UE_MODULE_ID_TO_INSTANCE(ue_mod_id), message_p);
- rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_SEARCHING);
-
- break;
- }
-
- case RRC_STATE_CONNECTED:
- /* should not happen */
- LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
- break;
-
- default:
- LOG_E(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id));
- break;
- }
-
- break;
-
- case NAS_CONN_ESTABLI_REQ:
- LOG_D(RRC, "[UE %d] Received %s: cause %d, type %d, s_tmsi (mme code %"PRIu8", m-tmsi %"PRIu32"), plmnID (%d%d%d.%d%d%d)\n", ue_mod_id, ITTI_MSG_NAME (msg_p), NAS_CONN_ESTABLI_REQ (msg_p).cause,
- NAS_CONN_ESTABLI_REQ (msg_p).type,
- NAS_CONN_ESTABLI_REQ (msg_p).s_tmsi.MMEcode,
- NAS_CONN_ESTABLI_REQ (msg_p).s_tmsi.m_tmsi,
- NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit1,
- NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit2,
- NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit3,
- NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit1,
- NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit2,
- NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit3);
-
- //PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, 0, 0);
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, NOT_A_RNTI, 0, 0, 0);
-
- UE_rrc_inst[ue_mod_id].initialNasMsg = NAS_CONN_ESTABLI_REQ (msg_p).initialNasMsg;
-
- switch (rrc_get_state(ue_mod_id)) {
- case RRC_STATE_IDLE: {
- if (rrc_get_sub_state(ue_mod_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) {
- rrc_ue_generate_RRCConnectionRequest(&ctxt, 0);
- LOG_D(RRC, "not sending connection request\n");
-
- rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_CONNECTING);
+ if (rrc_get_state(ue_mod_id) == RRC_STATE_INACTIVE) {
+ // have a look at MAC/main.c void dl_phy_sync_success(...)
+ openair_rrc_ue_init(ue_mod_id,0);
}
- break;
- }
-
- case RRC_STATE_INACTIVE:
- case RRC_STATE_CONNECTED:
- /* should not happen */
- LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
- break;
-
- default:
- LOG_E(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id));
- break;
- }
-
- break;
-
- case NAS_UPLINK_DATA_REQ: {
- uint32_t length;
- uint8_t *buffer;
-
- LOG_D(RRC, "[UE %d] Received %s: UEid %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), NAS_UPLINK_DATA_REQ (msg_p).UEid);
-
- /* Create message for PDCP (ULInformationTransfer_t) */
- length = do_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.data);
-
- /* Transfer data to PDCP */
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0,0);
-
- // check if SRB2 is created, if yes request data_req on DCCH1 (SRB2)
- if(UE_rrc_inst[ue_mod_id].SRB2_config[0] == NULL)
- {
- rrc_data_req_ue (&ctxt,
- DCCH,
- rrc_mui++,
- SDU_CONFIRM_NO,
- length, buffer,
- PDCP_TRANSMISSION_MODE_CONTROL);
- }
- else
- {
- rrc_data_req_ue (&ctxt,
- DCCH1,
- rrc_mui++,
- SDU_CONFIRM_NO,
- length, buffer,
- PDCP_TRANSMISSION_MODE_CONTROL);
- }
- break;
- }
-
-# endif
-
-# if ENABLE_RAL
-
- case RRC_RAL_SCAN_REQ:
- LOG_D(RRC, "[UE %d] Received %s: state %d\n", ue_mod_id,ITTI_MSG_NAME (msg_p) );
-
- switch (rrc_get_state(ue_mod_id)) {
- case RRC_STATE_INACTIVE: {
- /* Need to first activate lower layers */
- MessageDef *message_p;
-
- message_p = itti_alloc_new_message(TASK_RRC_UE, ACTIVATE_MESSAGE);
-
- itti_send_msg_to_task(TASK_L2L1, instance, message_p);
-
- rrc_set_state (ue_mod_id, RRC_STATE_IDLE);
- /* Fall through to next case */
- }
-
- case RRC_STATE_IDLE: {
- if (rrc_get_sub_state(ue_mod_id) != RRC_SUB_STATE_IDLE_SEARCHING) {
- /* Ask to layer 1 to find a cell matching the criterion */
- MessageDef *message_p;
-
- message_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_CELL_REQ);
-
- rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_SEARCHING);
-
- PHY_FIND_CELL_REQ (message_p).transaction_id = RRC_RAL_SCAN_REQ (msg_p).transaction_id;
- PHY_FIND_CELL_REQ (message_p).earfcn_start = 1;
- PHY_FIND_CELL_REQ (message_p).earfcn_end = 1; //44
-
- itti_send_msg_to_task(TASK_PHY_UE, instance, message_p);
+ /* Save cell selection criterion */
+ {
+ UE_rrc_inst[ue_mod_id].plmnID = NAS_CELL_SELECTION_REQ (msg_p).plmnID;
+ UE_rrc_inst[ue_mod_id].rat = NAS_CELL_SELECTION_REQ (msg_p).rat;
+ LOG_D(RRC, "[UE %d] Save cell selection criterion MCC %X%X%X MNC %X%X%X\n",
+ ue_mod_id,
+ UE_rrc_inst[ue_mod_id].plmnID.MCCdigit1,
+ UE_rrc_inst[ue_mod_id].plmnID.MCCdigit2,
+ UE_rrc_inst[ue_mod_id].plmnID.MCCdigit3,
+ UE_rrc_inst[ue_mod_id].plmnID.MNCdigit1,
+ UE_rrc_inst[ue_mod_id].plmnID.MNCdigit2,
+ UE_rrc_inst[ue_mod_id].plmnID.MNCdigit3);
}
- break;
- }
-
- case RRC_STATE_CONNECTED:
- /* should not happen */
- LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
- break;
-
- default:
- LOG_E(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id));
- break;
- }
-
- break;
-
- case PHY_FIND_CELL_IND:
- LOG_D(RRC, "[UE %d] Received %s: state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
-
- switch (rrc_get_state(ue_mod_id)) {
- case RRC_STATE_IDLE:
- switch (rrc_get_sub_state(ue_mod_id)) {
- case RRC_SUB_STATE_IDLE_SEARCHING: {
- MessageDef *message_p;
- int i;
-
- message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_SCAN_CONF);
-
- RRC_RAL_SCAN_CONF (message_p).transaction_id = PHY_FIND_CELL_IND(msg_p).transaction_id;
- RRC_RAL_SCAN_CONF (message_p).num_scan_resp = PHY_FIND_CELL_IND(msg_p).cell_nb;
-
- for (i = 0 ; i < PHY_FIND_CELL_IND(msg_p).cell_nb; i++) {
- // TO DO
- memset(&RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].link_addr, 0, sizeof(ral_link_addr_t));
- // TO DO
- memset(&RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].network_id, 0, sizeof(ral_network_id_t));
-
- RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].sig_strength.choice = RAL_SIG_STRENGTH_CHOICE_DBM;
- RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].sig_strength._union.dbm = PHY_FIND_CELL_IND(msg_p).cells[i].rsrp;
+ switch (rrc_get_state(ue_mod_id)) {
+ case RRC_STATE_INACTIVE: {
+ rrc_set_state (ue_mod_id, RRC_STATE_IDLE);
+ /* Fall through to next case */
}
- rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE);
+ case RRC_STATE_IDLE: {
+ /* Ask to layer 1 to find a cell matching the criterion */
+ MessageDef *message_p;
+ message_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_CELL_REQ);
+ PHY_FIND_CELL_REQ (message_p).earfcn_start = 1;
+ PHY_FIND_CELL_REQ (message_p).earfcn_end = 1;
+ itti_send_msg_to_task(TASK_PHY_UE, UE_MODULE_ID_TO_INSTANCE(ue_mod_id), message_p);
+ rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_SEARCHING);
+ break;
+ }
- itti_send_msg_to_task(TASK_RAL_UE, instance, message_p);
- break;
- }
+ case RRC_STATE_CONNECTED:
+ /* should not happen */
+ LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
+ break;
- default:
- LOG_E(RRC, "[UE %d] Invalid RRC state %d substate %d\n",
- ue_mod_id,
- rrc_get_state(ue_mod_id),
- rrc_get_sub_state(ue_mod_id));
+ default:
+ LOG_E(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id));
+ break;
}
break;
- case RRC_STATE_INACTIVE:
- case RRC_STATE_CONNECTED:
- /* should not happen */
- LOG_E(RRC, "[UE %d] indication %s in RRC state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
+ case NAS_CONN_ESTABLI_REQ:
+ LOG_D(RRC, "[UE %d] Received %s: cause %d, type %d, s_tmsi (mme code %"PRIu8", m-tmsi %"PRIu32"), plmnID (%d%d%d.%d%d%d)\n", ue_mod_id, ITTI_MSG_NAME (msg_p), NAS_CONN_ESTABLI_REQ (msg_p).cause,
+ NAS_CONN_ESTABLI_REQ (msg_p).type,
+ NAS_CONN_ESTABLI_REQ (msg_p).s_tmsi.MMEcode,
+ NAS_CONN_ESTABLI_REQ (msg_p).s_tmsi.m_tmsi,
+ NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit1,
+ NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit2,
+ NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit3,
+ NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit1,
+ NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit2,
+ NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit3);
+ //PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, 0, 0);
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, NOT_A_RNTI, 0, 0, 0);
+ UE_rrc_inst[ue_mod_id].initialNasMsg = NAS_CONN_ESTABLI_REQ (msg_p).initialNasMsg;
+
+ switch (rrc_get_state(ue_mod_id)) {
+ case RRC_STATE_IDLE: {
+ if (rrc_get_sub_state(ue_mod_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) {
+ rrc_ue_generate_RRCConnectionRequest(&ctxt, 0);
+ LOG_D(RRC, "not sending connection request\n");
+ rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_CONNECTING);
+ }
+
+ break;
+ }
+
+ case RRC_STATE_INACTIVE:
+ case RRC_STATE_CONNECTED:
+ /* should not happen */
+ LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
+ break;
+
+ default:
+ LOG_E(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id));
+ break;
+ }
+
break;
- default:
- LOG_E(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id));
- break;
- }
+ case NAS_UPLINK_DATA_REQ: {
+ uint32_t length;
+ uint8_t *buffer;
+ LOG_D(RRC, "[UE %d] Received %s: UEid %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), NAS_UPLINK_DATA_REQ (msg_p).UEid);
+ /* Create message for PDCP (ULInformationTransfer_t) */
+ length = do_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.data);
+ /* Transfer data to PDCP */
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0,0);
- break; // PHY_FIND_CELL_IND
-
- case PHY_MEAS_REPORT_IND: {
- LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
- MessageDef *message_p;
- message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_MEASUREMENT_REPORT_IND);
-
- memcpy(&RRC_RAL_MEASUREMENT_REPORT_IND (message_p).threshold,
- &PHY_MEAS_REPORT_IND(msg_p).threshold,
- sizeof(RRC_RAL_MEASUREMENT_REPORT_IND (message_p).threshold));
-
- memcpy(&RRC_RAL_MEASUREMENT_REPORT_IND (message_p).link_param,
- &PHY_MEAS_REPORT_IND(msg_p).link_param,
- sizeof(RRC_RAL_MEASUREMENT_REPORT_IND (message_p).link_param));
-
- LOG_D(RRC, "[UE %d] PHY_MEAS_REPORT_IN: sending msg %s to %s \n", ue_mod_id, "RRC_RAL_MEASUREMENT_REPORT_IND", "TASK_RAL_UE");
- itti_send_msg_to_task(TASK_RAL_UE, instance, message_p);
- break;
- }
-
- case RRC_RAL_CONFIGURE_THRESHOLD_REQ:
- LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
- rrc_ue_ral_handle_configure_threshold_request(ue_mod_id, msg_p);
- break;
-
- case RRC_RAL_CONNECTION_ESTABLISHMENT_REQ:
- LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
-
- switch (rrc_get_state(ue_mod_id)) {
- case RRC_STATE_IDLE: {
- if (rrc_get_sub_state(ue_mod_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) {
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0, 0);
- rrc_ue_generate_RRCConnectionRequest(&ctxt, 0);
- LOG_D(RRC, "not sending connection request\n");
- rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_CONNECTING);
+ // check if SRB2 is created, if yes request data_req on DCCH1 (SRB2)
+ if(UE_rrc_inst[ue_mod_id].SRB2_config[0] == NULL) {
+ rrc_data_req_ue (&ctxt,
+ DCCH,
+ rrc_mui++,
+ SDU_CONFIRM_NO,
+ length, buffer,
+ PDCP_TRANSMISSION_MODE_CONTROL);
+ } else {
+ rrc_data_req_ue (&ctxt,
+ DCCH1,
+ rrc_mui++,
+ SDU_CONFIRM_NO,
+ length, buffer,
+ PDCP_TRANSMISSION_MODE_CONTROL);
}
break;
}
- case RRC_STATE_INACTIVE:
- case RRC_STATE_CONNECTED:
- /* should not happen */
- LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
+# endif
+# if ENABLE_RAL
+
+ case RRC_RAL_SCAN_REQ:
+ LOG_D(RRC, "[UE %d] Received %s: state %d\n", ue_mod_id,ITTI_MSG_NAME (msg_p) );
+
+ switch (rrc_get_state(ue_mod_id)) {
+ case RRC_STATE_INACTIVE: {
+ rrc_set_state (ue_mod_id, RRC_STATE_IDLE);
+ /* Fall through to next case */
+ }
+
+ case RRC_STATE_IDLE: {
+ if (rrc_get_sub_state(ue_mod_id) != RRC_SUB_STATE_IDLE_SEARCHING) {
+ /* Ask to layer 1 to find a cell matching the criterion */
+ MessageDef *message_p;
+ message_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_CELL_REQ);
+ rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_SEARCHING);
+ PHY_FIND_CELL_REQ (message_p).transaction_id = RRC_RAL_SCAN_REQ (msg_p).transaction_id;
+ PHY_FIND_CELL_REQ (message_p).earfcn_start = 1;
+ PHY_FIND_CELL_REQ (message_p).earfcn_end = 1; //44
+ itti_send_msg_to_task(TASK_PHY_UE, instance, message_p);
+ }
+
+ break;
+ }
+
+ case RRC_STATE_CONNECTED:
+ /* should not happen */
+ LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
+ break;
+
+ default:
+ LOG_E(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id));
+ break;
+ }
+
break;
- default:
- LOG_E(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id));
+ case PHY_FIND_CELL_IND:
+ LOG_D(RRC, "[UE %d] Received %s: state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
+
+ switch (rrc_get_state(ue_mod_id)) {
+ case RRC_STATE_IDLE:
+ switch (rrc_get_sub_state(ue_mod_id)) {
+ case RRC_SUB_STATE_IDLE_SEARCHING: {
+ MessageDef *message_p;
+ int i;
+ message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_SCAN_CONF);
+ RRC_RAL_SCAN_CONF (message_p).transaction_id = PHY_FIND_CELL_IND(msg_p).transaction_id;
+ RRC_RAL_SCAN_CONF (message_p).num_scan_resp = PHY_FIND_CELL_IND(msg_p).cell_nb;
+
+ for (i = 0 ; i < PHY_FIND_CELL_IND(msg_p).cell_nb; i++) {
+ // TO DO
+ memset(&RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].link_addr, 0, sizeof(ral_link_addr_t));
+ // TO DO
+ memset(&RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].network_id, 0, sizeof(ral_network_id_t));
+ RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].sig_strength.choice = RAL_SIG_STRENGTH_CHOICE_DBM;
+ RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].sig_strength._union.dbm = PHY_FIND_CELL_IND(msg_p).cells[i].rsrp;
+ }
+
+ rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE);
+ itti_send_msg_to_task(TASK_RAL_UE, instance, message_p);
+ break;
+ }
+
+ default:
+ LOG_E(RRC, "[UE %d] Invalid RRC state %d substate %d\n",
+ ue_mod_id,
+ rrc_get_state(ue_mod_id),
+ rrc_get_sub_state(ue_mod_id));
+ }
+
+ break;
+
+ case RRC_STATE_INACTIVE:
+ case RRC_STATE_CONNECTED:
+ /* should not happen */
+ LOG_E(RRC, "[UE %d] indication %s in RRC state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
+ break;
+
+ default:
+ LOG_E(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id));
+ break;
+ }
+
+ break; // PHY_FIND_CELL_IND
+
+ case PHY_MEAS_REPORT_IND: {
+ LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
+ MessageDef *message_p;
+ message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_MEASUREMENT_REPORT_IND);
+ memcpy(&RRC_RAL_MEASUREMENT_REPORT_IND (message_p).threshold,
+ &PHY_MEAS_REPORT_IND(msg_p).threshold,
+ sizeof(RRC_RAL_MEASUREMENT_REPORT_IND (message_p).threshold));
+ memcpy(&RRC_RAL_MEASUREMENT_REPORT_IND (message_p).link_param,
+ &PHY_MEAS_REPORT_IND(msg_p).link_param,
+ sizeof(RRC_RAL_MEASUREMENT_REPORT_IND (message_p).link_param));
+ LOG_D(RRC, "[UE %d] PHY_MEAS_REPORT_IN: sending msg %s to %s \n", ue_mod_id, "RRC_RAL_MEASUREMENT_REPORT_IND", "TASK_RAL_UE");
+ itti_send_msg_to_task(TASK_RAL_UE, instance, message_p);
break;
}
- break;
+ case RRC_RAL_CONFIGURE_THRESHOLD_REQ:
+ LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
+ rrc_ue_ral_handle_configure_threshold_request(ue_mod_id, msg_p);
+ break;
- case RRC_RAL_CONNECTION_RELEASE_REQ:
- LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
- break;
+ case RRC_RAL_CONNECTION_ESTABLISHMENT_REQ:
+ LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
+
+ switch (rrc_get_state(ue_mod_id)) {
+ case RRC_STATE_IDLE: {
+ if (rrc_get_sub_state(ue_mod_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) {
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0, 0);
+ rrc_ue_generate_RRCConnectionRequest(&ctxt, 0);
+ LOG_D(RRC, "not sending connection request\n");
+ rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_CONNECTING);
+ }
+
+ break;
+ }
+
+ case RRC_STATE_INACTIVE:
+ case RRC_STATE_CONNECTED:
+ /* should not happen */
+ LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), rrc_get_state(ue_mod_id));
+ break;
+
+ default:
+ LOG_E(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id));
+ break;
+ }
+
+ break;
+
+ case RRC_RAL_CONNECTION_RELEASE_REQ:
+ LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
+ break;
#endif
- default:
- LOG_E(RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
- break;
+ default:
+ LOG_E(RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p));
+ break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
@@ -5186,28 +4729,24 @@ void *rrc_ue_task( void *args_p )
/*------------------------------------------------------------------------------*/
void
openair_rrc_top_init_ue(
- int eMBMS_active,
- char* uecap_xer,
- uint8_t cba_group_active,
- uint8_t HO_active
+ int eMBMS_active,
+ char *uecap_xer,
+ uint8_t cba_group_active,
+ uint8_t HO_active
)
//-----------------------------------------------------------------------------
{
-
module_id_t module_id;
OAI_UECapability_t *UECap = NULL;
int CC_id;
-
/* for no gcc warnings */
(void)CC_id;
-
LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_UE_INST=%d, NB_eNB_INST=%d\n", NB_UE_INST, NB_eNB_INST);
if (NB_UE_INST > 0) {
- UE_rrc_inst = (UE_RRC_INST*) malloc16(NB_UE_INST*sizeof(UE_RRC_INST));
+ UE_rrc_inst = (UE_RRC_INST *) malloc16(NB_UE_INST*sizeof(UE_RRC_INST));
memset (UE_rrc_inst, 0, NB_UE_INST * sizeof(UE_RRC_INST));
LOG_D(RRC, "ALLOCATE %d Bytes for UE_RRC_INST @ %p\n", (unsigned int)(NB_UE_INST*sizeof(UE_RRC_INST)), UE_rrc_inst);
-
// fill UE capability
UECap = fill_ue_capability (uecap_xer);
@@ -5225,18 +4764,15 @@ openair_rrc_top_init_ue(
}
#endif
-
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- /* TODO: this is disabled for the moment because the standard UE
- * crashes when calling this function.
- */
- //init_SL_preconfig(&UE_rrc_inst[module_id],0);
+ /* TODO: this is disabled for the moment because the standard UE
+ * crashes when calling this function.
+ */
+ //init_SL_preconfig(&UE_rrc_inst[module_id],0);
#endif
-
} else {
UE_rrc_inst = NULL;
}
-
}
//-----------------------------------------------------------------------------
@@ -5246,1086 +4782,1028 @@ rrc_top_cleanup_ue(
)
//-----------------------------------------------------------------------------
{
-
if (NB_UE_INST > 0) free (UE_rrc_inst);
-
-
}
//-----------------------------------------------------------------------------
-uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,LTE_SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq, SL_TRIGGER_t mode)
-{
- uint8_t size=0;
- uint8_t buffer[100];
+uint8_t rrc_ue_generate_SidelinkUEInformation( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,LTE_SL_DestinationInfoList_r12_t *destinationInfoList, long *discTxResourceReq,
+ SL_TRIGGER_t mode) {
+ uint8_t size=0;
+ uint8_t buffer[100];
- //Generate SidelinkUEInformation
- if (((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8192) > 0) && (destinationInfoList != NULL)) {//if SIB18 is available
- size = do_SidelinkUEInformation(ctxt_pP->module_id, buffer, destinationInfoList, NULL, mode);
- LOG_I(RRC,"[UE %d][RRC_UE] Frame %d : Logical Channel UL-DCCH, Generating SidelinkUEInformation (bytes%d, eNB %d)\n",
- ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index);
- //return size;
- }
- if (((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16384) > 0) && (discTxResourceReq != NULL)) {//if SIB19 is available
- size = do_SidelinkUEInformation(ctxt_pP->module_id, buffer, NULL, discTxResourceReq, mode);
- LOG_I(RRC,"[UE %d][RRC_UE] Frame %d : Logical Channel UL-DCCH, Generating SidelinkUEInformation (bytes%d, eNB %d)\n",
- ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index);
- //return size;
- }
+ //Generate SidelinkUEInformation
+ if (((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8192) > 0) && (destinationInfoList != NULL)) {//if SIB18 is available
+ size = do_SidelinkUEInformation(ctxt_pP->module_id, buffer, destinationInfoList, NULL, mode);
+ LOG_I(RRC,"[UE %d][RRC_UE] Frame %d : Logical Channel UL-DCCH, Generating SidelinkUEInformation (bytes%d, eNB %d)\n",
+ ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index);
+ //return size;
+ }
- rrc_data_req_ue (
- ctxt_pP,
- DCCH,
- rrc_mui++,
- SDU_CONFIRM_NO,
- size,
- buffer,
- PDCP_TRANSMISSION_MODE_CONTROL);
- return size;
+ if (((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16384) > 0) && (discTxResourceReq != NULL)) {//if SIB19 is available
+ size = do_SidelinkUEInformation(ctxt_pP->module_id, buffer, NULL, discTxResourceReq, mode);
+ LOG_I(RRC,"[UE %d][RRC_UE] Frame %d : Logical Channel UL-DCCH, Generating SidelinkUEInformation (bytes%d, eNB %d)\n",
+ ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index);
+ //return size;
+ }
+
+ rrc_data_req_ue (
+ ctxt_pP,
+ DCCH,
+ rrc_mui++,
+ SDU_CONFIRM_NO,
+ size,
+ buffer,
+ PDCP_TRANSMISSION_MODE_CONTROL);
+ return size;
}
// 3GPP 36.331 (Section 5.10.7.3)
-uint8_t fill_SLSS(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, LTE_SLSSID_r12_t *slss_id, uint8_t *subframe, uint8_t mode)
-{
- long syncOffsetIndicator = 0;
- switch(mode) {
- case 1: //if triggered by SL discovery announcement and in-coverage
+uint8_t fill_SLSS(const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, LTE_SLSSID_r12_t *slss_id, uint8_t *subframe, uint8_t mode) {
+ long syncOffsetIndicator = 0;
+
+ switch(mode) {
+ case 1: //if triggered by SL discovery announcement and in-coverage
//discSyncConfig_r12 contains only one element
*slss_id = UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index]->discConfig_r12->discSyncConfig_r12->list.array[0]->slssid_r12;
syncOffsetIndicator = UE_rrc_inst[ctxt_pP->module_id].sib19[eNB_index]->discConfig_r12->discSyncConfig_r12->list.array[0]->syncOffsetIndicator_r12;
//select subframe for SLSS
break;
- case 2: //if triggered by SL communication and in-coverage
+ case 2: //if triggered by SL communication and in-coverage
if (UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->txParameters_r12) {
- *slss_id = UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->slssid_r12;
- syncOffsetIndicator = UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->syncOffsetIndicator_r12;
+ *slss_id = UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->slssid_r12;
+ syncOffsetIndicator = UE_rrc_inst[ctxt_pP->module_id].sib18[eNB_index]->commConfig_r12->commSyncConfig_r12->list.array[0]->syncOffsetIndicator_r12;
- //if RRC_CONNECTED (Todo: and if networkControlledSyncTx (RRCConnectionReconfiguration) is configured and set to On)
- if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_CONNECTED){
- //select subframe(s) indicated by syncOffsetIndicator
- *subframe = syncOffsetIndicator;
- } else {
- //select subframe(s) indicated by syncOffsetIndicator within SC period
- }
- break;
- case 3: //if triggered by V2X communication and in coverage
+ //if RRC_CONNECTED (Todo: and if networkControlledSyncTx (RRCConnectionReconfiguration) is configured and set to On)
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_CONNECTED) {
+ //select subframe(s) indicated by syncOffsetIndicator
+ *subframe = syncOffsetIndicator;
+ } else {
+ //select subframe(s) indicated by syncOffsetIndicator within SC period
+ }
- break;
- case 4: //if triggered by V2X communication and out-of-coverage
+ break;
- break;
- case 5: //if triggered by V2X communication and UE has GNSS as the synchronization reference
+ case 3: //if triggered by V2X communication and in coverage
+ break;
- default:
- //if UE has a selected SyncRefUE
- //TODO
- //else (no SyncRefUE Selected)
- //Todo if trigger by V2X
- //else randomly select an SLSSID from the set defined for out-of-coverage
- *slss_id = 170;//hardcoded
- //select the subframe according to syncOffsetIndicator1/2 from the preconfigured parameters
- break;
+ case 4: //if triggered by V2X communication and out-of-coverage
+ break;
+
+ case 5: //if triggered by V2X communication and UE has GNSS as the synchronization reference
+ default:
+ //if UE has a selected SyncRefUE
+ //TODO
+ //else (no SyncRefUE Selected)
+ //Todo if trigger by V2X
+ //else randomly select an SLSSID from the set defined for out-of-coverage
+ *slss_id = 170;//hardcoded
+ //select the subframe according to syncOffsetIndicator1/2 from the preconfigured parameters
+ break;
}
- }
- return 0;
+ }
+
+ return 0;
}
//-----------------------------------------------------------------------------
void
rrc_ue_process_sidelink_radioResourceConfig(
- module_id_t Mod_idP,
- uint8_t eNB_index,
- LTE_SystemInformationBlockType18_r12_t *sib18,
- LTE_SystemInformationBlockType19_r12_t *sib19,
- LTE_SL_CommConfig_r12_t* sl_CommConfig,
- LTE_SL_DiscConfig_r12_t* sl_DiscConfig
+ module_id_t Mod_idP,
+ uint8_t eNB_index,
+ LTE_SystemInformationBlockType18_r12_t *sib18,
+ LTE_SystemInformationBlockType19_r12_t *sib19,
+ LTE_SL_CommConfig_r12_t *sl_CommConfig,
+ LTE_SL_DiscConfig_r12_t *sl_DiscConfig
)
//-----------------------------------------------------------------------------
{
- //process SIB18, configure MAC/PHY for receiving SL communication (RRC_IDLE and RRC_CONNECTED), for transmitting SL communication (RRC_IDLE)
- if (sib18 != NULL) {
- if (sib18->commConfig_r12 != NULL) {
- //do not consider commTXPoolExceptional for the moment
- //configure PHY/MAC to receive SL communication by using the RPs indicated by commRxPool
- //sib18->commConfig_r12->commRxPool_r12
- //TODO
-
- if (sib18->commConfig_r12->commTxPoolNormalCommon_r12 !=NULL) { //commTxPoolNormalCommon - to transmit SL communication in RRC_IDLE
- //maybe we don't consider this case for the moment since UE will immediately establish a RRC connection after receiving SIB messages
- //configure PHY/MAC to transmit SL communication using the RPs indicated by the first entry in commTxPoolNormalCommon
- //SL_CommResourcePool_r12_t sl_CommResourcePool = sib18->commConfig_r12->commTxPoolNormalCommon_r12->list.array[0];
- }
+ //process SIB18, configure MAC/PHY for receiving SL communication (RRC_IDLE and RRC_CONNECTED), for transmitting SL communication (RRC_IDLE)
+ if (sib18 != NULL) {
+ if (sib18->commConfig_r12 != NULL) {
+ //do not consider commTXPoolExceptional for the moment
+ //configure PHY/MAC to receive SL communication by using the RPs indicated by commRxPool
+ //sib18->commConfig_r12->commRxPool_r12
+ //TODO
+ if (sib18->commConfig_r12->commTxPoolNormalCommon_r12 !=NULL) { //commTxPoolNormalCommon - to transmit SL communication in RRC_IDLE
+ //maybe we don't consider this case for the moment since UE will immediately establish a RRC connection after receiving SIB messages
+ //configure PHY/MAC to transmit SL communication using the RPs indicated by the first entry in commTxPoolNormalCommon
+ //SL_CommResourcePool_r12_t sl_CommResourcePool = sib18->commConfig_r12->commTxPoolNormalCommon_r12->list.array[0];
}
- }
+ }
+ }
- //process SIB19, configure MAC/PHY for receiving SL discovery (RRC_IDLE and RRC_CONNECTED), for transmitting SL discovery (RRC_IDLE)
- if (sib19 != NULL) {
- //to receive non-PS related discovery announcements (discRxPool)
- //sib19->discConfig_r12->discRxPool_r12;
+ //process SIB19, configure MAC/PHY for receiving SL discovery (RRC_IDLE and RRC_CONNECTED), for transmitting SL discovery (RRC_IDLE)
+ if (sib19 != NULL) {
+ //to receive non-PS related discovery announcements (discRxPool)
+ //sib19->discConfig_r12->discRxPool_r12;
+ //to receive PS related discovery announcements (discRxPoolPS)
+ //sib19->ext1->discConfigPS_13->discRxPoolPS_r13;
+ //to transmit non-PS related discovery in RRC_IDLE
+ //sib19->discConfig_r12->discTxPoolCommon_r12;
+ //to transmit PS related discovery in RRC_IDLE
+ //sib19->ext1->discConfigPS_13->discTxPoolPS_Common_r13;
+ }
- //to receive PS related discovery announcements (discRxPoolPS)
- //sib19->ext1->discConfigPS_13->discRxPoolPS_r13;
+ //process sl_CommConfig, configure MAC/PHY for transmitting SL communication (RRC_CONNECTED)
+ if (sl_CommConfig != NULL) {
+ if (sl_CommConfig->commTxResources_r12 != NULL) {
+ switch (sl_CommConfig->commTxResources_r12->present) {
+ case LTE_SL_CommConfig_r12__commTxResources_r12_PR_setup:
+ if (sl_CommConfig->commTxResources_r12->choice.setup.present == LTE_SL_CommConfig_r12__commTxResources_r12__setup_PR_scheduled_r12 ) {
+ LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, sl_RNTI size %lu \n",
+ Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.size );
+ LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, sl_RNTI buf 0x%p \n",
+ Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf );
+ LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, Mac_MainConfig_r12.retx_BSR_TimerSL %ld \n",
+ Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mac_MainConfig_r12.retx_BSR_TimerSL );
+ LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, sc_CommTxConfig %ld \n",
+ Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mac_MainConfig_r12.retx_BSR_TimerSL );
+ //configure scheduled resource for SL
+ //TODO
+ } else if (sl_CommConfig->commTxResources_r12->choice.setup.present == LTE_SL_CommConfig_r12__commTxResources_r12__setup_PR_ue_Selected_r12) {
+ //configure dedicated resources (commTxPoolNormalDedicated) for SL from which UE can autonomously select
+ //sl_CommConfig->commTxResources_r12->choice.setup.choice.ue_Selected_r12.commTxPoolNormalDedicated_r12;
+ //for the moment, only pass the first entry (e.g., do not consider priorityList in commTxPoolNormalDedicated (3GPP 36.331 Section 5.10.4 1>2>3>4))
+ //sl_CommConfig->commTxResources_r12->choice.setup.choice.ue_Selected_r12.commTxPoolNormalDedicated_r12.poolToAddModList_r12->list.array[0];
+ } else {
+ //SL_CommConfig_r12__commTxResources_r12__setup_PR_NOTHING /* No components present */
+ }
- //to transmit non-PS related discovery in RRC_IDLE
- //sib19->discConfig_r12->discTxPoolCommon_r12;
+ break;
- //to transmit PS related discovery in RRC_IDLE
- //sib19->ext1->discConfigPS_13->discTxPoolPS_Common_r13;
- }
+ case LTE_SL_CommConfig_r12__commTxResources_r12_PR_release:
+ //release dedicated resources for SL communication
+ break;
- //process sl_CommConfig, configure MAC/PHY for transmitting SL communication (RRC_CONNECTED)
- if (sl_CommConfig != NULL) {
+ case LTE_SL_CommConfig_r12__commTxResources_r12_PR_NOTHING: /* No components present */
+ break;
- if (sl_CommConfig->commTxResources_r12 != NULL) {
- switch (sl_CommConfig->commTxResources_r12->present){
- case LTE_SL_CommConfig_r12__commTxResources_r12_PR_setup:
- if (sl_CommConfig->commTxResources_r12->choice.setup.present == LTE_SL_CommConfig_r12__commTxResources_r12__setup_PR_scheduled_r12 ){
-
- LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, sl_RNTI size %lu \n",
- Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.size );
- LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, sl_RNTI buf 0x%p \n",
- Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.sl_RNTI_r12.buf );
- LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, Mac_MainConfig_r12.retx_BSR_TimerSL %ld \n",
- Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mac_MainConfig_r12.retx_BSR_TimerSL );
- LOG_I(RRC,"[UE %d][RRC_UE] scheduled resource for SL, sc_CommTxConfig %ld \n",
- Mod_idP, sl_CommConfig->commTxResources_r12->choice.setup.choice.scheduled_r12.mac_MainConfig_r12.retx_BSR_TimerSL );
- //configure scheduled resource for SL
- //TODO
- } else if (sl_CommConfig->commTxResources_r12->choice.setup.present == LTE_SL_CommConfig_r12__commTxResources_r12__setup_PR_ue_Selected_r12){
- //configure dedicated resources (commTxPoolNormalDedicated) for SL from which UE can autonomously select
- //sl_CommConfig->commTxResources_r12->choice.setup.choice.ue_Selected_r12.commTxPoolNormalDedicated_r12;
-
- //for the moment, only pass the first entry (e.g., do not consider priorityList in commTxPoolNormalDedicated (3GPP 36.331 Section 5.10.4 1>2>3>4))
- //sl_CommConfig->commTxResources_r12->choice.setup.choice.ue_Selected_r12.commTxPoolNormalDedicated_r12.poolToAddModList_r12->list.array[0];
- } else {
- //SL_CommConfig_r12__commTxResources_r12__setup_PR_NOTHING /* No components present */
- }
- break;
-
- case LTE_SL_CommConfig_r12__commTxResources_r12_PR_release:
- //release dedicated resources for SL communication
- break;
-
- case LTE_SL_CommConfig_r12__commTxResources_r12_PR_NOTHING: /* No components present */
- break;
-
- default:
- break;
- }
+ default:
+ break;
}
+ }
+ }
- }
+ //process sl_DiscConfig, configure MAC/PHY for transmitting SL discovery announcements (RRC_CONNECTED)
+ if (sl_DiscConfig != NULL) {
+ //dedicated resources for transmitting non-PS related discovery
+ if (sl_DiscConfig->discTxResources_r12 != NULL) {
+ switch (sl_DiscConfig->discTxResources_r12->present) {
+ case LTE_SL_DiscConfig_r12__discTxResources_r12_PR_setup:
+ if (sl_DiscConfig->discTxResources_r12->choice.setup.present == LTE_SL_DiscConfig_r12__discTxResources_r12__setup_PR_scheduled_r12) {
+ //sl_DiscConfig->discTxResources_r12->choice.setup.choice.scheduled_r12.discHoppingConfig_r12;
+ //sl_DiscConfig->discTxResources_r12->choice.setup.choice.scheduled_r12.discTF_IndexList_r12;
+ //sl_DiscConfig->discTxResources_r12->choice.setup.choice.scheduled_r12.discTxConfig_r12;
+ } else if (sl_DiscConfig->discTxResources_r12->choice.setup.present == LTE_SL_DiscConfig_r12__discTxResources_r12__setup_PR_ue_Selected_r12) {
+ //sl_DiscConfig->discTxResources_r12->choice.setup.choice.ue_Selected_r12.discTxPoolDedicated_r12;
+ } else {
+ //SL_DiscConfig_r12__discTxResources_r12__setup_PR_NOTHING, /* No components present */
+ }
- //process sl_DiscConfig, configure MAC/PHY for transmitting SL discovery announcements (RRC_CONNECTED)
- if (sl_DiscConfig != NULL) {
- //dedicated resources for transmitting non-PS related discovery
- if (sl_DiscConfig->discTxResources_r12 != NULL) {
+ break;
- switch (sl_DiscConfig->discTxResources_r12->present) {
- case LTE_SL_DiscConfig_r12__discTxResources_r12_PR_setup:
- if (sl_DiscConfig->discTxResources_r12->choice.setup.present == LTE_SL_DiscConfig_r12__discTxResources_r12__setup_PR_scheduled_r12) {
- //sl_DiscConfig->discTxResources_r12->choice.setup.choice.scheduled_r12.discHoppingConfig_r12;
- //sl_DiscConfig->discTxResources_r12->choice.setup.choice.scheduled_r12.discTF_IndexList_r12;
- //sl_DiscConfig->discTxResources_r12->choice.setup.choice.scheduled_r12.discTxConfig_r12;
- } else if (sl_DiscConfig->discTxResources_r12->choice.setup.present == LTE_SL_DiscConfig_r12__discTxResources_r12__setup_PR_ue_Selected_r12) {
- //sl_DiscConfig->discTxResources_r12->choice.setup.choice.ue_Selected_r12.discTxPoolDedicated_r12;
- } else {
- //SL_DiscConfig_r12__discTxResources_r12__setup_PR_NOTHING, /* No components present */
- }
- break;
- case LTE_SL_DiscConfig_r12__discTxResources_r12_PR_release:
- //release dedicated resources for SL discovery
- break;
- case LTE_SL_DiscConfig_r12__discTxResources_r12_PR_NOTHING: /* No components present */
- break;
- default:
- break;
- }
+ case LTE_SL_DiscConfig_r12__discTxResources_r12_PR_release:
+ //release dedicated resources for SL discovery
+ break;
+ case LTE_SL_DiscConfig_r12__discTxResources_r12_PR_NOTHING: /* No components present */
+ break;
+
+ default:
+ break;
}
- //dedicated resources for transmitting PS related discovery
- if (sl_DiscConfig->ext2->discTxResourcesPS_r13 != NULL){
- switch (sl_DiscConfig->ext2->discTxResourcesPS_r13->present) {
- case LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_setup:
- if (sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.present == LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_scheduled_r13) {
- //sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.choice.scheduled_r13.discHoppingConfig_r13;
- //sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.choice.scheduled_r13.discTxConfig_r13
- } else if (sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.present == LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_ue_Selected_r13) {
- //sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.choice.ue_Selected_r13.discTxPoolPS_Dedicated_r13;
- } else {
- //SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_NOTHING, /* No components present */
- }
+ }
- break;
- case LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_release:
- break;
- case LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_NOTHING:
- /* No components present */
- break;
- default:
- break;
- }
+ //dedicated resources for transmitting PS related discovery
+ if (sl_DiscConfig->ext2->discTxResourcesPS_r13 != NULL) {
+ switch (sl_DiscConfig->ext2->discTxResourcesPS_r13->present) {
+ case LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_setup:
+ if (sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.present == LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_scheduled_r13) {
+ //sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.choice.scheduled_r13.discHoppingConfig_r13;
+ //sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.choice.scheduled_r13.discTxConfig_r13
+ } else if (sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.present == LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_ue_Selected_r13) {
+ //sl_DiscConfig->ext2->discTxResourcesPS_r13->choice.setup.choice.ue_Selected_r13.discTxPoolPS_Dedicated_r13;
+ } else {
+ //SL_DiscConfig_r12__ext2__discTxResourcesPS_r13__setup_PR_NOTHING, /* No components present */
+ }
+
+ break;
+
+ case LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_release:
+ break;
+
+ case LTE_SL_DiscConfig_r12__ext2__discTxResourcesPS_r13_PR_NOTHING:
+ /* No components present */
+ break;
+
+ default:
+ break;
}
- }
+ }
+ }
}
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
//-----------------------------------------------------------
void
-rrc_control_socket_init(){
+rrc_control_socket_init() {
+ struct sockaddr_in rrc_ctrl_socket_addr;
+ pthread_attr_t attr;
+ struct sched_param sched_param;
+ int optval; // flag value for setsockopt
+ //int n; // message byte size
+ // create the control socket
+ ctrl_sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
- struct sockaddr_in rrc_ctrl_socket_addr;
- pthread_attr_t attr;
- struct sched_param sched_param;
- int optval; // flag value for setsockopt
- //int n; // message byte size
+ if (ctrl_sock_fd == -1) {
+ LOG_E(RRC,"[rrc_control_socket_init] :Error opening socket %d (%d:%s)\n",ctrl_sock_fd,errno, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ // if (ctrl_sock_fd < 0)
+ // error("ERROR: Failed on opening socket");
+ optval = 1;
+ setsockopt(ctrl_sock_fd, SOL_SOCKET, SO_REUSEADDR,
+ (const void *)&optval , sizeof(int));
+ //build the server's address
+ bzero((char *) &rrc_ctrl_socket_addr, sizeof(rrc_ctrl_socket_addr));
+ rrc_ctrl_socket_addr.sin_family = AF_INET;
+ rrc_ctrl_socket_addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ rrc_ctrl_socket_addr.sin_port = htons(CONTROL_SOCKET_PORT_NO);
- // create the control socket
- ctrl_sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (ctrl_sock_fd == -1) {
- LOG_E(RRC,"[rrc_control_socket_init] :Error opening socket %d (%d:%s)\n",ctrl_sock_fd,errno, strerror(errno));
- exit(EXIT_FAILURE);
- }
- // if (ctrl_sock_fd < 0)
- // error("ERROR: Failed on opening socket");
- optval = 1;
- setsockopt(ctrl_sock_fd, SOL_SOCKET, SO_REUSEADDR,
- (const void *)&optval , sizeof(int));
+ // associate the parent socket with a port
+ if (bind(ctrl_sock_fd, (struct sockaddr *) &rrc_ctrl_socket_addr,
+ sizeof(rrc_ctrl_socket_addr)) < 0) {
+ LOG_E(RRC,"[rrc_control_socket_init] ERROR: Failed on binding the socket\n");
+ exit(1);
+ }
- //build the server's address
- bzero((char *) &rrc_ctrl_socket_addr, sizeof(rrc_ctrl_socket_addr));
- rrc_ctrl_socket_addr.sin_family = AF_INET;
- rrc_ctrl_socket_addr.sin_addr.s_addr = htonl(INADDR_ANY);
- rrc_ctrl_socket_addr.sin_port = htons(CONTROL_SOCKET_PORT_NO);
- // associate the parent socket with a port
- if (bind(ctrl_sock_fd, (struct sockaddr *) &rrc_ctrl_socket_addr,
- sizeof(rrc_ctrl_socket_addr)) < 0) {
- LOG_E(RRC,"[rrc_control_socket_init] ERROR: Failed on binding the socket\n");
- exit(1);
- }
- //create thread to listen to incoming packets
- if (pthread_attr_init(&attr) != 0) {
- LOG_E(RRC, "[rrc_control_socket_init]Failed to initialize pthread attribute for ProSe -> RRC communication (%d:%s)\n",
- errno, strerror(errno));
- exit(EXIT_FAILURE);
- }
+ //create thread to listen to incoming packets
+ if (pthread_attr_init(&attr) != 0) {
+ LOG_E(RRC, "[rrc_control_socket_init]Failed to initialize pthread attribute for ProSe -> RRC communication (%d:%s)\n",
+ errno, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
- sched_param.sched_priority = 10;
+ sched_param.sched_priority = 10;
+ pthread_attr_setschedpolicy(&attr, SCHED_RR);
+ pthread_attr_setschedparam(&attr, &sched_param);
+ pthread_t rrc_control_socket_thread;
- pthread_attr_setschedpolicy(&attr, SCHED_RR);
- pthread_attr_setschedparam(&attr, &sched_param);
-
- pthread_t rrc_control_socket_thread;
-
- if (pthread_create(&rrc_control_socket_thread, &attr, rrc_control_socket_thread_fct, NULL) != 0) {
- LOG_E(RRC, "[rrc_control_socket_init]Failed to create new thread for RRC/ProSeApp communication (%d:%s)\n",
- errno, strerror(errno));
- exit(EXIT_FAILURE);
- }
-
- pthread_setname_np( rrc_control_socket_thread, "RRC Control Socket" );
+ if (pthread_create(&rrc_control_socket_thread, &attr, rrc_control_socket_thread_fct, NULL) != 0) {
+ LOG_E(RRC, "[rrc_control_socket_init]Failed to create new thread for RRC/ProSeApp communication (%d:%s)\n",
+ errno, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ pthread_setname_np( rrc_control_socket_thread, "RRC Control Socket" );
}
//--------------------------------------------------------
-void *rrc_control_socket_thread_fct(void *arg)
-{
+void *rrc_control_socket_thread_fct(void *arg) {
+ int prose_addr_len;
+ char send_buf[BUFSIZE];
+ char receive_buf[BUFSIZE];
+ //int optval;
+ int n;
+ struct sidelink_ctrl_element *sl_ctrl_msg_recv = NULL;
+ struct sidelink_ctrl_element *sl_ctrl_msg_send = NULL;
+ uint32_t sourceL2Id, groupL2Id, destinationL2Id;
+ module_id_t module_id = 0; //hardcoded for testing only
+ uint8_t type;
+ UE_RRC_INST *UE = NULL;
+ protocol_ctxt_t ctxt;
+ struct LTE_RLC_Config *DRB_rlc_config = NULL;
+ struct LTE_PDCP_Config *DRB_pdcp_config = NULL;
+ struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL;
+ struct LTE_LogicalChannelConfig *DRB_lchan_config = NULL;
+ struct LTE_LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters = NULL;
+ long *logicalchannelgroup_drb = NULL;
+ int j = 0;
+ int i = 0;
+ //from the main program, listen for the incoming messages from control socket (ProSe App)
+ prose_addr_len = sizeof(prose_app_addr);
- int prose_addr_len;
- char send_buf[BUFSIZE];
- char receive_buf[BUFSIZE];
- //int optval;
- int n;
- struct sidelink_ctrl_element *sl_ctrl_msg_recv = NULL;
- struct sidelink_ctrl_element *sl_ctrl_msg_send = NULL;
- uint32_t sourceL2Id, groupL2Id, destinationL2Id;
- module_id_t module_id = 0; //hardcoded for testing only
- uint8_t type;
- UE_RRC_INST *UE = NULL;
- protocol_ctxt_t ctxt;
- struct LTE_RLC_Config *DRB_rlc_config = NULL;
- struct LTE_PDCP_Config *DRB_pdcp_config = NULL;
- struct LTE_PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL;
- struct LTE_LogicalChannelConfig *DRB_lchan_config = NULL;
- struct LTE_LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters = NULL;
- long *logicalchannelgroup_drb = NULL;
- int j = 0;
- int i = 0;
+ //int enable_notification = 1;
+ while (1) {
+ LOG_I(RRC,"Listening to incoming connection from ProSe App \n");
+ // receive a message from ProSe App
+ memset(receive_buf, 0, BUFSIZE);
+ n = recvfrom(ctrl_sock_fd, receive_buf, BUFSIZE, 0,
+ (struct sockaddr *) &prose_app_addr, (socklen_t *)&prose_addr_len);
- //from the main program, listen for the incoming messages from control socket (ProSe App)
- prose_addr_len = sizeof(prose_app_addr);
- //int enable_notification = 1;
- while (1) {
- LOG_I(RRC,"Listening to incoming connection from ProSe App \n");
- // receive a message from ProSe App
- memset(receive_buf, 0, BUFSIZE);
- n = recvfrom(ctrl_sock_fd, receive_buf, BUFSIZE, 0,
- (struct sockaddr *) &prose_app_addr, (socklen_t *)&prose_addr_len);
- if (n < 0){
- LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n");
- exit(EXIT_FAILURE);
- }
- //TODO: should store the address of ProSeApp [UE_rrc_inst] to be able to send UE state notification to the App
+ if (n < 0) {
+ LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n");
+ exit(EXIT_FAILURE);
+ }
- //sl_ctrl_msg_recv = (struct sidelink_ctrl_element *) receive_buf;
- sl_ctrl_msg_recv = calloc(1, sizeof(struct sidelink_ctrl_element));
- memcpy((void *)sl_ctrl_msg_recv, (void *)receive_buf, sizeof(struct sidelink_ctrl_element));
+ //TODO: should store the address of ProSeApp [UE_rrc_inst] to be able to send UE state notification to the App
+ //sl_ctrl_msg_recv = (struct sidelink_ctrl_element *) receive_buf;
+ sl_ctrl_msg_recv = calloc(1, sizeof(struct sidelink_ctrl_element));
+ memcpy((void *)sl_ctrl_msg_recv, (void *)receive_buf, sizeof(struct sidelink_ctrl_element));
- //process the message
- switch (sl_ctrl_msg_recv->type) {
+ //process the message
+ switch (sl_ctrl_msg_recv->type) {
case SESSION_INIT_REQ:
- if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)){
- LOG_UI(RRC,"Received SessionInitializationRequest on socket from ProSe App (msg type: %d)\n", sl_ctrl_msg_recv->type);
- }
- //TODO: get SL_UE_STATE from lower layer
+ if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)) {
+ LOG_UI(RRC,"Received SessionInitializationRequest on socket from ProSe App (msg type: %d)\n", sl_ctrl_msg_recv->type);
+ }
- LOG_I(RRC,"Send UEStateInformation to ProSe App \n");
- memset(send_buf, 0, BUFSIZE);
+ //TODO: get SL_UE_STATE from lower layer
+ LOG_I(RRC,"Send UEStateInformation to ProSe App \n");
+ memset(send_buf, 0, BUFSIZE);
+ sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
+ sl_ctrl_msg_send->type = UE_STATUS_INFO;
+ sl_ctrl_msg_send->sidelinkPrimitive.ue_state = UE_STATE_OFF_NETWORK; //off-network
+ memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
+ free(sl_ctrl_msg_send);
+ prose_addr_len = sizeof(prose_app_addr);
+ n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
- sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
- sl_ctrl_msg_send->type = UE_STATUS_INFO;
- sl_ctrl_msg_send->sidelinkPrimitive.ue_state = UE_STATE_OFF_NETWORK; //off-network
- memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
- free(sl_ctrl_msg_send);
+ if (n < 0) {
+ LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
+ exit(EXIT_FAILURE);
+ }
- prose_addr_len = sizeof(prose_app_addr);
- n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
- if (n < 0) {
- LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
- exit(EXIT_FAILURE);
- }
+ if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)) {
+ struct sidelink_ctrl_element *ptr_ctrl_msg = NULL;
+ ptr_ctrl_msg = (struct sidelink_ctrl_element *) send_buf;
+ LOG_UI(RRC,"[UEStateInformation] msg type: %d\n",ptr_ctrl_msg->type);
+ LOG_UI(RRC,"[UEStateInformation] UE state: %d\n",ptr_ctrl_msg->sidelinkPrimitive.ue_state);
+ }
- if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)){
- struct sidelink_ctrl_element *ptr_ctrl_msg = NULL;
- ptr_ctrl_msg = (struct sidelink_ctrl_element *) send_buf;
- LOG_UI(RRC,"[UEStateInformation] msg type: %d\n",ptr_ctrl_msg->type);
- LOG_UI(RRC,"[UEStateInformation] UE state: %d\n",ptr_ctrl_msg->sidelinkPrimitive.ue_state);
- }
- /* if (enable_notification > 0) {
- //create thread to send status notification (for testing purpose, status notification will be sent e.g., every 20 seconds)
- pthread_t notification_thread;
- if( pthread_create( ¬ification_thread , NULL , send_UE_status_notification , (void*) &sockfd) < 0)
- error("ERROR: could not create thread");
- }
- enable_notification = 0;
- */
- break;
+ /* if (enable_notification > 0) {
+ //create thread to send status notification (for testing purpose, status notification will be sent e.g., every 20 seconds)
+ pthread_t notification_thread;
+ if( pthread_create( ¬ification_thread , NULL , send_UE_status_notification , (void*) &sockfd) < 0)
+ error("ERROR: could not create thread");
+ }
+ enable_notification = 0;
+ */
+ break;
case GROUP_COMMUNICATION_ESTABLISH_REQ:
- sourceL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.sourceL2Id;
- groupL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id;
+ sourceL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.sourceL2Id;
+ groupL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id;
- if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)){
- LOG_UI(RRC,"[GroupCommunicationEstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
- LOG_UI(RRC,"[GroupCommunicationEstablishReq] source Id: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.sourceL2Id);
- LOG_UI(RRC,"[GroupCommunicationEstablishReq] group Id: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id);
- LOG_UI(RRC,"[GroupCommunicationEstablishReq] group IP Address: " IPV4_ADDR "\n",IPV4_ADDR_FORMAT(sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupIpAddress));
- }
+ if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)) {
+ LOG_UI(RRC,"[GroupCommunicationEstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
+ LOG_UI(RRC,"[GroupCommunicationEstablishReq] source Id: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.sourceL2Id);
+ LOG_UI(RRC,"[GroupCommunicationEstablishReq] group Id: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id);
+ LOG_UI(RRC,"[GroupCommunicationEstablishReq] group IP Address: " IPV4_ADDR "\n",IPV4_ADDR_FORMAT(sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupIpAddress));
+ }
- //store sourceL2Id/groupL2Id
- UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
- UE_rrc_inst[module_id].groupL2Id = groupL2Id;
- j = 0;
- i = 0;
- for (i=0; i< MAX_NUM_DEST; i++) {
- if ((UE_rrc_inst[module_id].destinationList[i] == 0) && (j == 0)) j = i+1;
- if (UE_rrc_inst[module_id].destinationList[i] == groupL2Id) break; //group already exists!
- }
- if ((i == MAX_NUM_DEST) && (j > 0)) UE_mac_inst[module_id].destinationList[j-1] = groupL2Id;
+ //store sourceL2Id/groupL2Id
+ UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
+ UE_rrc_inst[module_id].groupL2Id = groupL2Id;
+ j = 0;
+ i = 0;
- // configure lower layers PDCP/MAC/PHY for this communication
- //Establish a new RBID/LCID for this communication
- // Establish a SLRB (using DRB 3 for now)
- UE = &UE_rrc_inst[module_id];
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
+ for (i=0; i< MAX_NUM_DEST; i++) {
+ if ((UE_rrc_inst[module_id].destinationList[i] == 0) && (j == 0)) j = i+1;
- UE->DRB_config[0][0] = CALLOC(1,sizeof(struct LTE_DRB_ToAddMod));
- UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
- UE->DRB_config[0][0]->drb_Identity = 3;
- UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
- // allowed value 5..15, value : x+4
- *(UE->DRB_config[0][0]->eps_BearerIdentity) = 3;
- UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long));
- *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
+ if (UE_rrc_inst[module_id].destinationList[i] == groupL2Id) break; //group already exists!
+ }
- DRB_rlc_config = CALLOC(1,sizeof(struct LTE_RLC_Config));
- DRB_pdcp_config = CALLOC(1,sizeof(struct LTE_PDCP_Config));
- PDCP_rlc_UM = CALLOC(1,sizeof(struct LTE_PDCP_Config__rlc_UM));
- DRB_lchan_config = CALLOC(1,sizeof(struct LTE_LogicalChannelConfig));
- DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LTE_LogicalChannelConfig__ul_SpecificParameters));
- logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+ if ((i == MAX_NUM_DEST) && (j > 0)) UE_mac_inst[module_id].destinationList[j-1] = groupL2Id;
- DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional;
- DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
- DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
- DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35;
- UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config;
-
- DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
- UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config;
- DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
- *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity;
- DRB_pdcp_config->rlc_AM = NULL;
- DRB_pdcp_config->rlc_UM = NULL;
-
- /* avoid gcc warnings */
- (void)PDCP_rlc_UM;
-
- DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
- PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
- DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed;
-
- UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config;
- DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
- DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
-
- DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer
- DRB_ul_SpecificParameters->prioritisedBitRate =LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
- //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
- DRB_ul_SpecificParameters->bucketSizeDuration =
- LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
-
- // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
-
- *logicalchannelgroup_drb = 1;
- DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
-
- UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t));
- ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]);
-
- rrc_pdcp_config_asn1_req(&ctxt,
- (LTE_SRB_ToAddModList_t *) NULL,
- UE->DRB_configList,
- (LTE_DRB_ToReleaseList_t*) NULL,
- 0xff, NULL, NULL, NULL
+ // configure lower layers PDCP/MAC/PHY for this communication
+ //Establish a new RBID/LCID for this communication
+ // Establish a SLRB (using DRB 3 for now)
+ UE = &UE_rrc_inst[module_id];
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
+ UE->DRB_config[0][0] = CALLOC(1,sizeof(struct LTE_DRB_ToAddMod));
+ UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
+ UE->DRB_config[0][0]->drb_Identity = 3;
+ UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
+ // allowed value 5..15, value : x+4
+ *(UE->DRB_config[0][0]->eps_BearerIdentity) = 3;
+ UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long));
+ *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
+ DRB_rlc_config = CALLOC(1,sizeof(struct LTE_RLC_Config));
+ DRB_pdcp_config = CALLOC(1,sizeof(struct LTE_PDCP_Config));
+ PDCP_rlc_UM = CALLOC(1,sizeof(struct LTE_PDCP_Config__rlc_UM));
+ DRB_lchan_config = CALLOC(1,sizeof(struct LTE_LogicalChannelConfig));
+ DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LTE_LogicalChannelConfig__ul_SpecificParameters));
+ logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+ DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional;
+ DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
+ DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
+ DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35;
+ UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config;
+ DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
+ UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config;
+ DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
+ *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity;
+ DRB_pdcp_config->rlc_AM = NULL;
+ DRB_pdcp_config->rlc_UM = NULL;
+ /* avoid gcc warnings */
+ (void)PDCP_rlc_UM;
+ DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+ PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+ DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed;
+ UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config;
+ DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
+ DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
+ DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer
+ DRB_ul_SpecificParameters->prioritisedBitRate =LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
+ //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+ DRB_ul_SpecificParameters->bucketSizeDuration =
+ LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+ // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
+ *logicalchannelgroup_drb = 1;
+ DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
+ UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t));
+ ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]);
+ rrc_pdcp_config_asn1_req(&ctxt,
+ (LTE_SRB_ToAddModList_t *) NULL,
+ UE->DRB_configList,
+ (LTE_DRB_ToReleaseList_t *) NULL,
+ 0xff, NULL, NULL, NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- , (LTE_PMCH_InfoList_r9_t *) NULL
+ , (LTE_PMCH_InfoList_r9_t *) NULL
#endif
- ,NULL);
-
-
- rrc_rlc_config_asn1_req(&ctxt,
- (LTE_SRB_ToAddModList_t*)NULL,
- UE->DRB_configList,
- (LTE_DRB_ToReleaseList_t*)NULL
+ ,NULL);
+ rrc_rlc_config_asn1_req(&ctxt,
+ (LTE_SRB_ToAddModList_t *)NULL,
+ UE->DRB_configList,
+ (LTE_DRB_ToReleaseList_t *)NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,(LTE_PMCH_InfoList_r9_t *)NULL
- , 0, 0
+ ,(LTE_PMCH_InfoList_r9_t *)NULL
+ , 0, 0
#endif
- );
-
- rrc_rlc_config_asn1_req(&ctxt,
- (LTE_SRB_ToAddModList_t*)NULL,
- UE->DRB_configList,
- (LTE_DRB_ToReleaseList_t*)NULL
+ );
+ rrc_rlc_config_asn1_req(&ctxt,
+ (LTE_SRB_ToAddModList_t *)NULL,
+ UE->DRB_configList,
+ (LTE_DRB_ToReleaseList_t *)NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,(LTE_PMCH_InfoList_r9_t *)NULL
- , sourceL2Id, groupL2Id
+ ,(LTE_PMCH_InfoList_r9_t *)NULL
+ , sourceL2Id, groupL2Id
#endif
- );
-
-
- //configure MAC with sourceL2Id/groupL2ID
- rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- (struct LTE_PhysicalConfigDedicated *)NULL,
+ );
+ //configure MAC with sourceL2Id/groupL2ID
+ rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- (LTE_MAC_MainConfig_t *)NULL,
- 3, //LCID
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- (LTE_TDD_Config_t *)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ (LTE_MAC_MainConfig_t *)NULL,
+ 3, //LCID
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
-
+ ,0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,
- 0,
- 0
+ ,
+ 0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,CONFIG_ACTION_ADD,
- &sourceL2Id,
- &groupL2Id
+ ,CONFIG_ACTION_ADD,
+ &sourceL2Id,
+ &groupL2Id
#endif
- );
+ );
+ LOG_I(RRC,"Send GroupCommunicationEstablishResp to ProSe App\n");
+ memset(send_buf, 0, BUFSIZE);
+ sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
+ sl_ctrl_msg_send->type = GROUP_COMMUNICATION_ESTABLISH_RSP;
+ sl_ctrl_msg_send->sidelinkPrimitive.slrb_id = 3; //slrb_id
+ memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
+ free(sl_ctrl_msg_send);
+ prose_addr_len = sizeof(prose_app_addr);
+ n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
- LOG_I(RRC,"Send GroupCommunicationEstablishResp to ProSe App\n");
- memset(send_buf, 0, BUFSIZE);
- sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
- sl_ctrl_msg_send->type = GROUP_COMMUNICATION_ESTABLISH_RSP;
- sl_ctrl_msg_send->sidelinkPrimitive.slrb_id = 3; //slrb_id
+ if (n < 0) {
+ LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
+ exit(EXIT_FAILURE);
+ }
- memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
- free(sl_ctrl_msg_send);
+ if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)) {
+ struct sidelink_ctrl_element *ptr_ctrl_msg = NULL;
+ ptr_ctrl_msg = (struct sidelink_ctrl_element *) send_buf;
+ LOG_UI(RRC,"[GroupCommunicationEstablishResponse] msg type: %d\n",ptr_ctrl_msg->type);
+ LOG_UI(RRC,"[GroupCommunicationEstablishResponse] slrb_id: %d\n",ptr_ctrl_msg->sidelinkPrimitive.slrb_id);
+ }
- prose_addr_len = sizeof(prose_app_addr);
- n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
- if (n < 0){
- LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
- exit(EXIT_FAILURE);
- }
-
- if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)){
- struct sidelink_ctrl_element *ptr_ctrl_msg = NULL;
- ptr_ctrl_msg = (struct sidelink_ctrl_element *) send_buf;
- LOG_UI(RRC,"[GroupCommunicationEstablishResponse] msg type: %d\n",ptr_ctrl_msg->type);
- LOG_UI(RRC,"[GroupCommunicationEstablishResponse] slrb_id: %d\n",ptr_ctrl_msg->sidelinkPrimitive.slrb_id);
- }
- break;
+ break;
case GROUP_COMMUNICATION_RELEASE_REQ:
- printf("-----------------------------------\n");
- if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)){
- LOG_UI(RRC,"[GroupCommunicationReleaseRequest] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
- LOG_UI(RRC,"[GroupCommunicationReleaseRequest] Slrb Id: %i\n",sl_ctrl_msg_recv->sidelinkPrimitive.slrb_id);
- }
- //reset groupL2ID from MAC LAYER
- UE_rrc_inst[module_id].groupL2Id = 0x00000000;
- sourceL2Id = UE_rrc_inst[module_id].sourceL2Id;
+ printf("-----------------------------------\n");
- rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- (struct LTE_PhysicalConfigDedicated *)NULL,
- #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
- #endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- (LTE_MAC_MainConfig_t *)NULL,
- 0,
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- (LTE_TDD_Config_t *)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
- #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
+ if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)) {
+ LOG_UI(RRC,"[GroupCommunicationReleaseRequest] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
+ LOG_UI(RRC,"[GroupCommunicationReleaseRequest] Slrb Id: %i\n",sl_ctrl_msg_recv->sidelinkPrimitive.slrb_id);
+ }
- #endif
- #ifdef CBA
- ,
- 0,
- 0
- #endif
- #if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,CONFIG_ACTION_REMOVE,
- &sourceL2Id,
- &destinationL2Id
- #endif
- );
+ //reset groupL2ID from MAC LAYER
+ UE_rrc_inst[module_id].groupL2Id = 0x00000000;
+ sourceL2Id = UE_rrc_inst[module_id].sourceL2Id;
+ rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
+#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+#endif
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ (LTE_MAC_MainConfig_t *)NULL,
+ 0,
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+ ,0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
+#endif
+#ifdef CBA
+ ,
+ 0,
+ 0
+#endif
+#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+ ,CONFIG_ACTION_REMOVE,
+ &sourceL2Id,
+ &destinationL2Id
+#endif
+ );
+ LOG_I(RRC,"Send GroupCommunicationReleaseResponse to ProSe App \n");
+ memset(send_buf, 0, BUFSIZE);
+ sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
+ sl_ctrl_msg_send->type = GROUP_COMMUNICATION_RELEASE_RSP;
+ //if the requested id exists -> release this ID
+ if (sl_ctrl_msg_recv->sidelinkPrimitive.slrb_id == slrb_id) {
+ sl_ctrl_msg_send->sidelinkPrimitive.group_comm_release_rsp = GROUP_COMMUNICATION_RELEASE_OK;
+ slrb_id = 0; //Reset slrb_id
+ } else {
+ sl_ctrl_msg_send->sidelinkPrimitive.group_comm_release_rsp = GROUP_COMMUNICATION_RELEASE_FAILURE;
+ }
- LOG_I(RRC,"Send GroupCommunicationReleaseResponse to ProSe App \n");
- memset(send_buf, 0, BUFSIZE);
+ memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
+ free(sl_ctrl_msg_send);
+ prose_addr_len = sizeof(prose_app_addr);
+ n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
- sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
- sl_ctrl_msg_send->type = GROUP_COMMUNICATION_RELEASE_RSP;
- //if the requested id exists -> release this ID
- if (sl_ctrl_msg_recv->sidelinkPrimitive.slrb_id == slrb_id) {
- sl_ctrl_msg_send->sidelinkPrimitive.group_comm_release_rsp = GROUP_COMMUNICATION_RELEASE_OK;
- slrb_id = 0; //Reset slrb_id
- } else {
- sl_ctrl_msg_send->sidelinkPrimitive.group_comm_release_rsp = GROUP_COMMUNICATION_RELEASE_FAILURE;
- }
- memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
- free(sl_ctrl_msg_send);
-
- prose_addr_len = sizeof(prose_app_addr);
- n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
- if (n < 0){
- LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
- exit(EXIT_FAILURE);
- }
- break;
+ if (n < 0) {
+ LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
+ exit(EXIT_FAILURE);
+ }
+ break;
case DIRECT_COMMUNICATION_ESTABLISH_REQ:
- sourceL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.direct_comm_establish_req.sourceL2Id;
- destinationL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.direct_comm_establish_req.destinationL2Id;
+ sourceL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.direct_comm_establish_req.sourceL2Id;
+ destinationL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.direct_comm_establish_req.destinationL2Id;
- if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)){
- LOG_UI(RRC,"[DirectCommunicationEstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
- LOG_UI(RRC,"[DirectCommunicationEstablishReq] source Id: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.sourceL2Id);
- LOG_UI(RRC,"[DirectCommunicationEstablishReq] destination Id: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id);
- }
+ if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)) {
+ LOG_UI(RRC,"[DirectCommunicationEstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
+ LOG_UI(RRC,"[DirectCommunicationEstablishReq] source Id: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.sourceL2Id);
+ LOG_UI(RRC,"[DirectCommunicationEstablishReq] destination Id: 0x%08x\n",sl_ctrl_msg_recv->sidelinkPrimitive.group_comm_establish_req.groupL2Id);
+ }
- //store sourceL2Id/destinationL2Id
- UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
- i = 0;
- j = 0;
- for (i=0; i< MAX_NUM_DEST; i++) {
- if ((UE_rrc_inst[module_id].destinationList[i] == 0) && (j == 0)) j = i+1;
- if (UE_rrc_inst[module_id].destinationList[i] == destinationL2Id) break; //destination already exists!
- }
- if ((i == MAX_NUM_DEST) && (j > 0)) UE_mac_inst[module_id].destinationList[j-1] = destinationL2Id;
+ //store sourceL2Id/destinationL2Id
+ UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
+ i = 0;
+ j = 0;
- // configure lower layers PDCP/MAC/PHY for this communication
- //Establish a new RBID/LCID for this communication
- // Establish a SLRB (using DRB 3 for now)
- UE = &UE_rrc_inst[module_id];
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
+ for (i=0; i< MAX_NUM_DEST; i++) {
+ if ((UE_rrc_inst[module_id].destinationList[i] == 0) && (j == 0)) j = i+1;
- UE->DRB_config[0][0] = CALLOC(1,sizeof(struct LTE_DRB_ToAddMod));
- UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
- UE->DRB_config[0][0]->drb_Identity = 3;
- UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
- // allowed value 5..15, value : x+4
- *(UE->DRB_config[0][0]->eps_BearerIdentity) = 3;
- UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long));
- *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
+ if (UE_rrc_inst[module_id].destinationList[i] == destinationL2Id) break; //destination already exists!
+ }
- DRB_rlc_config = CALLOC(1,sizeof(struct LTE_RLC_Config));
- DRB_pdcp_config = CALLOC(1,sizeof(struct LTE_PDCP_Config));
- PDCP_rlc_UM = CALLOC(1,sizeof(struct LTE_PDCP_Config__rlc_UM));
- DRB_lchan_config = CALLOC(1,sizeof(struct LTE_LogicalChannelConfig));
- DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LTE_LogicalChannelConfig__ul_SpecificParameters));
- logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+ if ((i == MAX_NUM_DEST) && (j > 0)) UE_mac_inst[module_id].destinationList[j-1] = destinationL2Id;
- DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional;
- DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
- DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
- DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35;
- UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config;
-
- DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
- UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config;
- DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
- *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity;
- DRB_pdcp_config->rlc_AM = NULL;
- DRB_pdcp_config->rlc_UM = NULL;
-
- /* avoid gcc warnings */
- (void)PDCP_rlc_UM;
-
- DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
- PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
- DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed;
-
- UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config;
- DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
- DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
-
- DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer
- DRB_ul_SpecificParameters->prioritisedBitRate =LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
- //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
- DRB_ul_SpecificParameters->bucketSizeDuration =
- LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
-
- // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
-
- *logicalchannelgroup_drb = 1;
- DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
-
- UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t));
- ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]);
-
- rrc_pdcp_config_asn1_req(&ctxt,
- (LTE_SRB_ToAddModList_t *) NULL,
- UE->DRB_configList,
- (LTE_DRB_ToReleaseList_t*) NULL,
- 0xff, NULL, NULL, NULL
+ // configure lower layers PDCP/MAC/PHY for this communication
+ //Establish a new RBID/LCID for this communication
+ // Establish a SLRB (using DRB 3 for now)
+ UE = &UE_rrc_inst[module_id];
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
+ UE->DRB_config[0][0] = CALLOC(1,sizeof(struct LTE_DRB_ToAddMod));
+ UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
+ UE->DRB_config[0][0]->drb_Identity = 3;
+ UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
+ // allowed value 5..15, value : x+4
+ *(UE->DRB_config[0][0]->eps_BearerIdentity) = 3;
+ UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long));
+ *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
+ DRB_rlc_config = CALLOC(1,sizeof(struct LTE_RLC_Config));
+ DRB_pdcp_config = CALLOC(1,sizeof(struct LTE_PDCP_Config));
+ PDCP_rlc_UM = CALLOC(1,sizeof(struct LTE_PDCP_Config__rlc_UM));
+ DRB_lchan_config = CALLOC(1,sizeof(struct LTE_LogicalChannelConfig));
+ DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LTE_LogicalChannelConfig__ul_SpecificParameters));
+ logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+ DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional;
+ DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
+ DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
+ DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35;
+ UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config;
+ DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
+ UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config;
+ DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
+ *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity;
+ DRB_pdcp_config->rlc_AM = NULL;
+ DRB_pdcp_config->rlc_UM = NULL;
+ /* avoid gcc warnings */
+ (void)PDCP_rlc_UM;
+ DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+ PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+ DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed;
+ UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config;
+ DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
+ DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
+ DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer
+ DRB_ul_SpecificParameters->prioritisedBitRate =LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
+ //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+ DRB_ul_SpecificParameters->bucketSizeDuration =
+ LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+ // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
+ *logicalchannelgroup_drb = 1;
+ DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
+ UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t));
+ ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]);
+ rrc_pdcp_config_asn1_req(&ctxt,
+ (LTE_SRB_ToAddModList_t *) NULL,
+ UE->DRB_configList,
+ (LTE_DRB_ToReleaseList_t *) NULL,
+ 0xff, NULL, NULL, NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- , (LTE_PMCH_InfoList_r9_t *) NULL
+ , (LTE_PMCH_InfoList_r9_t *) NULL
#endif
- ,NULL);
-
-
- rrc_rlc_config_asn1_req(&ctxt,
- (LTE_SRB_ToAddModList_t*)NULL,
- UE->DRB_configList,
- (LTE_DRB_ToReleaseList_t*)NULL
+ ,NULL);
+ rrc_rlc_config_asn1_req(&ctxt,
+ (LTE_SRB_ToAddModList_t *)NULL,
+ UE->DRB_configList,
+ (LTE_DRB_ToReleaseList_t *)NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,(LTE_PMCH_InfoList_r9_t *)NULL
- , 0, 0
+ ,(LTE_PMCH_InfoList_r9_t *)NULL
+ , 0, 0
#endif
- );
-
- rrc_rlc_config_asn1_req(&ctxt,
- (LTE_SRB_ToAddModList_t*)NULL,
- UE->DRB_configList,
- (LTE_DRB_ToReleaseList_t*)NULL
+ );
+ rrc_rlc_config_asn1_req(&ctxt,
+ (LTE_SRB_ToAddModList_t *)NULL,
+ UE->DRB_configList,
+ (LTE_DRB_ToReleaseList_t *)NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,(LTE_PMCH_InfoList_r9_t *)NULL
- , sourceL2Id, destinationL2Id
+ ,(LTE_PMCH_InfoList_r9_t *)NULL
+ , sourceL2Id, destinationL2Id
#endif
- );
-
-
- //configure MAC with sourceL2Id/destinationL2Id
- rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- (struct LTE_PhysicalConfigDedicated *)NULL,
+ );
+ //configure MAC with sourceL2Id/destinationL2Id
+ rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- (LTE_MAC_MainConfig_t *)NULL,
- 3, //LCID
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- (LTE_TDD_Config_t *)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ (LTE_MAC_MainConfig_t *)NULL,
+ 3, //LCID
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
-
+ ,0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,
- 0,
- 0
+ ,
+ 0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,CONFIG_ACTION_ADD,
- &sourceL2Id,
- &destinationL2Id
+ ,CONFIG_ACTION_ADD,
+ &sourceL2Id,
+ &destinationL2Id
#endif
- );
+ );
+ LOG_I(RRC,"Send DirectCommunicationEstablishResp to ProSe App\n");
+ memset(send_buf, 0, BUFSIZE);
+ sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
+ sl_ctrl_msg_send->type = DIRECT_COMMUNICATION_ESTABLISH_RSP;
+ sl_ctrl_msg_send->sidelinkPrimitive.slrb_id = 3; //slrb_id
+ memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
+ free(sl_ctrl_msg_send);
+ prose_addr_len = sizeof(prose_app_addr);
+ n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
- LOG_I(RRC,"Send DirectCommunicationEstablishResp to ProSe App\n");
- memset(send_buf, 0, BUFSIZE);
- sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
- sl_ctrl_msg_send->type = DIRECT_COMMUNICATION_ESTABLISH_RSP;
- sl_ctrl_msg_send->sidelinkPrimitive.slrb_id = 3; //slrb_id
+ if (n < 0) {
+ LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
+ exit(EXIT_FAILURE);
+ }
- memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
- free(sl_ctrl_msg_send);
+ if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)) {
+ struct sidelink_ctrl_element *ptr_ctrl_msg = NULL;
+ ptr_ctrl_msg = (struct sidelink_ctrl_element *) send_buf;
+ LOG_UI(RRC,"[DirectCommunicationEstablishResponse] msg type: %d\n",ptr_ctrl_msg->type);
+ LOG_UI(RRC,"[DirectCommunicationEstablishResponse] slrb_id: %d\n",ptr_ctrl_msg->sidelinkPrimitive.slrb_id);
+ }
- prose_addr_len = sizeof(prose_app_addr);
- n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
- if (n < 0){
- LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
- exit(EXIT_FAILURE);
- }
-
-
- if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)){
- struct sidelink_ctrl_element *ptr_ctrl_msg = NULL;
- ptr_ctrl_msg = (struct sidelink_ctrl_element *) send_buf;
- LOG_UI(RRC,"[DirectCommunicationEstablishResponse] msg type: %d\n",ptr_ctrl_msg->type);
- LOG_UI(RRC,"[DirectCommunicationEstablishResponse] slrb_id: %d\n",ptr_ctrl_msg->sidelinkPrimitive.slrb_id);
- }
- break;
+ break;
case PC5S_ESTABLISH_REQ:
- type = sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.type;
- sourceL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.sourceL2Id;
- if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)){
- LOG_UI(RRC,"[PC5EstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
- LOG_UI(RRC,"[PC5EstablishReq] type: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.type); //RX/TX
- LOG_UI(RRC,"[PC5EstablishReq] source Id: 0x%08x \n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.sourceL2Id);
- }
- if (type > 0) {
- destinationL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.destinationL2Id;
- if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)){
- LOG_UI(RRC,"[PC5EstablishReq] destination Id: 0x%08x \n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.destinationL2Id);
- }
- }
+ type = sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.type;
+ sourceL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.sourceL2Id;
- //store sourceL2Id/destinationL2Id
- if (type > 0) { //TX
- UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
- j = 0;
- i = 0;
- for (i=0; i< MAX_NUM_DEST; i++) {
- if ((UE_rrc_inst[module_id].destinationList[i] == 0) && (j == 0)) j = i+1;
- if (UE_rrc_inst[module_id].destinationList[i] == destinationL2Id) break; //group already exists!
- }
- if ((i == MAX_NUM_DEST) && (j > 0)) UE_mac_inst[module_id].destinationList[j-1] = destinationL2Id;
- } else {//RX
- UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
- }
+ if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)) {
+ LOG_UI(RRC,"[PC5EstablishReq] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
+ LOG_UI(RRC,"[PC5EstablishReq] type: %d\n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.type); //RX/TX
+ LOG_UI(RRC,"[PC5EstablishReq] source Id: 0x%08x \n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.sourceL2Id);
+ }
- // configure lower layers PDCP/MAC/PHY for this communication
- //Establish a new RBID/LCID for this communication
- // Establish a SLRB (using DRB 10 for now)
- UE = &UE_rrc_inst[module_id];
- PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
+ if (type > 0) {
+ destinationL2Id = sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.destinationL2Id;
- UE->DRB_config[0][0] = CALLOC(1,sizeof(struct LTE_DRB_ToAddMod));
- UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
- UE->DRB_config[0][0]->drb_Identity = 10;
- UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
- // allowed value 5..15, value : x+4
- *(UE->DRB_config[0][0]->eps_BearerIdentity) = 10;
- UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long));
- *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
+ if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)) {
+ LOG_UI(RRC,"[PC5EstablishReq] destination Id: 0x%08x \n",sl_ctrl_msg_recv->sidelinkPrimitive.pc5s_establish_req.destinationL2Id);
+ }
+ }
- DRB_rlc_config = CALLOC(1,sizeof(struct LTE_RLC_Config));
- DRB_pdcp_config = CALLOC(1,sizeof(struct LTE_PDCP_Config));
- PDCP_rlc_UM = CALLOC(1,sizeof(struct LTE_PDCP_Config__rlc_UM));
- DRB_lchan_config = CALLOC(1,sizeof(struct LTE_LogicalChannelConfig));
- DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LTE_LogicalChannelConfig__ul_SpecificParameters));
- logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+ //store sourceL2Id/destinationL2Id
+ if (type > 0) { //TX
+ UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
+ j = 0;
+ i = 0;
- DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional;
- DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
- DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
- DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35;
- UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config;
+ for (i=0; i< MAX_NUM_DEST; i++) {
+ if ((UE_rrc_inst[module_id].destinationList[i] == 0) && (j == 0)) j = i+1;
- DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
- UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config;
- DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
- *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity;
- DRB_pdcp_config->rlc_AM = NULL;
- DRB_pdcp_config->rlc_UM = NULL;
+ if (UE_rrc_inst[module_id].destinationList[i] == destinationL2Id) break; //group already exists!
+ }
- /* avoid gcc warnings */
- (void)PDCP_rlc_UM;
+ if ((i == MAX_NUM_DEST) && (j > 0)) UE_mac_inst[module_id].destinationList[j-1] = destinationL2Id;
+ } else {//RX
+ UE_rrc_inst[module_id].sourceL2Id = sourceL2Id;
+ }
- DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
- PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
- DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed;
-
- UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config;
- DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
- DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
-
- DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer
- DRB_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
- //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
- DRB_ul_SpecificParameters->bucketSizeDuration =
- LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
-
- // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
-
- *logicalchannelgroup_drb = 1;
- DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
-
- UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t));
- ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]);
-
- rrc_pdcp_config_asn1_req(&ctxt,
- (LTE_SRB_ToAddModList_t *) NULL,
- UE->DRB_configList,
- (LTE_DRB_ToReleaseList_t*) NULL,
- 0xff, NULL, NULL, NULL
+ // configure lower layers PDCP/MAC/PHY for this communication
+ //Establish a new RBID/LCID for this communication
+ // Establish a SLRB (using DRB 10 for now)
+ UE = &UE_rrc_inst[module_id];
+ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, ENB_FLAG_NO, 0x1234, 0, 0,0);
+ UE->DRB_config[0][0] = CALLOC(1,sizeof(struct LTE_DRB_ToAddMod));
+ UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
+ UE->DRB_config[0][0]->drb_Identity = 10;
+ UE->DRB_config[0][0]->eps_BearerIdentity = CALLOC(1, sizeof(long));
+ // allowed value 5..15, value : x+4
+ *(UE->DRB_config[0][0]->eps_BearerIdentity) = 10;
+ UE->DRB_config[0][0]->logicalChannelIdentity = CALLOC(1, sizeof(long));
+ *(UE->DRB_config[0][0]->logicalChannelIdentity) = UE->DRB_config[0][0]->drb_Identity; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2
+ DRB_rlc_config = CALLOC(1,sizeof(struct LTE_RLC_Config));
+ DRB_pdcp_config = CALLOC(1,sizeof(struct LTE_PDCP_Config));
+ PDCP_rlc_UM = CALLOC(1,sizeof(struct LTE_PDCP_Config__rlc_UM));
+ DRB_lchan_config = CALLOC(1,sizeof(struct LTE_LogicalChannelConfig));
+ DRB_ul_SpecificParameters = CALLOC(1, sizeof(struct LTE_LogicalChannelConfig__ul_SpecificParameters));
+ logicalchannelgroup_drb = CALLOC(1, sizeof(long));
+ DRB_rlc_config->present = LTE_RLC_Config_PR_um_Bi_Directional;
+ DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
+ DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = LTE_SN_FieldLength_size10;
+ DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = LTE_T_Reordering_ms35;
+ UE->DRB_config[0][0]->rlc_Config = DRB_rlc_config;
+ DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
+ UE->DRB_config[0][0]->pdcp_Config = DRB_pdcp_config;
+ DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
+ *DRB_pdcp_config->discardTimer = LTE_PDCP_Config__discardTimer_infinity;
+ DRB_pdcp_config->rlc_AM = NULL;
+ DRB_pdcp_config->rlc_UM = NULL;
+ /* avoid gcc warnings */
+ (void)PDCP_rlc_UM;
+ DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
+ PDCP_rlc_UM->pdcp_SN_Size = LTE_PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
+ DRB_pdcp_config->headerCompression.present = LTE_PDCP_Config__headerCompression_PR_notUsed;
+ UE->DRB_config[0][0]->logicalChannelConfig = DRB_lchan_config;
+ DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters));
+ DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters;
+ DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer
+ DRB_ul_SpecificParameters->prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ;
+ //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+ DRB_ul_SpecificParameters->bucketSizeDuration =
+ LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+ // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
+ *logicalchannelgroup_drb = 1;
+ DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
+ UE->DRB_configList = CALLOC(1,sizeof(LTE_DRB_ToAddModList_t));
+ ASN_SEQUENCE_ADD(&UE->DRB_configList->list,UE->DRB_config[0][0]);
+ rrc_pdcp_config_asn1_req(&ctxt,
+ (LTE_SRB_ToAddModList_t *) NULL,
+ UE->DRB_configList,
+ (LTE_DRB_ToReleaseList_t *) NULL,
+ 0xff, NULL, NULL, NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- , (LTE_PMCH_InfoList_r9_t *) NULL
+ , (LTE_PMCH_InfoList_r9_t *) NULL
#endif
- ,NULL);
-
-
- rrc_rlc_config_asn1_req(&ctxt,
- (LTE_SRB_ToAddModList_t*)NULL,
- UE->DRB_configList,
- (LTE_DRB_ToReleaseList_t*)NULL
+ ,NULL);
+ rrc_rlc_config_asn1_req(&ctxt,
+ (LTE_SRB_ToAddModList_t *)NULL,
+ UE->DRB_configList,
+ (LTE_DRB_ToReleaseList_t *)NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,(LTE_PMCH_InfoList_r9_t *)NULL
- , 0, 0
+ ,(LTE_PMCH_InfoList_r9_t *)NULL
+ , 0, 0
#endif
- );
+ );
- //TX
- if (type > 0) {
- rrc_rlc_config_asn1_req(&ctxt,
- (LTE_SRB_ToAddModList_t*)NULL,
- UE->DRB_configList,
- (LTE_DRB_ToReleaseList_t*)NULL
+ //TX
+ if (type > 0) {
+ rrc_rlc_config_asn1_req(&ctxt,
+ (LTE_SRB_ToAddModList_t *)NULL,
+ UE->DRB_configList,
+ (LTE_DRB_ToReleaseList_t *)NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- ,(LTE_PMCH_InfoList_r9_t *)NULL
- , sourceL2Id, destinationL2Id
+ ,(LTE_PMCH_InfoList_r9_t *)NULL
+ , sourceL2Id, destinationL2Id
#endif
- );
-
- //configure MAC with sourceL2Id/groupL2ID
- rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- (struct LTE_PhysicalConfigDedicated *)NULL,
+ );
+ //configure MAC with sourceL2Id/groupL2ID
+ rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- (LTE_MAC_MainConfig_t *)NULL,
- 10, //LCID
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- (LTE_TDD_Config_t *)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ (LTE_MAC_MainConfig_t *)NULL,
+ 10, //LCID
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
-
+ ,0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,
- 0,
- 0
+ ,
+ 0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,CONFIG_ACTION_ADD,
- &sourceL2Id,
- &destinationL2Id
+ ,CONFIG_ACTION_ADD,
+ &sourceL2Id,
+ &destinationL2Id
#endif
- );
- } else {//RX
- //configure MAC with sourceL2Id/groupL2ID
- rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
- (LTE_RadioResourceConfigCommonSIB_t *)NULL,
- (struct LTE_PhysicalConfigDedicated *)NULL,
+ );
+ } else {//RX
+ //configure MAC with sourceL2Id/groupL2ID
+ rrc_mac_config_req_ue(module_id,0,0, //eNB_index =0
+ (LTE_RadioResourceConfigCommonSIB_t *)NULL,
+ (struct LTE_PhysicalConfigDedicated *)NULL,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
#endif
- (LTE_MeasObjectToAddMod_t **)NULL,
- (LTE_MAC_MainConfig_t *)NULL,
- 10, //LCID
- (struct LTE_LogicalChannelConfig *)NULL,
- (LTE_MeasGapConfig_t *)NULL,
- (LTE_TDD_Config_t *)NULL,
- (LTE_MobilityControlInfo_t *)NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ (LTE_MeasObjectToAddMod_t **)NULL,
+ (LTE_MAC_MainConfig_t *)NULL,
+ 10, //LCID
+ (struct LTE_LogicalChannelConfig *)NULL,
+ (LTE_MeasGapConfig_t *)NULL,
+ (LTE_TDD_Config_t *)NULL,
+ (LTE_MobilityControlInfo_t *)NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,0,
- (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
- (LTE_PMCH_InfoList_r9_t *)NULL
-
+ ,0,
+ (LTE_MBSFN_AreaInfoList_r9_t *)NULL,
+ (LTE_PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
- ,
- 0,
- 0
+ ,
+ 0,
+ 0
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- ,CONFIG_ACTION_ADD,
- &sourceL2Id,
- NULL
+ ,CONFIG_ACTION_ADD,
+ &sourceL2Id,
+ NULL
#endif
- );
+ );
+ }
- }
+ LOG_I(RRC,"Send PC5EstablishRsp to ProSe App\n");
+ memset(send_buf, 0, BUFSIZE);
+ sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
+ sl_ctrl_msg_send->type = PC5S_ESTABLISH_RSP;
+ sl_ctrl_msg_send->sidelinkPrimitive.pc5s_establish_rsp.slrbid_lcid28 = 10;
+ sl_ctrl_msg_send->sidelinkPrimitive.pc5s_establish_rsp.slrbid_lcid29 = 10;
+ sl_ctrl_msg_send->sidelinkPrimitive.pc5s_establish_rsp.slrbid_lcid30 = 10;
+ memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
+ prose_addr_len = sizeof(prose_app_addr);
+ n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
- LOG_I(RRC,"Send PC5EstablishRsp to ProSe App\n");
- memset(send_buf, 0, BUFSIZE);
- sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
- sl_ctrl_msg_send->type = PC5S_ESTABLISH_RSP;
- sl_ctrl_msg_send->sidelinkPrimitive.pc5s_establish_rsp.slrbid_lcid28 = 10;
- sl_ctrl_msg_send->sidelinkPrimitive.pc5s_establish_rsp.slrbid_lcid29 = 10;
- sl_ctrl_msg_send->sidelinkPrimitive.pc5s_establish_rsp.slrbid_lcid30 = 10;
- memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
-
- prose_addr_len = sizeof(prose_app_addr);
- n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
-// free(sl_ctrl_msg_send);
- if (n < 0){
- LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
- exit(EXIT_FAILURE);
- }
- break;
+ // free(sl_ctrl_msg_send);
+ if (n < 0) {
+ LOG_E(RRC, "ERROR: Failed to send to ProSe App\n");
+ exit(EXIT_FAILURE);
+ }
+ break;
case PC5_DISCOVERY_MESSAGE:
+ if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)) {
+ LOG_UI(RRC,"[PC5DiscoveryMessage] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
+ }
- if (LOG_DEBUGFLAG(DEBUG_CTRLSOCKET)){
- LOG_UI(RRC,"[PC5DiscoveryMessage] Received on socket from ProSe App (msg type: %d)\n",sl_ctrl_msg_recv->type);
- }
//prepare SL_Discovery buffer
- if (UE_rrc_inst) {
- memcpy((void*)&UE_rrc_inst[module_id].SL_Discovery[0].Tx_buffer.Payload[0], (void*)&sl_ctrl_msg_recv->sidelinkPrimitive.pc5_discovery_message.payload[0], PC5_DISCOVERY_PAYLOAD_SIZE);
- UE_rrc_inst[module_id].SL_Discovery[0].Tx_buffer.payload_size = PC5_DISCOVERY_PAYLOAD_SIZE;
- LOG_I(RRC,"[PC5DiscoveryMessage] Copied %d bytes\n",PC5_DISCOVERY_PAYLOAD_SIZE);
- }
- break;
+ if (UE_rrc_inst) {
+ memcpy((void *)&UE_rrc_inst[module_id].SL_Discovery[0].Tx_buffer.Payload[0], (void *)&sl_ctrl_msg_recv->sidelinkPrimitive.pc5_discovery_message.payload[0], PC5_DISCOVERY_PAYLOAD_SIZE);
+ UE_rrc_inst[module_id].SL_Discovery[0].Tx_buffer.payload_size = PC5_DISCOVERY_PAYLOAD_SIZE;
+ LOG_I(RRC,"[PC5DiscoveryMessage] Copied %d bytes\n",PC5_DISCOVERY_PAYLOAD_SIZE);
+ }
+
+ break;
+
default:
- break;
- }
- }
- free (sl_ctrl_msg_recv);
- return 0;
+ break;
+ }
+ }
+
+ free (sl_ctrl_msg_recv);
+ return 0;
}
//-----------------------------------------------------------------------------
int decode_SL_Discovery_Message(
- const protocol_ctxt_t* const ctxt_pP,
+ const protocol_ctxt_t *const ctxt_pP,
const uint8_t eNB_index,
- const uint8_t* Sdu,
- const uint8_t Sdu_len)
-{
-
- int prose_addr_len;
- char send_buf[BUFSIZE];
- int n;
- struct sidelink_ctrl_element *sl_ctrl_msg_send = NULL;
-
- //from the main program, listen for the incoming messages from control socket (ProSe App)
- prose_addr_len = sizeof(prose_app_addr);
-
- //Store in Rx_buffer
- memcpy((void*)&UE_rrc_inst[ctxt_pP->module_id].SL_Discovery[0].Rx_buffer.Payload[0], (void*)Sdu, Sdu_len);
- UE_rrc_inst[ctxt_pP->module_id].SL_Discovery[0].Rx_buffer.payload_size = Sdu_len;
-
- memset(send_buf, 0, BUFSIZE);
- //send to ProSeApp
- memcpy((void *)send_buf, (void*)Sdu, Sdu_len);
- prose_addr_len = sizeof(prose_app_addr);
-
- sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
- sl_ctrl_msg_send->type = PC5_DISCOVERY_MESSAGE;
- // TODO: Add a check for the SDU size.
- memcpy((void*)&sl_ctrl_msg_send->sidelinkPrimitive.pc5_discovery_message.payload[0], (void*) Sdu, PC5_DISCOVERY_PAYLOAD_SIZE);
-
- memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
- free(sl_ctrl_msg_send);
-
- prose_addr_len = sizeof(prose_app_addr);
-
- n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
- if (n < 0){
- // TODO: We should not just exit if the Prose App has not yet attached. It creates a race condition.
- LOG_I(RRC, "ERROR: Failed to send to ProSe App\n");
- //exit(EXIT_FAILURE);
- }
-
+ const uint8_t *Sdu,
+ const uint8_t Sdu_len) {
+ int prose_addr_len;
+ char send_buf[BUFSIZE];
+ int n;
+ struct sidelink_ctrl_element *sl_ctrl_msg_send = NULL;
+ //from the main program, listen for the incoming messages from control socket (ProSe App)
+ prose_addr_len = sizeof(prose_app_addr);
+ //Store in Rx_buffer
+ memcpy((void *)&UE_rrc_inst[ctxt_pP->module_id].SL_Discovery[0].Rx_buffer.Payload[0], (void *)Sdu, Sdu_len);
+ UE_rrc_inst[ctxt_pP->module_id].SL_Discovery[0].Rx_buffer.payload_size = Sdu_len;
+ memset(send_buf, 0, BUFSIZE);
+ //send to ProSeApp
+ memcpy((void *)send_buf, (void *)Sdu, Sdu_len);
+ prose_addr_len = sizeof(prose_app_addr);
+ sl_ctrl_msg_send = calloc(1, sizeof(struct sidelink_ctrl_element));
+ sl_ctrl_msg_send->type = PC5_DISCOVERY_MESSAGE;
+ // TODO: Add a check for the SDU size.
+ memcpy((void *)&sl_ctrl_msg_send->sidelinkPrimitive.pc5_discovery_message.payload[0], (void *) Sdu, PC5_DISCOVERY_PAYLOAD_SIZE);
+ memcpy((void *)send_buf, (void *)sl_ctrl_msg_send, sizeof(struct sidelink_ctrl_element));
+ free(sl_ctrl_msg_send);
+ prose_addr_len = sizeof(prose_app_addr);
+ n = sendto(ctrl_sock_fd, (char *)send_buf, sizeof(struct sidelink_ctrl_element), 0, (struct sockaddr *)&prose_app_addr, prose_addr_len);
+ if (n < 0) {
+ // TODO: We should not just exit if the Prose App has not yet attached. It creates a race condition.
+ LOG_I(RRC, "ERROR: Failed to send to ProSe App\n");
+ //exit(EXIT_FAILURE);
+ }
return(0);
}
@@ -6335,112 +5813,111 @@ int decode_SL_Discovery_Message(
//-----------------------------------------------------------------------------
RRC_status_t
rrc_rx_tx_ue(
- protocol_ctxt_t* const ctxt_pP,
+ protocol_ctxt_t *const ctxt_pP,
const uint8_t enb_indexP,
const int CC_id
)
//-----------------------------------------------------------------------------
{
-
#ifdef LOCALIZATION
double estimated_distance;
protocol_ctxt_t ctxt;
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
- // check timers
+ // check timers
- if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) {
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0)
- LOG_D(RRC,
- "[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt);
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) {
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0)
+ LOG_D(RRC,
+ "[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt);
- if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt
- == T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) {
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0;
- // ALLOW CCCH to be used
- UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0;
- rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
- return (RRC_ConnSetup_failed);
- }
-
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++;
- }
-
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) {
- if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt
- == N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) {
- LOG_I(RRC,"Activating T310\n");
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1;
- }
- } else { // in case we have not received SIB2 yet
- /* if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) {
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0;
-
- }*/
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt
+ == T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0;
+ // ALLOW CCCH to be used
+ UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0;
+ rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
- return RRC_OK;
+ return (RRC_ConnSetup_failed);
}
- if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) {
- if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt
- == N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) {
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0;
- }
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++;
+ }
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) {
- LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt);
- }
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) {
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt
+ == N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) {
+ LOG_I(RRC,"Activating T310\n");
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1;
+ }
+ } else { // in case we have not received SIB2 yet
+ /* if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0;
- if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) {
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
- rrc_t310_expiration (ctxt_pP, enb_indexP);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
- LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n");
- return RRC_PHY_RESYNCH;
- }
+ }*/
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+ return RRC_OK;
+ }
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++;
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) {
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt
+ == N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0;
}
- if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) {
- if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0)
- LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame,
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt);
-
- if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) {
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0;
- UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
- LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n",
- ctxt_pP->module_id);
- //Implement 36.331, section 5.3.5.6 here
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
- return(RRC_Handover_failed);
- }
-
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--;
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) {
+ LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt);
}
- // Layer 3 filtering of RRC measurements
- if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) {
- ue_meas_filtering(ctxt_pP,enb_indexP);
- }
-
- ue_measurement_report_triggering(ctxt_pP,enb_indexP);
-
- if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) {
- LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame);
- }
-
- if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION) &&
- (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) {
- UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE;
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
+ rrc_t310_expiration (ctxt_pP, enb_indexP);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
- return(RRC_HO_STARTED);
+ LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n");
+ return RRC_PHY_RESYNCH;
}
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++;
+ }
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) {
+ if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0)
+ LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame,
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt);
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0;
+ UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
+ LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n",
+ ctxt_pP->module_id);
+ //Implement 36.331, section 5.3.5.6 here
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+ return(RRC_Handover_failed);
+ }
+
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--;
+ }
+
+ // Layer 3 filtering of RRC measurements
+ if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) {
+ ue_meas_filtering(ctxt_pP,enb_indexP);
+ }
+
+ ue_measurement_report_triggering(ctxt_pP,enb_indexP);
+
+ if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) {
+ LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame);
+ }
+
+ if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION) &&
+ (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) {
+ UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE;
+ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
+ return(RRC_HO_STARTED);
+ }
+
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
return (RRC_OK);
}
diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h
index 9d42883086..f28b34982b 100644
--- a/openair2/RRC/LTE/rrc_defs.h
+++ b/openair2/RRC/LTE/rrc_defs.h
@@ -636,23 +636,24 @@ typedef struct {
uint8_t *SIB23_BR;
uint8_t sizeof_SIB23_BR;
#endif
- int physCellId;
- int Ncp;
- int p_eNB;
- uint32_t dl_CarrierFreq;
- uint32_t ul_CarrierFreq;
- uint32_t pbch_repetition;
- LTE_BCCH_BCH_Message_t mib;
- LTE_BCCH_DL_SCH_Message_t siblock1;
- LTE_BCCH_DL_SCH_Message_t systemInformation;
- // SystemInformation_t systemInformation;
- LTE_SystemInformationBlockType1_t *sib1;
- LTE_SystemInformationBlockType2_t *sib2;
- LTE_SystemInformationBlockType3_t *sib3;
+ int physCellId;
+ int Ncp;
+ int p_eNB;
+ uint32_t dl_CarrierFreq;
+ uint32_t ul_CarrierFreq;
+ uint32_t pbch_repetition;
+ LTE_BCCH_BCH_Message_t mib;
+ LTE_BCCH_DL_SCH_Message_t siblock1;
+ LTE_BCCH_DL_SCH_Message_t siblock1_BR;
+ LTE_BCCH_DL_SCH_Message_t systemInformation;
+ LTE_BCCH_DL_SCH_Message_t systemInformation_BR;
+ // SystemInformation_t systemInformation;
+ LTE_SystemInformationBlockType1_t *sib1;
+ LTE_SystemInformationBlockType2_t *sib2;
+ LTE_SystemInformationBlockType3_t *sib3;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- LTE_SystemInformationBlockType1_t *sib1_BR;
- LTE_SystemInformationBlockType2_t *sib2_BR;
- LTE_SystemInformationBlockType2_t *sib3_BR;
+ LTE_SystemInformationBlockType1_t *sib1_BR;
+ LTE_SystemInformationBlockType2_t *sib2_BR;
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
LTE_SystemInformationBlockType13_r9_t *sib13;
diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index cbce507341..792299f4ae 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -141,12 +141,9 @@ openair_rrc_on(
//-----------------------------------------------------------------------------
static void
init_SI(
- const protocol_ctxt_t *const ctxt_pP,
- const int CC_id
-#if defined(ENABLE_ITTI)
- ,
- RrcConfigurationReq *configuration
-#endif
+ const protocol_ctxt_t* const ctxt_pP,
+ const int CC_id,
+ RrcConfigurationReq * configuration
)
//-----------------------------------------------------------------------------
{
@@ -167,40 +164,81 @@ init_SI(
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition = configuration->pbch_repetition[CC_id];
#endif
- LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n",
- (int)configuration->N_RB_DL[CC_id],
- (int)configuration->phich_resource[CC_id],
- (int)configuration->phich_duration[CC_id]);
- do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],
-#ifdef ENABLE_ITTI
- configuration->N_RB_DL[CC_id],
- configuration->phich_resource[CC_id],
- configuration->phich_duration[CC_id]
-#else
- 50,0,0
+ LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n",
+ configuration->N_RB_DL[CC_id],
+ (int)configuration->radioresourceconfig[CC_id].phich_resource,
+ (int)configuration->radioresourceconfig[CC_id].phich_duration);
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ LOG_I(RRC, "configuration->schedulingInfoSIB1_BR_r13[CC_id] %d\n",(int)configuration->schedulingInfoSIB1_BR_r13[CC_id]);
#endif
- ,0);
+ do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],
+ configuration->N_RB_DL[CC_id],
+ (int)configuration->radioresourceconfig[CC_id].phich_resource,
+ (int)configuration->radioresourceconfig[CC_id].phich_duration,
+ 0
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ ,configuration->schedulingInfoSIB1_BR_r13[CC_id]
+#endif
+ );
+
+
+
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0;
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = 0;
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t *) malloc16(32);
AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
+
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id
-#if defined(ENABLE_ITTI)
- , configuration
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ ,FALSE
#endif
- );
+ , configuration
+ );
+
AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255");
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t *) malloc16(64);
+
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_BR = 0;
+ if (configuration->schedulingInfoSIB1_BR_r13[CC_id]>0) {
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_BR = (uint8_t*) malloc16(32);
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_BR = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id
+ ,TRUE
+ , configuration
+ );
+ }
+#endif
+
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t*) malloc16(64);
AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23!=NULL,"cannot allocate memory for SIB");
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = do_SIB23(
- ctxt_pP->module_id,
- CC_id
-#if defined(ENABLE_ITTI)
- , configuration
+ ctxt_pP->module_id,
+ CC_id
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ ,FALSE
#endif
- );
+ , configuration
+ );
+
AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255");
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23_BR = 0;
+ if (configuration->schedulingInfoSIB1_BR_r13[CC_id]>0) {
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23_BR = (uint8_t*) malloc16(64);
+ AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23_BR!=NULL,"cannot allocate memory for SIB");
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23_BR = do_SIB23(
+ ctxt_pP->module_id,
+ CC_id
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ ,TRUE
+#endif
+ ,configuration
+ );
+ }
+#endif
+
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n",
@@ -232,9 +270,10 @@ init_SI(
(int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled);
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift = %ld\n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
- ul_ReferenceSignalsPUSCH.cyclicShift);
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon.
+ ul_ReferenceSignalsPUSCH.cyclicShift);
+
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
if (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag > 0) {
@@ -256,7 +295,7 @@ init_SI(
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset);
}
-#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
+
// SIB13
for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count; i++) {
@@ -271,78 +310,85 @@ init_SI(
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9);
}
-
-#endif
- } else memset((void *)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13));
+ }
+ else memset((void*)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13));
//TTN - SIB 18
- for (int j = 0; j < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count; j++) {
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB18 %d/%d \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- j+1,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 rxPool_sc_CP_Len: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_CP_Len_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 sc_Period_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_Period_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 data_CP_Len_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->data_CP_Len_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Num_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Num_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Start_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Start_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_End_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_End_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 offsetIndicator: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 subframeBitmap_choice_bs_buf: %s \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf);
+ if (configuration->SL_configured>0) {
+ for (int j = 0; j < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count; j++) {
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB18 %d/%d \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ j+1,
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.count);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 rxPool_sc_CP_Len: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_CP_Len_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 sc_Period_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_Period_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 data_CP_Len_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->data_CP_Len_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Num_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Num_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_Start_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_Start_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 prb_End_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.prb_End_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 offsetIndicator: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB18 subframeBitmap_choice_bs_buf: %s \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib18->commConfig_r12->commRxPool_r12.list.array[j]->sc_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf);
+
+ }
+
+
+
+
+ for (int j = 0; j < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count; j++) {
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB19 %d/%d \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ j+1,
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 cp_Len_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->cp_Len_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 discPeriod_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->discPeriod_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRetx_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRetx_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRepetition_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRepetition_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Num_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Num_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Start_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Start_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_End_r12: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_End_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 offsetIndicator: %ld \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12);
+ LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 subframeBitmap_choice_bs_buf: %s \n",
+ PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf);
+
+ }
}
- //TTN - SIB 19
- for (int j = 0; j < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count; j++) {
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB19 %d/%d \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- j+1,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.count);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 cp_Len_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->cp_Len_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 discPeriod_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->discPeriod_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRetx_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRetx_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 numRepetition_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->numRepetition_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Num_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Num_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_Start_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_Start_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 prb_End_r12: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.prb_End_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 offsetIndicator: %ld \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12);
- LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" SIB19 tf_ResourceConfig_r12 subframeBitmap_choice_bs_buf: %s \n",
- PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib19->discConfig_r12->discRxPool_r12.list.array[j]->tf_ResourceConfig_r12.subframeBitmap_r12.choice.bs16_r12.buf);
- }
+#endif // (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
+
-#endif
LOG_D(RRC,
PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
@@ -350,17 +396,32 @@ init_SI(
if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) &&
(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR!=NULL)) {
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL,
- "sib2_br->nonCriticalExtension is null (v8.9)\n");
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL,
- "sib2_br->nonCriticalExtension is null (v9.2)\n");
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
- "sib2_br->nonCriticalExtension is null (v11.3)\n");
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
- "sib2_br->nonCriticalExtension is null (v12.5)\n");
- AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
- "sib2_br->nonCriticalExtension is null (v13.10)\n");
- sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension;
+
+ AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL,
+ "sib2_br->nonCriticalExtension is null (v8.9)\n");
+ AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL,
+ "sib2_br->nonCriticalExtension is null (v9.2)\n");
+ AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
+ "sib2_br->nonCriticalExtension is null (v11.3)\n");
+ AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
+ "sib2_br->nonCriticalExtension is null (v12.5)\n");
+ AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL,
+ "sib2_br->nonCriticalExtension is null (v13.10)\n");
+ sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension;
+
+ // Basic Asserts for CE_level0 PRACH configuration
+
+ LTE_RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR = &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon;
+ struct LTE_PRACH_ConfigSIB_v1310 *ext4_prach=radioResourceConfigCommon_BR->ext4->prach_ConfigCommon_v1310;
+
+ LTE_PRACH_ParametersListCE_r13_t *prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
+ AssertFatal(prach_ParametersListCE_r13->list.count>0,"prach_ParametersListCE_r13 is empty\n");
+ LTE_PRACH_ParametersCE_r13_t *p = prach_ParametersListCE_r13->list.array[0];
+ AssertFatal(p->prach_StartingSubframe_r13 != NULL, "prach_StartingSubframe_r13 celevel0 is null\n");
+ AssertFatal((1<numRepetitionPerPreambleAttempt_r13)<=(2<<*p->prach_StartingSubframe_r13),
+ "prachce0->numReptitionPerPreambleAttempt_r13 %d > prach_StartingSubframe_r13 %d\n",
+ 1<numRepetitionPerPreambleAttempt_r13,
+ 2<<*p->prach_StartingSubframe_r13);
}
#endif
@@ -2823,57 +2884,62 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t *cons
//TODO: change TM for secondary CC in SCelltoaddmodlist
if (*physicalConfigDedicated) {
if ((*physicalConfigDedicated)->antennaInfo) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0];
- LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]);
- if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm3) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
- } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm4) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
- } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm5) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
- } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm6) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode;
+ LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode);
+ if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm3) {
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
}
- } else {
+ else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm4) {
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
+ }
+ else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) {
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
+ }
+ else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6) {
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
+ }
+ }
+ else {
LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n");
}
if ((*physicalConfigDedicated)->cqi_ReportConfig) {
- if ((rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm4) ||
- (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm5) ||
- (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm6)) {
- //feedback mode needs to be set as well
- //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
- printf("setting cqi reporting mode to rm31\n");
+
+ if ((rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm4) ||
+ (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) ||
+ (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6)) {
+ //feedback mode needs to be set as well
+ //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
+ printf("setting cqi reporting mode to rm31\n");
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=LTE_CQI_ReportModeAperiodic_rm31;
#else
@@ -3457,57 +3523,63 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt
//TODO: change TM for secondary CC in SCelltoaddmodlist
if (*physicalConfigDedicated) {
if ((*physicalConfigDedicated)->antennaInfo) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0];
- LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode;
+ LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode);
+ if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm3) {
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
+ } else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm4) {
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
+ }
+ else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) {
- if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm3) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6;
- } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm4) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2;
- } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm5) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
- } else if (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm6) {
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
- CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
- LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
- (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4;
}
- } else {
+
+ else if (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6) {
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction=
+ CALLOC(1,sizeof(LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR));
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present =
+ LTE_AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1);
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1;
+ (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4;
+
+ }
+ }
+ else {
LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n");
}
if ((*physicalConfigDedicated)->cqi_ReportConfig) {
- if ((rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm4) ||
- (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm5) ||
- (rrc_inst->configuration.ue_TransmissionMode[0] == LTE_AntennaInfoDedicated__transmissionMode_tm6)) {
- //feedback mode needs to be set as well
- //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
- printf("setting cqi reporting mode to rm31\n");
+ if ((rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm4) ||
+ (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm5) ||
+ (rrc_inst->configuration.radioresourceconfig[0].ue_TransmissionMode==LTE_AntennaInfoDedicated__transmissionMode_tm6)) {
+
+ //feedback mode needs to be set as well
+ //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable
+ printf("setting cqi reporting mode to rm31\n");
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
*((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=LTE_CQI_ReportModeAperiodic_rm31;
#else
@@ -5196,129 +5268,145 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
}
//-----------------------------------------------------------------------------
-void
-rrc_eNB_generate_RRCConnectionSetup(
- const protocol_ctxt_t *const ctxt_pP,
- rrc_eNB_ue_context_t *const ue_context_pP,
- const int CC_id
-)
+void rrc_eNB_generate_RRCConnectionSetup(const protocol_ctxt_t *const ctxt_pP,
+ rrc_eNB_ue_context_t *const ue_context_pP,
+ const int CC_id
+ )
//-----------------------------------------------------------------------------
{
+
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ boolean_t is_mtc = ctxt_pP->brOption;
+#endif
+
LTE_LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig;
LTE_SRB_ToAddModList_t **SRB_configList;
LTE_SRB_ToAddMod_t *SRB1_config;
+
int cnt;
T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
SRB_configList = &ue_context_pP->ue_context.SRB_configList;
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
- do_RRCConnectionSetup(ctxt_pP,
- ue_context_pP,
- CC_id,
- (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload,
- (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
- rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
- SRB_configList,
- &ue_context_pP->ue_context.physicalConfigDedicated);
- LOG_DUMPMSG(RRC,DEBUG_RRC,
- (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
- "[MSG] RRC Connection Setup\n");
-
- // configure SRB1/SRB2, PhysicalConfigDedicated, LTE_MAC_MainConfig for UE
-
- if (*SRB_configList != NULL) {
- for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) {
- if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) {
- SRB1_config = (*SRB_configList)->list.array[cnt];
-
- if (SRB1_config->logicalChannelConfig) {
- if (SRB1_config->logicalChannelConfig->present ==
- LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) {
- SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue;
- } else {
- SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
- }
- } else {
- SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
- }
-
- LOG_D(RRC,
- PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n",
- PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
- rrc_mac_config_req_eNB(
- ctxt_pP->module_id,
- ue_context_pP->ue_context.primaryCC_id,
- 0,0,0,0,0,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- 0,
+ if (is_mtc) {
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+ do_RRCConnectionSetup_BR(ctxt_pP,
+ ue_context_pP,
+ CC_id,
+ (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload,
+ (const uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
+ rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
+ SRB_configList,
+ &ue_context_pP->ue_context.physicalConfigDedicated);
+ } else
#endif
- ue_context_pP->ue_context.rnti,
- (LTE_BCCH_BCH_Message_t *) NULL,
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ {
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size =
+ do_RRCConnectionSetup(ctxt_pP,
+ ue_context_pP,
+ CC_id,
+ (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload,
+ (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2
+ rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
+ SRB_configList,
+ &ue_context_pP->ue_context.physicalConfigDedicated);
+ LOG_DUMPMSG(RRC,DEBUG_RRC,
+ (char *)(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+ "[MSG] RRC Connection Setup\n");
+
+ // configure SRB1/SRB2, PhysicalConfigDedicated, LTE_MAC_MainConfig for UE
+
+ if (*SRB_configList != NULL) {
+ for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) {
+ if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) {
+ SRB1_config = (*SRB_configList)->list.array[cnt];
+
+ if (SRB1_config->logicalChannelConfig) {
+ if (SRB1_config->logicalChannelConfig->present ==
+ LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) {
+ SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue;
+ } else {
+ SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+ }
+ } else {
+ SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue;
+ }
+
+ LOG_D(RRC,
+ PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n",
+ PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+ rrc_mac_config_req_eNB(
+ ctxt_pP->module_id,
+ ue_context_pP->ue_context.primaryCC_id,
+ 0,0,0,0,0,
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
- (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+ 0,
#endif
- ue_context_pP->ue_context.physicalConfigDedicated,
+ ue_context_pP->ue_context.rnti,
+ (LTE_BCCH_BCH_Message_t *) NULL,
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ (LTE_RadioResourceConfigCommonSIB_t *) NULL,
+#endif
+ ue_context_pP->ue_context.physicalConfigDedicated,
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
- (LTE_SCellToAddMod_r10_t *)NULL,
- //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
+ (LTE_SCellToAddMod_r10_t *)NULL,
+ //(struct LTE_PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
- (LTE_MeasObjectToAddMod_t **) NULL,
- ue_context_pP->ue_context.mac_MainConfig,
- 1,
- SRB1_logicalChannelConfig,
- ue_context_pP->ue_context.measGapConfig,
- (LTE_TDD_Config_t *) NULL,
- NULL,
- (LTE_SchedulingInfoList_t *) NULL,
- 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
+ (LTE_MeasObjectToAddMod_t **) NULL,
+ ue_context_pP->ue_context.mac_MainConfig,
+ 1,
+ SRB1_logicalChannelConfig,
+ ue_context_pP->ue_context.measGapConfig,
+ (LTE_TDD_Config_t *) NULL,
+ NULL,
+ (LTE_SchedulingInfoList_t *) NULL,
+ 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL
#if (LTE_RRC_VERSION >= MAKE_VERSION(9, 0, 0))
- , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL
+ , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL
#endif
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
- ,
- (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
+ ,
+ (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL
#endif
- );
- break;
+ );
+ break;
+ }
}
}
+
+ MSC_LOG_TX_MESSAGE(
+ MSC_RRC_ENB,
+ MSC_RRC_UE,
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, // LG WARNING
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
+ MSC_AS_TIME_FMT" LTE_RRCConnectionSetup UE %x size %u",
+ MSC_AS_TIME_ARGS(ctxt_pP),
+ ue_context_pP->ue_context.rnti,
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+ LOG_I(RRC,
+ PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionSetup (bytes %d)\n",
+ PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+ RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
+ //ue_context_pP->ue_context.ue_release_timer_thres=100;
+ // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
+ ue_context_pP->ue_context.ue_release_timer=1;
+ // remove UE after 10 frames after LTE_RRCConnectionRelease is triggered
+ ue_context_pP->ue_context.ue_release_timer_thres=1000;
}
-
- MSC_LOG_TX_MESSAGE(
- MSC_RRC_ENB,
- MSC_RRC_UE,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, // LG WARNING
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size,
- MSC_AS_TIME_FMT" LTE_RRCConnectionSetup UE %x size %u",
- MSC_AS_TIME_ARGS(ctxt_pP),
- ue_context_pP->ue_context.rnti,
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
- LOG_I(RRC,
- PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating LTE_RRCConnectionSetup (bytes %d)\n",
- PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
- RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size);
- //ue_context_pP->ue_context.ue_release_timer_thres=100;
- // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
- ue_context_pP->ue_context.ue_release_timer=1;
- // remove UE after 10 frames after LTE_RRCConnectionRelease is triggered
- ue_context_pP->ue_context.ue_release_timer_thres=1000;
}
-
-
+
#if defined(ENABLE_ITTI)
//-----------------------------------------------------------------------------
-char
-openair_rrc_eNB_configuration(
- const module_id_t enb_mod_idP,
- RrcConfigurationReq *configuration
-)
+char openair_rrc_eNB_configuration(
+ const module_id_t enb_mod_idP,
+ RrcConfigurationReq *configuration
+ )
#else
-char
-openair_rrc_eNB_init(
- const module_id_t enb_mod_idP
-)
+char openair_rrc_eNB_init(
+ const module_id_t enb_mod_idP
+ )
#endif
//-----------------------------------------------------------------------------
{
@@ -5499,37 +5587,6 @@ rrc_eNB_decode_ccch(
0,
0);
- /*
- #if defined(ENABLE_ITTI)
- # if defined(DISABLE_ITTI_XER_PRINT)
- {
- MessageDef *message_p;
-
- message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_CCCH_MESSAGE);
- memcpy(&message_p->ittiMsg, (void *)ul_ccch_msg, sizeof(RrcUlCcchMessage));
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p);
- }
- # else
- {
- char message_string[10000];
- size_t message_string_size;
-
- if ((message_string_size =
- xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_UL_CCCH_Message, (void *)ul_ccch_msg)) > 0) {
- MessageDef *msg_p;
-
- msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_CCCH, message_string_size + sizeof(IttiMsgText));
- msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size;
- memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size);
-
- itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
- }
- }
- # endif
- #endif
- */
-
for (i = 0; i < 8; i++) {
LOG_T(RRC, "%x.", ((uint8_t *) & ul_ccch_msg)[i]);
}
@@ -6017,12 +6074,8 @@ rrc_eNB_decode_dcch(
LTE_UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg;
int i;
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
-#if defined(ENABLE_ITTI)
-# if defined(ENABLE_USE_MME)
MessageDef *msg_delete_tunnels_p = NULL;
uint8_t xid;
-#endif
-#endif
int dedicated_DRB=0;
T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c
index 56219d9ebd..ebacfc8381 100644
--- a/openair2/RRC/LTE/rrc_eNB_S1AP.c
+++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c
@@ -1784,6 +1784,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance
uint32_t T; /* DRX cycle */
for (uint16_t tai_size = 0; tai_size < S1AP_PAGING_IND(msg_p).tai_size; tai_size++) {
+
LOG_D(RRC,"[eNB %d] In S1AP_PAGING_IND: MCC %d, MNC %d, TAC %d\n", instance, S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc,
S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc, S1AP_PAGING_IND(msg_p).tac[tai_size]);
@@ -1795,7 +1796,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance
lte_frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type;
/* get nB from configuration */
/* get default DRX cycle from configuration */
- Tc = (uint8_t)RC.rrc[instance]->configuration.pcch_defaultPagingCycle[CC_id];
+ Tc = (uint8_t)RC.rrc[instance]->configuration.radioresourceconfig[CC_id].pcch_defaultPagingCycle;
if (Tc < LTE_PCCH_Config__defaultPagingCycle_rf32 || Tc > LTE_PCCH_Config__defaultPagingCycle_rf256) {
continue;
@@ -1805,8 +1806,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance
/* set T = min(Tc,Tue) */
T = Tc < Tue ? Ttab[Tc] : Ttab[Tue];
/* set pcch_nB = PCCH-Config->nB */
- pcch_nB = (uint32_t)RC.rrc[instance]->configuration.pcch_nB[CC_id];
-
+ pcch_nB = (uint32_t)RC.rrc[instance]->configuration.radioresourceconfig[CC_id].pcch_nB;
switch (pcch_nB) {
case LTE_PCCH_Config__nB_fourT:
Ns = 4;
diff --git a/openair2/RRC/LTE/rrc_proto.h b/openair2/RRC/LTE/rrc_proto.h
index 0aeb67dfba..3777f3ea26 100644
--- a/openair2/RRC/LTE/rrc_proto.h
+++ b/openair2/RRC/LTE/rrc_proto.h
@@ -432,6 +432,9 @@ mac_rrc_data_ind(
const uint8_t* sduP,
const sdu_size_t sdu_lenP,
const uint8_t mbsfn_sync_areaP
+#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
+ , const boolean_t brOption
+#endif
);
int8_t
diff --git a/openair2/UTIL/OMG/README.TXT b/openair2/UTIL/OMG/README.TXT
old mode 100755
new mode 100644
diff --git a/openair2/UTIL/OPT/opt.h b/openair2/UTIL/OPT/opt.h
index b4ff3b5006..5ae19f9b55 100644
--- a/openair2/UTIL/OPT/opt.h
+++ b/openair2/UTIL/OPT/opt.h
@@ -33,26 +33,23 @@ This header file must be included */
#define OPT_H_
#ifndef sys_include
-#define sys_include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+ #define sys_include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
#endif
#ifndef project_include
-#define project_include
-#include "common/utils/LOG/log_if.h"
-// #include "UTIL/LOG/log_extern.h"
-//#include "PHY/defs.h"
-//#include "PHY/extern.h"
-#include "PHY/impl_defs_lte.h"
+ #define project_include
+ #include "common/utils/LOG/log_if.h"
+ #include "PHY/impl_defs_lte.h"
#endif
#define PACKET_MAC_LTE_DEFAULT_UDP_PORT (9999)
@@ -65,6 +62,32 @@ typedef guint8 gboolean;
#include "packet-mac-lte.h"
#include "mac_pcap.h"
+/* OPT parameters definitions */
+#define OPT_CONFIGPREFIX "opt"
+
+#define CONFIG_HLP_TYPEMON "Type of L2 monitoring messages: none,pcap,wireshark \n"
+#define CONFIG_HLP_L2MONIP "ip address for wireshark messages \n"
+#define CONFIG_HLP_L2MONPATH "file path for pcap messages on localhost \n"
+/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+/* command line parameters for LOG utility */
+/* optname helpstr paramflags XXXptr defXXXval type numelt */
+/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
+#define OPT_PARAMS_DESC { \
+ {"type" , CONFIG_HLP_TYPEMON, 0, strptr:&in_type, defstrval:"none", TYPE_STRING, 0}, \
+ {"ip" , CONFIG_HLP_L2MONIP, 0, strptr:&in_ip, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
+ {"path" , CONFIG_HLP_L2MONPATH, 0, strptr:&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, 0}, \
+ }
+
+#define OPTTYPE_IDX 0
+/* check function for opt parameters */
+#define OPTTYPE_OKSTRINGS {"none","pcap","wireshark"}
+#define OPTTYPE_VALUES {OPT_NONE,OPT_PCAP,OPT_WIRESHARK}
+#define OPTPARAMS_CHECK_DESC { \
+ { .s3a= { config_checkstr_assign_integer, OPTTYPE_OKSTRINGS,OPTTYPE_VALUES ,3}} ,\
+ { .s5= {NULL }} , \
+ { .s5= {NULL }} , \
+ }
+
#ifdef OCP_FRAMEWORK
#include
#else
@@ -82,9 +105,7 @@ typedef enum radio_type_e {
RADIO_TYPE_MAX
} radio_type_t;
-extern trace_mode_t opt_type;
-extern char in_ip[40];
-extern char in_path[FILENAME_MAX];
+
/**
* function def
@@ -94,7 +115,7 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe,
int oob_event, int oob_event_value);
-int init_opt(char *path, char *ip);
+int init_opt(void);
void terminate_opt(void);
diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c
index a1e5367168..b032784028 100644
--- a/openair2/UTIL/OPT/probe.c
+++ b/openair2/UTIL/OPT/probe.c
@@ -90,7 +90,7 @@ what about the implementation
#include
#include
-
+#include "common/config/config_userapi.h"
#include "opt.h"
int opt_enabled=0;
@@ -98,8 +98,8 @@ int opt_enabled=0;
//static unsigned char g_PDUBuffer[1600];
//static unsigned int g_PDUOffset;
-char in_ip[40];
-char in_path[FILENAME_MAX];
+static char *in_ip;
+static char *in_path;
FILE *file_fd = NULL;
pcap_hdr_t file_header = {
0xa1b2c3d4, /* magic number */
@@ -133,17 +133,15 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
const unsigned char *PDU, unsigned int length);
-static void *opt_listener_thread(void *arg)
-{
+static void *opt_listener_thread(void *arg) {
ssize_t ret;
struct sockaddr_in from_address;
socklen_t socklen = sizeof(from_address);
-
memset(&from_address, 0, sizeof(from_address));
while(1) {
/* Simply drop packets */
- ret = recvfrom(opt_listener.sd, NULL, 0, 0, (struct sockaddr*)&from_address,
+ ret = recvfrom(opt_listener.sd, NULL, 0, 0, (struct sockaddr *)&from_address,
&socklen);
if (ret == 0) {
@@ -165,17 +163,13 @@ static void *opt_listener_thread(void *arg)
}
static
-int opt_create_listener_socket(char *ip_address, uint16_t port)
-{
+int opt_create_listener_socket(char *ip_address, uint16_t port) {
/* Create an UDP socket and listen on it.
* Silently discard PDU received.
*/
-
int sd = -1;
int ret = -1;
-
memset(&opt_listener, 0, sizeof(opt_listener_t));
-
sd = socket(AF_INET, SOCK_DGRAM, 0);
if (sd < 0) {
@@ -190,8 +184,7 @@ int opt_create_listener_socket(char *ip_address, uint16_t port)
/* Listening only on provided IP address */
opt_listener.address.sin_addr.s_addr = inet_addr(ip_address);
opt_listener.address.sin_port = htons(port);
-
- ret = bind(opt_listener.sd, (struct sockaddr*) &opt_listener.address, sizeof(opt_listener.address));
+ ret = bind(opt_listener.sd, (struct sockaddr *) &opt_listener.address, sizeof(opt_listener.address));
if (ret != 0) {
LOG_E(OPT, "Failed to bind socket to (%s:%u): %s\n",
@@ -231,49 +224,39 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
guint16 rnti, guint16 ueid, guint16 sfnSf,
guint8 isPredefinedData, guint8 retx, guint8 crcStatus,
guint8 oob_event, guint8 oob_event_value,
- uint8_t *pdu_buffer, unsigned int pdu_buffer_size)
-{
+ uint8_t *pdu_buffer, unsigned int pdu_buffer_size) {
unsigned char frameBuffer[9000];
unsigned int frameOffset;
-
ssize_t bytesSent;
frameOffset = 0;
uint16_t tmp16;
-
memcpy(frameBuffer+frameOffset, MAC_LTE_START_STRING,
strlen(MAC_LTE_START_STRING));
frameOffset += strlen(MAC_LTE_START_STRING);
-
/******************************************************************************/
/* Now write out fixed fields (the mandatory elements of struct mac_lte_info) */
frameBuffer[frameOffset++] = radioType;
frameBuffer[frameOffset++] = direction;
frameBuffer[frameOffset++] = rntiType;
-
/*************************************/
/* Now optional fields */
-
/* RNTI */
frameBuffer[frameOffset++] = MAC_LTE_RNTI_TAG;
tmp16 = htons(rnti);
memcpy(frameBuffer+frameOffset, &tmp16, 2);
frameOffset += 2;
-
/* UEId */
frameBuffer[frameOffset++] = MAC_LTE_UEID_TAG;
tmp16 = htons(ueid);
memcpy(frameBuffer+frameOffset, &tmp16, 2);
frameOffset += 2;
-
/* Subframe number */
frameBuffer[frameOffset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
tmp16 = htons(sfnSf); // frame counter : this will give an expert info as wireshark expects SF and not F
memcpy(frameBuffer+frameOffset, &tmp16, 2);
frameOffset += 2;
-
frameBuffer[frameOffset++] = MAC_LTE_CRC_STATUS_TAG;
frameBuffer[frameOffset++] = crcStatus;
-
#ifdef WIRESHARK_DEV
frameOffset += 2;
tmp16 = htons(sfnSf); // subframe
@@ -293,55 +276,55 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
frameBuffer[frameOffset++] = retx;
}
-//#ifdef WIRESHARK_DEV
+ //#ifdef WIRESHARK_DEV
/* Relating to out-of-band events */
/* N.B. dissector will only look to these fields if length is 0... */
if (pdu_buffer_size==0) {
switch (oob_event) {
- case ltemac_send_preamble :
- LOG_D(OPT,"ltemac_send_preamble event %02x."
- //"%02x."
- "%02x.%02x\n",
- MAC_LTE_SEND_PREAMBLE_TAG,
- //ltemac_send_preamble,
- rnti,
- oob_event_value);
- //frameBuffer[frameOffset++]=0;
- //frameBuffer[frameOffset++]=0;
- //frameBuffer[frameOffset++]=0;
- frameBuffer[frameOffset++] = MAC_LTE_SEND_PREAMBLE_TAG;
- //frameBuffer[frameOffset++]=ltemac_send_preamble;
- frameBuffer[frameOffset++]=rnti; // is the preamble
- frameBuffer[frameOffset++]=oob_event_value;
- break;
+ case ltemac_send_preamble :
+ LOG_D(OPT,"ltemac_send_preamble event %02x."
+ //"%02x."
+ "%02x.%02x\n",
+ MAC_LTE_SEND_PREAMBLE_TAG,
+ //ltemac_send_preamble,
+ rnti,
+ oob_event_value);
+ //frameBuffer[frameOffset++]=0;
+ //frameBuffer[frameOffset++]=0;
+ //frameBuffer[frameOffset++]=0;
+ frameBuffer[frameOffset++] = MAC_LTE_SEND_PREAMBLE_TAG;
+ //frameBuffer[frameOffset++]=ltemac_send_preamble;
+ frameBuffer[frameOffset++]=rnti; // is the preamble
+ frameBuffer[frameOffset++]=oob_event_value;
+ break;
- case ltemac_send_sr:
- frameBuffer[frameOffset++]=MAC_LTE_SR_TAG ;
- frameOffset+=2;
- frameBuffer[frameOffset++]=rnti;
- frameOffset++;
- frameBuffer[frameOffset++]=oob_event_value;
- frameOffset++;
- break;
+ case ltemac_send_sr:
+ frameBuffer[frameOffset++]=MAC_LTE_SR_TAG ;
+ frameOffset+=2;
+ frameBuffer[frameOffset++]=rnti;
+ frameOffset++;
+ frameBuffer[frameOffset++]=oob_event_value;
+ frameOffset++;
+ break;
- case ltemac_sr_failure:
- default:
- LOG_W(OPT,"not implemeneted yet\n");
- break;
+ case ltemac_sr_failure:
+ default:
+ LOG_W(OPT,"not implemeneted yet\n");
+ break;
}
}
-//#endif
+ //#endif
/***************************************/
/* Now write the MAC PDU */
frameBuffer[frameOffset++] = MAC_LTE_PAYLOAD_TAG;
-
+
/* Append actual PDU */
//memcpy(frameBuffer+frameOffset, g_PDUBuffer, g_PDUOffset);
//frameOffset += g_PDUOffset;
if (pdu_buffer != NULL) {
- memcpy(frameBuffer+frameOffset, (void*)pdu_buffer, pdu_buffer_size);
+ memcpy(frameBuffer+frameOffset, (void *)pdu_buffer, pdu_buffer_size);
frameOffset += pdu_buffer_size;
}
@@ -358,44 +341,36 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
/* Write an individual PDU (PCAP packet header + mac-context + mac-pdu) */
static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
- const uint8_t *PDU, unsigned int length)
-{
+ const uint8_t *PDU, unsigned int length) {
pcaprec_hdr_t packet_header;
uint8_t context_header[256];
int offset = 0;
unsigned short tmp16;
-
/*****************************************************************/
/* Context information (same as written by UDP heuristic clients */
context_header[offset++] = context->radioType;
context_header[offset++] = context->direction;
context_header[offset++] = context->rntiType;
-
/* RNTI */
context_header[offset++] = MAC_LTE_RNTI_TAG;
tmp16 = htons(context->rnti);
memcpy(context_header+offset, &tmp16, 2);
offset += 2;
-
/* UEId */
context_header[offset++] = MAC_LTE_UEID_TAG;
tmp16 = htons(context->ueid);
memcpy(context_header+offset, &tmp16, 2);
offset += 2;
-
/* Subframe number */
context_header[offset++] = MAC_LTE_FRAME_SUBFRAME_TAG;
tmp16 = htons(context->subFrameNumber);
memcpy(context_header+offset, &tmp16, 2);
offset += 2;
-
/* CRC Status */
context_header[offset++] = MAC_LTE_CRC_STATUS_TAG;
context_header[offset++] = context->crcStatusOK;
-
/* Data tag immediately preceding PDU */
context_header[offset++] = MAC_LTE_PAYLOAD_TAG;
-
/****************************************************************/
/* PCAP Header */
/* TODO: Timestamp might want to be relative to a more sensible
@@ -404,13 +379,11 @@ static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context,
packet_header.ts_usec = (context->subframesSinceCaptureStart % 1000) * 1000;
packet_header.incl_len = offset + length;
packet_header.orig_len = offset + length;
-
/***************************************************************/
/* Now write everything to the file */
fwrite(&packet_header, sizeof(pcaprec_hdr_t), 1, file_fd);
fwrite(context_header, 1, offset, file_fd);
fwrite(PDU, 1, length, file_fd);
-
return 1;
}
#include
@@ -419,117 +392,129 @@ extern RAN_CONTEXT_t RC;
/* Remote serveraddress (where Wireshark is running) */
void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size,
int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event,
- int oob_event_value)
-{
+ int oob_event_value) {
MAC_Context_Info_t pdu_context;
int radioType=FDD_RADIO;
+
if (RC.eNB[0][0]!=NULL)
radioType=RC.eNB[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
+
if (PHY_vars_UE_g[0][0] != NULL)
radioType=PHY_vars_UE_g[0][0]->frame_parms.frame_type== FDD ? FDD_RADIO:TDD_RADIO;
+
switch (opt_type) {
- case OPT_WIRESHARK :
- if (g_socksd == -1) {
- return;
- }
+ case OPT_WIRESHARK :
+ if (g_socksd == -1) {
+ return;
+ }
- SendFrame( radioType,
- (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
- rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber,
- 1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
- oob_event,oob_event_value,
- pdu_buffer, pdu_buffer_size);
- break;
+ SendFrame( radioType,
+ (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK,
+ rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber,
+ 1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus
+ oob_event,oob_event_value,
+ pdu_buffer, pdu_buffer_size);
+ break;
- case OPT_PCAP:
- if (file_fd == NULL) {
- return;
- }
+ case OPT_PCAP:
+ if (file_fd == NULL) {
+ return;
+ }
- pdu_context.radioType = radioType;
- pdu_context.direction = (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK
- : DIRECTION_UPLINK;
- pdu_context.rntiType = rntiType;
- pdu_context.rnti = rnti;
- pdu_context.ueid = ueid;
- pdu_context.isRetx = 0;
- pdu_context.crcStatusOK =1;
- pdu_context.sysFrameNumber = sysFrameNumber;
- pdu_context.subFrameNumber = subFrameNumber;
- pdu_context.subframesSinceCaptureStart = subframesSinceCaptureStart++;
- MAC_LTE_PCAP_WritePDU( &pdu_context, pdu_buffer, pdu_buffer_size);
- break;
+ pdu_context.radioType = radioType;
+ pdu_context.direction = (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK
+ : DIRECTION_UPLINK;
+ pdu_context.rntiType = rntiType;
+ pdu_context.rnti = rnti;
+ pdu_context.ueid = ueid;
+ pdu_context.isRetx = 0;
+ pdu_context.crcStatusOK =1;
+ pdu_context.sysFrameNumber = sysFrameNumber;
+ pdu_context.subFrameNumber = subFrameNumber;
+ pdu_context.subframesSinceCaptureStart = subframesSinceCaptureStart++;
+ MAC_LTE_PCAP_WritePDU( &pdu_context, pdu_buffer, pdu_buffer_size);
+ break;
- case OPT_TSHARK:
- default:
- break;
+ case OPT_TSHARK:
+ default:
+ break;
}
}
/*---------------------------------------------------*/
-int init_opt(char *path, char *ip)
-{
+int init_opt(void) {
+ char *in_type=NULL;
+ paramdef_t opt_params[] = OPT_PARAMS_DESC ;
+ checkedparam_t opt_checkParams[] = OPTPARAMS_CHECK_DESC;
uint16_t in_port;
+ config_set_checkfunctions(opt_params, opt_checkParams,
+ sizeof(opt_params)/sizeof(paramdef_t));
+ config_get( opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX);
subframesSinceCaptureStart = 0;
+ int tmptype = config_get_processedint( &(opt_params[OPTTYPE_IDX]));
- if (path != NULL) {
- strncpy( in_path, path, sizeof(in_path) );
- in_path[sizeof(in_path) - 1] = 0; // terminate string
+ if (tmptype == OPT_NONE) {
+ opt_enabled=0;
+ LOG_I(OPT,"OPT disabled\n");
+ return 0;
+ } else if (tmptype == OPT_PCAP && strlen(in_path) > 0) {
+ opt_type = OPT_PCAP;
+ opt_enabled=1;
+ LOG_I(OPT,"Enabling OPT for PCAP with the following file %s \n",in_path);
+ } else if (tmptype == OPT_WIRESHARK && strlen(in_ip) > 0) {
+ opt_enabled=1;
+ opt_type = OPT_WIRESHARK;
+ LOG_I(OPT,"Enabling OPT for wireshark for local interface %s\n",in_ip);
} else {
- strcpy( in_path, "/tmp/opt.pcap" );
- }
-
- if (ip != NULL) {
- strncpy( in_ip, ip, sizeof(in_ip) );
- in_ip[sizeof(in_ip) - 1] = 0; // terminate string
- } else {
- strcpy( in_ip, "127.0.0.1" );
+ LOG_E(OPT,"Invalid OPT configuration\n");
+ config_printhelp(opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX);
}
in_port = PACKET_MAC_LTE_DEFAULT_UDP_PORT;
// trace_mode
switch (opt_type) {
- case OPT_WIRESHARK:
+ case OPT_WIRESHARK:
- /* Create local server socket only if using localhost address */
- if (strcmp(in_ip, "127.0.0.1") == 0) {
- opt_create_listener_socket(in_ip, in_port);
- }
+ /* Create local server socket only if using localhost address */
+ if (strcmp(in_ip, "127.0.0.1") == 0) {
+ opt_create_listener_socket(in_ip, in_port);
+ }
- g_socksd = socket(AF_INET, SOCK_DGRAM, 0);
+ g_socksd = socket(AF_INET, SOCK_DGRAM, 0);
- if (g_socksd == -1) {
- LOG_E(OPT, "Error trying to create socket (errno=%d)\n", errno);
- LOG_E(OPT, "CREATING SOCKET FAILED\n");
- return (-1);
- }
+ if (g_socksd == -1) {
+ LOG_E(OPT, "Error trying to create socket (errno=%d)\n", errno);
+ LOG_E(OPT, "CREATING SOCKET FAILED\n");
+ return (-1);
+ }
- /* Get remote IP address from the function argument */
- g_serv_addr.sin_family = AF_INET;
- g_serv_addr.sin_port = htons(in_port);
- g_serv_addr.sin_addr.s_addr = inet_addr(in_ip);
- break;
+ /* Get remote IP address from the function argument */
+ g_serv_addr.sin_family = AF_INET;
+ g_serv_addr.sin_port = htons(in_port);
+ g_serv_addr.sin_addr.s_addr = inet_addr(in_ip);
+ break;
- case OPT_PCAP:
- file_fd = fopen(in_path, "w");
+ case OPT_PCAP:
+ file_fd = fopen(in_path, "w");
- if (file_fd == NULL) {
- LOG_D(OPT, "Failed to open file \"%s\" for writing\n", in_path);
- return (-1);
- }
- /* Write the file header */
- fwrite(&file_header, sizeof(pcap_hdr_t), 1, file_fd);
- break;
+ if (file_fd == NULL) {
+ LOG_D(OPT, "Failed to open file \"%s\" for writing\n", in_path);
+ return (-1);
+ }
- case OPT_TSHARK:
- LOG_W(OPT, "Tshark is currently not supported\n");
- opt_type = OPT_NONE;
- break;
+ /* Write the file header */
+ fwrite(&file_header, sizeof(pcap_hdr_t), 1, file_fd);
+ break;
- default:
- opt_type = OPT_NONE;
- LOG_W(OPT, "supported Option\n");
- break;
+ case OPT_TSHARK:
+ LOG_W(OPT, "Tshark is currently not supported\n");
+ opt_type = OPT_NONE;
+ break;
+
+ default:
+ opt_type = OPT_NONE;
+ LOG_W(OPT, "supported Option\n");
+ break;
}
if ( opt_type == OPT_WIRESHARK )
@@ -543,8 +528,7 @@ int init_opt(char *path, char *ip)
// memset(mac_info, 0, sizeof(mac_lte_info)+pdu_buffer_size + 8);
return (1);
}
-void terminate_opt(void)
-{
+void terminate_opt(void) {
/* Close local socket */
// free(mac_info);
if (opt_type != OPT_NONE) {
@@ -552,18 +536,18 @@ void terminate_opt(void)
}
switch (opt_type) {
- case OPT_WIRESHARK:
- close(g_socksd);
- g_socksd = -1;
- break;
+ case OPT_WIRESHARK:
+ close(g_socksd);
+ g_socksd = -1;
+ break;
- case OPT_PCAP:
- fclose (file_fd);
- file_fd = NULL;
- break;
+ case OPT_PCAP:
+ fclose (file_fd);
+ file_fd = NULL;
+ break;
- default:
- break;
+ default:
+ break;
}
}
diff --git a/openair2/X2AP/MESSAGES/ASN1/R10/x2ap-10.7.0.asn1 b/openair2/X2AP/MESSAGES/ASN1/R10/x2ap-10.7.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/X2AP/MESSAGES/ASN1/R11/x2ap-11.9.0.asn1 b/openair2/X2AP/MESSAGES/ASN1/R11/x2ap-11.9.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/X2AP/MESSAGES/ASN1/R12/x2ap-12.8.0.asn1 b/openair2/X2AP/MESSAGES/ASN1/R12/x2ap-12.8.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/X2AP/MESSAGES/ASN1/R13/x2ap-13.7.0.asn1 b/openair2/X2AP/MESSAGES/ASN1/R13/x2ap-13.7.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/X2AP/MESSAGES/ASN1/R14/x2ap-14.6.0.asn1 b/openair2/X2AP/MESSAGES/ASN1/R14/x2ap-14.6.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/X2AP/MESSAGES/ASN1/R15/x2ap-15.1.0.asn1 b/openair2/X2AP/MESSAGES/ASN1/R15/x2ap-15.1.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/X2AP/MESSAGES/ASN1/R15/x2ap-15.2.0.asn1 b/openair2/X2AP/MESSAGES/ASN1/R15/x2ap-15.2.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/X2AP/MESSAGES/ASN1/R8/x2ap-8.9.0.asn1 b/openair2/X2AP/MESSAGES/ASN1/R8/x2ap-8.9.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/X2AP/MESSAGES/ASN1/R9/x2ap-9.6.0.asn1 b/openair2/X2AP/MESSAGES/ASN1/R9/x2ap-9.6.0.asn1
old mode 100755
new mode 100644
diff --git a/openair2/X2AP/x2ap_eNB.c b/openair2/X2AP/x2ap_eNB.c
index d12dfa8819..13f6989f1c 100644
--- a/openair2/X2AP/x2ap_eNB.c
+++ b/openair2/X2AP/x2ap_eNB.c
@@ -67,30 +67,21 @@ void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p,
static
void x2ap_eNB_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) {
-
int result;
-
DevAssert(sctp_data_ind != NULL);
-
x2ap_eNB_handle_message(instance, sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
-
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
-
}
static
-void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp)
-{
+void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) {
x2ap_eNB_instance_t *instance_p;
x2ap_eNB_data_t *x2ap_enb_data_p;
-
DevAssert(sctp_new_association_resp != NULL);
-
-printf("x2ap_eNB_handle_sctp_association_resp at 1\n");
-dump_trees();
-
+ printf("x2ap_eNB_handle_sctp_association_resp at 1\n");
+ dump_trees();
instance_p = x2ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
@@ -99,13 +90,15 @@ dump_trees();
*/
if (sctp_new_association_resp->assoc_id != -1) {
x2ap_enb_data_p = x2ap_get_eNB(instance_p, sctp_new_association_resp->assoc_id,
- sctp_new_association_resp->ulp_cnx_id);
+ sctp_new_association_resp->ulp_cnx_id);
+
if (x2ap_enb_data_p != NULL) {
/* some sanity check - to be refined at some point */
if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
X2AP_ERROR("x2ap_enb_data_p not NULL and sctp state not SCTP_STATE_ESTABLISHED, what to do?\n");
abort();
}
+
x2ap_enb_data_p->in_streams = sctp_new_association_resp->in_streams;
x2ap_enb_data_p->out_streams = sctp_new_association_resp->out_streams;
return;
@@ -113,70 +106,60 @@ dump_trees();
}
x2ap_enb_data_p = x2ap_get_eNB(instance_p, -1,
- sctp_new_association_resp->ulp_cnx_id);
+ sctp_new_association_resp->ulp_cnx_id);
DevAssert(x2ap_enb_data_p != NULL);
-
-printf("x2ap_eNB_handle_sctp_association_resp at 2\n");
-dump_trees();
+ printf("x2ap_eNB_handle_sctp_association_resp at 2\n");
+ dump_trees();
if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
X2AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n",
sctp_new_association_resp->sctp_state,
instance,
sctp_new_association_resp->ulp_cnx_id);
-
x2ap_handle_x2_setup_message(x2ap_enb_data_p,
- sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
-
+ sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
return;
}
-printf("x2ap_eNB_handle_sctp_association_resp at 3\n");
-dump_trees();
-
+ printf("x2ap_eNB_handle_sctp_association_resp at 3\n");
+ dump_trees();
/* Update parameters */
x2ap_enb_data_p->assoc_id = sctp_new_association_resp->assoc_id;
x2ap_enb_data_p->in_streams = sctp_new_association_resp->in_streams;
x2ap_enb_data_p->out_streams = sctp_new_association_resp->out_streams;
-
-printf("x2ap_eNB_handle_sctp_association_resp at 4\n");
-dump_trees();
-
+ printf("x2ap_eNB_handle_sctp_association_resp at 4\n");
+ dump_trees();
/* Prepare new x2 Setup Request */
x2ap_eNB_generate_x2_setup_request(instance_p, x2ap_enb_data_p);
}
static
-void x2ap_eNB_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind)
-{
+void x2ap_eNB_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) {
x2ap_eNB_instance_t *instance_p;
x2ap_eNB_data_t *x2ap_enb_data_p;
-
-printf("x2ap_eNB_handle_sctp_association_ind at 1 (called for instance %d)\n", instance);
-dump_trees();
+ printf("x2ap_eNB_handle_sctp_association_ind at 1 (called for instance %d)\n", instance);
+ dump_trees();
DevAssert(sctp_new_association_ind != NULL);
-
instance_p = x2ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
-
x2ap_enb_data_p = x2ap_get_eNB(instance_p, sctp_new_association_ind->assoc_id, -1);
+
if (x2ap_enb_data_p != NULL) abort();
-// DevAssert(x2ap_enb_data_p != NULL);
+
+ // DevAssert(x2ap_enb_data_p != NULL);
if (x2ap_enb_data_p == NULL) {
/* Create new eNB descriptor */
x2ap_enb_data_p = calloc(1, sizeof(*x2ap_enb_data_p));
DevAssert(x2ap_enb_data_p != NULL);
-
x2ap_enb_data_p->cnx_id = x2ap_eNB_fetch_add_global_cnx_id();
-
x2ap_enb_data_p->x2ap_eNB_instance = instance_p;
-
/* Insert the new descriptor in list of known eNB
* but not yet associated.
*/
RB_INSERT(x2ap_enb_map, &instance_p->x2ap_enb_head, x2ap_enb_data_p);
x2ap_enb_data_p->state = X2AP_ENB_STATE_CONNECTED;
instance_p->x2_target_enb_nb++;
+
if (instance_p->x2_target_enb_pending_nb > 0) {
instance_p->x2_target_enb_pending_nb--;
}
@@ -184,37 +167,31 @@ dump_trees();
X2AP_WARN("x2ap_enb_data_p already exists\n");
}
-printf("x2ap_eNB_handle_sctp_association_ind at 2\n");
-dump_trees();
+ printf("x2ap_eNB_handle_sctp_association_ind at 2\n");
+ dump_trees();
/* Update parameters */
x2ap_enb_data_p->assoc_id = sctp_new_association_ind->assoc_id;
x2ap_enb_data_p->in_streams = sctp_new_association_ind->in_streams;
x2ap_enb_data_p->out_streams = sctp_new_association_ind->out_streams;
-
-printf("x2ap_eNB_handle_sctp_association_ind at 3\n");
-dump_trees();
+ printf("x2ap_eNB_handle_sctp_association_ind at 3\n");
+ dump_trees();
}
int x2ap_eNB_init_sctp (x2ap_eNB_instance_t *instance_p,
- net_ip_address_t *local_ip_addr,
- uint32_t enb_port_for_X2C)
-{
+ net_ip_address_t *local_ip_addr,
+ uint32_t enb_port_for_X2C) {
// Create and alloc new message
MessageDef *message;
sctp_init_t *sctp_init = NULL;
-
DevAssert(instance_p != NULL);
DevAssert(local_ip_addr != NULL);
-
message = itti_alloc_new_message (TASK_X2AP, SCTP_INIT_MSG_MULTI_REQ);
sctp_init = &message->ittiMsg.sctp_init_multi;
-
sctp_init->port = enb_port_for_X2C;
sctp_init->ppid = X2AP_SCTP_PPID;
sctp_init->ipv4 = 1;
sctp_init->ipv6 = 0;
sctp_init->nb_ipv4_addr = 1;
-
#if 0
memcpy(&sctp_init->ipv4_address,
local_ip_addr,
@@ -227,9 +204,7 @@ int x2ap_eNB_init_sctp (x2ap_eNB_instance_t *instance_p,
*/
sctp_init->nb_ipv6_addr = 0;
sctp_init->ipv6_address[0] = "0:0:0:0:0:0:0:1";
-
return itti_send_msg_to_task (TASK_SCTP, instance_p->instance, message);
-
}
static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p,
@@ -237,47 +212,33 @@ static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p,
net_ip_address_t *local_ip_addr,
uint16_t in_streams,
uint16_t out_streams,
- uint32_t enb_port_for_X2C,
- int multi_sd)
-{
-
+ uint32_t enb_port_for_X2C,
+ int multi_sd) {
MessageDef *message = NULL;
sctp_new_association_req_multi_t *sctp_new_association_req = NULL;
x2ap_eNB_data_t *x2ap_enb_data = NULL;
-
DevAssert(instance_p != NULL);
DevAssert(target_eNB_ip_address != NULL);
-
message = itti_alloc_new_message(TASK_X2AP, SCTP_NEW_ASSOCIATION_REQ_MULTI);
-
sctp_new_association_req = &message->ittiMsg.sctp_new_association_req_multi;
-
sctp_new_association_req->port = enb_port_for_X2C;
sctp_new_association_req->ppid = X2AP_SCTP_PPID;
-
sctp_new_association_req->in_streams = in_streams;
sctp_new_association_req->out_streams = out_streams;
-
sctp_new_association_req->multi_sd = multi_sd;
-
memcpy(&sctp_new_association_req->remote_address,
target_eNB_ip_address,
sizeof(*target_eNB_ip_address));
-
memcpy(&sctp_new_association_req->local_address,
local_ip_addr,
sizeof(*local_ip_addr));
-
/* Create new eNB descriptor */
x2ap_enb_data = calloc(1, sizeof(*x2ap_enb_data));
DevAssert(x2ap_enb_data != NULL);
-
x2ap_enb_data->cnx_id = x2ap_eNB_fetch_add_global_cnx_id();
sctp_new_association_req->ulp_cnx_id = x2ap_enb_data->cnx_id;
-
x2ap_enb_data->assoc_id = -1;
x2ap_enb_data->x2ap_eNB_instance = instance_p;
-
/* Insert the new descriptor in list of known eNB
* but not yet associated.
*/
@@ -285,18 +246,14 @@ static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p,
x2ap_enb_data->state = X2AP_ENB_STATE_WAITING;
instance_p->x2_target_enb_nb ++;
instance_p->x2_target_enb_pending_nb ++;
-
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message);
}
static
void x2ap_eNB_handle_register_eNB(instance_t instance,
- x2ap_register_enb_req_t *x2ap_register_eNB)
-{
+ x2ap_register_enb_req_t *x2ap_register_eNB) {
x2ap_eNB_instance_t *new_instance;
-
DevAssert(x2ap_register_eNB != NULL);
-
/* Look if the provided instance already exists */
new_instance = x2ap_eNB_get_instance(instance);
@@ -308,13 +265,10 @@ void x2ap_eNB_handle_register_eNB(instance_t instance,
DevCheck(new_instance->mcc == x2ap_register_eNB->mcc, new_instance->mcc, x2ap_register_eNB->mcc, 0);
DevCheck(new_instance->mnc == x2ap_register_eNB->mnc, new_instance->mnc, x2ap_register_eNB->mnc, 0);
X2AP_WARN("eNB[%d] already registered\n", instance);
- }
- else {
+ } else {
new_instance = calloc(1, sizeof(x2ap_eNB_instance_t));
DevAssert(new_instance != NULL);
-
RB_INIT(&new_instance->x2ap_enb_head);
-
/* Copy usefull parameters */
new_instance->instance = instance;
new_instance->eNB_name = x2ap_register_eNB->eNB_name;
@@ -324,10 +278,9 @@ void x2ap_eNB_handle_register_eNB(instance_t instance,
new_instance->mcc = x2ap_register_eNB->mcc;
new_instance->mnc = x2ap_register_eNB->mnc;
new_instance->mnc_digit_length = x2ap_register_eNB->mnc_digit_length;
-
new_instance->num_cc = x2ap_register_eNB->num_cc;
- for (int i = 0; i< x2ap_register_eNB->num_cc; i++){
+ for (int i = 0; i< x2ap_register_eNB->num_cc; i++) {
new_instance->eutra_band[i] = x2ap_register_eNB->eutra_band[i];
new_instance->downlink_frequency[i] = x2ap_register_eNB->downlink_frequency[i];
new_instance->uplink_frequency_offset[i] = x2ap_register_eNB->uplink_frequency_offset[i];
@@ -343,44 +296,40 @@ void x2ap_eNB_handle_register_eNB(instance_t instance,
memcpy(new_instance->target_enb_x2_ip_address,
x2ap_register_eNB->target_enb_x2_ip_address,
x2ap_register_eNB->nb_x2 * sizeof(net_ip_address_t));
-
new_instance->nb_x2 = x2ap_register_eNB->nb_x2;
new_instance->enb_x2_ip_address = x2ap_register_eNB->enb_x2_ip_address;
new_instance->sctp_in_streams = x2ap_register_eNB->sctp_in_streams;
new_instance->sctp_out_streams = x2ap_register_eNB->sctp_out_streams;
new_instance->enb_port_for_X2C = x2ap_register_eNB->enb_port_for_X2C;
-
/* Add the new instance to the list of eNB (meaningfull in virtual mode) */
x2ap_eNB_insert_new_instance(new_instance);
-
X2AP_INFO("Registered new eNB[%d] and %s eNB id %u\n",
- instance,
- x2ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
- x2ap_register_eNB->eNB_id);
+ instance,
+ x2ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
+ x2ap_register_eNB->eNB_id);
+
/* initiate the SCTP listener */
if (x2ap_eNB_init_sctp(new_instance,&x2ap_register_eNB->enb_x2_ip_address,x2ap_register_eNB->enb_port_for_X2C) < 0 ) {
- X2AP_ERROR ("Error while sending SCTP_INIT_MSG to SCTP \n");
- return;
+ X2AP_ERROR ("Error while sending SCTP_INIT_MSG to SCTP \n");
+ return;
}
- X2AP_INFO("eNB[%d] eNB id %u acting as a listner (server)\n",
- instance, x2ap_register_eNB->eNB_id);
+
+ X2AP_INFO("eNB[%d] eNB id %u acting as a listner (server)\n",
+ instance, x2ap_register_eNB->eNB_id);
}
}
static
void x2ap_eNB_handle_sctp_init_msg_multi_cnf(
- instance_t instance_id,
- sctp_init_msg_multi_cnf_t *m)
-{
+ instance_t instance_id,
+ sctp_init_msg_multi_cnf_t *m) {
x2ap_eNB_instance_t *instance;
int index;
-
DevAssert(m != NULL);
-
instance = x2ap_eNB_get_instance(instance_id);
DevAssert(instance != NULL);
-
instance->multi_sd = m->multi_sd;
+
/* Exit if CNF message reports failure.
* Failure means multi_sd < 0.
*/
@@ -392,72 +341,67 @@ void x2ap_eNB_handle_sctp_init_msg_multi_cnf(
/* Trying to connect to the provided list of eNB ip address */
for (index = 0; index < instance->nb_x2; index++) {
-
- X2AP_INFO("eNB[%d] eNB id %u acting as an initiator (client)\n",
- instance_id, instance->eNB_id);
- x2ap_eNB_register_eNB(instance,
- &instance->target_enb_x2_ip_address[index],
- &instance->enb_x2_ip_address,
- instance->sctp_in_streams,
- instance->sctp_out_streams,
- instance->enb_port_for_X2C,
- instance->multi_sd);
+ X2AP_INFO("eNB[%d] eNB id %u acting as an initiator (client)\n",
+ instance_id, instance->eNB_id);
+ x2ap_eNB_register_eNB(instance,
+ &instance->target_enb_x2_ip_address[index],
+ &instance->enb_x2_ip_address,
+ instance->sctp_in_streams,
+ instance->sctp_out_streams,
+ instance->enb_port_for_X2C,
+ instance->multi_sd);
}
}
-void *x2ap_task(void *arg)
-{
+void *x2ap_task(void *arg) {
MessageDef *received_msg = NULL;
int result;
-
X2AP_DEBUG("Starting X2AP layer\n");
-
x2ap_eNB_prepare_internal_data();
-
itti_mark_task_ready(TASK_X2AP);
while (1) {
itti_receive_msg(TASK_X2AP, &received_msg);
+
switch (ITTI_MSG_ID(received_msg)) {
- case TERMINATE_MESSAGE:
- X2AP_WARN(" *** Exiting X2AP thread\n");
- itti_exit_task();
- break;
+ case TERMINATE_MESSAGE:
+ X2AP_WARN(" *** Exiting X2AP thread\n");
+ itti_exit_task();
+ break;
- case X2AP_REGISTER_ENB_REQ:
- x2ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
- &X2AP_REGISTER_ENB_REQ(received_msg));
- break;
+ case X2AP_REGISTER_ENB_REQ:
+ x2ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg),
+ &X2AP_REGISTER_ENB_REQ(received_msg));
+ break;
- case SCTP_INIT_MSG_MULTI_CNF:
- x2ap_eNB_handle_sctp_init_msg_multi_cnf(ITTI_MESSAGE_GET_INSTANCE(received_msg),
- &received_msg->ittiMsg.sctp_init_msg_multi_cnf);
- break;
+ case SCTP_INIT_MSG_MULTI_CNF:
+ x2ap_eNB_handle_sctp_init_msg_multi_cnf(ITTI_MESSAGE_GET_INSTANCE(received_msg),
+ &received_msg->ittiMsg.sctp_init_msg_multi_cnf);
+ break;
- case SCTP_NEW_ASSOCIATION_RESP:
- x2ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
- &received_msg->ittiMsg.sctp_new_association_resp);
- break;
+ case SCTP_NEW_ASSOCIATION_RESP:
+ x2ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
+ &received_msg->ittiMsg.sctp_new_association_resp);
+ break;
- case SCTP_NEW_ASSOCIATION_IND:
- x2ap_eNB_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
- &received_msg->ittiMsg.sctp_new_association_ind);
- break;
+ case SCTP_NEW_ASSOCIATION_IND:
+ x2ap_eNB_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
+ &received_msg->ittiMsg.sctp_new_association_ind);
+ break;
- case SCTP_DATA_IND:
- x2ap_eNB_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
- &received_msg->ittiMsg.sctp_data_ind);
- break;
+ case SCTP_DATA_IND:
+ x2ap_eNB_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
+ &received_msg->ittiMsg.sctp_data_ind);
+ break;
- default:
- X2AP_ERROR("Received unhandled message: %d:%s\n",
- ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
- break;
+ default:
+ X2AP_ERROR("Received unhandled message: %d:%s\n",
+ ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
+ break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
-
received_msg = NULL;
}
diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c
index 0389106ec3..0c5a2fec1f 100644
--- a/openair3/NAS/UE/nas_itti_messaging.c
+++ b/openair3/NAS/UE/nas_itti_messaging.c
@@ -85,94 +85,13 @@ static const uint8_t esm_message_ids[] = {
ESM_STATUS,
};
-static int _nas_find_message_index(const uint8_t message_id, const uint8_t *message_ids, const int ids_number)
-{
- int i;
- for(i = 0; i < ids_number; i ++) {
- if (message_id == message_ids[i]) {
- return (2 + i);
- }
- }
-
- return (1);
+int nas_itti_plain_msg(const char *buffer, const nas_message_t *msg, const int length, const int down_link) {
+ return 0;
}
-int nas_itti_plain_msg(const char *buffer, const nas_message_t *msg, const int length, const int down_link)
-{
- MessageDef *message_p;
- int data_length = length < NAS_DATA_LENGHT_MAX ? length : NAS_DATA_LENGHT_MAX;
- int message_type = -1;
- MessagesIds messageId_raw = -1;
- MessagesIds messageId_plain = -1;
-
- /* Define message ids */
- if (msg->header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) {
- message_type = 0;
- messageId_raw = down_link ? NAS_DL_EMM_RAW_MSG : NAS_UL_EMM_RAW_MSG;
- messageId_plain = down_link ? NAS_DL_EMM_PLAIN_MSG : NAS_UL_EMM_PLAIN_MSG;
- } else {
- if (msg->header.protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) {
- message_type = 1;
- messageId_raw = down_link ? NAS_DL_ESM_RAW_MSG : NAS_UL_ESM_RAW_MSG;
- messageId_plain = down_link ? NAS_DL_ESM_PLAIN_MSG : NAS_UL_ESM_PLAIN_MSG;
- }
- }
-
- if (message_type >= 0) {
- /* Create and send the RAW message */
- message_p = itti_alloc_new_message(TASK_ORIGIN, messageId_raw);
-
- NAS_DL_EMM_RAW_MSG(message_p).lenght = length;
- memset ((void *) &(NAS_DL_EMM_RAW_MSG(message_p).data), 0, NAS_DATA_LENGHT_MAX);
- memcpy ((void *) &(NAS_DL_EMM_RAW_MSG(message_p).data), buffer, data_length);
-
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
-
- /* Create and send the plain message */
- if (message_type == 0) {
- message_p = itti_alloc_new_message(TASK_ORIGIN, messageId_plain);
-
- NAS_DL_EMM_PLAIN_MSG(message_p).present = _nas_find_message_index(msg->plain.emm.header.message_type, emm_message_ids, sizeof(emm_message_ids) / sizeof(emm_message_ids[0]));
- memcpy ((void *) &(NAS_DL_EMM_PLAIN_MSG(message_p).choice), &msg->plain.emm, sizeof (EMM_msg));
- } else {
- message_p = itti_alloc_new_message(TASK_ORIGIN, messageId_plain);
-
- NAS_DL_ESM_PLAIN_MSG(message_p).present = _nas_find_message_index(msg->plain.esm.header.message_type, esm_message_ids, sizeof(esm_message_ids) / sizeof(esm_message_ids[0]));
- memcpy ((void *) &(NAS_DL_ESM_PLAIN_MSG(message_p).choice), &msg->plain.esm, sizeof (ESM_msg));
- }
-
- return itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
- }
-
- return EXIT_FAILURE;
-}
-
-int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const int length, const int down_link)
-{
- MessageDef *message_p = NULL;
-
- if (msg->header.protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) {
- message_p = itti_alloc_new_message(TASK_ORIGIN, down_link ? NAS_DL_EMM_PROTECTED_MSG : NAS_UL_EMM_PROTECTED_MSG);
-
- memcpy ((void *) &(NAS_DL_EMM_PROTECTED_MSG(message_p).header), &msg->header, sizeof (nas_message_security_header_t));
- NAS_DL_EMM_PROTECTED_MSG(message_p).present = _nas_find_message_index(msg->security_protected.plain.emm.header.message_type, emm_message_ids, sizeof(emm_message_ids) / sizeof(emm_message_ids[0]));
- memcpy ((void *) &(NAS_DL_EMM_PROTECTED_MSG(message_p).choice), &msg->security_protected.plain.emm, sizeof (EMM_msg));
- } else {
- if (msg->header.protocol_discriminator == EPS_SESSION_MANAGEMENT_MESSAGE) {
- message_p = itti_alloc_new_message(TASK_ORIGIN, down_link ? NAS_DL_ESM_PROTECTED_MSG : NAS_UL_ESM_PROTECTED_MSG);
-
- memcpy ((void *) &(NAS_DL_ESM_PROTECTED_MSG(message_p).header), &msg->header, sizeof (nas_message_security_header_t));
- NAS_DL_ESM_PROTECTED_MSG(message_p).present = _nas_find_message_index(msg->security_protected.plain.esm.header.message_type, esm_message_ids, sizeof(esm_message_ids) / sizeof(esm_message_ids[0]));
- memcpy ((void *) &(NAS_DL_ESM_PROTECTED_MSG(message_p).choice), &msg->security_protected.plain.esm, sizeof (ESM_msg));
- }
- }
-
- if (message_p != NULL) {
- return itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
- }
-
- return EXIT_FAILURE;
+int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const int length, const int down_link) {
+ return 0;
}
#endif
@@ -180,112 +99,89 @@ int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const i
extern unsigned char NB_eNB_INST;
-int nas_itti_kenb_refresh_req(const Byte_t kenb[32])
-{
+int nas_itti_kenb_refresh_req(const Byte_t kenb[32]) {
MessageDef *message_p;
-
message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_KENB_REFRESH_REQ);
-
memcpy(NAS_KENB_REFRESH_REQ(message_p).kenb, kenb, sizeof(NAS_KENB_REFRESH_REQ(message_p).kenb));
-
MSC_LOG_TX_MESSAGE(
- MSC_NAS_UE,
- MSC_RRC_UE,
- NULL,0,
- "0 NAS_KENB_REFRESH_REQ KeNB "
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x"
- "%02x%02x%02x%02x",
- kenb[0], kenb[1], kenb[2], kenb[3],
- kenb[4], kenb[5], kenb[6], kenb[7],
- kenb[8], kenb[9], kenb[10], kenb[11],
- kenb[12], kenb[13], kenb[14], kenb[15],
- kenb[16], kenb[17], kenb[18], kenb[19],
- kenb[20], kenb[21], kenb[22], kenb[23],
- kenb[24], kenb[25], kenb[26], kenb[27],
- kenb[28], kenb[29], kenb[30], kenb[31]);
-
+ MSC_NAS_UE,
+ MSC_RRC_UE,
+ NULL,0,
+ "0 NAS_KENB_REFRESH_REQ KeNB "
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x"
+ "%02x%02x%02x%02x",
+ kenb[0], kenb[1], kenb[2], kenb[3],
+ kenb[4], kenb[5], kenb[6], kenb[7],
+ kenb[8], kenb[9], kenb[10], kenb[11],
+ kenb[12], kenb[13], kenb[14], kenb[15],
+ kenb[16], kenb[17], kenb[18], kenb[19],
+ kenb[20], kenb[21], kenb[22], kenb[23],
+ kenb[24], kenb[25], kenb[26], kenb[27],
+ kenb[28], kenb[29], kenb[30], kenb[31]);
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + 0 /* TODO to be virtualized */, message_p);
}
-int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id)
-{
+int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id) {
MessageDef *message_p;
-
message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_CELL_SELECTION_REQ);
-
NAS_CELL_SELECTION_REQ(message_p).plmnID = plmnID;
NAS_CELL_SELECTION_REQ(message_p).rat = rat;
-
MSC_LOG_TX_MESSAGE(
- MSC_NAS_UE,
- MSC_RRC_UE,
- NULL,0,
- "0 NAS_CELL_SELECTION_REQ PLMN %X%X%X.%X%X%X",
- plmnID.MCCdigit1, plmnID.MCCdigit2, plmnID.MCCdigit3,
- plmnID.MNCdigit1, plmnID.MNCdigit2, plmnID.MNCdigit3);
-
+ MSC_NAS_UE,
+ MSC_RRC_UE,
+ NULL,0,
+ "0 NAS_CELL_SELECTION_REQ PLMN %X%X%X.%X%X%X",
+ plmnID.MCCdigit1, plmnID.MCCdigit2, plmnID.MCCdigit3,
+ plmnID.MNCdigit1, plmnID.MNCdigit2, plmnID.MNCdigit3);
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
}
-int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data, uint32_t length, int user_id)
-{
+int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data, uint32_t length, int user_id) {
MessageDef *message_p;
-
message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_CONN_ESTABLI_REQ);
-
NAS_CONN_ESTABLI_REQ(message_p).cause = cause;
NAS_CONN_ESTABLI_REQ(message_p).type = type;
NAS_CONN_ESTABLI_REQ(message_p).s_tmsi = s_tmsi;
NAS_CONN_ESTABLI_REQ(message_p).plmnID = plmnID;
NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.data = data;
NAS_CONN_ESTABLI_REQ(message_p).initialNasMsg.length = length;
-
MSC_LOG_TX_MESSAGE(
- MSC_NAS_UE,
- MSC_RRC_UE,
- NULL,0,
- "0 NAS_CONN_ESTABLI_REQ MME code %u m-TMSI %u PLMN %X%X%X.%X%X%X",
- s_tmsi.MMEcode, s_tmsi.m_tmsi,
- plmnID.MCCdigit1, plmnID.MCCdigit2, plmnID.MCCdigit3,
- plmnID.MNCdigit1, plmnID.MNCdigit2, plmnID.MNCdigit3);
-
+ MSC_NAS_UE,
+ MSC_RRC_UE,
+ NULL,0,
+ "0 NAS_CONN_ESTABLI_REQ MME code %u m-TMSI %u PLMN %X%X%X.%X%X%X",
+ s_tmsi.MMEcode, s_tmsi.m_tmsi,
+ plmnID.MCCdigit1, plmnID.MCCdigit2, plmnID.MCCdigit3,
+ plmnID.MNCdigit1, plmnID.MNCdigit2, plmnID.MNCdigit3);
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
}
-int nas_itti_ul_data_req(const uint32_t ue_id, void *const data, const uint32_t length, int user_id)
-{
+int nas_itti_ul_data_req(const uint32_t ue_id, void *const data, const uint32_t length, int user_id) {
MessageDef *message_p;
-
message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_UPLINK_DATA_REQ);
-
NAS_UPLINK_DATA_REQ(message_p).UEid = ue_id;
NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = data;
NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = length;
-
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
}
-int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID, const nas_error_code_t errCode, int user_id)
-{
+int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID, const nas_error_code_t errCode, int user_id) {
MessageDef *message_p;
-
message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_RAB_ESTABLI_RSP);
-
NAS_RAB_ESTABLI_RSP(message_p).s_tmsi = s_tmsi;
NAS_RAB_ESTABLI_RSP(message_p).rabID = rabID;
NAS_RAB_ESTABLI_RSP(message_p).errCode = errCode;
-
MSC_LOG_TX_MESSAGE(
- MSC_NAS_UE,
- MSC_RRC_UE,
- NULL,0,
- "0 NAS_RAB_ESTABLI_RSP MME code %u m-TMSI %u rb id %u status %u",
- s_tmsi.MMEcode, s_tmsi.m_tmsi,rabID, errCode );
+ MSC_NAS_UE,
+ MSC_RRC_UE,
+ NULL,0,
+ "0 NAS_RAB_ESTABLI_RSP MME code %u m-TMSI %u rb id %u status %u",
+ s_tmsi.MMEcode, s_tmsi.m_tmsi,rabID, errCode );
return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + user_id, message_p);
}
diff --git a/openair3/S1AP/MESSAGES/ASN1/R10/s1ap-10.9.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R10/s1ap-10.9.0.asn1
old mode 100755
new mode 100644
diff --git a/openair3/S1AP/MESSAGES/ASN1/R11/s1ap-11.8.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R11/s1ap-11.8.0.asn1
old mode 100755
new mode 100644
diff --git a/openair3/S1AP/MESSAGES/ASN1/R12/s1ap-12.7.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R12/s1ap-12.7.0.asn1
old mode 100755
new mode 100644
diff --git a/openair3/S1AP/MESSAGES/ASN1/R13/s1ap-13.6.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R13/s1ap-13.6.0.asn1
old mode 100755
new mode 100644
diff --git a/openair3/S1AP/MESSAGES/ASN1/R14/s1ap-14.5.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R14/s1ap-14.5.0.asn1
old mode 100755
new mode 100644
diff --git a/openair3/S1AP/MESSAGES/ASN1/R14/s1ap-14.6.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R14/s1ap-14.6.0.asn1
old mode 100755
new mode 100644
diff --git a/openair3/S1AP/MESSAGES/ASN1/R15/s1ap-15.1.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R15/s1ap-15.1.0.asn1
old mode 100755
new mode 100644
diff --git a/openair3/S1AP/MESSAGES/ASN1/R15/s1ap-15.2.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R15/s1ap-15.2.0.asn1
old mode 100755
new mode 100644
diff --git a/openair3/S1AP/MESSAGES/ASN1/R8/s1ap-8.10.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R8/s1ap-8.10.0.asn1
old mode 100755
new mode 100644
diff --git a/openair3/S1AP/MESSAGES/ASN1/R9/s1ap-9.10.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R9/s1ap-9.10.0.asn1
old mode 100755
new mode 100644
diff --git a/openair3/S1AP/s1ap_eNB_decoder.c b/openair3/S1AP/s1ap_eNB_decoder.c
index c12374f758..dd1dfadc23 100644
--- a/openair3/S1AP/s1ap_eNB_decoder.c
+++ b/openair3/S1AP/s1ap_eNB_decoder.c
@@ -36,103 +36,52 @@
#include "s1ap_common.h"
#include "s1ap_eNB_decoder.h"
-static int s1ap_eNB_decode_initiating_message(S1AP_S1AP_PDU_t *pdu)
-{
- MessageDef *message_p;
- MessagesIds message_id;
+static int s1ap_eNB_decode_initiating_message(S1AP_S1AP_PDU_t *pdu) {
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
switch(pdu->choice.initiatingMessage.procedureCode) {
case S1AP_ProcedureCode_id_downlinkNASTransport:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_DOWNLINK_NAS_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
- res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_downlink_nas_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_downlink_nas_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1AP_ProcedureCode_id_InitialContextSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
- res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1AP_ProcedureCode_id_UEContextRelease:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
- res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_ue_context_release_command_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_ue_context_release_command_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1AP_ProcedureCode_id_Paging:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_PAGING_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
- res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_paging_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_paging_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
S1AP_INFO("Paging initiating message\n");
free(res.buffer);
break;
case S1AP_ProcedureCode_id_E_RABSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_E_RAB_SETUP_REQUEST_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
- res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_e_rab_setup_request_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_request_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("E_RABSetup initiating message\n");
break;
case S1AP_ProcedureCode_id_E_RABModify:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_E_RAB_MODIFY_REQUEST_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
- res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_e_rab_modify_request_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_request_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("E_RABModify initiating message\n");
break;
case S1AP_ProcedureCode_id_E_RABRelease:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_E_RAB_RELEASE_REQUEST_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
- res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_e_rab_release_request_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_e_rab_release_request_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("TODO E_RABRelease initiating message\n");
break;
case S1AP_ProcedureCode_id_ErrorIndication:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_ERROR_INDICATION_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id,
- res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_error_indication_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_error_indication_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("TODO ErrorIndication initiating message\n");
break;
@@ -148,21 +97,13 @@ static int s1ap_eNB_decode_initiating_message(S1AP_S1AP_PDU_t *pdu)
return 0;
}
-static int s1ap_eNB_decode_successful_outcome(S1AP_S1AP_PDU_t *pdu)
-{
- MessageDef *message_p;
- MessagesIds message_id;
+static int s1ap_eNB_decode_successful_outcome(S1AP_S1AP_PDU_t *pdu) {
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
switch(pdu->choice.successfulOutcome.procedureCode) {
case S1AP_ProcedureCode_id_S1Setup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_S1_SETUP_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
@@ -175,21 +116,13 @@ static int s1ap_eNB_decode_successful_outcome(S1AP_S1AP_PDU_t *pdu)
return 0;
}
-static int s1ap_eNB_decode_unsuccessful_outcome(S1AP_S1AP_PDU_t *pdu)
-{
- MessageDef *message_p;
- MessagesIds message_id;
+static int s1ap_eNB_decode_unsuccessful_outcome(S1AP_S1AP_PDU_t *pdu) {
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
switch(pdu->choice.unsuccessfulOutcome.procedureCode) {
case S1AP_ProcedureCode_id_S1Setup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_S1_SETUP_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
@@ -203,13 +136,10 @@ static int s1ap_eNB_decode_unsuccessful_outcome(S1AP_S1AP_PDU_t *pdu)
}
int s1ap_eNB_decode_pdu(S1AP_S1AP_PDU_t *pdu, const uint8_t *const buffer,
- const uint32_t length)
-{
+ const uint32_t length) {
asn_dec_rval_t dec_ret;
-
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
-
dec_ret = aper_decode(NULL,
&asn_DEF_S1AP_S1AP_PDU,
(void **)&pdu,
diff --git a/openair3/S1AP/s1ap_eNB_encoder.c b/openair3/S1AP/s1ap_eNB_encoder.c
index bc0c69792d..e282d1dd78 100644
--- a/openair3/S1AP/s1ap_eNB_encoder.c
+++ b/openair3/S1AP/s1ap_eNB_encoder.c
@@ -47,8 +47,7 @@ static inline int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu,
static inline int s1ap_eNB_encode_unsuccessfull_outcome(S1AP_S1AP_PDU_t *pdu,
uint8_t **buffer, uint32_t *len);
-int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
-{
+int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) {
int ret = -1;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
@@ -79,71 +78,38 @@ int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
static inline
int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu,
- uint8_t **buffer, uint32_t *len)
-{
- MessageDef *message_p;
- MessagesIds message_id;
+ uint8_t **buffer, uint32_t *len) {
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
switch(pdu->choice.initiatingMessage.procedureCode) {
case S1AP_ProcedureCode_id_S1Setup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_S1_SETUP_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1AP_ProcedureCode_id_uplinkNASTransport:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_UPLINK_NAS_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_uplink_nas_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_uplink_nas_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1AP_ProcedureCode_id_UECapabilityInfoIndication:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_UE_CAPABILITY_IND_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_ue_capability_ind_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_ue_capability_ind_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1AP_ProcedureCode_id_initialUEMessage:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_INITIAL_UE_MESSAGE_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_initial_ue_message_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_initial_ue_message_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1AP_ProcedureCode_id_NASNonDeliveryIndication:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_NAS_NON_DELIVERY_IND_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_nas_non_delivery_ind_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_nas_non_delivery_ind_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1AP_ProcedureCode_id_UEContextReleaseRequest:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_ue_context_release_req_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_ue_context_release_req_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
@@ -166,63 +132,35 @@ int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu,
static inline
int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu,
- uint8_t **buffer, uint32_t *len)
-{
- MessageDef *message_p;
- MessagesIds message_id;
+ uint8_t **buffer, uint32_t *len) {
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
switch(pdu->choice.successfulOutcome.procedureCode) {
case S1AP_ProcedureCode_id_InitialContextSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1AP_ProcedureCode_id_UEContextRelease:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_ue_context_release_complete_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
case S1AP_ProcedureCode_id_E_RABSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_E_RAB_SETUP_RESPONSE_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_response_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("E_RABSetup successful message\n");
break;
case S1AP_ProcedureCode_id_E_RABModify:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_E_RAB_MODIFY_RESPONSE_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("E_RABModify successful message\n");
break;
case S1AP_ProcedureCode_id_E_RABRelease:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_E_RAB_RELEASE_RESPONSE_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_e_rab_release_response_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
S1AP_INFO("E_RAB Release successful message\n");
break;
@@ -246,21 +184,13 @@ int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu,
static inline
int s1ap_eNB_encode_unsuccessfull_outcome(S1AP_S1AP_PDU_t *pdu,
- uint8_t **buffer, uint32_t *len)
-{
- MessageDef *message_p;
- MessagesIds message_id;
+ uint8_t **buffer, uint32_t *len) {
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
DevAssert(pdu != NULL);
switch(pdu->choice.unsuccessfulOutcome.procedureCode) {
case S1AP_ProcedureCode_id_InitialContextSetup:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
- message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
- message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
- message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded;
- memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
- itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(res.buffer);
break;
diff --git a/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/enb1.conf b/openair3/TEST/EPC_TEST/TEST_1MME_1ENB_1UE_ATTACH_GUTI/enb1.conf
old mode 100755
new mode 100644
diff --git a/openair3/valgrind.sh b/openair3/valgrind.sh
old mode 100644
new mode 100755
diff --git a/svn2git/git-author-rewrite.sh b/svn2git/git-author-rewrite.sh
old mode 100644
new mode 100755
diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
index 8cf14b4ca8..11ad12bfec 100644
--- a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
+++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
@@ -244,7 +244,6 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
}
eth->tx_nsamps = nblocks;
- // printf("Sending %d bytes to %s:%d\n",packet_size,str,ntohs(eth->local_addrd.sin_port));
bytes_sent = sendto(eth->sockfdd,
buff[0],
diff --git a/targets/ARCH/EXMIMO/DRIVER/eurecom/Makefile b/targets/ARCH/EXMIMO/DRIVER/eurecom/Makefile
old mode 100755
new mode 100644
diff --git a/targets/ARCH/EXMIMO/DRIVER/exmimo3/Makefile b/targets/ARCH/EXMIMO/DRIVER/exmimo3/Makefile
old mode 100755
new mode 100644
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/OFDM_TX.m b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/OFDM_TX.m
old mode 100755
new mode 100644
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/OFDM_TX_FRAME.m b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/OFDM_TX_FRAME.m
old mode 100755
new mode 100644
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/QAM_MOD.m b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/QAM_MOD.m
old mode 100755
new mode 100644
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/exmimo_test_tx_rx.m b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/exmimo_test_tx_rx.m
old mode 100755
new mode 100644
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/rx_calibration_exmimo_freq.m b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/rx_calibration_exmimo_freq.m
old mode 100755
new mode 100644
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/rx_spec.m b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/rx_spec.m
old mode 100755
new mode 100644
diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/rx_spec_multicard_sync.m b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/rx_spec_multicard_sync.m
old mode 100755
new mode 100644
diff --git a/targets/ARCH/LMSSDR/LimeSDR_above_1p8GHz.ini b/targets/ARCH/LMSSDR/LimeSDR_above_1p8GHz.ini
old mode 100755
new mode 100644
diff --git a/targets/ARCH/LMSSDR/LimeSDR_above_1p8GHz_1v4.ini b/targets/ARCH/LMSSDR/LimeSDR_above_1p8GHz_1v4.ini
old mode 100755
new mode 100644
diff --git a/targets/ARCH/LMSSDR/LimeSDR_below_1p8GHz.ini b/targets/ARCH/LMSSDR/LimeSDR_below_1p8GHz.ini
old mode 100755
new mode 100644
diff --git a/targets/ARCH/LMSSDR/LimeSDR_below_1p8GHz_1v4.ini b/targets/ARCH/LMSSDR/LimeSDR_below_1p8GHz_1v4.ini
old mode 100755
new mode 100644
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/Makefile.inc b/targets/ARCH/USRP/USERSPACE/LIB/Makefile.inc
deleted file mode 100644
index 631f2162bd..0000000000
--- a/targets/ARCH/USRP/USERSPACE/LIB/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-USRP_OBJ += $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/usrp_lib.o
-USRP_FILE_OBJ += $(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
-USRP_CFLAGS += -I$(OPENAIR_TARGETS)/ARCH/COMMON -I$(OPENAIR_TARGETS)/ARCH/USRP/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/COMMON
-
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
index c591cc6c0f..563e3755b7 100644
--- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
@@ -346,6 +346,7 @@ static void trx_usrp_end(openair0_device *device) {
done = 1;
+
if (u_sf_mode != 2) { // not subframes replay
#endif
usrp_state_t *s = (usrp_state_t *)device->priv;
@@ -435,6 +436,7 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
#endif
usrp_state_t *s = (usrp_state_t *)device->priv;
int nsamps2; // aligned to upper 32 or 16 byte boundary
+
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
nsamps2 = (nsamps+7)>>3;
diff --git a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c
index b0f131de91..a7bb8c00bf 100644
--- a/targets/ARCH/tcp_bridge/tcp_bridge_oai.c
+++ b/targets/ARCH/tcp_bridge/tcp_bridge_oai.c
@@ -354,6 +354,29 @@ int tcp_bridge_ue_first_read(openair0_device *device, openair0_timestamp *timest
abort();
}
+ /* Due to some unknown bug in the eNB (or UE, or both), the first frames
+ * are not correctly generated (or handled), which leads to a bad behavior
+ * of the simulator in some cases (seen with 100 RBs: the UE reads a bad
+ * MIB and switches to 25 RBs, which results in a deadlock in this driver).
+ * Let's skip 10 frames to avoid this issue.
+ */
+ for (int i = 0; i < 10 * 10; i++) {
+ memset(b, 0, t->samples_per_subframe * 4);
+ n = fullwrite(t->sock, b, t->samples_per_subframe * 4);
+
+ if (n != t->samples_per_subframe * 4) {
+ printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno));
+ abort();
+ }
+
+ n = fullread(t->sock, b, t->samples_per_subframe * 4);
+
+ if (n != t->samples_per_subframe * 4) {
+ printf("tcp_bridge: read error ret %d error %s\n", n, strerror(errno));
+ abort();
+ }
+ }
+
device->trx_read_func = tcp_bridge_read_ue;
return tcp_bridge_read_ue(device, timestamp, buff, nsamps, cc);
}
diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c
index 2c27cc29e8..3cb7d23467 100644
--- a/targets/COMMON/create_tasks.c
+++ b/targets/COMMON/create_tasks.c
@@ -25,40 +25,34 @@
# include "common/utils/LOG/log.h"
# include "targets/RT/USER/lte-softmodem.h"
-# ifdef OPENAIR2
-# if defined(ENABLE_USE_MME)
-# include "sctp_eNB_task.h"
-# include "x2ap_eNB.h"
-# include "s1ap_eNB.h"
-# include "nas_ue_task.h"
-# include "udp_eNB_task.h"
-# include "gtpv1u_eNB_task.h"
-/* temporary warning removale while implementing noS1 */
-/* as config option */
-# else
-# ifdef EPC_MODE_ENABLED
-# undef EPC_MODE_ENABLED
-# endif
-# define EPC_MODE_ENABLED 0
-# endif
-# if ENABLE_RAL
-# include "lteRALue.h"
-# include "lteRALenb.h"
-# endif
-# include "RRC/LTE/rrc_defs.h"
-# endif
+#ifdef OPENAIR2
+ #if defined(ENABLE_USE_MME)
+ #include "sctp_eNB_task.h"
+ #include "x2ap_eNB.h"
+ #include "s1ap_eNB.h"
+ #include "nas_ue_task.h"
+ #include "udp_eNB_task.h"
+ #include "gtpv1u_eNB_task.h"
+ /* temporary warning removale while implementing noS1 */
+ /* as config option */
+ #else
+ #ifdef EPC_MODE_ENABLED
+ #undef EPC_MODE_ENABLED
+ #endif
+ #define EPC_MODE_ENABLED 0
+ #endif
+ #if ENABLE_RAL
+ #include "lteRALue.h"
+ #include "lteRALenb.h"
+ #endif
+ #include "RRC/LTE/rrc_defs.h"
+#endif
# include "enb_app.h"
-int create_tasks(uint32_t enb_nb)
-{
+int create_tasks(uint32_t enb_nb) {
LOG_D(ENB_APP, "%s(enb_nb:%d\n", __FUNCTION__, enb_nb);
-
itti_wait_ready(1);
- if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) {
- LOG_E(PDCP, "Create task for L2L1 failed\n");
- return -1;
- }
if (enb_nb > 0) {
/* Last task to create, others task must be ready before its start */
@@ -67,50 +61,52 @@ int create_tasks(uint32_t enb_nb)
return -1;
}
}
+
# if defined(ENABLE_USE_MME)
+
if (EPC_MODE_ENABLED) {
- if (enb_nb > 0) {
- if (itti_create_task (TASK_X2AP, x2ap_task, NULL) < 0) {
- LOG_E(X2AP, "Create task for X2AP failed\n");
- return -1;
- }
+ if (enb_nb > 0) {
+ if (itti_create_task (TASK_X2AP, x2ap_task, NULL) < 0) {
+ LOG_E(X2AP, "Create task for X2AP failed\n");
+ return -1;
+ }
- if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
- LOG_E(SCTP, "Create task for SCTP failed\n");
- return -1;
- }
+ if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
+ LOG_E(SCTP, "Create task for SCTP failed\n");
+ return -1;
+ }
- if (itti_create_task (TASK_S1AP, s1ap_eNB_task, NULL) < 0) {
- LOG_E(S1AP, "Create task for S1AP failed\n");
- return -1;
- }
- if(!(get_softmodem_params()->emulate_rf)){
- if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) {
- LOG_E(UDP_, "Create task for UDP failed\n");
- return -1;
- }
- }
+ if (itti_create_task (TASK_S1AP, s1ap_eNB_task, NULL) < 0) {
+ LOG_E(S1AP, "Create task for S1AP failed\n");
+ return -1;
+ }
- if (itti_create_task (TASK_GTPV1_U, >pv1u_eNB_task, NULL) < 0) {
- LOG_E(GTPU, "Create task for GTPV1U failed\n");
+ if(!(get_softmodem_params()->emulate_rf)) {
+ if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) {
+ LOG_E(UDP_, "Create task for UDP failed\n");
return -1;
}
}
- } /* if (EPC_MODE_ENABLED) */
-#endif
- if (enb_nb > 0) {
- LOG_I(RRC,"Creating RRC eNB Task\n");
-
- if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) {
- LOG_E(RRC, "Create task for RRC eNB failed\n");
+ if (itti_create_task (TASK_GTPV1_U, >pv1u_eNB_task, NULL) < 0) {
+ LOG_E(GTPU, "Create task for GTPV1U failed\n");
return -1;
}
}
+ } /* if (EPC_MODE_ENABLED) */
+#endif
+
+ if (enb_nb > 0) {
+ LOG_I(RRC,"Creating RRC eNB Task\n");
+
+ if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) {
+ LOG_E(RRC, "Create task for RRC eNB failed\n");
+ return -1;
+ }
+ }
itti_wait_ready(0);
-
return 0;
}
#endif
diff --git a/targets/COMMON/create_tasks_ue.c b/targets/COMMON/create_tasks_ue.c
index 20b5979f31..601b342ee8 100644
--- a/targets/COMMON/create_tasks_ue.c
+++ b/targets/COMMON/create_tasks_ue.c
@@ -24,57 +24,52 @@
# include "create_tasks.h"
# include "common/utils/LOG/log.h"
-# ifdef OPENAIR2
-# if defined(ENABLE_USE_MME)
-# include "sctp_eNB_task.h"
-# include "s1ap_eNB.h"
-# include "nas_ue_task.h"
-# include "udp_eNB_task.h"
-# include "gtpv1u_eNB_task.h"
-# endif
-# if ENABLE_RAL
-# include "lteRALue.h"
-# include "lteRALenb.h"
-# endif
-# include "RRC/LTE/rrc_defs.h"
-# endif
+#ifdef OPENAIR2
+ #if defined(ENABLE_USE_MME)
+ #include "sctp_eNB_task.h"
+ #include "s1ap_eNB.h"
+ #include "nas_ue_task.h"
+ #include "udp_eNB_task.h"
+ #include "gtpv1u_eNB_task.h"
+ #endif
+ #if ENABLE_RAL
+ #include "lteRALue.h"
+ #include "lteRALenb.h"
+ #endif
+ #include "RRC/LTE/rrc_defs.h"
+#endif
# include "enb_app.h"
-int create_tasks_ue(uint32_t ue_nb)
-{
+int create_tasks_ue(uint32_t ue_nb) {
LOG_D(ENB_APP, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb);
-
itti_wait_ready(1);
- if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) {
- LOG_E(PDCP, "Create task for L2L1 failed\n");
- return -1;
- }
-
# if defined(ENABLE_USE_MME)
# if defined(NAS_BUILT_IN_UE)
- if (ue_nb > 0) {
- nas_user_container_t *users = calloc(1, sizeof(*users));
- if (users == NULL) abort();
- users->count = ue_nb;
- if (itti_create_task (TASK_NAS_UE, nas_ue_task, users) < 0) {
- LOG_E(NAS, "Create task for NAS UE failed\n");
- return -1;
- }
- }
-# endif
-# endif
- if (ue_nb > 0) {
- if (itti_create_task (TASK_RRC_UE, rrc_ue_task, NULL) < 0) {
- LOG_E(RRC, "Create task for RRC UE failed\n");
- return -1;
- }
+ if (ue_nb > 0) {
+ nas_user_container_t *users = calloc(1, sizeof(*users));
+ if (users == NULL) abort();
+
+ users->count = ue_nb;
+
+ if (itti_create_task (TASK_NAS_UE, nas_ue_task, users) < 0) {
+ LOG_E(NAS, "Create task for NAS UE failed\n");
+ return -1;
}
+ }
+# endif
+# endif
+
+ if (ue_nb > 0) {
+ if (itti_create_task (TASK_RRC_UE, rrc_ue_task, NULL) < 0) {
+ LOG_E(RRC, "Create task for RRC UE failed\n");
+ return -1;
+ }
+ }
itti_wait_ready(0);
-
return 0;
}
#endif
diff --git a/targets/DOCS/E-UTRAN_User_Guide.docx b/targets/DOCS/E-UTRAN_User_Guide.docx
old mode 100755
new mode 100644
diff --git a/targets/DOCS/E-UTRAN_User_Guide.pdf b/targets/DOCS/E-UTRAN_User_Guide.pdf
old mode 100755
new mode 100644
diff --git a/targets/DOCS/oai_L1_L2_procedures.ipe b/targets/DOCS/oai_L1_L2_procedures.ipe
old mode 100755
new mode 100644
diff --git a/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.calisson.conf b/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.calisson.conf
old mode 100755
new mode 100644
diff --git a/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.memphis.conf b/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.memphis.conf
old mode 100755
new mode 100644
diff --git a/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.nord.conf b/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.nord.conf
old mode 100755
new mode 100644
diff --git a/targets/PROJECTS/E-MBMS/enb.conf b/targets/PROJECTS/E-MBMS/enb.conf
old mode 100755
new mode 100644
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf
new file mode 100644
index 0000000000..d33a9dc41f
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf
@@ -0,0 +1,445 @@
+Active_eNBs = ( "eNB_Eurecom_LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+ ////////// Identification parameters:
+ eNB_ID = 0xe00;
+
+ cell_type = "CELL_MACRO_ENB";
+
+ eNB_name = "eNB_Eurecom_LTEBox";
+
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = "1";
+
+ plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2;} );
+
+ tr_s_preference = "local_mac"
+
+ ////////// Physical parameters:
+
+ component_carriers = (
+ {
+ node_function = "3GPP_eNodeB";
+ node_timing = "synch_to_ext_device";
+ node_synch_ref = 0;
+ frame_type = "FDD";
+ tdd_config = 3;
+ tdd_config_s = 0;
+ prefix_type = "NORMAL";
+ eutra_band = 13;
+ downlink_frequency = 751000000L;
+ uplink_frequency_offset = 31000000;
+ Nid_cell = 0;
+ N_RB_DL = 50;
+ Nid_cell_mbsfn = 0;
+ nb_antenna_ports = 1;
+ nb_antennas_tx = 1;
+ nb_antennas_rx = 1;
+ tx_gain = 90;
+ rx_gain = 110;
+ pbch_repetition = "FALSE";
+ prach_root = 0;
+ prach_config_index = 0;
+ prach_high_speed = "DISABLE";
+ prach_zero_correlation = 1;
+ prach_freq_offset = 1;
+ pucch_delta_shift = 1;
+ pucch_nRB_CQI = 1;
+ pucch_nCS_AN = 0;
+ pucch_n1_AN = 32;
+ pdsch_referenceSignalPower = -27;
+ pdsch_p_b = 0;
+ pusch_n_SB = 1;
+ pusch_enable64QAM = "DISABLE";
+ pusch_hoppingMode = "interSubFrame";
+ pusch_hoppingOffset = 0;
+ pusch_groupHoppingEnabled = "ENABLE";
+ pusch_groupAssignment = 0;
+ pusch_sequenceHoppingEnabled = "DISABLE";
+ pusch_nDMRS1 = 1;
+ phich_duration = "NORMAL";
+ phich_resource = "ONESIXTH";
+ srs_enable = "DISABLE";
+ /* srs_BandwidthConfig =;
+ srs_SubframeConfig =;
+ srs_ackNackST =;
+ srs_MaxUpPts =;*/
+
+ pusch_p0_Nominal = -96;
+ pusch_alpha = "AL1";
+ pucch_p0_Nominal = -104;
+ msg3_delta_Preamble = 6;
+ pucch_deltaF_Format1 = "deltaF2";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+
+ rach_numberOfRA_Preambles = "n64"; #64
+ rach_preamblesGroupAConfig = "DISABLE";
+ /*
+ rach_sizeOfRA_PreamblesGroupA = ;
+ rach_messageSizeGroupA = ;
+ rach_messagePowerOffsetGroupB = ;
+ */
+ rach_powerRampingStep = 4;
+ rach_preambleInitialReceivedTargetPower = -108;
+ rach_preambleTransMax = 10;
+ rach_raResponseWindowSize = 10;
+ rach_macContentionResolutionTimer = 48;
+ rach_maxHARQ_Msg3Tx = 4;
+
+ pcch_default_PagingCycle = "rf128"; #128
+ pcch_nB = "oneT";
+ bcch_modificationPeriodCoeff = 2;
+ ue_TimersAndConstants_t300 = "ms1000";
+ ue_TimersAndConstants_t301 = "ms1000";
+ ue_TimersAndConstants_t310 = "ms1000";
+ ue_TimersAndConstants_t311 = "ms10000";
+ ue_TimersAndConstants_n310 = "n20";
+ ue_TimersAndConstants_n311 = "n1";
+ ue_TransmissionMode = "tm1";
+
+ # eMTC Parameters
+ emtc_parameters :
+ {
+ eMTC_configured = 1;
+ #hyperSFN_r13 = 0;
+ #eDRX_Allowed_r13 = 0;
+ #q_QualMinRSRQ_CE_r13 = ;
+
+ #SIB1
+ schedulingInfoSIB1_BR_r13 = 4;
+
+ #system_info_value_tag_SI =
+ #(
+ # {
+ # systemInfoValueTagSi_r13 = 0;
+ # }
+ #);
+
+ cellSelectionInfoCE_r13 = "ENABLE";
+ q_RxLevMinCE_r13 = -70;
+ bandwidthReducedAccessRelatedInfo_r13 = "ENABLE"
+ si_WindowLength_BR_r13 = "ms20"; #0
+ si_RepetitionPattern_r13 = "everyRF"; #0
+
+ scheduling_info_br =
+ (
+ {
+ si_Narrowband_r13 = 8;
+ si_TBS_r13 = 5;
+ }
+ );
+
+ fdd_DownlinkOrTddSubframeBitmapBR_r13 = "subframePattern40-r13";
+ fdd_DownlinkOrTddSubframeBitmapBR_val_r13 = 0xFFFFFFFFFF;
+ startSymbolBR_r13 = 2;
+ si_HoppingConfigCommon_r13 = "off"; #1; # Note: 1==OFF !
+ si_ValidityTime_r13 = "true"; #0
+
+ freqHoppingParametersDL_r13 = "DISABLE"
+ mpdcch_pdsch_HoppingNB_r13 = "nb2"; #0
+ interval_DLHoppingConfigCommonModeA_r13 = "interval-FDD-r13"
+ interval_DLHoppingConfigCommonModeA_r13_val = 0;
+ interval_DLHoppingConfigCommonModeB_r13 = "interval-FDD-r13"
+ interval_DLHoppingConfigCommonModeB_r13_val = 0;
+ mpdcch_pdsch_HoppingOffset_r13 = 1;
+
+
+ # SIB23
+ frame_type = "FDD";
+ preambleTransMax_CE_r13 = 10; #6
+
+ rach_numberOfRA_Preambles = 60; #14
+ rach_powerRampingStep = 4;
+ rach_preambleInitialReceivedTargetPower = -110;
+ rach_preambleTransMax = 10;
+ rach_raResponseWindowSize = 10;
+ rach_macContentionResolutionTimer = 64;
+ rach_maxHARQ_Msg3Tx = 4;
+
+ # max size for this array is 4
+ rach_CE_LevelInfoList_r13 =
+ (
+ {
+ firstPreamble_r13 = 60;
+ lastPreamble_r13 = 63;
+ ra_ResponseWindowSize_r13 = 20; #0
+ mac_ContentionResolutionTimer_r13 = 80; #0
+ rar_HoppingConfig_r13 = "off"; #1;
+ }
+ );
+
+ # BCCH CONFIG
+ bcch_modificationPeriodCoeff = 2;
+
+ #PCCH Config
+ pcch_default_PagingCycle = "rf128"; #128
+ pcch_nB = "oneT";
+
+ #PRACH Config
+ prach_root = 89;
+ prach_config_index = 0;
+ prach_high_speed = "DISABLE";
+ prach_zero_correlation = 1;
+ prach_freq_offset = 1;
+
+ #PDSCH Config Common
+ pdsch_referenceSignalPower = -27
+ pdsch_p_b = 0;
+
+
+ # PUSCH Config Common
+ pusch_n_SB = 1;
+ pusch_hoppingMode = "interSubFrame";
+ pusch_hoppingOffset = 0;
+ pusch_enable64QAM = "DISABLE";
+ pusch_groupHoppingEnabled = "ENABLE";
+ pusch_groupAssignment = 0;
+ pusch_sequenceHoppingEnabled = "DISABLE";
+ pusch_nDMRS1 = 1;
+
+ # PUCCH Config Common
+ pucch_delta_shift = 1;
+ pucch_nRB_CQI = 0;
+ pucch_nCS_AN = 0;
+ pucch_n1_AN = 32;
+
+ pusch_p0_Nominal = -96;
+ pusch_alpha = "AL1";
+ pucch_p0_Nominal = -104;
+ pucch_deltaF_Format1 = "deltaF0";
+ pucch_deltaF_Format1b = "deltaF3";
+ pucch_deltaF_Format2 = "deltaF0";
+ pucch_deltaF_Format2a = "deltaF0";
+ pucch_deltaF_Format2b = "deltaF0";
+
+ msg3_delta_Preamble = 6;
+
+
+ prach_ConfigCommon_v1310 = "ENABLE";
+
+ mpdcch_startSF_CSS_RA_r13 = "fdd-r13";
+ mpdcch_startSF_CSS_RA_r13_val = "v1"; #0
+ prach_HoppingOffset_r13 = 0;
+
+
+ pdsch_maxNumRepetitionCEmodeA_r13 = "r16"; #0
+ #pdsch_maxNumRepetitionCEmodeB_r13 = "r384"; # NULL - 2
+
+ pusch_maxNumRepetitionCEmodeA_r13 = "r8"; #0
+ #pusch_maxNumRepetitionCEmodeB_r13 = "r768"; #4 #NULL
+ #pusch_HoppingOffset_v1310 = 5; #NULL
+
+ # max size for this array is 3
+ rsrp_range_list =
+ (
+ {
+ rsrp_range_br = 0;
+ }
+ );
+
+ # max size for this array is 4
+ prach_parameters_ce_r13 =
+ (
+ {
+ prach_config_index_br = 3;
+ prach_freq_offset_br = 2;
+ prach_StartingSubframe_r13 = 2;
+ maxNumPreambleAttemptCE_r13 = 10; #6
+ numRepetitionPerPreambleAttempt_r13 = 1; #0
+ mpdcch_NumRepetition_RA_r13 = 1; #0
+ prach_HoppingConfig_r13 = 0; #1
+ max_available_narrow_band = [3];
+ }
+ );
+
+ n1PUCCH_AN_InfoList_r13 =
+ (
+ {
+ pucch_info_value = 0;
+ }
+ );
+
+
+ ue_TimersAndConstants_t300 = "ms1000";
+ ue_TimersAndConstants_t301 = "ms400";
+ ue_TimersAndConstants_t310 = "ms50";
+ ue_TimersAndConstants_t311 = "ms30000";
+ ue_TimersAndConstants_n310 = "n1";
+ ue_TimersAndConstants_n311 = "n10";
+ ue_TransmissionMode = "tm1";
+
+ pcch_config_v1310 :
+ {
+ paging_narrowbands_r13 = 1;
+ mpdcch_numrepetition_paging_r13 = "r1"; #0
+ #nb_v1310 = "one256thT"; #2
+ }
+
+
+ pucch_NumRepetitionCE_Msg4_Level0_r13 = "n1"; #0
+ #pucch_NumRepetitionCE_Msg4_Level1_r13 = "n2"; #1
+ #pucch_NumRepetitionCE_Msg4_Level2_r13 = "n16"; #2
+ #pucch_NumRepetitionCE_Msg4_Level3_r13 = "n32"; #3
+
+ sib2_freq_hoppingParameters_r13 :
+ {
+ #sib2_mpdcch_pdsch_hoppingNB_r13 = "nb2"; #0
+ #sib2_interval_DLHoppingConfigCommonModeA_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
+ #sib2_interval_DLHoppingConfigCommonModeA_r13_val = "int1";
+ #sib2_interval_DLHoppingConfigCommonModeB_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
+ #sib2_interval_DLHoppingConfigCommonModeB_r13_val = "int2";
+
+ sib2_interval_ULHoppingConfigCommonModeA_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
+ sib2_interval_ULHoppingConfigCommonModeA_r13_val = "int4"; #2
+# sib2_interval_ULHoppingConfigCommonModeB_r13 = "FDD"; # choice -> (0, FDD) (1, TDD)
+# sib2_interval_ULHoppingConfigCommonModeB_r13_val = "int2"; #0
+
+# sib2_mpdcch_pdsch_hoppingOffset_r13 = 1;
+ }
+
+ rach_preamblesGroupAConfig = "DISABLE";
+
+ phich_duration = "NORMAL";
+ phich_resource = "ONESIXTH";
+ srs_enable = "DISABLE";
+
+ }
+
+
+
+}
+
+
+
+
+ );
+
+
+ srb1_parameters :
+ {
+ # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
+ timer_poll_retransmit = 80;
+
+ # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
+ timer_reordering = 35;
+
+ # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
+ timer_status_prohibit = 0;
+
+ # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
+ poll_pdu = 4;
+
+ # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
+ poll_byte = 99999;
+
+ # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
+ max_retx_threshold = 4;
+ }
+
+ # ------- SCTP definitions
+ SCTP :
+ {
+ # Number of streams to use in input/output
+ SCTP_INSTREAMS = 2;
+ SCTP_OUTSTREAMS = 2;
+ };
+
+
+ ////////// MME parameters:
+ mme_ip_address = ( { ipv4 = "127.0.0.3";
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+
+ NETWORK_INTERFACES :
+ {
+
+ ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
+ ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
+ ENB_INTERFACE_NAME_FOR_S1U = "lo";
+ ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.4/24";
+ ENB_PORT_FOR_S1U = 2152; # Spec 2152
+
+ ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24";
+ ENB_PORT_FOR_X2C = 36422; # Spec 36422
+ };
+
+ log_config :
+ {
+ global_log_level ="info";
+ global_log_verbosity ="medium";
+ hw_log_level ="info";
+ hw_log_verbosity ="medium";
+ phy_log_level ="info";
+ phy_log_verbosity ="medium";
+ mac_log_level ="info";
+ mac_log_verbosity ="high";
+ rlc_log_level ="info";
+ rlc_log_verbosity ="medium";
+ pdcp_log_level ="info";
+ pdcp_log_verbosity ="medium";
+ rrc_log_level ="info";
+ rrc_log_verbosity ="medium";
+ };
+ }
+);
+
+MACRLCs = (
+ {
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "local_RRC";
+ phy_test_mode = 0;
+ puSch10xSnr = 200;
+ puCch10xSnr = 200;
+ }
+);
+
+L1s = (
+ {
+ num_cc = 1;
+ tr_n_preference = "local_mac";
+ }
+);
+
+RUs = (
+ {
+ local_rf = "yes"
+ nb_tx = 1
+ nb_rx = 1
+ att_tx = 0
+ att_rx = 0;
+ bands = [13];
+ max_pdschReferenceSignalPower = -27;
+ max_rxgain = 125;
+ eNB_instances = [0];
+ }
+);
+
+log_config :
+ {
+ global_log_level ="info";
+ global_log_verbosity ="medium";
+ hw_log_level ="info";
+ hw_log_verbosity ="medium";
+ phy_log_level ="info";
+ phy_log_verbosity ="medium";
+ mac_log_level ="info";
+ mac_log_verbosity ="high";
+ rlc_log_level ="info";
+ rlc_log_verbosity ="medium";
+ pdcp_log_level ="info";
+ pdcp_log_verbosity ="medium";
+ rrc_log_level ="info";
+ rrc_log_verbosity ="medium";
+ };
+
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index ddc7fdf94b..0583c689e6 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -1429,6 +1429,7 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
cfg->tx_gain[i] = (double)ru->att_tx;
cfg->rx_gain[i] = ru->max_rxgain-(double)ru->att_rx;
+
cfg->configFilename = rf_config_file;
printf("channel %d, Setting tx_gain offset %f, rx_gain offset %f, tx_freq %f, rx_freq %f\n",
i, cfg->tx_gain[i],
@@ -2772,6 +2773,7 @@ void init_RU(char *rf_config_file) {
// use eNB_list[0] as a reference for RU frame parameters
// NOTE: multiple CC_id are not handled here yet!
+
if (ru->num_eNB > 0) {
LOG_D(PHY, "%s() RC.ru[%d].num_eNB:%d ru->eNB_list[0]:%p RC.eNB[0][0]:%p rf_config_file:%s\n", __FUNCTION__, ru_id, ru->num_eNB, ru->eNB_list[0], RC.eNB[0][0], ru->rf_config_file);
@@ -2783,6 +2785,7 @@ void init_RU(char *rf_config_file) {
//
// DJP - feptx_prec() / feptx_ofdm() parses the eNB_list (based on num_eNB) and copies the txdata_F to txdata in RU
//
+
}
else
{
diff --git a/targets/RT/USER/lte-softmodem-common.c b/targets/RT/USER/lte-softmodem-common.c
index 7e1235b310..814800ccfc 100644
--- a/targets/RT/USER/lte-softmodem-common.c
+++ b/targets/RT/USER/lte-softmodem-common.c
@@ -39,67 +39,58 @@ char *parallel_config=NULL;
char *worker_config=NULL;
uint64_t get_softmodem_optmask(void) {
- return softmodem_params.optmask;
+ return softmodem_params.optmask;
}
uint64_t set_softmodem_optmask(uint64_t bitmask) {
- softmodem_params.optmask = softmodem_params.optmask | bitmask;
- return softmodem_params.optmask;
+ softmodem_params.optmask = softmodem_params.optmask | bitmask;
+ return softmodem_params.optmask;
}
-softmodem_params_t* get_softmodem_params(void) {
- return &softmodem_params;
+softmodem_params_t *get_softmodem_params(void) {
+ return &softmodem_params;
}
-void get_common_options(void)
-{
-
-
-uint32_t online_log_messages;
-uint32_t glog_level ;
-uint32_t start_telnetsrv;
-uint32_t noS1;
-uint32_t nokrnmod;
-uint32_t nonbiot;
-paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
-paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
-
-
-
- config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
-
- if (strlen(in_path) > 0) {
- opt_type = OPT_PCAP;
- opt_enabled=1;
- printf("Enabling OPT for PCAP with the following file %s \n",in_path);
- }
- if (strlen(in_ip) > 0) {
- opt_enabled=1;
- opt_type = OPT_WIRESHARK;
- printf("Enabling OPT for wireshark for local interface");
- }
-
- config_process_cmdline( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
+void get_common_options(void) {
+ uint32_t online_log_messages;
+ uint32_t glog_level ;
+ uint32_t start_telnetsrv;
+ uint32_t noS1;
+ uint32_t nokrnmod;
+ uint32_t nonbiot;
+ paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
+ paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
+ checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
+ config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
+ config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,
+ sizeof(cmdline_logparams)/sizeof(paramdef_t));
+ config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
- set_glog_onlinelog(online_log_messages);
+ set_glog_onlinelog(online_log_messages);
}
+
if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
- set_glog(glog_level);
+ set_glog(glog_level);
}
+
if (start_telnetsrv) {
- load_module_shlib("telnetsrv",NULL,0,NULL);
+ load_module_shlib("telnetsrv",NULL,0,NULL);
}
if (noS1) {
- set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
+ set_softmodem_optmask(SOFTMODEM_NOS1_BIT);
}
+
if (nokrnmod) {
- set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
- }
+ set_softmodem_optmask(SOFTMODEM_NOKRNMOD_BIT);
+ }
+
if (nonbiot) {
- set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT);
- }
+ set_softmodem_optmask(SOFTMODEM_NONBIOT_BIT);
+ }
+
if(parallel_config != NULL) set_parallel_conf(parallel_config);
+
if(worker_config != NULL) set_worker_conf(worker_config);
}
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 872340e28c..b349b06a06 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -127,10 +127,7 @@ int config_sync_var=-1;
uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
-#if defined(ENABLE_ITTI)
- volatile int start_eNB = 0;
- volatile int start_UE = 0;
-#endif
+
volatile int oai_exit = 0;
uint32_t downlink_frequency[MAX_NUM_CCs][4];
@@ -305,9 +302,6 @@ void exit_function(const char *file, const char *function, const int line, const
}
sleep(1); //allow lte-softmodem threads to exit first
-#if defined(ENABLE_ITTI)
- itti_terminate_tasks (TASK_UNKNOWN);
-#endif
exit(1);
}
@@ -382,61 +376,6 @@ static void *scope_thread(void *arg) {
#endif
-
-
-#if defined(ENABLE_ITTI)
-void *l2l1_task(void *arg) {
- MessageDef *message_p = NULL;
- int result;
- itti_set_task_real_time(TASK_L2L1);
- itti_mark_task_ready(TASK_L2L1);
- /* Wait for the initialize message */
- printf("Wait for the ITTI initialize message\n");
-
- while (1) {
- itti_receive_msg (TASK_L2L1, &message_p);
-
- switch (ITTI_MSG_ID(message_p)) {
- case INITIALIZE_MESSAGE:
- /* Start eNB thread */
- LOG_D(PHY, "L2L1 TASK received %s\n", ITTI_MSG_NAME(message_p));
- start_eNB = 1;
- break;
-
- case TERMINATE_MESSAGE:
- LOG_W(PHY, " *** Exiting L2L1 thread\n");
- oai_exit=1;
- start_eNB = 0;
- itti_exit_task ();
- break;
-
- case ACTIVATE_MESSAGE:
- start_UE = 1;
- break;
-
- case DEACTIVATE_MESSAGE:
- start_UE = 0;
- break;
-
- case MESSAGE_TEST:
- printf("Received %s\n", ITTI_MSG_NAME(message_p));
- break;
-
- default:
- printf("Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
- break;
- }
-
- result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
- AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
- message_p = NULL;
- };
-
- return NULL;
-}
-#endif
-
-
static void get_options(void) {
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
get_common_options();
@@ -449,7 +388,7 @@ static void get_options(void) {
NB_eNB_INST = RC.nb_inst;
printf("Configuration: nb_rrc_inst %d, nb_L1_inst %d, nb_ru %d\n",NB_eNB_INST,RC.nb_L1_inst,RC.nb_RU);
- if (!SOFTMODEM_NONBIOT) {
+ if (!IS_SOFTMODEM_NONBIOT) {
load_NB_IoT();
printf(" nb_nbiot_rrc_inst %d, nb_nbiot_L1_inst %d, nb_nbiot_macrlc_inst %d\n",
RC.nb_nb_iot_rrc_inst, RC.nb_nb_iot_L1_inst, RC.nb_nb_iot_macrlc_inst);
@@ -505,7 +444,8 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
}
void wait_RUs(void) {
- LOG_I(PHY,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask);
+ /* do not modify the following LOG_UI message, which is used by CI */
+ LOG_UI(ENB_APP,"Waiting for RUs to be configured ... RC.ru_mask:%02lx\n", RC.ru_mask);
// wait for all RUs to be configured over fronthaul
pthread_mutex_lock(&RC.ru_mutex);
@@ -567,7 +507,6 @@ int stop_L1L2(module_id_t enb_id) {
/* these tasks need to pick up new configuration */
terminate_task(enb_id, TASK_ENB_APP, TASK_RRC_ENB);
- terminate_task(enb_id, TASK_ENB_APP, TASK_L2L1);
oai_exit = 1;
LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id);
kill_RU_proc(RC.ru[enb_id]);
@@ -619,13 +558,6 @@ int restart_L1L2(module_id_t enb_id) {
LOG_I(RRC, "Re-created task for RRC eNB successfully\n");
}
- if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) {
- LOG_E(PDCP, "Create task for L2L1 failed\n");
- return -1;
- } else {
- LOG_I(PDCP, "Re-created task for L2L1 successfully\n");
- }
-
/* pass a reconfiguration request which will configure everything down to
* RC.eNB[i][j]->frame_parms, too */
msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ);
@@ -678,7 +610,6 @@ int main( int argc, char **argv ) {
set_latency_target();
logInit();
printf("Reading in command-line options\n");
- CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT);
get_options ();
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
@@ -689,14 +620,6 @@ int main( int argc, char **argv ) {
#if T_TRACER
T_Config_Init();
#endif
- ret=config_check_unknown_cmdlineopt(NULL);
-
- if (ret != 0) {
- LOG_E(ENB_APP, "%i unknown options in command line\n",ret);
- exit_fun("");
- }
-
- CONFIG_CLEARRTFLAG(CONFIG_NOCHECKUNKOPT);
//randominit (0);
set_taus_seed (0);
printf("configuring for RAU/RRU\n");
@@ -717,12 +640,7 @@ int main( int argc, char **argv ) {
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
#endif
-
- if (opt_type != OPT_NONE) {
- if (init_opt(in_path, in_ip) == -1)
- LOG_E(OPT,"failed to run OPT \n");
- }
-
+ init_opt();
#ifdef PDCP_USE_NETLINK
printf("PDCP netlink\n");
netlink_init();
@@ -947,13 +865,7 @@ if (nfapi_mode==2) {// VNF
sync_var=0;
pthread_cond_broadcast(&sync_cond);
pthread_mutex_unlock(&sync_mutex);
- ret=config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
-
- if (ret != 0) {
- LOG_E(ENB_APP, "%i unknown options in command line (invalid section name)\n",ret);
- exit_fun("");
- }
-
+ config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
// wait for end of program
printf("TYPE TO TERMINATE\n");
//getchar();
@@ -1008,9 +920,7 @@ if (nfapi_mode==2) {// VNF
}
free_lte_top();
- printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
end_configmodule();
- printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
pthread_cond_destroy(&sync_cond);
pthread_mutex_destroy(&sync_mutex);
pthread_cond_destroy(&nfapi_sync_cond);
@@ -1029,9 +939,7 @@ if (nfapi_mode==2) {// VNF
}
}
- if (opt_enabled == 1)
- terminate_opt();
-
+ terminate_opt();
logClean();
printf("Bye.\n");
return 0;
diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h
index 81f84e133b..85ee4765f0 100644
--- a/targets/RT/USER/lte-softmodem.h
+++ b/targets/RT/USER/lte-softmodem.h
@@ -35,12 +35,12 @@
#include "flexran_agent.h"
#if defined(ENABLE_ITTI)
-#if defined(ENABLE_USE_MME)
-#include "s1ap_eNB.h"
-#ifdef PDCP_USE_NETLINK
-#include "SIMULATION/ETH_TRANSPORT/proto.h"
-#endif
-#endif
+ #if defined(ENABLE_USE_MME)
+ #include "s1ap_eNB.h"
+ #ifdef PDCP_USE_NETLINK
+ #include "SIMULATION/ETH_TRANSPORT/proto.h"
+ #endif
+ #endif
#endif
/* help strings definition for command line options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
@@ -60,14 +60,14 @@
#define CONFIG_HLP_UENANTR "set UE number of rx antennas\n"
#define CONFIG_HLP_UENANTT "set UE number of tx antennas\n"
#define CONFIG_HLP_UESCAN "set UE to scan around carrier\n"
-#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
+#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
-#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
+#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n"
-#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
-#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
+#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
+#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
#define CONFIG_HLP_TADV "Set timing_advance\n"
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
#define CONFIG_HLP_CHOFF "Channel id offset\n"
@@ -76,16 +76,14 @@
#define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n"
#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n"
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
-#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
+#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
#define CONFIG_HLP_EMULIFACE "Set the interface name for the multicast transport for emulation mode (e.g. eth0, lo, etc.) \n"
-//#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation"
-#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
+//#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation"
+#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
-#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
-#define CONFIG_HLP_L2MONP "Enable L2 pcap messages on localhost \n"
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"
#define CONFIG_HLP_TPORT "tracer port\n"
#define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n"
@@ -103,7 +101,7 @@
#define CONFIG_HLP_USRP_CLK_SRC "USRP clock source: 'internal' or 'external'\n"
/***************************************************************************************************************************************/
-/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
+/* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument
when calling config_get or config_getlist functions */
@@ -112,15 +110,15 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_UEMODEPARAMS_DESC { \
-{"calib-ue-rx", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
-{"calib-ue-rx-med", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
-{"calib-ue-rx-byp", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
-{"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
-{"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
-{"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
-{"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
-{"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
-}
+ {"calib-ue-rx", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
+ {"calib-ue-rx-med", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
+ {"calib-ue-rx-byp", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
+ {"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
+ {"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
+ {"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
+ {"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
+ {"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
+ }
#define CMDLINE_CALIBUERX_IDX 0
#define CMDLINE_CALIBUERXMED_IDX 1
#define CMDLINE_CALIBUERXBYP_IDX 2
@@ -138,42 +136,42 @@
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_UEPARAMS_DESC { \
-{"siml1", CONFIG_HLP_SIML1, PARAMFLAG_BOOL, iptr:&simL1flag, defintval:0, TYPE_INT, 0}, \
-{"U", CONFIG_HLP_NUMUE, 0, u8ptr:&NB_UE_INST, defuintval:1, TYPE_UINT, 0}, \
-{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:130, TYPE_DOUBLE, 0}, \
-{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
-{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
-{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \
-{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
-{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
-{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:23, TYPE_INT, 0}, \
-{"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \
-{"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \
-{"num-ues", NULL, 0, u8ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT8, 0}, \
-{"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \
-{"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \
-{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
-{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
-{"usrp-clksrc", CONFIG_HLP_USRP_CLK_SRC,0, strptr:(char **)&usrp_clksrc, defstrval:"internal", TYPE_STRING, 0}, \
-{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
-{"clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \
-{"s" , CONFIG_HLP_SNR, 0, iptr:&snr_dB, defintval:25, TYPE_INT, 0}, \
-{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
-{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \
-}
+ {"siml1", CONFIG_HLP_SIML1, PARAMFLAG_BOOL, iptr:&simL1flag, defintval:0, TYPE_INT, 0}, \
+ {"U", CONFIG_HLP_NUMUE, 0, u16ptr:&NB_UE_INST, defuintval:1, TYPE_UINT16, 0}, \
+ {"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:130, TYPE_DOUBLE, 0}, \
+ {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
+ {"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
+ {"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \
+ {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \
+ {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \
+ {"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:23, TYPE_INT, 0}, \
+ {"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \
+ {"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \
+ {"num-ues", NULL, 0, u16ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT16, 0}, \
+ {"nums_ue_thread", NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \
+ {"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \
+ {"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
+ {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
+ {"usrp-clksrc", CONFIG_HLP_USRP_CLK_SRC,0, strptr:(char **)&usrp_clksrc, defstrval:"internal", TYPE_STRING, 0}, \
+ {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
+ {"clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \
+ {"s" , CONFIG_HLP_SNR, 0, iptr:&snr_dB, defintval:25, TYPE_INT, 0}, \
+ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
+ {"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \
+ }
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters specific to UE threads */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_UETHREADSPARAMS_DESC { \
-{"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \
-{"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \
-{"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \
-{"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \
-{"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \
-{"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \
-}
+ {"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \
+ {"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \
+ {"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \
+ {"threadThreeSubframe", NULL, 0, iptr:&(threads.three), defintval:1, TYPE_INT, 0}, \
+ {"threadSlot1ProcOne", NULL, 0, iptr:&(threads.slot1_proc_one), defintval:1, TYPE_INT, 0}, \
+ {"threadSlot1ProcTwo", NULL, 0, iptr:&(threads.slot1_proc_two), defintval:1, TYPE_INT, 0}, \
+ }
#define DEFAULT_DLF 2680000000
@@ -192,28 +190,26 @@
#define CLOCK_SOURCE softmodem_params.clock_source
#define USIM_TEST softmodem_params.usim_test
#define CMDLINE_PARAMS_DESC { \
-{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)}, \
-{"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
-{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
-{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
-{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \
-{"clock", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
-{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
-{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
-{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
-{"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \
-{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&DO_FORMS, defintval:0, TYPE_INT8, 0}, \
-{"W" , CONFIG_HLP_L2MONW, 0, strptr:(char **)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \
-{"P" , CONFIG_HLP_L2MONP, 0, strptr:(char **)&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, sizeof(in_path)}, \
-{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
-{"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
-{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:0, TYPE_INT, 0}, \
-{"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \
-{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
-{"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \
-{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
-{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
-}
+ {"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)}, \
+ {"ulsch-max-errors", CONFIG_HLP_ULMAXE, 0, uptr:&ULSCH_max_consecutive_errors, defuintval:0, TYPE_UINT, 0}, \
+ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
+ {"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
+ {"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \
+ {"clock", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
+ {"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
+ {"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
+ {"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
+ {"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \
+ {"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&DO_FORMS, defintval:0, TYPE_INT8, 0}, \
+ {"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
+ {"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \
+ {"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:0, TYPE_INT, 0}, \
+ {"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \
+ {"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
+ {"noS1", CONFIG_HLP_NOS1, PARAMFLAG_BOOL, uptr:&noS1, defintval:0, TYPE_INT, 0}, \
+ {"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
+ {"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
+ }
#define CONFIG_HLP_FLOG "Enable online log \n"
#define CONFIG_HLP_LOGL "Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n"
@@ -225,17 +221,24 @@
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define START_MSC softmodem_params.start_msc
#define CMDLINE_LOGPARAMS_DESC { \
-{"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
-{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
-{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
-{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
-}
-#define CMDLINE_ONLINELOG_IDX 0
+ {"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
+ {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
+ {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
+ {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
+ }
+#define CMDLINE_ONLINELOG_IDX 0
#define CMDLINE_GLOGLEVEL_IDX 1
#define CMDLINE_STARTTELN_IDX 2
+/* check function for global log level */
+#define CMDLINE_LOGPARAMS_CHECK_DESC { \
+ { .s5= {NULL }} , \
+ { .s2= { config_check_intrange, {0,4}}}, \
+ { .s5= {NULL }} , \
+ { .s5= {NULL }} , \
+ }
-/***************************************************************************************************************************************/
+/***************************************************************************************************************************************/
/* */
#include "threads_t.h"
@@ -243,30 +246,29 @@
#define SOFTMODEM_NOKRNMOD_BIT (1<<1)
#define SOFTMODEM_NONBIOT_BIT (1<<2)
typedef struct {
- uint64_t optmask;
- THREAD_STRUCT thread_struct;
- char rf_config_file[1024];
- int phy_test;
- uint8_t usim_test;
- int emulate_rf;
- int wait_for_sync; //eNodeB only
- int single_thread_flag; //eNodeB only
- int chain_offset;
- uint32_t do_forms;
- int numerology;
- unsigned int start_msc;
- int nonbiotflag;
- uint32_t clock_source;
- int hw_timing_advance;
+ uint64_t optmask;
+ THREAD_STRUCT thread_struct;
+ char rf_config_file[1024];
+ int phy_test;
+ uint8_t usim_test;
+ int emulate_rf;
+ int wait_for_sync; //eNodeB only
+ int single_thread_flag; //eNodeB only
+ int chain_offset;
+ uint32_t do_forms;
+ int numerology;
+ unsigned int start_msc;
+ uint32_t clock_source;
+ int hw_timing_advance;
} softmodem_params_t;
-#define SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
-#define SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
-#define SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT)
+#define IS_SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
+#define IS_SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
+#define IS_SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT)
extern uint64_t get_softmodem_optmask(void);
extern uint64_t set_softmodem_optmask(uint64_t bitmask);
extern void get_common_options(void);
-extern softmodem_params_t* get_softmodem_params(void);
+extern softmodem_params_t *get_softmodem_params(void);
uint64_t get_pdcp_optmask(void);
extern pthread_cond_t sync_cond;
@@ -291,21 +293,13 @@ extern int sync_var;
extern int transmission_mode;
extern double cpuf;
-#if defined(ENABLE_ITTI)
-extern volatile int start_eNB;
-extern volatile int start_UE;
-#endif
-
-
-
-
// In lte-enb.c
extern void init_eNB(int single_thread_flag,int wait_for_sync);
extern void stop_eNB(int);
extern void kill_eNB_proc(int inst);
// In lte-ru.c
-extern void init_RU(char*);
+extern void init_RU(char *);
extern void stop_ru(RU_t *ru);
extern void init_ru_vnf(void);
extern void init_RU_proc(RU_t *ru);
@@ -317,8 +311,9 @@ extern void set_function_spec_param(RU_t *ru);
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
extern void fill_ue_band_info(void);
-extern void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction, int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax, LTE_DL_FRAME_PARMS *fp);
-extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char * name);
+extern void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correction, int phy_test, int UE_scan, int UE_scan_carrier, runmode_t mode,int rxgain,int txpowermax,
+ LTE_DL_FRAME_PARMS *fp);
+extern void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_t *cpuset, char *name);
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
@@ -333,7 +328,7 @@ extern void RCConfig_sim(void);
extern void init_ocm(double,double);
extern void init_ue_devices(PHY_VARS_UE *);
-PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
+PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id,
uint8_t abstraction_flag);
void init_eNB_afterRU(void);
@@ -348,8 +343,8 @@ extern int restart_L1L2(module_id_t enb_id);
extern void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_iface);
-extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
- uint8_t UE_id,
- uint8_t abstraction_flag);
+extern PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
+ uint8_t UE_id,
+ uint8_t abstraction_flag);
#endif
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 31857026ee..1fe1d4c06b 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -978,12 +978,16 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
uint16_t ue_index = 0;
uint16_t ue_num = NB_UE_INST/NB_THREAD_INST+((NB_UE_INST%NB_THREAD_INST > ue_thread_id) ? 1 :0);
module_id_t ue_Mod_id;
- PHY_VARS_UE *UE; //= rtd->UE;
+ PHY_VARS_UE *UE = NULL;
int ret;
uint8_t end_flag;
proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0];
phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
+ if (rtd != NULL) {
+ UE = rtd->UE;
+ }
+
if(ue_thread_id == 0){
phy_stub_ticking->ticking_var = -1;
proc->subframe_rx=proc->sub_frame_start;
@@ -1038,10 +1042,15 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
proc->frame_tx = proc->frame_rx + (proc->subframe_rx>(9-sf_ahead)?1:0);
//oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
- if(UE->frame_parms.frame_type == FDD){
- oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
- }else{
- oai_subframe_ind(proc->frame_tx,proc->subframe_tx);
+ if (UE != NULL) {
+ if (UE->frame_parms.frame_type == FDD) {
+ oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
+ } else {
+ oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
+ }
+ } else {
+ // Default will be FDD
+ oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
}
//Guessing that the next 4 lines are not needed for the phy_stub mode.
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index 4583b6ac97..a3aa003662 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -128,10 +128,6 @@ int config_sync_var=-1;
uint16_t runtime_phy_rx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75, 100]
-#if defined(ENABLE_ITTI)
- volatile int start_eNB = 0;
- volatile int start_UE = 0;
-#endif
volatile int oai_exit = 0;
clock_source_t clock_source = internal;
@@ -402,48 +398,6 @@ static void *scope_thread(void *arg) {
-#if defined(ENABLE_ITTI)
-void *l2l1_task(void *arg) {
- MessageDef *message_p = NULL;
- int result;
- itti_set_task_real_time(TASK_L2L1);
- itti_mark_task_ready(TASK_L2L1);
-
- do {
- // Wait for a message
- itti_receive_msg (TASK_L2L1, &message_p);
-
- switch (ITTI_MSG_ID(message_p)) {
- case TERMINATE_MESSAGE:
- oai_exit=1;
- itti_exit_task ();
- break;
-
- case ACTIVATE_MESSAGE:
- start_UE = 1;
- break;
-
- case DEACTIVATE_MESSAGE:
- start_UE = 0;
- break;
-
- case MESSAGE_TEST:
- LOG_I(SIM, "Received %s\n", ITTI_MSG_NAME(message_p));
- break;
-
- default:
- LOG_E(SIM, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
- break;
- }
-
- result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
- AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
- } while(!oai_exit);
-
- return NULL;
-}
-#endif
-
extern int16_t dlsch_demod_shift;
static void get_options(void) {
@@ -456,7 +410,6 @@ static void get_options(void) {
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
/* unknown parameters on command line will be checked in main
after all init have been performed */
- CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT);
get_common_options();
get_uethreads_params();
paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
@@ -754,7 +707,6 @@ int main( int argc, char **argv ) {
for (int i=0; irfdevice.trx_end_func)
PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice);
- if (opt_enabled == 1)
- terminate_opt();
-
+ terminate_opt();
logClean();
printf("Bye.\n");
return 0;
diff --git a/targets/TEST/AT_COMMANDS/Makefile b/targets/TEST/AT_COMMANDS/Makefile
old mode 100755
new mode 100644
diff --git a/targets/TEST/PACKET_TRACER/Makefile b/targets/TEST/PACKET_TRACER/Makefile
old mode 100755
new mode 100644
diff --git a/targets/TEST/PDCP/Makefile b/targets/TEST/PDCP/Makefile
old mode 100755
new mode 100644
diff --git a/targets/TEST/PDCP/with_rlc/Makefile.data_bearer b/targets/TEST/PDCP/with_rlc/Makefile.data_bearer
old mode 100755
new mode 100644
diff --git a/targets/TEST/PDCP/with_rlc/readme_test_pdcp_rlc.txt b/targets/TEST/PDCP/with_rlc/readme_test_pdcp_rlc.txt
old mode 100755
new mode 100644
diff --git a/targets/TEST/RLC_AM_V9.3.0/Makefile b/targets/TEST/RLC_AM_V9.3.0/Makefile
old mode 100755
new mode 100644
diff --git a/targets/TEST/RLC_UM_V9.3.0/Makefile b/targets/TEST/RLC_UM_V9.3.0/Makefile
old mode 100755
new mode 100644