mirror of https://github.com/PentHertz/srsLTE.git
Created log and params interfaces
This commit is contained in:
parent
9c10861128
commit
dc9464be9c
|
@ -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 <stdint.h>
|
||||
#include <string>
|
||||
|
||||
/******************************************************************************
|
||||
* 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
|
||||
|
|
@ -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;
|
||||
|
|
|
@ -39,8 +39,8 @@ namespace ue {
|
|||
{
|
||||
public:
|
||||
|
||||
phy_params();
|
||||
~phy_params();
|
||||
phy_params() : params_db(NOF_PARAMS) { }
|
||||
~phy_params() {}
|
||||
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 <string.h>
|
||||
#include <strings.h>
|
||||
#include <pthread.h>
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 <string.h>
|
||||
#include <strings.h>
|
||||
#include <pthread.h>
|
||||
#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()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue