changed srsue namespace to srslte for all common objects

master
Ismael Gomez 8 years ago
parent e75daee148
commit 8a367bf825

File diff suppressed because it is too large Load Diff

@ -1,234 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsUE library.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: interfaces.h
* Description: Abstract base class interfaces provided by layers
* to other layers.
*****************************************************************************/
#ifndef INTERFACES_H
#define INTERFACES_H
#include "srslte/asn1/liblte_rrc.h"
#include "srslte/common/interfaces_common.h"
#include "srslte/common/common.h"
#include "srslte/common/security.h"
#include "mac_interface.h"
#include "phy_interface.h"
namespace srsue {
// UE interface
class ue_interface
{
};
// USIM interface for NAS
class usim_interface_nas
{
public:
virtual void get_imsi_vec(uint8_t* imsi_, uint32_t n) = 0;
virtual void get_imei_vec(uint8_t* imei_, uint32_t n) = 0;
virtual void generate_authentication_response(uint8_t *rand,
uint8_t *autn_enb,
uint16_t mcc,
uint16_t mnc,
bool *net_valid,
uint8_t *res) = 0;
virtual void generate_nas_keys(uint8_t *k_nas_enc,
uint8_t *k_nas_int,
CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
};
// USIM interface for RRC
class usim_interface_rrc
{
public:
virtual void generate_as_keys(uint32_t count_ul,
uint8_t *k_rrc_enc,
uint8_t *k_rrc_int,
uint8_t *k_up_enc,
uint8_t *k_up_int,
CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
};
// GW interface for NAS
class gw_interface_nas
{
public:
virtual srslte::error_t setup_if_addr(uint32_t ip_addr, char *err_str) = 0;
};
// GW interface for PDCP
class gw_interface_pdcp
{
public:
virtual void write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu) = 0;
};
// NAS interface for RRC
class nas_interface_rrc
{
public:
virtual bool is_attached() = 0;
virtual void notify_connection_setup() = 0;
virtual void write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu) = 0;
virtual uint32_t get_ul_count() = 0;
virtual bool get_s_tmsi(LIBLTE_RRC_S_TMSI_STRUCT *s_tmsi) = 0;
};
// RRC interface for MAC
class rrc_interface_mac
{
public:
virtual void release_pucch_srs() = 0;
virtual void ra_problem() = 0;
};
// RRC interface for PHY
class rrc_interface_phy
{
public:
virtual void in_sync() = 0;
virtual void out_of_sync() = 0;
};
// RRC interface for NAS
class rrc_interface_nas
{
public:
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual uint16_t get_mcc() = 0;
virtual uint16_t get_mnc() = 0;
virtual void enable_capabilities() = 0;
};
// RRC interface for GW
class rrc_interface_gw
{
public:
virtual bool rrc_connected() = 0;
virtual void rrc_connect() = 0;
virtual bool have_drb() = 0;
};
// RRC interface for PDCP
class rrc_interface_pdcp
{
public:
virtual void write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu) = 0;
virtual void write_pdu_bcch_bch(srslte::byte_buffer_t *pdu) = 0;
virtual void write_pdu_bcch_dlsch(srslte::byte_buffer_t *pdu) = 0;
virtual void write_pdu_pcch(srslte::byte_buffer_t *pdu) = 0;
};
// RRC interface for RLC
class rrc_interface_rlc
{
public:
virtual void max_retx_attempted() = 0;
};
// PDCP interface for GW
class pdcp_interface_gw
{
public:
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
};
// PDCP interface for RRC
class pdcp_interface_rrc
{
public:
virtual void reset() = 0;
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual void add_bearer(uint32_t lcid, LIBLTE_RRC_PDCP_CONFIG_STRUCT *cnfg=NULL) = 0;
virtual void config_security(uint32_t lcid,
uint8_t *k_rrc_enc_,
uint8_t *k_rrc_int_,
CIPHERING_ALGORITHM_ID_ENUM cipher_algo_,
INTEGRITY_ALGORITHM_ID_ENUM integ_algo_) = 0;
};
// PDCP interface for RLC
class pdcp_interface_rlc
{
public:
/* RLC calls PDCP to push a PDCP PDU. */
virtual void write_pdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual void write_pdu_bcch_bch(srslte::byte_buffer_t *sdu) = 0;
virtual void write_pdu_bcch_dlsch(srslte::byte_buffer_t *sdu) = 0;
virtual void write_pdu_pcch(srslte::byte_buffer_t *sdu) = 0;
};
// RLC interface for RRC
class rlc_interface_rrc
{
public:
virtual void reset() = 0;
virtual void add_bearer(uint32_t lcid) = 0;
virtual void add_bearer(uint32_t lcid, LIBLTE_RRC_RLC_CONFIG_STRUCT *cnfg) = 0;
};
// RLC interface for PDCP
class rlc_interface_pdcp
{
public:
/* PDCP calls RLC to push an RLC SDU. SDU gets placed into the RLC buffer and MAC pulls
* RLC PDUs according to TB size. */
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
};
//RLC interface for MAC
class rlc_interface_mac : public srslte::read_pdu_interface
{
public:
/* MAC calls RLC to get buffer state for a logical channel.
* This function should return quickly. */
virtual uint32_t get_buffer_state(uint32_t lcid) = 0;
virtual uint32_t get_total_buffer_state(uint32_t lcid) = 0;
const static int MAX_PDU_SEGMENTS = 20;
/* MAC calls RLC to get RLC segment of nof_bytes length.
* Segmentation happens in this function. RLC PDU is stored in payload. */
virtual int read_pdu(uint32_t lcid, uint8_t *payload, uint32_t nof_bytes) = 0;
/* MAC calls RLC to push an RLC PDU. This function is called from an independent MAC thread.
* PDU gets placed into the buffer and higher layer thread gets notified. */
virtual void write_pdu(uint32_t lcid, uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_bcch_bch(uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_bcch_dlsch(uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_pcch(uint8_t *payload, uint32_t nof_bytes) = 0;
};
} // namespace srsue
#endif // INTERFACES_H

@ -1,177 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsUE library.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: mac_interface.h
* Description: LTE MAC layer interface
* Reference:
*****************************************************************************/
#ifndef MAC_INTERFACE_H
#define MAC_INTERFACE_H
#include <stdint.h>
#include <string>
#include "srslte/srslte.h"
#include "srslte/common/interfaces_common.h"
#include "srslte/common/timers.h"
#include "srslte/asn1/liblte_rrc.h"
namespace srsue {
/* Interface PHY -> MAC */
class mac_interface_phy
{
public:
typedef struct {
uint32_t pid;
uint32_t tti;
uint32_t last_tti;
bool ndi;
bool last_ndi;
uint32_t n_bytes;
int rv;
uint16_t rnti;
bool is_from_rar;
bool is_sps_release;
bool has_cqi_request;
srslte_rnti_type_t rnti_type;
srslte_phy_grant_t phy_grant;
} mac_grant_t;
typedef struct {
bool decode_enabled;
int rv;
uint16_t rnti;
bool generate_ack;
bool default_ack;
// If non-null, called after tb_decoded_ok to determine if ack needs to be sent
bool (*generate_ack_callback)(void*);
void *generate_ack_callback_arg;
uint8_t *payload_ptr;
srslte_softbuffer_rx_t *softbuffer;
srslte_phy_grant_t phy_grant;
} tb_action_dl_t;
typedef struct {
bool tx_enabled;
bool expect_ack;
uint32_t rv;
uint16_t rnti;
uint32_t current_tx_nb;
srslte_softbuffer_tx_t *softbuffer;
srslte_phy_grant_t phy_grant;
uint8_t *payload_ptr;
} tb_action_ul_t;
/* Indicate reception of UL grant.
* payload_ptr points to memory where MAC PDU must be written by MAC layer */
virtual void new_grant_ul(mac_grant_t grant, tb_action_ul_t *action) = 0;
/* Indicate reception of UL grant + HARQ information throught PHICH in the same TTI. */
virtual void new_grant_ul_ack(mac_grant_t grant, bool ack, tb_action_ul_t *action) = 0;
/* Indicate reception of HARQ information only through PHICH. */
virtual void harq_recv(uint32_t tti, bool ack, tb_action_ul_t *action) = 0;
/* Indicate reception of DL grant. */
virtual void new_grant_dl(mac_grant_t grant, tb_action_dl_t *action) = 0;
/* Indicate successfull decoding of PDSCH TB. */
virtual void tb_decoded(bool ack, srslte_rnti_type_t rnti_type, uint32_t harq_pid) = 0;
/* Indicate successfull decoding of BCH TB through PBCH */
virtual void bch_decoded_ok(uint8_t *payload, uint32_t len) = 0;
/* Indicate successfull decoding of PCH TB through PDSCH */
virtual void pch_decoded_ok(uint32_t len) = 0;
/* Function called every start of a subframe (TTI). Warning, this function is called
* from a high priority thread and should terminate asap
*/
virtual void tti_clock(uint32_t tti) = 0;
};
/* Interface RRC -> MAC */
class mac_interface_rrc
{
public:
typedef struct {
LIBLTE_RRC_MAC_MAIN_CONFIG_STRUCT main;
LIBLTE_RRC_RACH_CONFIG_COMMON_STRUCT rach;
LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT sr;
uint32_t prach_config_index;
} mac_cfg_t;
// Class to handle UE specific RNTIs between RRC and MAC
typedef struct {
uint16_t crnti;
uint16_t temp_rnti;
uint16_t tpc_rnti;
uint16_t sps_rnti;
uint64_t contention_id;
} ue_rnti_t;
/* Instructs the MAC to start receiving BCCH */
virtual void bcch_start_rx() = 0;
virtual void bcch_stop_rx() = 0;
virtual void bcch_start_rx(int si_window_start, int si_window_length) = 0;
/* Instructs the MAC to start receiving PCCH */
virtual void pcch_start_rx() = 0;
virtual void pcch_stop_rx() = 0;
/* RRC configures a logical channel */
virtual void setup_lcid(uint32_t lcid, uint32_t lcg, uint32_t priority, int PBR_x_tti, uint32_t BSD) = 0;
virtual uint32_t get_current_tti() = 0;
virtual void set_config(mac_cfg_t *mac_cfg) = 0;
virtual void set_config_main(LIBLTE_RRC_MAC_MAIN_CONFIG_STRUCT *main_cfg) = 0;
virtual void set_config_rach(LIBLTE_RRC_RACH_CONFIG_COMMON_STRUCT *rach_cfg, uint32_t prach_config_index) = 0;
virtual void set_config_sr(LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT *sr_cfg) = 0;
virtual void get_config(mac_cfg_t *mac_cfg) = 0;
virtual void get_rntis(ue_rnti_t *rntis) = 0;
virtual void set_contention_id(uint64_t uecri) = 0;
virtual void reconfiguration() = 0;
virtual void reset() = 0;
};
}
#endif

@ -44,7 +44,7 @@ public:
class process_callback
{
public:
virtual void process_pdu(uint8_t *buff, uint32_t len) = 0;
virtual void process_pdu(uint8_t *buff, uint32_t len, uint32_t tstamp) = 0;
};
pdu_queue(uint32_t pool_size = DEFAULT_POOL_SIZE) : pool(pool_size), callback(NULL), log_h(NULL) {}
@ -52,7 +52,7 @@ public:
uint8_t* request(uint32_t len);
void deallocate(uint8_t* pdu);
void push(uint8_t *ptr, uint32_t len);
void push(uint8_t *ptr, uint32_t len, uint32_t tstamp = 0);
bool process_pdus();
@ -63,6 +63,7 @@ private:
typedef struct {
uint8_t ptr[MAX_PDU_LEN];
uint32_t len;
uint32_t tstamp;
} pdu_t;
block_queue<pdu_t*> pdu_q;

@ -1,156 +0,0 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsUE library.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: phy_interface.h
* Description: PHY layer interfaces provided to other layers
* Reference:
*****************************************************************************/
#ifndef PHY_INTERFACE_H
#define PHY_INTERFACE_H
#include <stdint.h>
#include <string>
#include "srslte/srslte.h"
#include "srslte/asn1/liblte_rrc.h"
namespace srsue {
typedef struct {
bool ul_pwr_ctrl_en;
float prach_gain;
int pdsch_max_its;
bool attach_enable_64qam;
int nof_phy_threads;
int worker_cpu_mask;
int sync_cpu_affinity;
uint32_t nof_rx_ant;
std::string equalizer_mode;
int cqi_max;
int cqi_fixed;
float snr_ema_coeff;
std::string snr_estim_alg;
bool cfo_integer_enabled;
float cfo_correct_tol_hz;
int time_correct_period;
bool sfo_correct_disable;
std::string sss_algorithm;
float estimator_fil_w;
bool rssi_sensor_enabled;
} phy_args_t;
/* Interface MAC -> PHY */
class phy_interface_mac
{
public:
/* Configure PRACH using parameters written by RRC */
virtual void configure_prach_params() = 0;
/* Start synchronization with strongest cell in the current carrier frequency */
virtual void sync_start() = 0;
virtual void sync_stop() = 0;
/* Sets a C-RNTI allowing the PHY to pregenerate signals if necessary */
virtual void set_crnti(uint16_t rnti) = 0;
virtual void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm) = 0;
virtual int prach_tx_tti() = 0;
/* Indicates the transmission of a SR signal in the next opportunity */
virtual void sr_send() = 0;
virtual int sr_last_tx_tti() = 0;
/* Time advance commands */
virtual void set_timeadv_rar(uint32_t ta_cmd) = 0;
virtual void set_timeadv(uint32_t ta_cmd) = 0;
/* Sets RAR grant payload */
virtual void set_rar_grant(uint32_t tti, uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN]) = 0;
/* Instruct the PHY to decode PDCCH with the CRC scrambled with given RNTI */
virtual void pdcch_ul_search(srslte_rnti_type_t rnti_type, uint16_t rnti, int tti_start = -1, int tti_end = -1) = 0;
virtual void pdcch_dl_search(srslte_rnti_type_t rnti_type, uint16_t rnti, int tti_start = -1, int tti_end = -1) = 0;
virtual void pdcch_ul_search_reset() = 0;
virtual void pdcch_dl_search_reset() = 0;
virtual uint32_t get_current_tti() = 0;
virtual float get_phr() = 0;
virtual float get_pathloss_db() = 0;
};
class phy_interface_rrc
{
public:
typedef struct {
LIBLTE_RRC_PRACH_CONFIG_SIB_STRUCT prach_cnfg;
LIBLTE_RRC_PDSCH_CONFIG_COMMON_STRUCT pdsch_cnfg;
LIBLTE_RRC_PUSCH_CONFIG_COMMON_STRUCT pusch_cnfg;
LIBLTE_RRC_PHICH_CONFIG_STRUCT phich_cnfg;
LIBLTE_RRC_PUCCH_CONFIG_COMMON_STRUCT pucch_cnfg;
LIBLTE_RRC_SRS_UL_CONFIG_COMMON_STRUCT srs_ul_cnfg;
LIBLTE_RRC_UL_POWER_CONTROL_COMMON_STRUCT ul_pwr_ctrl;
LIBLTE_RRC_TDD_CONFIG_STRUCT tdd_cnfg;
LIBLTE_RRC_ANTENNA_PORTS_COUNT_ENUM ant_info;
} phy_cfg_common_t;
typedef struct {
LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT dedicated;
phy_cfg_common_t common;
bool enable_64qam;
} phy_cfg_t;
virtual void get_current_cell(srslte_cell_t *cell) = 0;
virtual void get_config(phy_cfg_t *phy_cfg) = 0;
virtual void set_config(phy_cfg_t *phy_cfg) = 0;
virtual void set_config_dedicated(LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT *dedicated) = 0;
virtual void set_config_common(phy_cfg_common_t *common) = 0;
virtual void set_config_tdd(LIBLTE_RRC_TDD_CONFIG_STRUCT *tdd) = 0;
virtual void set_config_64qam_en(bool enable) = 0;
/* Is the PHY downlink synchronized? */
virtual bool status_is_sync() = 0;
/* Configure UL using parameters written with set_param() */
virtual void configure_ul_params(bool pregen_disabled = false) = 0;
virtual void reset() = 0;
virtual void resync_sfn() = 0;
};
}
#endif

@ -38,7 +38,7 @@
#define SECURITY_DIRECTION_UPLINK 0
#define SECURITY_DIRECTION_DOWNLINK 1
namespace srsue{
namespace srslte {
typedef enum{
CIPHERING_ALGORITHM_ID_EEA0 = 0,

@ -0,0 +1,244 @@
#include "srslte/srslte.h"
#include "srslte/common/common.h"
#include "srslte/common/security.h"
#include "srslte/interfaces/sched_interface.h"
#include "srslte/asn1/liblte_rrc.h"
#include "srslte/asn1/liblte_s1ap.h"
#include <vector>
#ifndef ENBINTERFACES_H
#define ENBINTERFACES_H
namespace srsenb {
/* Interface PHY -> MAC */
class mac_interface_phy
{
public:
const static int MAX_GRANTS = 64;
typedef struct {
srslte_enb_dl_pdsch_t sched_grants[MAX_GRANTS];
uint32_t nof_grants;
uint32_t cfi;
} dl_sched_t;
typedef struct {
srslte_enb_ul_pusch_t sched_grants[MAX_GRANTS];
srslte_enb_dl_phich_t phich[MAX_GRANTS];
uint32_t nof_grants;
uint32_t nof_phich;
} ul_sched_t;
virtual int sr_detected(uint32_t tti, uint16_t rnti) = 0;
virtual int rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv) = 0;
virtual int cqi_info(uint32_t tti, uint16_t rnti, uint32_t cqi_value) = 0;
virtual int snr_info(uint32_t tti, uint16_t rnti, float snr_db) = 0;
virtual int ack_info(uint32_t tti, uint16_t rnti, bool ack) = 0;
virtual int crc_info(uint32_t tti, uint16_t rnti, uint32_t nof_bytes, bool crc_res) = 0;
virtual int get_dl_sched(uint32_t tti, dl_sched_t *dl_sched_res) = 0;
virtual int get_ul_sched(uint32_t tti, ul_sched_t *ul_sched_res) = 0;
// Radio-Link status
virtual void rl_failure(uint16_t rnti) = 0;
virtual void rl_ok(uint16_t rnti) = 0;
virtual void tti_clock() = 0;
};
/* Interface MAC -> PHY */
class phy_interface_mac
{
public:
/* MAC adds/removes an RNTI to the list of active RNTIs */
virtual int add_rnti(uint16_t rnti) = 0;
virtual void rem_rnti(uint16_t rnti) = 0;
};
/* Interface RRC -> PHY */
class phy_interface_rrc
{
public:
virtual void set_config_dedicated(uint16_t rnti, LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT* dedicated) = 0;
};
class mac_interface_rrc
{
public:
/* Provides cell configuration including SIB periodicity, etc. */
virtual int cell_cfg(sched_interface::cell_cfg_t *cell_cfg) = 0;
virtual void reset() = 0;
/* Manages UE configuration context */
virtual int ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t *cfg) = 0;
virtual int ue_rem(uint16_t rnti) = 0;
/* Manages UE bearers and associated configuration */
virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t *cfg) = 0;
virtual int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) = 0;
virtual void phy_config_enabled(uint16_t rnti, bool enabled) = 0;
};
class mac_interface_rlc
{
public:
virtual int rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue) = 0;
};
//RLC interface for MAC
class rlc_interface_mac
{
public:
/* MAC calls RLC to get RLC segment of nof_bytes length.
* Segmentation happens in this function. RLC PDU is stored in payload. */
virtual int read_pdu(uint16_t rnti, uint32_t lcid, uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void read_pdu_bcch_dlsch(uint32_t sib_index, uint8_t *payload) = 0;
virtual void read_pdu_pcch(uint8_t* payload, uint32_t buffer_size) = 0;
/* MAC calls RLC to push an RLC PDU. This function is called from an independent MAC thread.
* PDU gets placed into the buffer and higher layer thread gets notified. */
virtual void write_pdu(uint16_t rnti, uint32_t lcid, uint8_t *payload, uint32_t nof_bytes) = 0;
};
// RLC interface for PDCP
class rlc_interface_pdcp
{
public:
/* PDCP calls RLC to push an RLC SDU. SDU gets placed into the RLC buffer and MAC pulls
* RLC PDUs according to TB size. */
virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
};
// RLC interface for RRC
class rlc_interface_rrc
{
public:
virtual void reset(uint16_t rnti) = 0;
virtual void clear_buffer(uint16_t rnti) = 0;
virtual void add_user(uint16_t rnti) = 0;
virtual void rem_user(uint16_t rnti) = 0;
virtual void add_bearer(uint16_t rnti, uint32_t lcid) = 0;
virtual void add_bearer(uint16_t rnti, uint32_t lcid, LIBLTE_RRC_RLC_CONFIG_STRUCT *cnfg) = 0;
};
// PDCP interface for GTPU
class pdcp_interface_gtpu
{
public:
virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
};
// PDCP interface for RRC
class pdcp_interface_rrc
{
public:
virtual void reset(uint16_t rnti) = 0;
virtual void add_user(uint16_t rnti) = 0;
virtual void rem_user(uint16_t rnti) = 0;
virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual void add_bearer(uint16_t rnti, uint32_t lcid, LIBLTE_RRC_PDCP_CONFIG_STRUCT *cnfg=NULL) = 0;
virtual void config_security(uint16_t rnti,
uint32_t lcid,
uint8_t *k_rrc_enc_,
uint8_t *k_rrc_int_,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo_,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo_) = 0;
};
// PDCP interface for RLC
class pdcp_interface_rlc
{
public:
/* RLC calls PDCP to push a PDCP PDU. */
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
};
// RRC interface for RLC
class rrc_interface_rlc
{
public:
virtual void read_pdu_bcch_dlsch(uint32_t sib_index, uint8_t *payload) = 0;
virtual void read_pdu_pcch(uint8_t *payload, uint32_t payload_size) = 0;
virtual void max_retx_attempted(uint16_t rnti) = 0;
};
// RRC interface for MAC
class rrc_interface_mac
{
public:
/* Radio Link failure */
virtual void rl_failure(uint16_t rnti) = 0;
virtual void add_user(uint16_t rnti) = 0;
virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0;
virtual void set_activity_user(uint16_t rnti) = 0;
virtual bool is_paging_opportunity(uint32_t tti, uint32_t *payload_len) = 0;
};
// RRC interface for PDCP
class rrc_interface_pdcp
{
public:
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::byte_buffer_t *pdu) = 0;
};
// RRC interface for S1AP
class rrc_interface_s1ap
{
public:
virtual void write_dl_info(uint16_t rnti, srslte::byte_buffer_t *sdu) = 0;
virtual void release_complete(uint16_t rnti) = 0;
virtual bool setup_ue_ctxt(uint16_t rnti, LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPREQUEST_STRUCT *msg) = 0;
virtual bool setup_ue_erabs(uint16_t rnti, LIBLTE_S1AP_MESSAGE_E_RABSETUPREQUEST_STRUCT *msg) = 0;
virtual bool release_erabs(uint32_t rnti) = 0;
virtual void add_paging_id(uint32_t ueid, LIBLTE_S1AP_UEPAGINGID_STRUCT UEPagingID) = 0;
};
// GTPU interface for PDCP
class gtpu_interface_pdcp
{
public:
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::byte_buffer_t *pdu) = 0;
};
// GTPU interface for RRC
class gtpu_interface_rrc
{
public:
virtual void add_bearer(uint16_t rnti, uint32_t lcid, uint32_t teid_out, uint32_t *teid_in) = 0;
virtual void rem_bearer(uint16_t rnti, uint32_t lcid) = 0;
virtual void rem_user(uint16_t rnti) = 0;
};
// S1AP interface for RRC
class s1ap_interface_rrc
{
public:
virtual void initial_ue(uint16_t rnti, srslte::byte_buffer_t *pdu) = 0;
virtual void initial_ue(uint16_t rnti, srslte::byte_buffer_t *pdu, uint32_t m_tmsi, uint8_t mmec) = 0;
virtual void write_pdu(uint16_t rnti, srslte::byte_buffer_t *pdu) = 0;
virtual bool user_exists(uint16_t rnti) = 0;
virtual void user_inactivity(uint16_t rnti) = 0;
virtual void release_eutran(uint16_t rnti) = 0;
virtual bool user_link_lost(uint16_t rnti) = 0;
virtual void ue_ctxt_setup_complete(uint16_t rnti, LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPRESPONSE_STRUCT *res) = 0;
virtual void ue_erab_setup_complete(uint16_t rnti, LIBLTE_S1AP_MESSAGE_E_RABSETUPRESPONSE_STRUCT *res) = 0;
// virtual void ue_capabilities(uint16_t rnti, LIBLTE_RRC_UE_EUTRA_CAPABILITY_STRUCT *caps) = 0;
};
}
#endif

@ -0,0 +1,42 @@
#ifndef ENB_METRICS_INTERFACE_H
#define ENB_METRICS_INTERFACE_H
#include <stdint.h>
#include "upper/common_enb.h"
#include "upper/s1ap_metrics.h"
#include "upper/rrc_metrics.h"
#include "srslte/upper/gw_metrics.h"
#include "srslte/upper/rlc_metrics.h"
#include "mac/mac_metrics.h"
#include "phy/phy_metrics.h"
namespace srsenb {
typedef struct {
uint32_t rf_o;
uint32_t rf_u;
uint32_t rf_l;
bool rf_error;
}rf_metrics_t;
typedef struct {
rf_metrics_t rf;
phy_metrics_t phy[ENB_METRICS_MAX_USERS];
mac_metrics_t mac[ENB_METRICS_MAX_USERS];
rrc_metrics_t rrc;
s1ap_metrics_t s1ap;
bool running;
}enb_metrics_t;
// ENB interface
class enb_metrics_interface
{
public:
virtual bool get_metrics(enb_metrics_t &m) = 0;
};
} // namespace srsenb
#endif // ENB_METRICS_INTERFACE_H

@ -0,0 +1,222 @@
#include "srslte/srslte.h"
#ifndef SCHED_INTERFACE_H
#define SCHED_INTERFACE_H
namespace srsenb {
class sched_interface
{
public:
const static int MAX_SIB_PAYLOAD_LEN = 2048;
const static int MAX_SIBS = 16;
const static int MAX_LC = 6;
const static int MAX_DATA_LIST = 32;
const static int MAX_RAR_LIST = 8;
const static int MAX_BC_LIST = 8;
const static int MAX_RLC_PDU_LIST = 8;
const static int MAX_PHICH_LIST = 8;
typedef struct {
uint32_t len;
uint32_t period_rf;
} cell_cfg_sib_t;
typedef struct {
int pdsch_mcs;
int pdsch_max_mcs;
int pusch_mcs;
int pusch_max_mcs;
int nof_ctrl_symbols;
} sched_args_t;
typedef struct {
// Main cell configuration (used to calculate DCI locations in scheduler)
srslte_cell_t cell;
/* SIB configuration */
cell_cfg_sib_t sibs[MAX_SIBS];
uint32_t si_window_ms;
/* pusch configuration */
srslte_pusch_hopping_cfg_t pusch_hopping_cfg;
/* prach configuration */
uint32_t prach_config;
uint32_t prach_freq_offset;
uint32_t prach_rar_window;
uint32_t prach_contention_resolution_timer;
uint32_t maxharq_msg3tx;
uint32_t n1pucch_an;
uint32_t delta_pucch_shift;
uint32_t nrb_cqi;
uint32_t ncs_an;
uint32_t srs_subframe_config;
uint32_t srs_subframe_offset;
uint32_t srs_bw_config;
} cell_cfg_t;
typedef struct {
int priority;
int bsd;
int pbr;
enum {IDLE = 0, UL, DL, BOTH} direction;
} ue_bearer_cfg_t;
typedef struct {
bool continuous_pusch;
/* ue capabilities, etc */
uint32_t maxharq_tx;
uint32_t aperiodic_cqi_period; // if 0 is periodic CQI
uint32_t beta_ack_index;
uint32_t beta_ri_index;
uint32_t beta_cqi_index;
srslte_pucch_cfg_t pucch_cfg;
uint32_t n_pucch_cqi;
uint32_t sr_I;
uint32_t sr_N_pucch;
bool sr_enabled;
uint32_t cqi_pucch;
uint32_t cqi_idx;
bool cqi_enabled;
ue_bearer_cfg_t ue_bearers[MAX_LC];
} ue_cfg_t;
typedef struct {
uint32_t lcid;
uint32_t nbytes;
} dl_sched_pdu_t;
typedef struct {
uint32_t rnti;
srslte_ra_dl_dci_t dci;
srslte_dci_location_t dci_location;
uint32_t tbs;
bool mac_ce_ta;
bool mac_ce_rnti;
uint32_t nof_pdu_elems;
dl_sched_pdu_t pdu[MAX_RLC_PDU_LIST];
} dl_sched_data_t;
typedef struct {
uint32_t rnti;
bool needs_pdcch;
uint32_t current_tx_nb;
uint32_t tbs;
srslte_ra_ul_dci_t dci;
srslte_dci_location_t dci_location;
} ul_sched_data_t;
typedef struct {
uint32_t ra_id;
srslte_dci_rar_grant_t grant;
} dl_sched_rar_grant_t;
typedef struct {
uint32_t rarnti;
uint32_t tbs;
srslte_ra_dl_dci_t dci;
srslte_dci_location_t dci_location;
uint32_t nof_grants;
dl_sched_rar_grant_t grants[MAX_RAR_LIST];
} dl_sched_rar_t;
typedef struct {
srslte_ra_dl_dci_t dci;
srslte_dci_location_t dci_location;
enum bc_type {
BCCH, PCCH
} type;
uint32_t index;
uint32_t tbs;
} dl_sched_bc_t;
typedef struct {
uint32_t cfi;
uint32_t nof_data_elems;
uint32_t nof_rar_elems;
uint32_t nof_bc_elems;
dl_sched_data_t data[MAX_DATA_LIST];
dl_sched_rar_t rar[MAX_RAR_LIST];
dl_sched_bc_t bc[MAX_BC_LIST];
} dl_sched_res_t;
typedef struct {
uint16_t rnti;
enum phich_elem {
ACK, NACK
} phich;
} ul_sched_phich_t;
typedef struct {
uint32_t nof_dci_elems;
uint32_t nof_phich_elems;
ul_sched_data_t pusch[MAX_DATA_LIST];
ul_sched_phich_t phich[MAX_PHICH_LIST];
} ul_sched_res_t;
/******************* Scheduler Control ****************************/
/* Provides cell configuration including SIB periodicity, etc. */
virtual int cell_cfg(cell_cfg_t *cell_cfg) = 0;
virtual int reset() = 0;
/* Manages UE scheduling context */
virtual int ue_cfg(uint16_t rnti, ue_cfg_t *cfg) = 0;
virtual int ue_rem(uint16_t rnti) = 0;
virtual bool ue_exists(uint16_t rnti) = 0;
/* Manages UE bearers and associated configuration */
virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, ue_bearer_cfg_t *cfg) = 0;
virtual int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) = 0;
virtual uint32_t get_ul_buffer(uint16_t rnti) = 0;
virtual uint32_t get_dl_buffer(uint16_t rnti) = 0;
/******************* Scheduling Interface ***********************/
/* DL buffer status report */
virtual int dl_rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue) = 0;
virtual int dl_mac_buffer_state(uint16_t rnti, uint32_t ce_code) = 0;
/* DL information */
virtual int dl_ack_info(uint32_t tti, uint16_t rnti, bool ack) = 0;
virtual int dl_rach_info(uint32_t tti, uint32_t ra_id, uint16_t rnti, uint32_t estimated_size) = 0;
virtual int dl_cqi_info(uint32_t tti, uint16_t rnti, uint32_t cqi_value) = 0;
/* UL information */
virtual int ul_crc_info(uint32_t tti, uint16_t rnti, bool crc) = 0;
virtual int ul_sr_info(uint32_t tti, uint16_t rnti) = 0;
virtual int ul_bsr(uint16_t rnti, uint32_t lcid, uint32_t bsr) = 0;
virtual int ul_recv_len(uint16_t rnti, uint32_t lcid, uint32_t len) = 0;
virtual int ul_phr(uint16_t rnti, int phr) = 0;
virtual int ul_cqi_info(uint32_t tti, uint16_t rnti, uint32_t cqi, uint32_t ul_ch_code) = 0;
/* Run Scheduler for this tti */
virtual int dl_sched(uint32_t tti, dl_sched_res_t *sched_result) = 0;
virtual int ul_sched(uint32_t tti, ul_sched_res_t *sched_result) = 0;
};
}
#endif

@ -0,0 +1,481 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsUE library.
*
* srsUE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsUE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: interfaces.h
* Description: Abstract base class interfaces provided by layers
* to other layers.
*****************************************************************************/
#ifndef INTERFACES_H
#define INTERFACES_H
#include <string>
#include "srslte/asn1/liblte_rrc.h"
#include "srslte/common/interfaces_common.h"
#include "srslte/common/common.h"
#include "srslte/common/security.h"
namespace srsue {
// UE interface
class ue_interface
{
};
// USIM interface for NAS
class usim_interface_nas
{
public:
virtual void get_imsi_vec(uint8_t* imsi_, uint32_t n) = 0;
virtual void get_imei_vec(uint8_t* imei_, uint32_t n) = 0;
virtual void generate_authentication_response(uint8_t *rand,
uint8_t *autn_enb,
uint16_t mcc,
uint16_t mnc,
bool *net_valid,
uint8_t *res) = 0;
virtual void generate_nas_keys(uint8_t *k_nas_enc,
uint8_t *k_nas_int,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
};
// USIM interface for RRC
class usim_interface_rrc
{
public:
virtual void generate_as_keys(uint32_t count_ul,
uint8_t *k_rrc_enc,
uint8_t *k_rrc_int,
uint8_t *k_up_enc,
uint8_t *k_up_int,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0;
};
// GW interface for NAS
class gw_interface_nas
{
public:
virtual srslte::error_t setup_if_addr(uint32_t ip_addr, char *err_str) = 0;
};
// GW interface for PDCP
class gw_interface_pdcp
{
public:
virtual void write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu) = 0;
};
// NAS interface for RRC
class nas_interface_rrc
{
public:
virtual bool is_attached() = 0;
virtual void notify_connection_setup() = 0;
virtual void write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu) = 0;
virtual uint32_t get_ul_count() = 0;
virtual bool get_s_tmsi(LIBLTE_RRC_S_TMSI_STRUCT *s_tmsi) = 0;
};
// RRC interface for MAC
class rrc_interface_mac
{
public:
virtual void release_pucch_srs() = 0;
virtual void ra_problem() = 0;
};
// RRC interface for PHY
class rrc_interface_phy
{
public:
virtual void in_sync() = 0;
virtual void out_of_sync() = 0;
};
// RRC interface for NAS
class rrc_interface_nas
{
public:
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual uint16_t get_mcc() = 0;
virtual uint16_t get_mnc() = 0;
virtual void enable_capabilities() = 0;
};
// RRC interface for GW
class rrc_interface_gw
{
public:
virtual bool rrc_connected() = 0;
virtual void rrc_connect() = 0;
virtual bool have_drb() = 0;
};
// RRC interface for PDCP
class rrc_interface_pdcp
{
public:
virtual void write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu) = 0;
virtual void write_pdu_bcch_bch(srslte::byte_buffer_t *pdu) = 0;
virtual void write_pdu_bcch_dlsch(srslte::byte_buffer_t *pdu) = 0;
virtual void write_pdu_pcch(srslte::byte_buffer_t *pdu) = 0;
};
// RRC interface for RLC
class rrc_interface_rlc
{
public:
virtual void max_retx_attempted() = 0;
};
// PDCP interface for GW
class pdcp_interface_gw
{
public:
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
};
// PDCP interface for RRC
class pdcp_interface_rrc
{
public:
virtual void reset() = 0;
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual void add_bearer(uint32_t lcid, LIBLTE_RRC_PDCP_CONFIG_STRUCT *cnfg=NULL) = 0;
virtual void config_security(uint32_t lcid,
uint8_t *k_rrc_enc_,
uint8_t *k_rrc_int_,
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo_,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo_) = 0;
};
// PDCP interface for RLC
class pdcp_interface_rlc
{
public:
/* RLC calls PDCP to push a PDCP PDU. */
virtual void write_pdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
virtual void write_pdu_bcch_bch(srslte::byte_buffer_t *sdu) = 0;
virtual void write_pdu_bcch_dlsch(srslte::byte_buffer_t *sdu) = 0;
virtual void write_pdu_pcch(srslte::byte_buffer_t *sdu) = 0;
};
// RLC interface for RRC
class rlc_interface_rrc
{
public:
virtual void reset() = 0;
virtual void add_bearer(uint32_t lcid) = 0;
virtual void add_bearer(uint32_t lcid, LIBLTE_RRC_RLC_CONFIG_STRUCT *cnfg) = 0;
};
// RLC interface for PDCP
class rlc_interface_pdcp
{
public:
/* PDCP calls RLC to push an RLC SDU. SDU gets placed into the RLC buffer and MAC pulls
* RLC PDUs according to TB size. */
virtual void write_sdu(uint32_t lcid, srslte::byte_buffer_t *sdu) = 0;
};
//RLC interface for MAC
class rlc_interface_mac : public srslte::read_pdu_interface
{
public:
/* MAC calls RLC to get buffer state for a logical channel.
* This function should return quickly. */
virtual uint32_t get_buffer_state(uint32_t lcid) = 0;
virtual uint32_t get_total_buffer_state(uint32_t lcid) = 0;
const static int MAX_PDU_SEGMENTS = 20;
/* MAC calls RLC to get RLC segment of nof_bytes length.
* Segmentation happens in this function. RLC PDU is stored in payload. */
virtual int read_pdu(uint32_t lcid, uint8_t *payload, uint32_t nof_bytes) = 0;
/* MAC calls RLC to push an RLC PDU. This function is called from an independent MAC thread.
* PDU gets placed into the buffer and higher layer thread gets notified. */
virtual void write_pdu(uint32_t lcid, uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_bcch_bch(uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_bcch_dlsch(uint8_t *payload, uint32_t nof_bytes) = 0;
virtual void write_pdu_pcch(uint8_t *payload, uint32_t nof_bytes) = 0;
};
/** MAC interface
*
*/
/* Interface PHY -> MAC */
class mac_interface_phy
{
public:
typedef struct {
uint32_t pid;
uint32_t tti;
uint32_t last_tti;
bool ndi;
bool last_ndi;
uint32_t n_bytes;
int rv;
uint16_t rnti;
bool is_from_rar;
bool is_sps_release;
bool has_cqi_request;
srslte_rnti_type_t rnti_type;
srslte_phy_grant_t phy_grant;
} mac_grant_t;
typedef struct {
bool decode_enabled;
int rv;
uint16_t rnti;
bool generate_ack;
bool default_ack;
// If non-null, called after tb_decoded_ok to determine if ack needs to be sent
bool (*generate_ack_callback)(void*);
void *generate_ack_callback_arg;
uint8_t *payload_ptr;
srslte_softbuffer_rx_t *softbuffer;
srslte_phy_grant_t phy_grant;
} tb_action_dl_t;
typedef struct {
bool tx_enabled;
bool expect_ack;
uint32_t rv;
uint16_t rnti;
uint32_t current_tx_nb;
srslte_softbuffer_tx_t *softbuffer;
srslte_phy_grant_t phy_grant;
uint8_t *payload_ptr;
} tb_action_ul_t;
/* Indicate reception of UL grant.
* payload_ptr points to memory where MAC PDU must be written by MAC layer */
virtual void new_grant_ul(mac_grant_t grant, tb_action_ul_t *action) = 0;
/* Indicate reception of UL grant + HARQ information throught PHICH in the same TTI. */
virtual void new_grant_ul_ack(mac_grant_t grant, bool ack, tb_action_ul_t *action) = 0;
/* Indicate reception of HARQ information only through PHICH. */
virtual void harq_recv(uint32_t tti, bool ack, tb_action_ul_t *action) = 0;
/* Indicate reception of DL grant. */
virtual void new_grant_dl(mac_grant_t grant, tb_action_dl_t *action) = 0;
/* Indicate successfull decoding of PDSCH TB. */
virtual void tb_decoded(bool ack, srslte_rnti_type_t rnti_type, uint32_t harq_pid) = 0;
/* Indicate successfull decoding of BCH TB through PBCH */
virtual void bch_decoded_ok(uint8_t *payload, uint32_t len) = 0;
/* Indicate successfull decoding of PCH TB through PDSCH */
virtual void pch_decoded_ok(uint32_t len) = 0;
/* Function called every start of a subframe (TTI). Warning, this function is called
* from a high priority thread and should terminate asap
*/
virtual void tti_clock(uint32_t tti) = 0;
};
/* Interface RRC -> MAC */
class mac_interface_rrc
{
public:
typedef struct {
LIBLTE_RRC_MAC_MAIN_CONFIG_STRUCT main;
LIBLTE_RRC_RACH_CONFIG_COMMON_STRUCT rach;
LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT sr;
uint32_t prach_config_index;
} mac_cfg_t;
// Class to handle UE specific RNTIs between RRC and MAC
typedef struct {
uint16_t crnti;
uint16_t temp_rnti;
uint16_t tpc_rnti;
uint16_t sps_rnti;
uint64_t contention_id;
} ue_rnti_t;
/* Instructs the MAC to start receiving BCCH */
virtual void bcch_start_rx() = 0;
virtual void bcch_stop_rx() = 0;
virtual void bcch_start_rx(int si_window_start, int si_window_length) = 0;
/* Instructs the MAC to start receiving PCCH */
virtual void pcch_start_rx() = 0;
virtual void pcch_stop_rx() = 0;
/* RRC configures a logical channel */
virtual void setup_lcid(uint32_t lcid, uint32_t lcg, uint32_t priority, int PBR_x_tti, uint32_t BSD) = 0;
virtual uint32_t get_current_tti() = 0;
virtual void set_config(mac_cfg_t *mac_cfg) = 0;
virtual void set_config_main(LIBLTE_RRC_MAC_MAIN_CONFIG_STRUCT *main_cfg) = 0;
virtual void set_config_rach(LIBLTE_RRC_RACH_CONFIG_COMMON_STRUCT *rach_cfg, uint32_t prach_config_index) = 0;
virtual void set_config_sr(LIBLTE_RRC_SCHEDULING_REQUEST_CONFIG_STRUCT *sr_cfg) = 0;
virtual void get_config(mac_cfg_t *mac_cfg) = 0;
virtual void get_rntis(ue_rnti_t *rntis) = 0;
virtual void set_contention_id(uint64_t uecri) = 0;
virtual void reconfiguration() = 0;
virtual void reset() = 0;
};
/** PHY interface
*
*/
typedef struct {
bool ul_pwr_ctrl_en;
float prach_gain;
int pdsch_max_its;
bool attach_enable_64qam;
int nof_phy_threads;
int worker_cpu_mask;
int sync_cpu_affinity;
uint32_t nof_rx_ant;
std::string equalizer_mode;
int cqi_max;
int cqi_fixed;
float snr_ema_coeff;
std::string snr_estim_alg;
bool cfo_integer_enabled;
float cfo_correct_tol_hz;
int time_correct_period;
bool sfo_correct_disable;
std::string sss_algorithm;
float estimator_fil_w;
bool rssi_sensor_enabled;
} phy_args_t;
/* Interface MAC -> PHY */
class phy_interface_mac
{
public:
/* Configure PRACH using parameters written by RRC */
virtual void configure_prach_params() = 0;
/* Start synchronization with strongest cell in the current carrier frequency */
virtual void sync_start() = 0;
virtual void sync_stop() = 0;
/* Sets a C-RNTI allowing the PHY to pregenerate signals if necessary */
virtual void set_crnti(uint16_t rnti) = 0;
virtual void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm) = 0;
virtual int prach_tx_tti() = 0;
/* Indicates the transmission of a SR signal in the next opportunity */
virtual void sr_send() = 0;
virtual int sr_last_tx_tti() = 0;
/* Time advance commands */
virtual void set_timeadv_rar(uint32_t ta_cmd) = 0;
virtual void set_timeadv(uint32_t ta_cmd) = 0;
/* Sets RAR grant payload */
virtual void set_rar_grant(uint32_t tti, uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN]) = 0;
/* Instruct the PHY to decode PDCCH with the CRC scrambled with given RNTI */
virtual void pdcch_ul_search(srslte_rnti_type_t rnti_type, uint16_t rnti, int tti_start = -1, int tti_end = -1) = 0;
virtual void pdcch_dl_search(srslte_rnti_type_t rnti_type, uint16_t rnti, int tti_start = -1, int tti_end = -1) = 0;
virtual void pdcch_ul_search_reset() = 0;
virtual void pdcch_dl_search_reset() = 0;
virtual uint32_t get_current_tti() = 0;
virtual float get_phr() = 0;
virtual float get_pathloss_db() = 0;
};
class phy_interface_rrc
{
public:
typedef struct {
LIBLTE_RRC_PRACH_CONFIG_SIB_STRUCT prach_cnfg;
LIBLTE_RRC_PDSCH_CONFIG_COMMON_STRUCT pdsch_cnfg;
LIBLTE_RRC_PUSCH_CONFIG_COMMON_STRUCT pusch_cnfg;
LIBLTE_RRC_PHICH_CONFIG_STRUCT phich_cnfg;
LIBLTE_RRC_PUCCH_CONFIG_COMMON_STRUCT pucch_cnfg;
LIBLTE_RRC_SRS_UL_CONFIG_COMMON_STRUCT srs_ul_cnfg;
LIBLTE_RRC_UL_POWER_CONTROL_COMMON_STRUCT ul_pwr_ctrl;
LIBLTE_RRC_TDD_CONFIG_STRUCT tdd_cnfg;
LIBLTE_RRC_ANTENNA_PORTS_COUNT_ENUM ant_info;
} phy_cfg_common_t;
typedef struct {
LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT dedicated;
phy_cfg_common_t common;
bool enable_64qam;
} phy_cfg_t;
virtual void get_current_cell(srslte_cell_t *cell) = 0;
virtual void get_config(phy_cfg_t *phy_cfg) = 0;
virtual void set_config(phy_cfg_t *phy_cfg) = 0;
virtual void set_config_dedicated(LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT *dedicated) = 0;
virtual void set_config_common(phy_cfg_common_t *common) = 0;
virtual void set_config_tdd(LIBLTE_RRC_TDD_CONFIG_STRUCT *tdd) = 0;
virtual void set_config_64qam_en(bool enable) = 0;
/* Is the PHY downlink synchronized? */
virtual bool status_is_sync() = 0;
/* Configure UL using parameters written with set_param() */
virtual void configure_ul_params(bool pregen_disabled = false) = 0;
virtual void reset() = 0;
virtual void resync_sfn() = 0;
};
} // namespace srslte
#endif // INTERFACES_H

