Commit a97a8387 authored by Ben Wojtowicz's avatar Ben Wojtowicz

Version 0.11.0: Fixed a bug with transmitting SIB2 for 1.4MHz bandwidth in...

Version 0.11.0: Fixed a bug with transmitting SIB2 for 1.4MHz bandwidth in LTE_fdd_dl_file_gen and LTE_fdd_enodeb, fixed several bugs in liblte_phy.cc, LTE_fdd_enodeb, and lte_prach_detector.m, and added PRACH detection processing in LTE_fdd_enodeb.
parent a4433905
......@@ -23,7 +23,7 @@
########################################################################
cmake_minimum_required(VERSION 2.6)
project(openLTE CXX C)
set(openLTE_version 0.10.4)
set(openLTE_version 0.11.0)
enable_testing()
#select the release build type by default to get optimization flags
......
......@@ -85,3 +85,7 @@ v00.10.03 Fixed a PDSCH mapping bug in the lte_fdd_dl_transmit octave
routine.
v00.10.04 Fixed a bug in LTE_fdd_enodeb dealing with saturation of baseband
transmit samples.
v00.11.00 Fixed a bug with transmitting SIB2 for 1.4MHz bandwidth in
LTE_fdd_dl_file_gen and LTE_fdd_enodeb, fixed several bugs in
liblte_phy.cc, LTE_fdd_enodeb, and lte_prach_detector.m, and
added PRACH detection processing in LTE_fdd_enodeb.
/*******************************************************************************
Copyright 2012-2013 Ben Wojtowicz
Copyright 2012-2014 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -42,6 +42,8 @@
09/16/2013 Ben Wojtowicz Added support for changing the sample rate.
09/28/2013 Ben Wojtowicz Added support for setting the sample rate
and output data type.
01/18/2014 Ben Wojtowicz Fixed a bug with transmitting SIB2 for 1.4MHz
bandwidth.
*******************************************************************************/
......@@ -128,8 +130,8 @@ LTE_fdd_dl_fg_samp_buf::LTE_fdd_dl_fg_samp_buf(size_t out_size_val)
si_periodicity_T = 8;
sib1.cell_barred = LIBLTE_RRC_CELL_NOT_BARRED;
sib1.intra_freq_reselection = LIBLTE_RRC_INTRA_FREQ_RESELECTION_ALLOWED;
sib1.si_window_length = LIBLTE_RRC_SI_WINDOW_LENGTH_MS1;
si_win_len = 1;
sib1.si_window_length = LIBLTE_RRC_SI_WINDOW_LENGTH_MS2;
si_win_len = 2;
sib1.sf_assignment = LIBLTE_RRC_SUBFRAME_ASSIGNMENT_0;
sib1.special_sf_patterns = LIBLTE_RRC_SPECIAL_SUBFRAME_PATTERNS_0;
sib1.cell_id = 0;
......@@ -382,7 +384,8 @@ int32 LTE_fdd_dl_fg_samp_buf::work(int32 noutput_items,
pdcch.alloc[pdcch.N_alloc].tx_mode = sib_tx_mode;
pdcch.N_alloc++;
}
if(subframe.num == (0 * si_win_len)%10 &&
if(subframe.num >= (0 * si_win_len)%10 &&
subframe.num < (1 * si_win_len)%10 &&
(sfn % si_periodicity_T) == ((0 * si_win_len)/10))
{
// SIs in 1st scheduling info list entry
......@@ -414,20 +417,24 @@ int32 LTE_fdd_dl_fg_samp_buf::work(int32 noutput_items,
}
liblte_rrc_pack_bcch_dlsch_msg(&bcch_dlsch_msg,
&pdcch.alloc[pdcch.N_alloc].msg);
liblte_phy_get_tbs_mcs_and_n_prb_for_dl(pdcch.alloc[pdcch.N_alloc].msg.N_bits,
subframe.num,
N_rb_dl,
LIBLTE_MAC_SI_RNTI,
&pdcch.alloc[pdcch.N_alloc].tbs,
&pdcch.alloc[pdcch.N_alloc].mcs,
&pdcch.alloc[pdcch.N_alloc].N_prb);
pdcch.alloc[pdcch.N_alloc].pre_coder_type = LIBLTE_PHY_PRE_CODER_TYPE_TX_DIVERSITY;
pdcch.alloc[pdcch.N_alloc].mod_type = LIBLTE_PHY_MODULATION_TYPE_QPSK;
pdcch.alloc[pdcch.N_alloc].rv_idx = 0; //36.321 section 5.3.1
pdcch.alloc[pdcch.N_alloc].N_codewords = 1;
pdcch.alloc[pdcch.N_alloc].rnti = LIBLTE_MAC_SI_RNTI;
pdcch.alloc[pdcch.N_alloc].tx_mode = sib_tx_mode;
pdcch.N_alloc++;
// FIXME: This was a hack to allow SIB2 decoding with 1.4MHz BW due to overlap with MIB
if(LIBLTE_SUCCESS == liblte_phy_get_tbs_mcs_and_n_prb_for_dl(pdcch.alloc[pdcch.N_alloc].msg.N_bits,
subframe.num,
N_rb_dl,
LIBLTE_MAC_SI_RNTI,
&pdcch.alloc[pdcch.N_alloc].tbs,
&pdcch.alloc[pdcch.N_alloc].mcs,
&pdcch.alloc[pdcch.N_alloc].N_prb))
{
pdcch.alloc[pdcch.N_alloc].pre_coder_type = LIBLTE_PHY_PRE_CODER_TYPE_TX_DIVERSITY;
pdcch.alloc[pdcch.N_alloc].mod_type = LIBLTE_PHY_MODULATION_TYPE_QPSK;
pdcch.alloc[pdcch.N_alloc].rv_idx = 0; //36.321 section 5.3.1
pdcch.alloc[pdcch.N_alloc].N_codewords = 1;
pdcch.alloc[pdcch.N_alloc].rnti = LIBLTE_MAC_SI_RNTI;
pdcch.alloc[pdcch.N_alloc].tx_mode = sib_tx_mode;
pdcch.N_alloc++;
}
}
for(j=1; j<sib1.N_sched_info; j++)
{
......
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
Copyright 2013-2014 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -25,6 +25,7 @@
Revision History
---------- ------------- --------------------------------------------
11/09/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Added set/get routines for uint32 values.
*******************************************************************************/
......@@ -38,6 +39,8 @@
#include "LTE_fdd_enb_interface.h"
#include "liblte_rrc.h"
#include "liblte_phy.h"
#include <string>
#include <map>
/*******************************************************************************
DEFINES
......@@ -97,9 +100,11 @@ public:
LTE_FDD_ENB_ERROR_ENUM set_param(LTE_FDD_ENB_PARAM_ENUM param, int64 value);
LTE_FDD_ENB_ERROR_ENUM set_param(LTE_FDD_ENB_PARAM_ENUM param, double value);
LTE_FDD_ENB_ERROR_ENUM set_param(LTE_FDD_ENB_PARAM_ENUM param, std::string value);
LTE_FDD_ENB_ERROR_ENUM set_param(LTE_FDD_ENB_PARAM_ENUM param, uint32 value);
LTE_FDD_ENB_ERROR_ENUM get_param(LTE_FDD_ENB_PARAM_ENUM param, int64 &value);
LTE_FDD_ENB_ERROR_ENUM get_param(LTE_FDD_ENB_PARAM_ENUM param, double &value);
LTE_FDD_ENB_ERROR_ENUM get_param(LTE_FDD_ENB_PARAM_ENUM param, std::string &value);
LTE_FDD_ENB_ERROR_ENUM get_param(LTE_FDD_ENB_PARAM_ENUM param, uint32 &value);
// MIB/SIB Construction
void construct_sys_info(void);
......
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
Copyright 2013-2014 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -24,6 +24,8 @@
Revision History
---------- ------------- --------------------------------------------
11/09/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Added dynamic variables and added level to
debug prints.
*******************************************************************************/
......@@ -70,6 +72,7 @@ typedef enum{
LTE_FDD_ENB_ERROR_NO_FREE_C_RNTI,
LTE_FDD_ENB_ERROR_C_RNTI_NOT_FOUND,
LTE_FDD_ENB_ERROR_CANT_SCHEDULE,
LTE_FDD_ENB_ERROR_VARIABLE_NOT_DYNAMIC,
LTE_FDD_ENB_ERROR_N_ITEMS,
}LTE_FDD_ENB_ERROR_ENUM;
static const char LTE_fdd_enb_error_text[LTE_FDD_ENB_ERROR_N_ITEMS][100] = {"none",
......@@ -85,22 +88,48 @@ static const char LTE_fdd_enb_error_text[LTE_FDD_ENB_ERROR_N_ITEMS][100] = {"non
"user not found",
"no free C-RNTI",
"C-RNTI not found",
"cant schedule"};
"cant schedule",
"variable not dynamic"};
typedef enum{
LTE_FDD_ENB_DEBUG_TYPE_ERROR = 0,
LTE_FDD_ENB_DEBUG_TYPE_WARNING,
LTE_FDD_ENB_DEBUG_TYPE_INFO,
LTE_FDD_ENB_DEBUG_TYPE_DEBUG,
LTE_FDD_ENB_DEBUG_TYPE_N_ITEMS,
}LTE_FDD_ENB_DEBUG_TYPE_ENUM;
static const char LTE_fdd_enb_debug_type_text[LTE_FDD_ENB_DEBUG_TYPE_N_ITEMS][100] = {"ERROR",
"WARNING",
"INFO"};
static const char LTE_fdd_enb_debug_type_text[LTE_FDD_ENB_DEBUG_TYPE_N_ITEMS][100] = {"error",
"warning",
"info",
"debug"};
typedef enum{
LTE_FDD_ENB_DEBUG_LEVEL_RADIO = 0,
LTE_FDD_ENB_DEBUG_LEVEL_PHY,
LTE_FDD_ENB_DEBUG_LEVEL_MAC,
LTE_FDD_ENB_DEBUG_LEVEL_RLC,
LTE_FDD_ENB_DEBUG_LEVEL_PDCP,
LTE_FDD_ENB_DEBUG_LEVEL_RRC,
LTE_FDD_ENB_DEBUG_LEVEL_MME,
LTE_FDD_ENB_DEBUG_LEVEL_USER,
LTE_FDD_ENB_DEBUG_LEVEL_IFACE,
LTE_FDD_ENB_DEBUG_LEVEL_N_ITEMS,
}LTE_FDD_ENB_DEBUG_LEVEL_ENUM;
static const char LTE_fdd_enb_debug_level_text[LTE_FDD_ENB_DEBUG_LEVEL_N_ITEMS][100] = {"radio",
"phy",
"mac",
"rlc",
"pdcp",
"rrc",
"mme",
"user",
"iface"};
typedef enum{
LTE_FDD_ENB_VAR_TYPE_DOUBLE = 0,
LTE_FDD_ENB_VAR_TYPE_INT64,
LTE_FDD_ENB_VAR_TYPE_HEX,
LTE_FDD_ENB_VAR_TYPE_UINT32,
}LTE_FDD_ENB_VAR_TYPE_ENUM;
typedef enum{
......@@ -137,6 +166,8 @@ typedef enum{
LTE_FDD_ENB_PARAM_PHICH_RESOURCE,
LTE_FDD_ENB_PARAM_N_SCHED_INFO,
LTE_FDD_ENB_PARAM_SYSTEM_INFO_PERIODICITY,
LTE_FDD_ENB_PARAM_DEBUG_TYPE,
LTE_FDD_ENB_PARAM_DEBUG_LEVEL,
// Radio parameters managed by LTE_fdd_enb_radio
LTE_FDD_ENB_PARAM_AVAILABLE_RADIOS,
......@@ -179,6 +210,8 @@ static const char lte_fdd_enb_param_text[LTE_FDD_ENB_PARAM_N_ITEMS][100] = {"ban
"phich_resource",
"n_sched_info",
"system_info_periodicity",
"debug_type",
"debug_level",
"available_radios",
"selected_radio_name",
"selected_radio_idx",
......@@ -193,6 +226,7 @@ typedef struct{
int64 int64_l_bound;
int64 int64_u_bound;
bool special_bounds;
bool dynamic;
}LTE_FDD_ENB_VAR_STRUCT;
/*******************************************************************************
......@@ -213,8 +247,8 @@ public:
void send_ctrl_msg(std::string msg);
void send_ctrl_info_msg(std::string msg);
void send_ctrl_error_msg(LTE_FDD_ENB_ERROR_ENUM error, std::string msg);
void send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ENUM type, std::string file_name, int32 line, std::string msg, ...);
void send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ENUM type, std::string file_name, int32 line, LIBLTE_MSG_STRUCT *lte_msg, std::string msg, ...);
void send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ENUM type, LTE_FDD_ENB_DEBUG_LEVEL_ENUM level, std::string file_name, int32 line, std::string msg, ...);
void send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ENUM type, LTE_FDD_ENB_DEBUG_LEVEL_ENUM level, std::string file_name, int32 line, LIBLTE_MSG_STRUCT *lte_msg, std::string msg, ...);
static void handle_ctrl_msg(std::string msg);
static void handle_ctrl_connect(void);
static void handle_ctrl_disconnect(void);
......@@ -252,6 +286,8 @@ private:
// Variables
std::map<std::string, LTE_FDD_ENB_VAR_STRUCT> var_map;
boost::mutex start_mutex;
uint32 debug_type_mask;
uint32 debug_level_mask;
bool shutdown;
bool started;
......@@ -259,6 +295,7 @@ private:
LTE_FDD_ENB_ERROR_ENUM write_value(LTE_FDD_ENB_VAR_STRUCT *var, double value);
LTE_FDD_ENB_ERROR_ENUM write_value(LTE_FDD_ENB_VAR_STRUCT *var, int64 value);
LTE_FDD_ENB_ERROR_ENUM write_value(LTE_FDD_ENB_VAR_STRUCT *var, std::string value);
LTE_FDD_ENB_ERROR_ENUM write_value(LTE_FDD_ENB_VAR_STRUCT *var, uint32 value);
};
#endif /* __LTE_FDD_ENB_INTERFACE_H__ */
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
Copyright 2013-2014 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -25,6 +25,7 @@
Revision History
---------- ------------- --------------------------------------------
11/09/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Cached a copy of the interface class.
*******************************************************************************/
......@@ -35,6 +36,7 @@
INCLUDES
*******************************************************************************/
#include "LTE_fdd_enb_interface.h"
#include "LTE_fdd_enb_cnfg_db.h"
#include "LTE_fdd_enb_msgq.h"
#include "liblte_mac.h"
......@@ -85,7 +87,7 @@ public:
static void cleanup(void);
// Start/Stop
void start(void);
void start(LTE_fdd_enb_interface *iface);
void stop(void);
// External interface
......@@ -98,8 +100,9 @@ private:
~LTE_fdd_enb_mac();
// Start/Stop
boost::mutex start_mutex;
bool started;
boost::mutex start_mutex;
LTE_fdd_enb_interface *interface;
bool started;
// Communication
void handle_phy_msg(LTE_FDD_ENB_MESSAGE_STRUCT *msg);
......
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
Copyright 2013-2014 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -25,6 +25,7 @@
Revision History
---------- ------------- --------------------------------------------
11/09/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Added an explicit include for boost mutexes.
*******************************************************************************/
......@@ -38,6 +39,7 @@
#include "LTE_fdd_enb_cnfg_db.h"
#include "LTE_fdd_enb_msgq.h"
#include <boost/interprocess/ipc/message_queue.hpp>
#include <boost/thread/mutex.hpp>
/*******************************************************************************
DEFINES
......
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
Copyright 2013-2014 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -25,6 +25,7 @@
Revision History
---------- ------------- --------------------------------------------
11/09/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Added the ability to set priorities.
*******************************************************************************/
......@@ -181,6 +182,9 @@ class LTE_fdd_enb_msgq
public:
LTE_fdd_enb_msgq(std::string _msgq_name,
msgq_cb cb);
LTE_fdd_enb_msgq(std::string _msgq_name,
msgq_cb cb,
uint32 _prio);
~LTE_fdd_enb_msgq();
// Send/Receive
......@@ -202,6 +206,7 @@ private:
msgq_cb callback;
std::string msgq_name;
pthread_t rx_thread;
uint32 prio;
};
#endif /* __LTE_FDD_ENB_MSGQ_H__ */
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
Copyright 2013-2014 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -25,6 +25,8 @@
Revision History
---------- ------------- --------------------------------------------
11/09/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Cached a copy of the interface class and
added the ability to handle late subframes.
*******************************************************************************/
......@@ -35,6 +37,7 @@
INCLUDES
*******************************************************************************/
#include "LTE_fdd_enb_interface.h"
#include "LTE_fdd_enb_cnfg_db.h"
#include "LTE_fdd_enb_msgq.h"
#include "LTE_fdd_enb_radio.h"
......@@ -69,7 +72,7 @@ public:
static void cleanup(void);
// Start/Stop
void start(void);
void start(LTE_fdd_enb_interface *iface);
void stop(void);
// External interface
......@@ -87,8 +90,8 @@ private:
~LTE_fdd_enb_phy();
// Start/Stop
boost::mutex start_mutex;
bool started;
LTE_fdd_enb_interface *interface;
bool started;
// Communication
void handle_mac_msg(LTE_FDD_ENB_MESSAGE_STRUCT *msg);
......@@ -114,6 +117,8 @@ private:
LIBLTE_PHY_SUBFRAME_STRUCT dl_subframe;
LIBLTE_MSG_STRUCT dl_rrc_msg;
uint32 dl_fn_combo;
uint32 last_rts_fn_combo;
bool late_subfr;
// Uplink
void process_ul(LTE_FDD_ENB_RADIO_RX_BUF_STRUCT *rx_buf);
......
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
Copyright 2013-2014 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -25,6 +25,8 @@
Revision History
---------- ------------- --------------------------------------------
11/09/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Handling EARFCN updates and multiple
antennas.
*******************************************************************************/
......@@ -102,6 +104,7 @@ public:
uint32 get_rx_gain(void);
LTE_FDD_ENB_ERROR_ENUM set_rx_gain(uint32 gain);
uint32 get_sample_rate(void);
void set_earfcns(int64 dl_earfcn, int64 ul_earfcn);
void send(LTE_FDD_ENB_RADIO_TX_BUF_STRUCT *buf);
private:
......@@ -127,6 +130,7 @@ private:
gr_complex tx_buf[LIBLTE_PHY_N_SAMPS_PER_SUBFR_30_72MHZ];
gr_complex rx_buf[LIBLTE_PHY_N_SAMPS_PER_SUBFR_30_72MHZ];
uhd::time_spec_t next_tx_ts;
int64 N_ant;
uint32 N_tx_samps;
uint32 N_rx_samps;
uint32 N_samps_per_subfr;
......
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
Copyright 2013-2014 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -25,6 +25,9 @@
Revision History
---------- ------------- --------------------------------------------
11/10/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Changed several default values, updating
EARFCNs in the radio, and added set/get for
uint32 values.
*******************************************************************************/
......@@ -33,6 +36,7 @@
*******************************************************************************/
#include "LTE_fdd_enb_cnfg_db.h"
#include "LTE_fdd_enb_interface.h"
#include "LTE_fdd_enb_phy.h"
#include "LTE_fdd_enb_mac.h"
#include "LTE_fdd_enb_rlc.h"
......@@ -110,8 +114,8 @@ LTE_fdd_enb_cnfg_db::LTE_fdd_enb_cnfg_db()
var_map_int64[LTE_FDD_ENB_PARAM_N_ID_1] = 0;
var_map_uint32[LTE_FDD_ENB_PARAM_MCC] = 0xFFFFF001;
var_map_uint32[LTE_FDD_ENB_PARAM_MNC] = 0xFFFFFF01;
var_map_int64[LTE_FDD_ENB_PARAM_CELL_ID] = 0;
var_map_int64[LTE_FDD_ENB_PARAM_TRACKING_AREA_CODE] = 0;
var_map_int64[LTE_FDD_ENB_PARAM_CELL_ID] = 1;
var_map_int64[LTE_FDD_ENB_PARAM_TRACKING_AREA_CODE] = 1;
var_map_int64[LTE_FDD_ENB_PARAM_Q_RX_LEV_MIN] = -140;
var_map_int64[LTE_FDD_ENB_PARAM_P0_NOMINAL_PUSCH] = -70;
var_map_int64[LTE_FDD_ENB_PARAM_P0_NOMINAL_PUCCH] = -96;
......@@ -123,11 +127,13 @@ LTE_fdd_enb_cnfg_db::LTE_fdd_enb_cnfg_db()
var_map_int64[LTE_FDD_ENB_PARAM_SIB7_PRESENT] = 0;
var_map_int64[LTE_FDD_ENB_PARAM_SIB8_PRESENT] = 0;
var_map_int64[LTE_FDD_ENB_PARAM_SEARCH_WIN_SIZE] = 0;
var_map_uint32[LTE_FDD_ENB_PARAM_SYSTEM_INFO_VALUE_TAG] = 0;
var_map_uint32[LTE_FDD_ENB_PARAM_SYSTEM_INFO_VALUE_TAG] = 1;
var_map_int64[LTE_FDD_ENB_PARAM_SYSTEM_INFO_WINDOW_LENGTH] = LIBLTE_RRC_SI_WINDOW_LENGTH_MS1;
var_map_int64[LTE_FDD_ENB_PARAM_PHICH_RESOURCE] = LIBLTE_RRC_PHICH_RESOURCE_1;
var_map_int64[LTE_FDD_ENB_PARAM_N_SCHED_INFO] = 1;
var_map_int64[LTE_FDD_ENB_PARAM_SYSTEM_INFO_PERIODICITY] = LIBLTE_RRC_SI_PERIODICITY_RF8;
var_map_uint32[LTE_FDD_ENB_PARAM_DEBUG_TYPE] = 0xFFFFFFFF;
var_map_uint32[LTE_FDD_ENB_PARAM_DEBUG_LEVEL] = 0xFFFFFFFF;
}
LTE_fdd_enb_cnfg_db::~LTE_fdd_enb_cnfg_db()
{
......@@ -139,8 +145,9 @@ LTE_fdd_enb_cnfg_db::~LTE_fdd_enb_cnfg_db()
LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_cnfg_db::set_param(LTE_FDD_ENB_PARAM_ENUM param,
int64 value)
{
std::map<LTE_FDD_ENB_PARAM_ENUM, int64>::iterator iter = var_map_int64.find(param);
LTE_FDD_ENB_ERROR_ENUM err = LTE_FDD_ENB_ERROR_INVALID_PARAM;
LTE_fdd_enb_radio *radio = LTE_fdd_enb_radio::get_instance();
std::map<LTE_FDD_ENB_PARAM_ENUM, int64>::iterator iter = var_map_int64.find(param);
LTE_FDD_ENB_ERROR_ENUM err = LTE_FDD_ENB_ERROR_INVALID_PARAM;
if(var_map_int64.end() != iter)
{
......@@ -154,6 +161,7 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_cnfg_db::set_param(LTE_FDD_ENB_PARAM_ENUM par
set_param(LTE_FDD_ENB_PARAM_N_ID_1, (value - (value % 3))/3);
}else if(LTE_FDD_ENB_PARAM_DL_EARFCN == param){
set_param(LTE_FDD_ENB_PARAM_UL_EARFCN, (int64)liblte_interface_get_corresponding_ul_earfcn(value));
radio->set_earfcns(value, (int64)liblte_interface_get_corresponding_ul_earfcn(value));
}
}
......@@ -224,6 +232,20 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_cnfg_db::set_param(LTE_FDD_ENB_PARAM_ENUM par
return(err);
}
LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_cnfg_db::set_param(LTE_FDD_ENB_PARAM_ENUM param,
uint32 value)
{
std::map<LTE_FDD_ENB_PARAM_ENUM, uint32>::iterator iter = var_map_uint32.find(param);
LTE_FDD_ENB_ERROR_ENUM err = LTE_FDD_ENB_ERROR_INVALID_PARAM;
if(var_map_uint32.end() != iter)
{
(*iter).second = value;
err = LTE_FDD_ENB_ERROR_NONE;
}
return(err);
}
LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_cnfg_db::get_param(LTE_FDD_ENB_PARAM_ENUM param,
int64 &value)
{
......@@ -278,6 +300,20 @@ LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_cnfg_db::get_param(LTE_FDD_ENB_PARAM_ENUM pa
return(err);
}
LTE_FDD_ENB_ERROR_ENUM LTE_fdd_enb_cnfg_db::get_param(LTE_FDD_ENB_PARAM_ENUM param,
uint32 &value)
{
std::map<LTE_FDD_ENB_PARAM_ENUM, uint32>::iterator iter = var_map_uint32.find(param);
LTE_FDD_ENB_ERROR_ENUM err = LTE_FDD_ENB_ERROR_INVALID_PARAM;
if(var_map_uint32.end() != iter)
{
value = (*iter).second;
err = LTE_FDD_ENB_ERROR_NONE;
}
return(err);
}
/******************************/
/* MIB/SIB Construction */
......@@ -416,7 +452,7 @@ void LTE_fdd_enb_cnfg_db::construct_sys_info(void)
sys_info.sib1.plmn_id[0].resv_for_oper = LIBLTE_RRC_NOT_RESV_FOR_OPER;
sys_info.sib1.cell_barred = LIBLTE_RRC_CELL_NOT_BARRED;
sys_info.sib1.intra_freq_reselection = LIBLTE_RRC_INTRA_FREQ_RESELECTION_ALLOWED;
sys_info.sib1.si_window_length = LIBLTE_RRC_SI_WINDOW_LENGTH_MS1;
sys_info.sib1.si_window_length = LIBLTE_RRC_SI_WINDOW_LENGTH_MS2;
sys_info.sib1.sf_assignment = LIBLTE_RRC_SUBFRAME_ASSIGNMENT_0;
sys_info.sib1.special_sf_patterns = LIBLTE_RRC_SPECIAL_SUBFRAME_PATTERNS_0;
int64_iter = var_map_int64.find(LTE_FDD_ENB_PARAM_CELL_ID);
......@@ -440,7 +476,7 @@ void LTE_fdd_enb_cnfg_db::construct_sys_info(void)
int64_iter = var_map_int64.find(LTE_FDD_ENB_PARAM_FREQ_BAND);
if(var_map_int64.end() != int64_iter)
{
sys_info.sib1.freq_band_indicator = (*int64_iter).second;
sys_info.sib1.freq_band_indicator = liblte_interface_band_num[(*int64_iter).second];
}
uint32_iter = var_map_uint32.find(LTE_FDD_ENB_PARAM_SYSTEM_INFO_VALUE_TAG);
if(var_map_uint32.end() != uint32_iter)
......@@ -448,7 +484,7 @@ void LTE_fdd_enb_cnfg_db::construct_sys_info(void)
sys_info.sib1.system_info_value_tag = (*uint32_iter).second++;
}
sys_info.sib1.p_max_present = true;
sys_info.sib1.p_max = -30;
sys_info.sib1.p_max = 23;
sys_info.sib1.tdd = false;
// SIB2
......@@ -469,7 +505,7 @@ void LTE_fdd_enb_cnfg_db::construct_sys_info(void)
sys_info.sib2.rr_config_common_sib.prach_cnfg.prach_cnfg_info.high_speed_flag = false;
sys_info.sib2.rr_config_common_sib.prach_cnfg.prach_cnfg_info.zero_correlation_zone_config = 1;
sys_info.sib2.rr_config_common_sib.prach_cnfg.prach_cnfg_info.prach_freq_offset = 0;
sys_info.sib2.rr_config_common_sib.pdsch_cnfg.rs_power = -60;
sys_info.sib2.rr_config_common_sib.pdsch_cnfg.rs_power = 0;
sys_info.sib2.rr_config_common_sib.pdsch_cnfg.p_b = 0;
sys_info.sib2.rr_config_common_sib.pusch_cnfg.n_sb = 1;
sys_info.sib2.rr_config_common_sib.pusch_cnfg.hopping_mode = LIBLTE_RRC_HOPPING_MODE_INTER_SUBFRAME;
......
This diff is collapsed.
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
Copyright 2013-2014 Ben Wojtowicz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
......@@ -25,6 +25,10 @@
Revision History
---------- ------------- --------------------------------------------
11/10/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Cached a copy of the interface class, added
real-time priority to PHY->MAC message queue,
added level to debug prints, and fixed
subframe scheduling.
*******************************************************************************/
......@@ -87,7 +91,8 @@ void LTE_fdd_enb_mac::cleanup(void)
/********************************/
LTE_fdd_enb_mac::LTE_fdd_enb_mac()
{
started = false;
interface = NULL;
started = false;
}
LTE_fdd_enb_mac::~LTE_fdd_enb_mac()
{
......@@ -97,7 +102,7 @@ LTE_fdd_enb_mac::~LTE_fdd_enb_mac()
/********************/
/* Start/Stop */
/********************/
void LTE_fdd_enb_mac::start(void)
void LTE_fdd_enb_mac::start(LTE_fdd_enb_interface *iface)
{
boost::mutex::scoped_lock lock(start_mutex);
msgq_cb phy_cb(&msgq_cb_wrapper<LTE_fdd_enb_mac, &LTE_fdd_enb_mac::handle_phy_msg>, this);
......@@ -107,9 +112,11 @@ void LTE_fdd_enb_mac::start(void)
if(!started)
{
interface = iface;
started = true;
phy_comm_msgq = new LTE_fdd_enb_msgq("phy_mac_mq",
phy_cb);
phy_cb,
90);
rlc_comm_msgq = new LTE_fdd_enb_msgq("rlc_mac_mq",
rlc_cb);
mac_phy_mq = new boost::interprocess::message_queue(boost::interprocess::open_only,
......@@ -134,11 +141,11 @@ void LTE_fdd_enb_mac::start(void)
sched_ul_subfr[i].fn_combo = i;
sched_ul_subfr[i].next_prb = 0;
}
sched_ul_subfr[9].fn_combo = (LTE_FDD_ENB_FN_COMBO_MAX + 1) - 1;
sched_dl_subfr[0].fn_combo = 10;
sched_dl_subfr[1].fn_combo = 11;
sched_cur_dl_subfn = 2;
sched_cur_ul_subfn = 9;
sched_dl_subfr[2].fn_combo = 12;
sched_cur_dl_subfn = 3;
sched_cur_ul_subfn = 0;
}
}
void LTE_fdd_enb_mac::stop(void)
......@@ -158,8 +165,6 @@ void LTE_fdd_enb_mac::stop(void)
/***********************/
void LTE_fdd_enb_mac::handle_phy_msg(LTE_FDD_ENB_MESSAGE_STRUCT *msg)
{
LTE_fdd_enb_interface *interface = LTE_fdd_enb_interface::get_instance();
if(LTE_FDD_ENB_DEST_LAYER_MAC == msg->dest_layer ||
LTE_FDD_ENB_DEST_LAYER_ANY == msg->dest_layer)
{
......@@ -183,6 +188,7 @@ void LTE_fdd_enb_mac::handle_phy_msg(LTE_FDD_ENB_MESSAGE_STRUCT *msg)
break;
default:
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_WARNING,
LTE_FDD_ENB_DEBUG_LEVEL_MAC,
__FILE__,
__LINE__,
"Received invalid message %s",
......@@ -197,12 +203,11 @@ void LTE_fdd_enb_mac::handle_phy_msg(LTE_FDD_ENB_MESSAGE_STRUCT *msg)
}
void LTE_fdd_enb_mac::handle_rlc_msg(LTE_FDD_ENB_MESSAGE_STRUCT *msg)
{
LTE_fdd_enb_interface *interface = LTE_fdd_enb_interface::get_instance();
if(LTE_FDD_ENB_DEST_LAYER_MAC == msg->dest_layer ||
LTE_FDD_ENB_DEST_LAYER_ANY == msg->dest_layer)
{
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_INFO,
LTE_FDD_ENB_DEBUG_LEVEL_MAC,
__FILE__,
__LINE__,
"Received RLC message %s",
......@@ -231,9 +236,8 @@ void LTE_fdd_enb_mac::update_sys_info(void)
/**********************/
void LTE_fdd_enb_mac::handle_ready_to_send(LTE_FDD_ENB_READY_TO_SEND_MSG_STRUCT *rts)
{
LTE_fdd_enb_interface *interface = LTE_fdd_enb_interface::get_instance();
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_INFO,
LTE_FDD_ENB_DEBUG_LEVEL_MAC,
__FILE__,
__LINE__,
"RTS %u:%u %u:%u",
......@@ -245,6 +249,7 @@ void LTE_fdd_enb_mac::handle_ready_to_send(LTE_FDD_ENB_READY_TO_SEND_MSG_STRUCT
if(rts->dl_fn_combo != sched_dl_subfr[sched_cur_dl_subfn].fn_combo)
{
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ERROR,
LTE_FDD_ENB_DEBUG_LEVEL_MAC,
__FILE__,
__LINE__,
"RTS dl_fn_combo incorrect: RTS %u but currently on %u",
......@@ -269,6 +274,7 @@ void LTE_fdd_enb_mac::handle_ready_to_send(LTE_FDD_ENB_READY_TO_SEND_MSG_STRUCT
if(rts->ul_fn_combo != sched_ul_subfr[sched_cur_ul_subfn].fn_combo)
{
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ERROR,
LTE_FDD_ENB_DEBUG_LEVEL_MAC,
__FILE__,
__LINE__,
"RTS ul_fn_combo incorrect: RTS %u but currently on %u",
......@@ -362,7 +368,6 @@ void LTE_fdd_enb_mac::construct_random_access_response(uint8 preamble,
uint16 timing_adv,
uint32 fn_combo)
{
LTE_fdd_enb_interface *interface = LTE_fdd_enb_interface::get_instance();
LTE_fdd_enb_user_mgr *user_mgr = LTE_fdd_enb_user_mgr::get_instance();
LIBLTE_MAC_RAR_STRUCT rar;
LIBLTE_PHY_ALLOCATION_STRUCT dl_alloc;
......@@ -416,11 +421,13 @@ void LTE_fdd_enb_mac::construct_random_access_response(uint8 preamble,
&rar))
{
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ERROR,
LTE_FDD_ENB_DEBUG_LEVEL_MAC,
__FILE__,
__LINE__,
"Can't schedule RAR");
}else{
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_INFO,
LTE_FDD_ENB_DEBUG_LEVEL_MAC,
__FILE__,
__LINE__,
"RAR scheduled %u",
......@@ -428,6 +435,7 @@ void LTE_fdd_enb_mac::construct_random_access_response(uint8 preamble,
}
}else{
interface->send_debug_msg(LTE_FDD_ENB_DEBUG_TYPE_ERROR,
LTE_FDD_ENB_DEBUG_LEVEL_MAC,
__FILE__,
__LINE__,