diff --git a/srslte/include/srslte/ue_itf/log.h b/srslte/include/srslte/ue_itf/log.h new file mode 100644 index 000000000..0045ec3e3 --- /dev/null +++ b/srslte/include/srslte/ue_itf/log.h @@ -0,0 +1,74 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2014 The srsLTE Developers. See the + * COPYRIGHT file at the top-level directory of this distribution. + * + * \section LICENSE + * + * This file is part of the srsLTE library. + * + * srsLTE is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * srsLTE 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 Lesser General Public License for more details. + * + * A copy of the GNU Lesser 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/. + * + */ + +#include +#include + +/****************************************************************************** + * File: log.h + * + * Description: Abstract logging service + * + * Reference: + *****************************************************************************/ + +#ifndef LOG_H +#define LOG_H + +using namespace std; + +namespace srslte { + +class log +{ +public: + + log(string service_name_) { service_name = service_name_; } + + // Pure virtual methods for logging + virtual void error(uint32_t tti, string message, ...) = 0; + virtual void warning(uint32_t tti, string message, ...) = 0; + virtual void info(uint32_t tti, string message, ...) = 0; + virtual void debug(uint32_t tti, string message, ...) = 0; + + // Same with line and file info + virtual void error(uint32_t tti, string file, int line, string message, ...) = 0; + virtual void warning(uint32_t tti, string file, int line, string message, ...) = 0; + virtual void info(uint32_t tti, string file, int line, string message, ...) = 0; + virtual void debug(uint32_t tti, string file, int line, string message, ...) = 0; + +protected: + string get_service_name() { return service_name; } + +private: + string service_name; +}; + +} + +#endif + diff --git a/srslte/include/srslte/ue_itf/params_db.h b/srslte/include/srslte/ue_itf/params_db.h index 537604f9a..c7d898f2a 100644 --- a/srslte/include/srslte/ue_itf/params_db.h +++ b/srslte/include/srslte/ue_itf/params_db.h @@ -35,12 +35,25 @@ namespace ue { class SRSLTE_API params_db { public: - params_db(); - ~params_db(); - void init_db(uint32_t nof_params); - void free_db(); - void set_param(uint32_t param_idx, int64_t value); - int64_t get_param(uint32_t param_idx); + params_db(uint32_t nof_params_) { + nof_params = nof_params_; + db = new int64_t[nof_params_]; + } + ~params_db() { + delete db; + } + void set_param(uint32_t param_idx, int64_t value) { + if (param_idx < nof_params) { + db[param_idx] = value; + } + } + int64_t get_param(uint32_t param_idx) { + if (param_idx < nof_params) { + return db[param_idx]; + } else { + return -1; + } + } private: uint32_t nof_params; diff --git a/srslte/include/srslte/ue_itf/phy_params.h b/srslte/include/srslte/ue_itf/phy_params.h index d9646f67e..cc0c702db 100644 --- a/srslte/include/srslte/ue_itf/phy_params.h +++ b/srslte/include/srslte/ue_itf/phy_params.h @@ -39,8 +39,8 @@ namespace ue { { public: - phy_params(); - ~phy_params(); + phy_params() : params_db(NOF_PARAMS) { } + ~phy_params() {} typedef enum { diff --git a/srslte/include/srslte/ue_itf/sched_grant.h b/srslte/include/srslte/ue_itf/sched_grant.h index c293ce3f8..6c4e8fa94 100644 --- a/srslte/include/srslte/ue_itf/sched_grant.h +++ b/srslte/include/srslte/ue_itf/sched_grant.h @@ -44,11 +44,13 @@ namespace ue { uint32_t get_rv(); void set_rv(uint32_t rv); bool get_ndi(); + void set_ndi(bool value); bool get_cqi_request(); int get_harq_process(); bool is_uplink(); bool is_downlink(); void* get_grant_ptr(); + bool is_sps_release(); void set_ncce(uint32_t ncce); uint32_t get_ncce(); uint32_t get_tbs(); diff --git a/srslte/lib/ue_itf/src/params_db.cc b/srslte/lib/ue_itf/src/params_db.cc deleted file mode 100644 index a0bb92326..000000000 --- a/srslte/lib/ue_itf/src/params_db.cc +++ /dev/null @@ -1,71 +0,0 @@ -/** - * - * \section COPYRIGHT - * - * Copyright 2013-2014 The srsLTE Developers. See the - * COPYRIGHT file at the top-level directory of this distribution. - * - * \section LICENSE - * - * This file is part of the srsLTE library. - * - * srsLTE is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. - * - * srsLTE 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 Lesser General Public License for more details. - * - * A copy of the GNU Lesser 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/. - * - */ - -#include -#include -#include -#include "srslte/srslte.h" - -#include "srslte/ue_itf/params_db.h" - -namespace srslte { - namespace ue { - - params_db::params_db() { - db = NULL; - } - - params_db::~params_db() - { - if (db) { - free(db); - } - } - - void params_db::init_db(uint32_t nof_params_) - { - nof_params = nof_params_; - db = (int64_t*) malloc(sizeof(int64_t)*nof_params); - } - - void params_db::set_param(uint32_t param_idx, int64_t value) - { - if (param_idx < nof_params) { - db[param_idx] = value; - } - } - - int64_t params_db::get_param(uint32_t param_idx) - { - if (param_idx < nof_params) { - return db[param_idx]; - } else { - return -1; - } - } - } -} diff --git a/srslte/lib/ue_itf/src/phy_params.cc b/srslte/lib/ue_itf/src/phy_params.cc deleted file mode 100644 index d7ebd9088..000000000 --- a/srslte/lib/ue_itf/src/phy_params.cc +++ /dev/null @@ -1,49 +0,0 @@ -/** - * - * \section COPYRIGHT - * - * Copyright 2013-2014 The srsLTE Developers. See the - * COPYRIGHT file at the top-level directory of this distribution. - * - * \section LICENSE - * - * This file is part of the srsLTE library. - * - * srsLTE is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. - * - * srsLTE 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 Lesser General Public License for more details. - * - * A copy of the GNU Lesser 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/. - * - */ - -#include -#include -#include -#include "srslte/srslte.h" - -#include "srslte/ue_itf/params_db.h" -#include "srslte/ue_itf/phy_params.h" - -namespace srslte { - namespace ue { - - phy_params::phy_params() - { - init_db(NOF_PARAMS); - } - - phy_params::~phy_params() - { - } - - } -} diff --git a/srslte/lib/ue_itf/src/sched_grant.cc b/srslte/lib/ue_itf/src/sched_grant.cc index 8076120a7..ac2c58447 100644 --- a/srslte/lib/ue_itf/src/sched_grant.cc +++ b/srslte/lib/ue_itf/src/sched_grant.cc @@ -67,6 +67,11 @@ namespace ue { return ncce; } + bool srslte::ue::sched_grant::is_sps_release() + { + return false; + } + void sched_grant::set_ncce(uint32_t ncce_) { ncce = ncce_; @@ -99,6 +104,14 @@ namespace ue { } } + void sched_grant::set_ndi(bool value) { + if (dir == UPLINK) { + ul_grant.ndi = value; + } else { + dl_grant.ndi = value; + } + } + bool sched_grant::get_cqi_request() { if (dir == UPLINK) { return ul_grant.ndi;