@ -31,41 +31,42 @@
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/msg_queue.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/threads.h"
#include "srslte/upper/gw_metrics.h"
#include <linux/if.h>
namespace srsue {
namespace srslte {
class gw
:public gw_interface_pdcp
,public gw_interface_nas
:public srsue::gw_interface_pdcp
,public srsue::gw_interface_nas
,public thread
{
public:
gw();
void init(pdcp_interface_gw *pdcp_, rrc_interface_gw *rrc_, ue_interface *ue_, srslte::log *gw_log_);
void init(srsue::pdcp_interface_gw *pdcp_, srsue::rrc_interface_gw *rrc_, srsue::ue_interface *ue_, log *gw_log_);
void stop();
void get_metrics(gw_metrics_t &m);
// PDCP interface
void write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu);
void write_pdu(uint32_t lcid, byte_buffer_t *pdu);
// NAS interface
srslte::error_t setup_if_addr(uint32_t ip_addr, char *err_str);
error_t setup_if_addr(uint32_t ip_addr, char *err_str);
private:
static const int GW_THREAD_PRIO = 7;
srslte::byte_buffer_pool *pool;
srslte::log *gw_log;
pdcp_interface_gw *pdcp;
rrc_interface_gw *rrc;
ue_interface *ue;
srsue::pdcp_interface_gw *pdcp;
srsue::rrc_interface_gw *rrc;
srsue::ue_interface *ue;
byte_buffer_pool *pool;
log *gw_log;
bool running;
bool run_enable;
int32 tun_fd;
@ -78,7 +79,7 @@ private:
struct timeval metrics_time[3];
void run_thread();
srslte::error_t init_if(char *err_str);
error_t init_if(char *err_str);
};
} // namespace srsue

