Commit 13df10c3 authored by Ben Wojtowicz's avatar Ben Wojtowicz

Version 0.14.0: Split LIBLTE_MSG_STRUCT into bit and byte messages, fixed a...

Version 0.14.0: Split LIBLTE_MSG_STRUCT into bit and byte messages, fixed a bug when adding more than 1 CCE to PDCCH, added MME, RLC, MAC padding LCID, TPC for DCI 0, RRC UL DCCH message processing, and DCI 0 pack support to the LTE library, added PCAP support to LTE_fdd_dl_scan, added HSS, QoS, uplink scheduling, RRC and MME NAS message handling, and RLC AM processing support, omitting the path from __FILE__, and deleteing users on C-RNTI expiration in LTE_fdd_enodeb.
parent 07a28fa4
......@@ -23,7 +23,7 @@
########################################################################
cmake_minimum_required(VERSION 2.6)
project(openLTE CXX C)
set(openLTE_version 0.13.0)
set(openLTE_version 0.14.0)
enable_testing()
#select the release build type by default to get optimization flags
......
......@@ -103,3 +103,10 @@ v00.13.00 Added MAC control element handling, PHICH support, TPC support, an
RRC DL CCCH message support to the LTE library, added PCAP support,
UL and DL CCCH MAC support, communication up to RRC, UL CCCH RRC
support, radio bearer, timer, and timer manager support to the eNodeB.
v00.14.00 Split LIBLTE_MSG_STRUCT into bit and byte messages, fixed a bug when
adding more than 1 CCE to PDCCH, added MME, RLC, MAC padding LCID,
TPC for DCI 0, RRC UL DCCH message processing, and DCI 0 pack support
to the LTE library, added PCAP support to LTE_fdd_dl_scan, added HSS,
QoS, uplink scheduling, RRC and MME NAS message handling, and RLC AM
processing support, omitting the path from __FILE__, and deleteing
users on C-RNTI expiration 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
......@@ -37,6 +37,7 @@
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.
06/15/2014 Ben Wojtowicz Using the latest LTE library.
*******************************************************************************/
......@@ -128,7 +129,7 @@ private:
// LTE parameters
void recreate_sched_info(void);
LIBLTE_MSG_STRUCT rrc_msg;
LIBLTE_BIT_MSG_STRUCT rrc_msg;
LIBLTE_RRC_MIB_STRUCT mib;
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT bcch_dlsch_msg;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_1_STRUCT sib1;
......
/*******************************************************************************
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
......@@ -39,6 +39,7 @@
08/26/2013 Ben Wojtowicz Updates to support GnuRadio 3.7.
09/28/2013 Ben Wojtowicz Added support for setting the sample rate
and input data type.
06/15/2014 Ben Wojtowicz Using the latest LTE library.
*******************************************************************************/
......@@ -117,7 +118,7 @@ private:
// LTE library
LIBLTE_PHY_STRUCT *phy_struct;
LIBLTE_PHY_COARSE_TIMING_STRUCT timing_struct;
LIBLTE_MSG_STRUCT rrc_msg;
LIBLTE_BIT_MSG_STRUCT rrc_msg;
LIBLTE_RRC_MIB_STRUCT mib;
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT bcch_dlsch_msg;
LIBLTE_RRC_PCCH_MSG_STRUCT pcch_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
......@@ -26,6 +26,7 @@
---------- ------------- --------------------------------------------
02/26/2013 Ben Wojtowicz Created file
07/21/2013 Ben Wojtowicz Added support for decoding SIBs.
06/15/2014 Ben Wojtowicz Added PCAP support.
*******************************************************************************/
......@@ -96,11 +97,14 @@ public:
void send_ctrl_channel_found_end_msg(LTE_FDD_DL_SCAN_CHAN_DATA_STRUCT *chan_data);
void send_ctrl_channel_not_found_msg(void);
void send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_ENUM status, std::string msg);
void open_pcap_fd(void);
void send_pcap_msg(uint32 rnti, uint32 current_tti, LIBLTE_BIT_MSG_STRUCT *msg);
static void handle_ctrl_msg(std::string msg);
static void handle_ctrl_connect(void);
static void handle_ctrl_disconnect(void);
static void handle_ctrl_error(LIBTOOLS_SOCKET_WRAP_ERROR_ENUM err);
boost::mutex ctrl_mutex;
FILE *pcap_fd;
libtools_socket_wrap *ctrl_socket;
int16 ctrl_port;
static bool ctrl_connected;
......@@ -131,6 +135,8 @@ private:
void write_dl_earfcn_list(std::string dl_earfcn_list_str);
void read_repeat(void);
void write_repeat(std::string repeat_str);
void read_enable_pcap(void);
void write_enable_pcap(std::string enable_pcap_str);
// Variables
boost::mutex dl_earfcn_list_mutex;
......@@ -140,6 +146,7 @@ private:
uint16 dl_earfcn_list_size;
uint16 dl_earfcn_list_idx;
bool repeat;
bool enable_pcap;
bool shutdown;
};
......
/*******************************************************************************
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
......@@ -27,6 +27,7 @@
02/26/2013 Ben Wojtowicz Created file
07/21/2013 Ben Wojtowicz Added support for multiple sample rates
08/26/2013 Ben Wojtowicz Updates to support GnuRadio 3.7.
06/15/2014 Ben Wojtowicz Using the latest LTE library.
*******************************************************************************/
......@@ -92,7 +93,7 @@ private:
// LTE library
LIBLTE_PHY_STRUCT *phy_struct;
LIBLTE_PHY_COARSE_TIMING_STRUCT timing_struct;
LIBLTE_MSG_STRUCT rrc_msg;
LIBLTE_BIT_MSG_STRUCT rrc_msg;
LIBLTE_RRC_MIB_STRUCT mib;
LIBLTE_RRC_BCCH_DLSCH_MSG_STRUCT bcch_dlsch_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
......@@ -26,6 +26,7 @@
---------- ------------- --------------------------------------------
02/26/2013 Ben Wojtowicz Created file
07/21/2013 Ben Wojtowicz Added support for decoding SIBs.
06/15/2014 Ben Wojtowicz Added PCAP support.
*******************************************************************************/
......@@ -41,6 +42,7 @@
#include <limits.h>
#include <stdarg.h>
#include <boost/lexical_cast.hpp>
#include <arpa/inet.h>
/*******************************************************************************
DEFINES
......@@ -49,6 +51,7 @@
#define BAND_PARAM "band"
#define DL_EARFCN_LIST_PARAM "dl_earfcn_list"
#define REPEAT_PARAM "repeat"
#define ENABLE_PCAP_PARAM "enable_pcap"
/*******************************************************************************
TYPEDEFS
......@@ -111,11 +114,16 @@ LTE_fdd_dl_scan_interface::LTE_fdd_dl_scan_interface()
}
current_dl_earfcn = dl_earfcn_list[dl_earfcn_list_idx];
repeat = true;
enable_pcap = false;
shutdown = false;
open_pcap_fd();
}
LTE_fdd_dl_scan_interface::~LTE_fdd_dl_scan_interface()
{
stop_ctrl_port();
fclose(pcap_fd);
}
// Communication
......@@ -1319,6 +1327,106 @@ void LTE_fdd_dl_scan_interface::send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_ENUM
ctrl_socket->send(tmp_msg);
}
}
void LTE_fdd_dl_scan_interface::open_pcap_fd(void)
{
uint32 magic_number = 0xa1b2c3d4;
uint32 timezone = 0;
uint32 sigfigs = 0;
uint32 snap_len = (LIBLTE_MAX_MSG_SIZE/4);
uint32 dlt = 147;
uint16 major_version = 2;
uint16 minor_version = 4;
pcap_fd = fopen("/tmp/LTE_fdd_dl_scan.pcap", "w");
fwrite(&magic_number, sizeof(magic_number), 1, pcap_fd);
fwrite(&major_version, sizeof(major_version), 1, pcap_fd);
fwrite(&minor_version, sizeof(minor_version), 1, pcap_fd);
fwrite(&timezone, sizeof(timezone), 1, pcap_fd);
fwrite(&sigfigs, sizeof(sigfigs), 1, pcap_fd);
fwrite(&snap_len, sizeof(snap_len), 1, pcap_fd);
fwrite(&dlt, sizeof(dlt), 1, pcap_fd);
}
void LTE_fdd_dl_scan_interface::send_pcap_msg(uint32 rnti,
uint32 current_tti,
LIBLTE_BIT_MSG_STRUCT *msg)
{
struct timeval time;
struct timezone time_zone;
uint32 i;
uint32 idx;
uint32 length;
uint16 tmp;
uint8 pcap_c_hdr[15];
uint8 pcap_msg[LIBLTE_MAX_MSG_SIZE/8];
if(enable_pcap)
{
// Get approximate time stamp
gettimeofday(&time, &time_zone);
// Radio Type
pcap_c_hdr[0] = 1;
// Direction
pcap_c_hdr[1] = 1; // DL only for now
// RNTI Type
if(0xFFFFFFFF == rnti)
{
pcap_c_hdr[2] = 0;
}else{
pcap_c_hdr[2] = 4;
}
// RNTI Tag and RNTI
pcap_c_hdr[3] = 2;
tmp = htons((uint16)rnti);
memcpy(&pcap_c_hdr[4], &tmp, sizeof(uint16));
// UEID Tag and UEID
pcap_c_hdr[6] = 3;
pcap_c_hdr[7] = 0;
pcap_c_hdr[8] = 0;
// SUBFN Tag and SUBFN
pcap_c_hdr[9] = 4;
tmp = htons((uint16)(current_tti%10));
memcpy(&pcap_c_hdr[10], &tmp, sizeof(uint16));
// CRC Status Tag and CRC Status
pcap_c_hdr[12] = 7;
pcap_c_hdr[13] = 1;
// Payload Tag
pcap_c_hdr[14] = 1;
// Payload
idx = 0;
pcap_msg[idx] = 0;
for(i=0; i<msg->N_bits; i++)
{
pcap_msg[idx] <<= 1;
pcap_msg[idx] |= msg->msg[i];
if((i % 8) == 7)
{
idx++;
pcap_msg[idx] = 0;
}
}
// Total Length
length = 15 + idx;
// Write Data
fwrite(&time.tv_sec, sizeof(uint32), 1, pcap_fd);
fwrite(&time.tv_usec, sizeof(uint32), 1, pcap_fd);
fwrite(&length, sizeof(uint32), 1, pcap_fd);
fwrite(&length, sizeof(uint32), 1, pcap_fd);
fwrite(pcap_c_hdr, sizeof(uint8), 15, pcap_fd);
fwrite(pcap_msg, sizeof(uint8), idx, pcap_fd);
}
}
void LTE_fdd_dl_scan_interface::handle_ctrl_msg(std::string msg)
{
LTE_fdd_dl_scan_interface *interface = LTE_fdd_dl_scan_interface::get_instance();
......@@ -1374,6 +1482,8 @@ void LTE_fdd_dl_scan_interface::handle_read(std::string msg)
read_dl_earfcn_list();
}else if(std::string::npos != msg.find(REPEAT_PARAM)){
read_repeat();
}else if(std::string::npos != msg.find(ENABLE_PCAP_PARAM)){
read_enable_pcap();
}else{
send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_FAIL, "Invalid read");
}
......@@ -1387,6 +1497,8 @@ void LTE_fdd_dl_scan_interface::handle_write(std::string msg)
write_dl_earfcn_list(msg.substr(msg.find(DL_EARFCN_LIST_PARAM)+sizeof(DL_EARFCN_LIST_PARAM), std::string::npos).c_str());
}else if(std::string::npos != msg.find(REPEAT_PARAM)){
write_repeat(msg.substr(msg.find(REPEAT_PARAM)+sizeof(REPEAT_PARAM), std::string::npos).c_str());
}else if(std::string::npos != msg.find(ENABLE_PCAP_PARAM)){
write_enable_pcap(msg.substr(msg.find(ENABLE_PCAP_PARAM)+sizeof(ENABLE_PCAP_PARAM), std::string::npos).c_str());
}else{
send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_FAIL, "Invalid write");
}
......@@ -1614,6 +1726,28 @@ void LTE_fdd_dl_scan_interface::write_repeat(std::string repeat_str)
send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_FAIL, "Invalid Repeat");
}
}
void LTE_fdd_dl_scan_interface::read_enable_pcap(void)
{
if(true == enable_pcap)
{
send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_OK, "on");
}else{
send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_OK, "off");
}
}
void LTE_fdd_dl_scan_interface::write_enable_pcap(std::string enable_pcap_str)
{
if(enable_pcap_str == "on")
{
enable_pcap = true;
send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_OK, "");
}else if(enable_pcap_str == "off"){
enable_pcap = false;
send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_OK, "");
}else{
send_ctrl_status_msg(LTE_FDD_DL_SCAN_STATUS_FAIL, "Invalid enable_pcap");
}
}
// Helpers
LTE_FDD_DL_SCAN_STATUS_ENUM LTE_fdd_dl_scan_interface::switch_to_next_freq(void)
......
......@@ -30,6 +30,7 @@
08/26/2013 Ben Wojtowicz Updates to support GnuRadio 3.7 and the
latest LTE library.
03/26/2014 Ben Wojtowicz Using the latest LTE library.
06/15/2014 Ben Wojtowicz Added PCAP support.
*******************************************************************************/
......@@ -384,6 +385,9 @@ int32 LTE_fdd_dl_scan_state_machine::work(int32 ninput_item
sfn = (mib.sfn_div_4 << 2) + sfn_offset;
phich_res = liblte_rrc_phich_resource_num[mib.phich_config.res];
// Send a PCAP message
interface->send_pcap_msg(0xFFFFFFFF, sfn*10 + subframe.num, &rrc_msg);
// Send channel found start and mib decoded messages
chan_data.freq_offset = timing_struct.freq_offset[corr_peak_idx];
interface->send_ctrl_channel_found_begin_msg(&chan_data, &mib, sfn, N_ant);
......@@ -460,6 +464,9 @@ int32 LTE_fdd_dl_scan_state_machine::work(int32 ninput_item
LIBLTE_SUCCESS == liblte_rrc_unpack_bcch_dlsch_msg(&rrc_msg,
&bcch_dlsch_msg))
{
// Send a PCAP message
interface->send_pcap_msg(pdcch.alloc[0].rnti, sfn*10 + subframe.num, &rrc_msg);
if(1 == bcch_dlsch_msg.N_sibs &&
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_1 == bcch_dlsch_msg.sibs[0].sib_type)
{
......@@ -515,6 +522,9 @@ int32 LTE_fdd_dl_scan_state_machine::work(int32 ninput_item
rrc_msg.msg,
&rrc_msg.N_bits))
{
// Send a PCAP message
interface->send_pcap_msg(pdcch.alloc[0].rnti, sfn*10 + subframe.num, &rrc_msg);
if(LIBLTE_MAC_SI_RNTI == pdcch.alloc[0].rnti &&
LIBLTE_SUCCESS == liblte_rrc_unpack_bcch_dlsch_msg(&rrc_msg,
&bcch_dlsch_msg))
......
......@@ -9,6 +9,7 @@ add_executable(LTE_fdd_enodeb
src/LTE_fdd_enb_interface.cc
src/LTE_fdd_enb_cnfg_db.cc
src/LTE_fdd_enb_msgq.cc
src/LTE_fdd_enb_hss.cc
src/LTE_fdd_enb_user.cc
src/LTE_fdd_enb_user_mgr.cc
src/LTE_fdd_enb_rb.cc
......
/*******************************************************************************
Copyright 2013 Ben Wojtowicz
Copyright 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
......@@ -17,27 +17,27 @@
*******************************************************************************
File: LTE_fdd_enb_c_rnti_mgr.h
File: LTE_fdd_enb_hss.h
Description: Contains all the definitions for the LTE FDD eNodeB
C-RNTI manager.
home subscriber server.
Revision History
---------- ------------- --------------------------------------------
11/09/2013 Ben Wojtowicz Created file
06/15/2014 Ben Wojtowicz Created file
*******************************************************************************/
#ifndef __LTE_FDD_ENB_C_RNTI_MGR_H__
#define __LTE_FDD_ENB_C_RNTI_MGR_H__
#ifndef __LTE_FDD_ENB_HSS_H__
#define __LTE_FDD_ENB_HSS_H__
/*******************************************************************************
INCLUDES
*******************************************************************************/
#include "LTE_fdd_enb_interface.h"
#include "LTE_fdd_enb_user.h"
#include "typedefs.h"
#include <boost/thread/mutex.hpp>
#include <list>
/*******************************************************************************
DEFINES
......@@ -58,27 +58,28 @@
CLASS DECLARATIONS
*******************************************************************************/
class LTE_fdd_enb_c_rnti_mgr
class LTE_fdd_enb_hss
{
public:
// Singleton
static LTE_fdd_enb_c_rnti_mgr* get_instance(void);
static LTE_fdd_enb_hss* get_instance(void);
static void cleanup(void);
// External interface
void add_c_rnti(uint16 c_rnti, LTE_fdd_enb_user *user);
void update_c_rnti_user(uint16 c_rnti, LTE_fdd_enb_user *user);
void del_c_rnti(uint16 c_rnti);
LTE_FDD_ENB_ERROR_ENUM add_user(std::string imsi);
LTE_FDD_ENB_ERROR_ENUM find_user(std::string imsi, LTE_fdd_enb_user **user);
LTE_FDD_ENB_ERROR_ENUM del_user(std::string imsi);
std::string print_all_users(void);
private:
// Singleton
static LTE_fdd_enb_c_rnti_mgr *instance;
LTE_fdd_enb_c_rnti_mgr();
~LTE_fdd_enb_c_rnti_mgr();
static LTE_fdd_enb_hss *instance;
LTE_fdd_enb_hss();
~LTE_fdd_enb_hss();
// User map
std::map<uint16, LTE_fdd_enb_user*> c_rnti_map;
boost::mutex c_rnti_mutex;
// Allowed users
boost::mutex user_mutex;
std::list<LTE_fdd_enb_user *> user_list;
};
#endif /* __LTE_FDD_ENB_C_RNTI_MGR_H__ */
#endif /* __LTE_FDD_ENB_HSS_H__ */
......@@ -30,6 +30,8 @@
04/12/2014 Ben Wojtowicz Pulled in a patch from Max Suraev for more
descriptive start failures.
05/04/2014 Ben Wojtowicz Added PCAP support and more error types.
06/15/2014 Ben Wojtowicz Added new error causes, ... support for info
messages, and using the latest LTE library.
*******************************************************************************/
......@@ -82,6 +84,7 @@ typedef enum{
LTE_FDD_ENB_ERROR_RB_NOT_SETUP,
LTE_FDD_ENB_ERROR_RB_ALREADY_SETUP,
LTE_FDD_ENB_ERROR_TIMER_NOT_FOUND,
LTE_FDD_ENB_ERROR_CANT_REASSEMBLE_SDU,
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",
......@@ -100,10 +103,11 @@ static const char LTE_fdd_enb_error_text[LTE_FDD_ENB_ERROR_N_ITEMS][100] = {"non
"cant schedule",
"variable not dynamic",
"unable to set master clock rate",
"no message in queue",
"RB not setup",
"RB already setup",
"no message in queue",
"timer not found"};
"timer not found",
"cant reassemble SDU"};
typedef enum{
LTE_FDD_ENB_DEBUG_TYPE_ERROR = 0,
......@@ -275,12 +279,13 @@ public:
void start_ports(void);
void stop_ports(void);
void send_ctrl_msg(std::string msg);
void send_ctrl_info_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, 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, ...);
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_BIT_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, LIBLTE_BYTE_MSG_STRUCT *lte_msg, std::string msg, ...);
void open_pcap_fd(void);
void send_pcap_msg(LTE_FDD_ENB_PCAP_DIRECTION_ENUM dir, uint32 rnti, uint32 fn_combo, LIBLTE_MSG_STRUCT *msg);
void send_pcap_msg(LTE_FDD_ENB_PCAP_DIRECTION_ENUM dir, uint32 rnti, uint32 current_tti, uint8 *msg, uint32 N_bits);
static void handle_ctrl_msg(std::string msg);
static void handle_ctrl_connect(void);
static void handle_ctrl_disconnect(void);
......
......@@ -27,6 +27,8 @@
11/09/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Cached a copy of the interface class.
05/04/2014 Ben Wojtowicz Added ULSCH handling.
06/15/2014 Ben Wojtowicz Added uplink scheduling and changed fn_combo
to current_tti.
*******************************************************************************/
......@@ -64,17 +66,18 @@ typedef struct{
LIBLTE_PHY_ALLOCATION_STRUCT dl_alloc;
LIBLTE_PHY_ALLOCATION_STRUCT ul_alloc;
LIBLTE_MAC_RAR_STRUCT rar;
uint32 fn_combo;
uint32 current_tti;
}LTE_FDD_ENB_RAR_SCHED_QUEUE_STRUCT;
typedef struct{
LIBLTE_PHY_ALLOCATION_STRUCT alloc;
uint32 fn_combo;
LIBLTE_MAC_PDU_STRUCT mac_pdu;
uint32 current_tti;
}LTE_FDD_ENB_DL_SCHED_QUEUE_STRUCT;
typedef struct{
LIBLTE_PHY_ALLOCATION_STRUCT alloc;
uint32 fn_combo;
uint32 current_tti;
}LTE_FDD_ENB_UL_SCHED_QUEUE_STRUCT;
/*******************************************************************************
......@@ -94,6 +97,7 @@ public:
// External interface
void update_sys_info(void);
void sched_ul(LTE_fdd_enb_user *user, uint32 requested_tbs);
private:
// Singleton
......@@ -124,31 +128,31 @@ private:
void handle_sdu_ready(LTE_FDD_ENB_MAC_SDU_READY_MSG_STRUCT *sdu_ready);
// MAC PDU Handlers
void handle_ulsch_ccch_sdu(LTE_fdd_enb_user *user, uint32 lcid, LIBLTE_MSG_STRUCT *sdu);
void handle_ulsch_dcch_sdu(LTE_fdd_enb_user *user, uint32 lcid, LIBLTE_MSG_STRUCT *sdu);
void handle_ulsch_ccch_sdu(LTE_fdd_enb_user *user, uint32 lcid, LIBLTE_BIT_MSG_STRUCT *sdu);
void handle_ulsch_dcch_sdu(LTE_fdd_enb_user *user, uint32 lcid, LIBLTE_BIT_MSG_STRUCT *sdu);
void handle_ulsch_ext_power_headroom_report(LTE_fdd_enb_user *user, LIBLTE_MAC_EXT_POWER_HEADROOM_CE_STRUCT *ext_power_headroom);
void handle_ulsch_power_headroom_report(LTE_fdd_enb_user *user, LIBLTE_MAC_POWER_HEADROOM_CE_STRUCT *power_headroom);
void handle_ulsch_c_rnti(LTE_fdd_enb_user *user, LIBLTE_MAC_C_RNTI_CE_STRUCT *c_rnti);
void handle_ulsch_c_rnti(LTE_fdd_enb_user **user, LIBLTE_MAC_C_RNTI_CE_STRUCT *c_rnti);
void handle_ulsch_truncated_bsr(LTE_fdd_enb_user *user, LIBLTE_MAC_TRUNCATED_BSR_CE_STRUCT *truncated_bsr);
void handle_ulsch_short_bsr(LTE_fdd_enb_user *user, LIBLTE_MAC_SHORT_BSR_CE_STRUCT *short_bsr);
void handle_ulsch_long_bsr(LTE_fdd_enb_user *user, LIBLTE_MAC_LONG_BSR_CE_STRUCT *long_bsr);
// Data Constructors
void construct_random_access_response(uint8 preamble, uint16 timing_adv, uint32 fn_combo);
void construct_random_access_response(uint8 preamble, uint16 timing_adv, uint32 current_tti);
// Scheduler
void scheduler(void);
LTE_FDD_ENB_ERROR_ENUM add_to_rar_sched_queue(uint32 fn_combo, LIBLTE_PHY_ALLOCATION_STRUCT *dl_alloc, LIBLTE_PHY_ALLOCATION_STRUCT *ul_alloc, LIBLTE_MAC_RAR_STRUCT *rar);
LTE_FDD_ENB_ERROR_ENUM add_to_dl_sched_queue(uint32 fn_combo, LIBLTE_PHY_ALLOCATION_STRUCT *alloc);
LTE_FDD_ENB_ERROR_ENUM add_to_ul_sched_queue(uint32 fn_combo, LIBLTE_PHY_ALLOCATION_STRUCT *alloc);
LTE_FDD_ENB_ERROR_ENUM add_to_rar_sched_queue(uint32 current_tti, LIBLTE_PHY_ALLOCATION_STRUCT *dl_alloc, LIBLTE_PHY_ALLOCATION_STRUCT *ul_alloc, LIBLTE_MAC_RAR_STRUCT *rar);
LTE_FDD_ENB_ERROR_ENUM add_to_dl_sched_queue(uint32 current_tti, LIBLTE_MAC_PDU_STRUCT *mac_pdu, LIBLTE_PHY_ALLOCATION_STRUCT *alloc);
LTE_FDD_ENB_ERROR_ENUM add_to_ul_sched_queue(uint32 current_tti, LIBLTE_PHY_ALLOCATION_STRUCT *alloc);
boost::mutex rar_sched_queue_mutex;
boost::mutex dl_sched_queue_mutex;
boost::mutex ul_sched_queue_mutex;
std::list<LTE_FDD_ENB_RAR_SCHED_QUEUE_STRUCT*> rar_sched_queue;
std::list<LTE_FDD_ENB_DL_SCHED_QUEUE_STRUCT*> dl_sched_queue;
std::list<LTE_FDD_ENB_UL_SCHED_QUEUE_STRUCT*> ul_sched_queue;
LTE_FDD_ENB_PDSCH_SCHEDULE_MSG_STRUCT sched_dl_subfr[10];
LTE_FDD_ENB_PUSCH_SCHEDULE_MSG_STRUCT sched_ul_subfr[10];
LTE_FDD_ENB_DL_SCHEDULE_MSG_STRUCT sched_dl_subfr[10];
LTE_FDD_ENB_UL_SCHEDULE_MSG_STRUCT sched_ul_subfr[10];
uint8 sched_cur_dl_subfn;
uint8 sched_cur_ul_subfn;
......@@ -157,7 +161,7 @@ private:
LTE_FDD_ENB_SYS_INFO_STRUCT sys_info;
// Helpers
uint32 get_n_reserved_prbs(uint32 fn_combo);
uint32 get_n_reserved_prbs(uint32 current_tti);
};
#endif /* __LTE_FDD_ENB_MAC_H__ */
......@@ -26,6 +26,7 @@
---------- ------------- --------------------------------------------
11/09/2013 Ben Wojtowicz Created file
01/18/2014 Ben Wojtowicz Added an explicit include for boost mutexes.
06/15/2014 Ben Wojtowicz Added RRC NAS message handler.
*******************************************************************************/
......@@ -89,6 +90,9 @@ private:
LTE_fdd_enb_msgq *rrc_comm_msgq;
boost::interprocess::message_queue *mme_rrc_mq;
// RRC Message Handlers
void handle_nas_msg(LTE_FDD_ENB_MME_NAS_MSG_READY_MSG_STRUCT *nas_msg);
// Parameters
boost::mutex sys_info_mutex;
LTE_FDD_ENB_SYS_INFO_STRUCT sys_info;
......
......@@ -29,6 +29,7 @@
03/26/2014 Ben Wojtowicz Added RNTI to PUSCH decode message.
05/04/2014 Ben Wojtowicz Added messages for MAC, RLC, PDCP, and RRC
communication.
06/15/2014 Ben Wojtowicz Added MME<->RRC messages.
*******************************************************************************/
......@@ -65,8 +66,8 @@ typedef enum{
LTE_FDD_ENB_MESSAGE_TYPE_KILL = 0,
// MAC -> PHY Messages
LTE_FDD_ENB_MESSAGE_TYPE_PDSCH_SCHEDULE,
LTE_FDD_ENB_MESSAGE_TYPE_PUSCH_SCHEDULE,
LTE_FDD_ENB_MESSAGE_TYPE_DL_SCHEDULE,
LTE_FDD_ENB_MESSAGE_TYPE_UL_SCHEDULE,
// PHY -> MAC Messages
LTE_FDD_ENB_MESSAGE_TYPE_READY_TO_SEND,
......@@ -92,11 +93,17 @@ typedef enum{
// PDCP -> RRC Messages
LTE_FDD_ENB_MESSAGE_TYPE_RRC_PDU_READY,
// MME -> RRC Messages
LTE_FDD_ENB_MESSAGE_TYPE_RRC_NAS_MSG_READY,
// RRC -> MME Messages
LTE_FDD_ENB_MESSAGE_TYPE_MME_NAS_MSG_READY,
LTE_FDD_ENB_MESSAGE_TYPE_N_ITEMS,
}LTE_FDD_ENB_MESSAGE_TYPE_ENUM;
static const char LTE_fdd_enb_message_type_text[LTE_FDD_ENB_MESSAGE_TYPE_N_ITEMS][100] = {"Kill",
"PDSCH schedule",
"PUSCH schedule",
"DL schedule",
"UL schedule",
"Ready to send",
"PRACH decode",
"PUCCH decode",
......@@ -106,7 +113,9 @@ static const char LTE_fdd_enb_message_type_text[LTE_FDD_ENB_MESSAGE_TYPE_N_ITEMS
"RLC sdu ready",
"PDCP pdu ready",
"PDCP sdu ready",
"RRC pdu ready"};
"RRC pdu ready",
"RRC NAS message ready",
"MME NAS message ready"};
typedef enum{
LTE_FDD_ENB_DEST_LAYER_PHY = 0,
......@@ -130,38 +139,38 @@ static const char LTE_fdd_enb_dest_layer_text[LTE_FDD_ENB_DEST_LAYER_N_ITEMS][10
// MAC -> PHY Messages
typedef struct{
LIBLTE_PHY_PDCCH_STRUCT pdcch;
LIBLTE_PHY_PDCCH_STRUCT dl_allocations;
LIBLTE_PHY_PDCCH_STRUCT ul_allocations;
uint32 N_avail_prbs;
uint32 N_sched_prbs;
uint32 fn_combo;
}LTE_FDD_ENB_PDSCH_SCHEDULE_MSG_STRUCT;
uint32 current_tti;
}LTE_FDD_ENB_DL_SCHEDULE_MSG_STRUCT;
typedef struct{
LIBLTE_PHY_PDCCH_STRUCT allocations;
LIBLTE_PHY_PDCCH_STRUCT decodes;
uint32 N_avail_prbs;
uint32 N_sched_prbs;
uint32 fn_combo;
uint32 current_tti;
uint8 next_prb;
}LTE_FDD_ENB_PUSCH_SCHEDULE_MSG_STRUCT;
}LTE_FDD_ENB_UL_SCHEDULE_MSG_STRUCT;
// PHY -> MAC Messages
typedef struct{
uint32 dl_fn_combo;
uint32 ul_fn_combo;
uint32 dl_current_tti;
uint32 ul_current_tti;
}LTE_FDD_ENB_READY_TO_SEND_MSG_STRUCT;
typedef struct{
uint32 fn_combo;
uint32 current_tti;
uint32 timing_adv[64];
uint32 preamble[64];
uint32 num_preambles;