@ -28,7 +28,7 @@
#define UE_GW_METRICS_H
namespace srsue {
namespace srslte {
struct gw_metrics_t
{

@ -29,24 +29,23 @@
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/upper/pdcp_entity.h"
using srslte::byte_buffer_t;
namespace srsue {
namespace srslte {
class pdcp
:public pdcp_interface_gw
,public pdcp_interface_rlc
,public pdcp_interface_rrc
:public srsue::pdcp_interface_gw
,public srsue::pdcp_interface_rlc
,public srsue::pdcp_interface_rrc
{
public:
pdcp();
void init(rlc_interface_pdcp *rlc_,
rrc_interface_pdcp *rrc_,
gw_interface_pdcp *gw_,
srslte::log *pdcp_log_,
virtual ~pdcp(){}
void init(srsue::rlc_interface_pdcp *rlc_,
srsue::rrc_interface_pdcp *rrc_,
srsue::gw_interface_pdcp *gw_,
log *pdcp_log_,
uint8_t direction_);
void stop();
@ -67,12 +66,12 @@ public:
void write_pdu_pcch(byte_buffer_t *sdu);
private:
srslte::log *pdcp_log;
log *pdcp_log;
pdcp_entity pdcp_array[SRSUE_N_RADIO_BEARERS];
rlc_interface_pdcp *rlc;
rrc_interface_pdcp *rrc;
gw_interface_pdcp *gw;
srsue::rlc_interface_pdcp *rlc;
srsue::rrc_interface_pdcp *rrc;
srsue::gw_interface_pdcp *gw;
uint8_t direction;

@ -30,13 +30,11 @@
#include "srslte/common/buffer_pool.h"
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/security.h"
using srslte::byte_buffer_t;
namespace srsue {
namespace srslte {
/****************************************************************************
* Structs and Defines
@ -64,9 +62,9 @@ class pdcp_entity
{
public:
pdcp_entity();
void init(rlc_interface_pdcp *rlc_,
rrc_interface_pdcp *rrc_,
gw_interface_pdcp *gw_,
void init(srsue::rlc_interface_pdcp *rlc_,
srsue::rrc_interface_pdcp *rrc_,
srsue::gw_interface_pdcp *gw_,
srslte::log *log_,
uint32_t lcid_,
uint8_t direction_,
@ -87,11 +85,12 @@ public:
void write_pdu(byte_buffer_t *pdu);
private:
srslte::byte_buffer_pool *pool;
srslte::log *log;
rlc_interface_pdcp *rlc;
rrc_interface_pdcp *rrc;
gw_interface_pdcp *gw;
byte_buffer_pool *pool;
srslte::log *log;
srsue::rlc_interface_pdcp *rlc;
srsue::rrc_interface_pdcp *rrc;
srsue::gw_interface_pdcp *gw;
bool active;
uint32_t lcid;

@ -30,12 +30,12 @@
#include "srslte/common/buffer_pool.h"
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/msg_queue.h"
#include "srslte/upper/rlc_entity.h"
#include "srslte/upper/rlc_metrics.h"
namespace srsue {
namespace srslte {
/****************************************************************************
* RLC Layer
@ -44,17 +44,18 @@ namespace srsue {
* each bearer.
***************************************************************************/
class rlc
:public rlc_interface_mac
,public rlc_interface_pdcp
,public rlc_interface_rrc
:public srsue::rlc_interface_mac
,public srsue::rlc_interface_pdcp
,public srsue::rlc_interface_rrc
{
public:
rlc();
void init(pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
ue_interface *ue_,
srslte::log *rlc_log_,
srslte::mac_interface_timers *mac_timers_);
virtual ~rlc() {}
void init(srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
srsue::ue_interface *ue_,
log *rlc_log_,
mac_interface_timers *mac_timers_);
void stop();
void get_metrics(rlc_metrics_t &m);
@ -79,13 +80,13 @@ public:
private:
void reset_metrics();
srslte::byte_buffer_pool *pool;
srslte::log *rlc_log;
pdcp_interface_rlc *pdcp;
rrc_interface_rlc *rrc;
byte_buffer_pool *pool;
srslte::log *rlc_log;
srsue::pdcp_interface_rlc *pdcp;
srsue::rrc_interface_rlc *rrc;
srslte::mac_interface_timers *mac_timers;
ue_interface *ue;
rlc_entity rlc_array[SRSUE_N_RADIO_BEARERS];
srsue::ue_interface *ue;
srslte::rlc_entity rlc_array[SRSUE_N_RADIO_BEARERS];
long ul_tput_bytes[SRSUE_N_RADIO_BEARERS];
long dl_tput_bytes[SRSUE_N_RADIO_BEARERS];

@ -30,7 +30,7 @@
#include "srslte/common/buffer_pool.h"
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/msg_queue.h"
#include "srslte/common/timeout.h"
#include "srslte/upper/rlc_common.h"
@ -38,9 +38,7 @@
#include <deque>
#include <list>
using srslte::byte_buffer_t;
namespace srsue {
namespace srslte {
@ -73,11 +71,11 @@ class rlc_am
{
public:
rlc_am();
void init(srslte::log *rlc_entity_log_,
void init(log *rlc_entity_log_,
uint32_t lcid_,
pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
srslte::mac_interface_timers *mac_timers);
srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
mac_interface_timers *mac_timers);
void configure(LIBLTE_RRC_RLC_CONFIG_STRUCT *cnfg);
void reset();
void empty_queue();
@ -96,14 +94,14 @@ public:
private:
srslte::byte_buffer_pool *pool;
srslte::log *log;
uint32_t lcid;
pdcp_interface_rlc *pdcp;
rrc_interface_rlc *rrc;
byte_buffer_pool *pool;
srslte::log *log;
uint32_t lcid;
srsue::pdcp_interface_rlc *pdcp;
srsue::rrc_interface_rlc *rrc;
// TX SDU buffers
srslte::msg_queue tx_sdu_queue;
msg_queue tx_sdu_queue;
byte_buffer_t *tx_sdu;
// PDU being resegmented
@ -166,9 +164,9 @@ private:
* Timers
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
***************************************************************************/
srslte::timeout poll_retx_timeout;
srslte::timeout reordering_timeout;
srslte::timeout status_prohibit_timeout;
timeout poll_retx_timeout;
timeout reordering_timeout;
timeout status_prohibit_timeout;
static const int reordering_timeout_id = 1;

@ -27,7 +27,7 @@
#ifndef RLC_COMMON_H
#define RLC_COMMON_H
namespace srsue {
namespace srslte {
/****************************************************************************
* Structs and Defines
@ -157,11 +157,11 @@ struct rlc_status_pdu_t{
class rlc_common
{
public:
virtual void init(srslte::log *rlc_entity_log_,
uint32_t lcid_,
pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
srslte::mac_interface_timers *mac_timers_) = 0;
virtual void init(srslte::log *rlc_entity_log_,
uint32_t lcid_,
srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
srslte::mac_interface_timers *mac_timers_) = 0;
virtual void configure(LIBLTE_RRC_RLC_CONFIG_STRUCT *cnfg) = 0;
virtual void reset() = 0;
virtual void empty_queue() = 0;
@ -170,7 +170,7 @@ public:
virtual uint32_t get_bearer() = 0;
// PDCP interface
virtual void write_sdu(srslte::byte_buffer_t *sdu) = 0;
virtual void write_sdu(byte_buffer_t *sdu) = 0;
// MAC interface
virtual uint32_t get_buffer_state() = 0;

@ -29,13 +29,13 @@
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/upper/rlc_common.h"
#include "srslte/upper/rlc_tm.h"
#include "srslte/upper/rlc_um.h"
#include "srslte/upper/rlc_am.h"
namespace srsue {
namespace srslte {
@ -48,11 +48,11 @@ class rlc_entity
public:
rlc_entity();
void init(rlc_mode_t mode,
srslte::log *rlc_entity_log_,
log *rlc_entity_log_,
uint32_t lcid_,
pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
srslte::mac_interface_timers *mac_timers_);
srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
mac_interface_timers *mac_timers_);
void configure(LIBLTE_RRC_RLC_CONFIG_STRUCT *cnfg);
void reset();

@ -28,7 +28,7 @@
#define UE_RLC_METRICS_H
namespace srsue {
namespace srslte {
struct rlc_metrics_t
{

@ -30,22 +30,22 @@
#include "srslte/common/buffer_pool.h"
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/msg_queue.h"
#include "srslte/upper/rlc_common.h"
namespace srsue {
namespace srslte {
class rlc_tm
:public rlc_common
{
public:
rlc_tm();
void init(srslte::log *rlc_entity_log_,
void init(log *rlc_entity_log_,
uint32_t lcid_,
pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
srslte::mac_interface_timers *mac_timers);
srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
mac_interface_timers *mac_timers);
void configure(LIBLTE_RRC_RLC_CONFIG_STRUCT *cnfg);
void reset();
void empty_queue();
@ -54,7 +54,7 @@ public:
uint32_t get_bearer();
// PDCP interface
void write_sdu(srslte::byte_buffer_t *sdu);
void write_sdu(byte_buffer_t *sdu);
// MAC interface
uint32_t get_buffer_state();
@ -64,14 +64,14 @@ public:
private:
srslte::byte_buffer_pool *pool;
srslte::log *log;
uint32_t lcid;
pdcp_interface_rlc *pdcp;
rrc_interface_rlc *rrc;
byte_buffer_pool *pool;
srslte::log *log;
uint32_t lcid;
srsue::pdcp_interface_rlc *pdcp;
srsue::rrc_interface_rlc *rrc;
// Thread-safe queues for MAC messages
srslte::msg_queue ul_queue;
msg_queue ul_queue;
};
} // namespace srsue

@ -30,32 +30,32 @@
#include "srslte/common/buffer_pool.h"
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/msg_queue.h"
#include "srslte/upper/rlc_common.h"
#include <pthread.h>
#include <map>
#include <queue>
namespace srsue {
namespace srslte {
struct rlc_umd_pdu_t{
rlc_umd_pdu_header_t header;
srslte::byte_buffer_t *buf;
byte_buffer_t *buf;
};
class rlc_um
:public srslte::timer_callback
:public timer_callback
,public rlc_common
{
public:
rlc_um();
void init(srslte::log *rlc_entity_log_,
void init(log *rlc_entity_log_,
uint32_t lcid_,
pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
srslte::mac_interface_timers *mac_timers_);
srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
mac_interface_timers *mac_timers_);
void configure(LIBLTE_RRC_RLC_CONFIG_STRUCT *cnfg);
void reset();
void empty_queue();
@ -64,7 +64,7 @@ public:
uint32_t get_bearer();
// PDCP interface
void write_sdu(srslte::byte_buffer_t *sdu);
void write_sdu(byte_buffer_t *sdu);
// MAC interface
uint32_t get_buffer_state();
@ -79,16 +79,16 @@ public:
private:
srslte::byte_buffer_pool *pool;
srslte::log *log;
uint32_t lcid;
pdcp_interface_rlc *pdcp;
rrc_interface_rlc *rrc;
srslte::mac_interface_timers *mac_timers;
byte_buffer_pool *pool;
srslte::log *log;
uint32_t lcid;
srsue::pdcp_interface_rlc *pdcp;
srsue::rrc_interface_rlc *rrc;
mac_interface_timers *mac_timers;
// TX SDU buffers
srslte::msg_queue tx_sdu_queue;
srslte::byte_buffer_t *tx_sdu;
msg_queue tx_sdu_queue;
byte_buffer_t *tx_sdu;
// Rx window
std::map<uint32_t, rlc_umd_pdu_t> rx_window;
@ -97,7 +97,7 @@ private:
uint32_t tx_mod; // Tx counter modulus
// RX SDU buffers
srslte::byte_buffer_t *rx_sdu;
byte_buffer_t *rx_sdu;
uint32_t vr_ur_in_rx_sdu;
// Mutexes
@ -144,9 +144,9 @@ private:
* Header pack/unpack helper functions
* Ref: 3GPP TS 36.322 v10.0.0 Section 6.2.1
***************************************************************************/
void rlc_um_read_data_pdu_header(srslte::byte_buffer_t *pdu, rlc_umd_sn_size_t sn_size, rlc_umd_pdu_header_t *header);
void rlc_um_read_data_pdu_header(byte_buffer_t *pdu, rlc_umd_sn_size_t sn_size, rlc_umd_pdu_header_t *header);
void rlc_um_read_data_pdu_header(uint8_t *payload, uint32_t nof_bytes, rlc_umd_sn_size_t sn_size, rlc_umd_pdu_header_t *header);
void rlc_um_write_data_pdu_header(rlc_umd_pdu_header_t *header, srslte::byte_buffer_t *pdu);
void rlc_um_write_data_pdu_header(rlc_umd_pdu_header_t *header, byte_buffer_t *pdu);
uint32_t rlc_um_packed_length(rlc_umd_pdu_header_t *header);
bool rlc_um_start_aligned(uint8_t fi);

@ -23,5 +23,6 @@ add_library(srslte_asn1 SHARED
liblte_common.cc
liblte_rrc.cc
liblte_mme.cc
liblte_s1ap.cc
)
install(TARGETS srslte_asn1 DESTINATION ${LIBRARY_DIR})
install(TARGETS srslte_asn1 DESTINATION ${LIBRARY_DIR})

File diff suppressed because it is too large Load Diff

@ -74,10 +74,11 @@ void pdu_queue::deallocate(uint8_t* pdu)
* This function enqueues the packet and returns quicly because ACK
* deadline is important here.
*/
void pdu_queue::push(uint8_t *ptr, uint32_t len)
void pdu_queue::push(uint8_t *ptr, uint32_t len, uint32_t tstamp)
{
pdu_t *pdu = (pdu_t*) ptr;
pdu->len = len;
pdu_t *pdu = (pdu_t*) ptr;
pdu->len = len;
pdu->tstamp = tstamp;
pdu_q.push(pdu);
}
@ -88,7 +89,7 @@ bool pdu_queue::process_pdus()
pdu_t *pdu;
while(pdu_q.try_pop(&pdu)) {
if (callback) {
callback->process_pdu(pdu->ptr, pdu->len);
callback->process_pdu(pdu->ptr, pdu->len, pdu->tstamp);
}
if (!pool.deallocate(pdu)) {
log_h->warning("Error deallocating from buffer pool: buffer not created in this pool.\n");

@ -29,9 +29,7 @@
#include "srslte/common/liblte_security.h"
#include "srslte/common/snow_3g.h"
using namespace srslte;
namespace srsue{
namespace srslte {
/******************************************************************************
* Key Generation

@ -38,15 +38,13 @@
#include <sys/socket.h>
using namespace srslte;
namespace srsue{
namespace srslte {
gw::gw()
:if_up(false)
{}
void gw::init(pdcp_interface_gw *pdcp_, rrc_interface_gw *rrc_, ue_interface *ue_, srslte::log *gw_log_)
void gw::init(srsue::pdcp_interface_gw *pdcp_, srsue::rrc_interface_gw *rrc_, srsue::ue_interface *ue_, log *gw_log_)
{
pool = byte_buffer_pool::get_instance();
pdcp = pdcp_;
@ -105,7 +103,7 @@ void gw::get_metrics(gw_metrics_t &m)
/*******************************************************************************
PDCP interface
*******************************************************************************/
void gw::write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu)
void gw::write_pdu(uint32_t lcid, byte_buffer_t *pdu)
{
gw_log->info_hex(pdu->msg, pdu->N_bytes, "RX PDU");
gw_log->info("RX PDU. Stack latency: %ld us\n", pdu->get_latency_us());
@ -126,7 +124,7 @@ void gw::write_pdu(uint32_t lcid, srslte::byte_buffer_t *pdu)
/*******************************************************************************
NAS interface
*******************************************************************************/
srslte::error_t gw::setup_if_addr(uint32_t ip_addr, char *err_str)
error_t gw::setup_if_addr(uint32_t ip_addr, char *err_str)
{
if(!if_up)
{
@ -164,7 +162,7 @@ srslte::error_t gw::setup_if_addr(uint32_t ip_addr, char *err_str)
return(ERROR_NONE);
}
srslte::error_t gw::init_if(char *err_str)
error_t gw::init_if(char *err_str)
{
if(if_up)
{

@ -27,14 +27,12 @@
#include "srslte/upper/pdcp.h"
using namespace srslte;
namespace srsue{
namespace srslte {
pdcp::pdcp()
{}
void pdcp::init(rlc_interface_pdcp *rlc_, rrc_interface_pdcp *rrc_, gw_interface_pdcp *gw_, srslte::log *pdcp_log_, uint8_t direction_)
void pdcp::init(srsue::rlc_interface_pdcp *rlc_, srsue::rrc_interface_pdcp *rrc_, srsue::gw_interface_pdcp *gw_, log *pdcp_log_, uint8_t direction_)
{
rlc = rlc_;
rrc = rrc_;

@ -28,9 +28,7 @@
#include "srslte/upper/pdcp_entity.h"
#include "srslte/common/security.h"
using namespace srslte;
namespace srsue{
namespace srslte {
pdcp_entity::pdcp_entity()
:active(false)
@ -42,10 +40,10 @@ pdcp_entity::pdcp_entity()
pool = byte_buffer_pool::get_instance();
}
void pdcp_entity::init(rlc_interface_pdcp *rlc_,
rrc_interface_pdcp *rrc_,
gw_interface_pdcp *gw_,
srslte::log *log_,
void pdcp_entity::init(srsue::rlc_interface_pdcp *rlc_,
srsue::rrc_interface_pdcp *rrc_,
srsue::gw_interface_pdcp *gw_,
srslte::log *log_,
uint32_t lcid_,
u_int8_t direction_,
LIBLTE_RRC_PDCP_CONFIG_STRUCT *cnfg)

@ -30,20 +30,18 @@
#include "srslte/upper/rlc_um.h"
#include "srslte/upper/rlc_am.h"
using namespace srslte;
namespace srsue{
namespace srslte {
rlc::rlc()
{
pool = byte_buffer_pool::get_instance();
}
void rlc::init(pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
ue_interface *ue_,
srslte::log *rlc_log_,
mac_interface_timers *mac_timers_)
void rlc::init(srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
srsue::ue_interface *ue_,
log *rlc_log_,
mac_interface_timers *mac_timers_)
{
pdcp = pdcp_;
rrc = rrc_;

@ -34,9 +34,7 @@
#define RX_MOD_BASE(x) (x-vr_r)%1024
#define TX_MOD_BASE(x) (x-vt_a)%1024
using namespace srslte;
namespace srsue{
namespace srslte {
rlc_am::rlc_am() : tx_sdu_queue(16)
{
@ -64,11 +62,11 @@ rlc_am::rlc_am() : tx_sdu_queue(16)
do_status = false;
}
void rlc_am::init(srslte::log *log_,
uint32_t lcid_,
pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
mac_interface_timers *mac_timers)
void rlc_am::init(srslte::log *log_,
uint32_t lcid_,
srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
srslte::mac_interface_timers *mac_timers)
{
log = log_;
lcid = lcid_;

@ -26,19 +26,19 @@
#include "srslte/upper/rlc_entity.h"
namespace srsue {
namespace srslte {
rlc_entity::rlc_entity()
:rlc(NULL)
{
}
void rlc_entity::init(rlc_mode_t mode,
srslte::log *rlc_entity_log_,
uint32_t lcid_,
pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
srslte::mac_interface_timers *mac_timers_)
void rlc_entity::init(rlc_mode_t mode,
log *rlc_entity_log_,
uint32_t lcid_,
srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
mac_interface_timers *mac_timers_)
{
tm.reset();
um.reset();

@ -27,20 +27,18 @@
#include "srslte/upper/rlc_tm.h"
using namespace srslte;
namespace srsue{
namespace srslte {
rlc_tm::rlc_tm() : ul_queue(16)
{
pool = byte_buffer_pool::get_instance();
}
void rlc_tm::init(srslte::log *log_,
uint32_t lcid_,
pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
mac_interface_timers *mac_timers)
void rlc_tm::init(srslte::log *log_,
uint32_t lcid_,
srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
mac_interface_timers *mac_timers)
{
log = log_;
lcid = lcid_;

@ -29,9 +29,7 @@
#define RX_MOD_BASE(x) (x-vr_uh-rx_window_size)%rx_mod
using namespace srslte;
namespace srsue{
namespace srslte {
rlc_um::rlc_um() : tx_sdu_queue(16)
{
@ -53,10 +51,10 @@ rlc_um::rlc_um() : tx_sdu_queue(16)
pdu_lost = false;
}
void rlc_um::init(srslte::log *log_,
uint32_t lcid_,
pdcp_interface_rlc *pdcp_,
rrc_interface_rlc *rrc_,
void rlc_um::init(srslte::log *log_,
uint32_t lcid_,
srsue::pdcp_interface_rlc *pdcp_,
srsue::rrc_interface_rlc *rrc_,
srslte::mac_interface_timers *mac_timers_)
{
log = log_;

@ -37,7 +37,7 @@ uint8_t pdu2[] = {0x00 ,0x22 ,0x00 ,0x40 ,0x0C ,0x01 ,0xC0 ,0x20};
uint32_t PDU2_LEN = 8;
int main(int argc, char **argv) {
srsue::rlc_status_pdu_t s;
srslte::rlc_status_pdu_t s;
srslte::byte_buffer_t b1,b2;
memcpy(b1.msg, &pdu1[0], PDU1_LEN);
@ -52,7 +52,7 @@ int main(int argc, char **argv) {
b1.reset();
b2.reset();
memset(&s, 0, sizeof(srsue::rlc_status_pdu_t));
memset(&s, 0, sizeof(srslte::rlc_status_pdu_t));
memcpy(b1.msg, &pdu2[0], PDU2_LEN);
b1.N_bytes = PDU2_LEN;

@ -43,8 +43,8 @@ uint32_t PDU3_LEN = 7;
using namespace srsue;
int main(int argc, char **argv) {
rlc_amd_pdu_header_t h;
byte_buffer_t b1,b2;
srslte::rlc_amd_pdu_header_t h;
srslte::byte_buffer_t b1,b2;
memcpy(b1.msg, &pdu1[0], PDU1_LEN);
b1.N_bytes = PDU1_LEN;
@ -64,7 +64,7 @@ int main(int argc, char **argv) {
b1.reset();
b2.reset();
memset(&h, 0, sizeof(rlc_amd_pdu_header_t));
memset(&h, 0, sizeof(srslte::rlc_amd_pdu_header_t));
memcpy(b1.msg, &pdu2[0], PDU2_LEN);
b1.N_bytes = PDU2_LEN;
@ -86,7 +86,7 @@ int main(int argc, char **argv) {
b1.reset();
b2.reset();
memset(&h, 0, sizeof(rlc_amd_pdu_header_t));
memset(&h, 0, sizeof(srslte::rlc_amd_pdu_header_t));
memcpy(b1.msg, &pdu3[0], PDU3_LEN);
b1.N_bytes = PDU3_LEN;

@ -39,12 +39,12 @@ uint32_t PDU2_LEN = 4;
using namespace srsue;
int main(int argc, char **argv) {
rlc_umd_pdu_header_t h;
srslte::rlc_umd_pdu_header_t h;
srslte::byte_buffer_t b1,b2;
memcpy(b1.msg, &pdu1[0], PDU1_LEN);
b1.N_bytes = PDU1_LEN;
rlc_um_read_data_pdu_header(&b1, RLC_UMD_SN_SIZE_10_BITS, &h);
rlc_um_read_data_pdu_header(&b1, srslte::RLC_UMD_SN_SIZE_10_BITS, &h);
assert(0x03 == h.fi);
assert(0 == h.N_li);
assert(226 == h.sn);
@ -55,11 +55,11 @@ int main(int argc, char **argv) {
b1.reset();
b2.reset();
memset(&h, 0, sizeof(rlc_umd_pdu_header_t));
memset(&h, 0, sizeof(srslte::rlc_umd_pdu_header_t));
memcpy(b1.msg, &pdu2[0], PDU2_LEN);
b1.N_bytes = PDU2_LEN;
rlc_um_read_data_pdu_header(&b1, RLC_UMD_SN_SIZE_10_BITS, &h);
rlc_um_read_data_pdu_header(&b1, srslte::RLC_UMD_SN_SIZE_10_BITS, &h);
assert(0x03 == h.fi);
assert(225 == h.sn);
assert(1 == h.N_li);

@ -27,9 +27,7 @@
#ifndef DEMUX_H
#define DEMUX_H
#include "srslte/common/interfaces.h"
#include "srslte/common/phy_interface.h"
#include "srslte/common/mac_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/pdu_queue.h"
#include "srslte/common/log.h"
#include "srslte/common/timers.h"
@ -56,7 +54,7 @@ public:
void set_uecrid_callback(bool (*callback)(void*, uint64_t), void *arg);
bool get_uecrid_successful();
void process_pdu(uint8_t *pdu, uint32_t nof_bytes);
void process_pdu(uint8_t *pdu, uint32_t nof_bytes, uint32_t tstamp);
private:
const static int NOF_HARQ_PID = 8;

@ -33,7 +33,7 @@
#include "mac/dl_sps.h"
#include "srslte/common/mac_pcap.h"
#include "srslte/common/mac_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
/* Downlink HARQ entity as defined in 5.3.2 of 36.321 */

@ -27,7 +27,6 @@
#ifndef DL_SPS_H
#define DL_SPS_H
#include "srslte/common/mac_interface.h"
#include "srslte/common/log.h"
#include "srslte/common/timers.h"

@ -39,8 +39,7 @@
#include "mac/mux.h"
#include "mac/demux.h"
#include "srslte/common/mac_pcap.h"
#include "srslte/common/phy_interface.h"
#include "srslte/common/mac_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/tti_sync_cv.h"
#include "srslte/common/threads.h"

@ -32,7 +32,7 @@
#include <vector>
#include "srslte/common/log.h"
#include "srslte/common/mac_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/pdu.h"
#include "mac/proc_bsr.h"
#include "mac/proc_phr.h"

@ -30,8 +30,7 @@
#include <stdint.h>
#include "srslte/common/log.h"
#include "srslte/common/mac_interface.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/timers.h"
/* Buffer status report procedure */

@ -29,10 +29,9 @@
#include <stdint.h>
#include "srslte/common/timers.h"
#include "srslte/common/phy_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/log.h"
#include "srslte/common/mac_interface.h"
/* Power headroom report procedure */

@ -28,8 +28,7 @@
#define PROCSR_H
#include <stdint.h>
#include "srslte/common/phy_interface.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/log.h"
/* Scheduling Request procedure as defined in 5.4.4 of 36.321 */

@ -27,7 +27,7 @@
#ifndef ULHARQ_H
#define ULHARQ_H
#include "srslte/common/mac_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/log.h"
#include "mac/mux.h"
#include "mac/ul_sps.h"

@ -31,8 +31,7 @@
#include <string.h>
#include <vector>
#include "srslte/srslte.h"
#include "srslte/common/mac_interface.h"
#include "srslte/common/phy_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/radio/radio.h"
#include "srslte/common/log.h"
#include "phy/phy_metrics.h"

@ -35,7 +35,7 @@
#include "phy/prach.h"
#include "phy/phch_worker.h"
#include "phy/phch_common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
namespace srsue {

@ -30,7 +30,6 @@
#include <string.h>
#include "srslte/srslte.h"
#include "srslte/common/thread_pool.h"
#include "srslte/common/phy_interface.h"
#include "srslte/common/trace.h"
#include "phy/phch_common.h"

@ -28,7 +28,6 @@
#define UEPHY_H
#include "srslte/srslte.h"
#include "srslte/common/phy_interface.h"
#include "srslte/common/log.h"
#include "phy/phy_metrics.h"
#include "phy/phch_recv.h"
@ -38,8 +37,7 @@
#include "srslte/radio/radio.h"
#include "srslte/common/task_dispatcher.h"
#include "srslte/common/trace.h"
#include "srslte/common/mac_interface.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
namespace srsue {

@ -32,7 +32,7 @@
#include "srslte/srslte.h"
#include "srslte/radio/radio.h"
#include "srslte/common/log.h"
#include "srslte/common/phy_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
namespace srsue {

@ -48,7 +48,7 @@
#include "upper/usim.h"
#include "srslte/common/buffer_pool.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/logger.h"
#include "srslte/common/log_filter.h"
@ -163,15 +163,15 @@ private:
virtual ~ue();
srslte::radio_multi radio;
srsue::phy phy;
srsue::mac mac;
srsue::phy phy;
srsue::mac mac;
srslte::mac_pcap mac_pcap;
srsue::rlc rlc;
srsue::pdcp pdcp;
srsue::rrc rrc;
srsue::nas nas;
srsue::gw gw;
srsue::usim usim;
srslte::rlc rlc;
srslte::pdcp pdcp;
srsue::rrc rrc;
srsue::nas nas;
srslte::gw gw;
srsue::usim usim;
srslte::logger logger;
srslte::log_filter rf_log;

@ -44,11 +44,11 @@ typedef struct {
}rf_metrics_t;
typedef struct {
rf_metrics_t rf;
phy_metrics_t phy;
mac_metrics_t mac;
rlc_metrics_t rlc;
gw_metrics_t gw;
rf_metrics_t rf;
phy_metrics_t phy;
mac_metrics_t mac;
srslte::rlc_metrics_t rlc;
srslte::gw_metrics_t gw;
}ue_metrics_t;
// UE interface

@ -30,7 +30,7 @@
#include "srslte/common/buffer_pool.h"
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/security.h"
#include "srslte/asn1/liblte_mme.h"
@ -106,8 +106,8 @@ private:
uint8_t k_nas_enc[32];
uint8_t k_nas_int[32];
CIPHERING_ALGORITHM_ID_ENUM cipher_algo;
INTEGRITY_ALGORITHM_ID_ENUM integ_algo;
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo;
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo;
void integrity_generate(uint8_t *key_128,
uint32_t count,

@ -32,7 +32,7 @@
#include "srslte/common/buffer_pool.h"
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/security.h"
#include <map>
@ -112,8 +112,8 @@ private:
uint8_t k_up_enc[32];
uint8_t k_up_int[32]; // Not used: only for relay nodes (3GPP 33.401 Annex A.7)
CIPHERING_ALGORITHM_ID_ENUM cipher_algo;
INTEGRITY_ALGORITHM_ID_ENUM integ_algo;
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo;
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo;
LIBLTE_RRC_MIB_STRUCT mib;
LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_1_STRUCT sib1;

@ -30,7 +30,7 @@
#include <string>
#include "srslte/common/log.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/security.h"
namespace srsue {
@ -71,8 +71,8 @@ public:
void generate_nas_keys(uint8_t *k_nas_enc,
uint8_t *k_nas_int,
CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
INTEGRITY_ALGORITHM_ID_ENUM integ_algo);
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo);
// RRC interface
void generate_as_keys(uint32_t count_ul,
@ -80,8 +80,8 @@ public:
uint8_t *k_rrc_int,
uint8_t *k_up_enc,
uint8_t *k_up_int,
CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
INTEGRITY_ALGORITHM_ID_ENUM integ_algo);
srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo,
srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo);
private:

@ -32,7 +32,7 @@
#include "mac/mac.h"
#include "mac/demux.h"
#include "srslte/common/phy_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
namespace srsue {
@ -139,7 +139,7 @@ bool demux::process_pdus()
return pdus.process_pdus();
}
void demux::process_pdu(uint8_t *mac_pdu, uint32_t nof_bytes)
void demux::process_pdu(uint8_t *mac_pdu, uint32_t nof_bytes, uint32_t tstamp)
{
// Unpack DLSCH MAC PDU
mac_msg.init_rx(nof_bytes);

@ -155,7 +155,9 @@ void mac::run_thread() {
if (started) {
log_h->step(tti);
timers_db.step_all();
// Step all procedures
bsr_procedure.step(tti);
phr_procedure.step(tti);

@ -32,7 +32,7 @@
#include "mac/proc_phr.h"
#include "mac/mac.h"
#include "mac/mux.h"
#include "srslte/common/phy_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
namespace srsue {

@ -27,8 +27,7 @@
#include <unistd.h>
#include <string.h>
#include "phy/phch_worker.h"
#include "srslte/common/mac_interface.h"
#include "srslte/common/phy_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/asn1/liblte_rrc.h"
#define Error(fmt, ...) if (SRSLTE_DEBUG_ENABLED) phy->log_h->error_line(__FILE__, __LINE__, fmt, ##__VA_ARGS__)

@ -32,7 +32,7 @@
#include "srslte/common/log.h"
#include "phy/prach.h"
#include "phy/phy.h"
#include "srslte/common/phy_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#define Error(fmt, ...) if (SRSLTE_DEBUG_ENABLED) log_h->error_line(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define Warning(fmt, ...) if (SRSLTE_DEBUG_ENABLED) log_h->warning_line(__FILE__, __LINE__, fmt, ##__VA_ARGS__)

@ -29,7 +29,7 @@
#include <sstream>
#include "upper/rrc.h"
#include <srslte/phy/utils/bit.h>
#include "srslte/phy/utils/bit.h"
#include "srslte/common/security.h"
#include "srslte/common/bcd_helpers.h"

@ -31,7 +31,7 @@
#include "srslte/asn1/liblte_rrc.h"
#include "srslte/radio/radio_multi.h"
#include "phy/phy.h"
#include "srslte/common/mac_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/log_stdout.h"
#include "mac/mac.h"
#include "srslte/common/mac_pcap.h"

@ -28,7 +28,7 @@
#include "srslte/phy/utils/debug.h"
#include "phy/phy.h"
#include "srslte/common/phy_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/common/log_stdout.h"
#include "srslte/radio/radio_multi.h"

@ -29,7 +29,7 @@
#include "srslte/phy/utils/debug.h"
#include "phy/phy.h"
#include "srslte/common/log_stdout.h"
#include "srslte/common/mac_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/radio/radio_multi.h"

@ -124,7 +124,7 @@ public:
read_enable = true;
}
void init(srsue::phy *phy_, srsue::mac *mac_, srsue::rlc *rlc_, srslte::log *log_h_, std::string ip_address) {
void init(srsue::phy *phy_, srsue::mac *mac_, srslte::rlc *rlc_, srslte::log *log_h_, std::string ip_address) {
log_h = log_h_;
rlc = rlc_;
mac = mac_;
@ -333,7 +333,7 @@ private:
bool running;
srslte::log *log_h;
srslte::byte_buffer_pool *pool;
srsue::rlc *rlc;
srslte::rlc *rlc;
srsue::mac *mac;
srsue::phy *phy;
srslte::bit_buffer_t bit_buf;
@ -472,7 +472,7 @@ srslte::log_filter log_tester;
srslte::mac_pcap mac_pcap;
srsue::phy my_phy;
srsue::mac my_mac;
srsue::rlc rlc;
srslte::rlc rlc;
srslte::radio_multi my_radio;
// Local classes for testing

@ -33,7 +33,7 @@
#include "srslte/upper/pdcp_entity.h"
#include "srslte/upper/pdcp.h"
#include "srslte/common/log_stdout.h"
#include "srslte/common/interfaces.h"
#include "srslte/interfaces/ue_interfaces.h"
using namespace srsue;

Loading…
Cancel
Save