mirror of https://github.com/pvnis/srsRAN_4G.git
Merge branch 'next'
commit
4bbcfaa1dc
@ -1,82 +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: log_stout.h
|
|
||||||
*
|
|
||||||
* Description: Logging service through standard output. Inherits log interface
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef LOGSTDOUT_H
|
|
||||||
#define LOGSTDOUT_H
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string>
|
|
||||||
#include "srslte/common/log.h"
|
|
||||||
|
|
||||||
namespace srslte {
|
|
||||||
|
|
||||||
class log_stdout : public log
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
log_stdout(std::string service_name_) : log(service_name_) { }
|
|
||||||
|
|
||||||
void console(std::string message, ...);
|
|
||||||
void error(std::string message, ...);
|
|
||||||
void warning(std::string message, ...);
|
|
||||||
void info(std::string message, ...);
|
|
||||||
void debug(std::string message, ...);
|
|
||||||
|
|
||||||
// Same with hex dump
|
|
||||||
void error_hex(uint8_t *hex, int size, std::string message, ...);
|
|
||||||
void warning_hex(uint8_t *hex, int size, std::string message, ...);
|
|
||||||
void info_hex(uint8_t *hex, int size, std::string message, ...);
|
|
||||||
void debug_hex(uint8_t *hex, int size, std::string message, ...);
|
|
||||||
|
|
||||||
// Same with line and file info
|
|
||||||
void error_line(std::string file, int line, std::string message, ...);
|
|
||||||
void warning_line(std::string file, int line, std::string message, ...);
|
|
||||||
void info_line(std::string file, int line, std::string message, ...);
|
|
||||||
void debug_line(std::string file, int line, std::string message, ...);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void printlog(srslte::LOG_LEVEL_ENUM level, uint32_t tti, std::string file, int line, std::string message, va_list args);
|
|
||||||
void printlog(srslte::LOG_LEVEL_ENUM level, uint32_t tti, std::string message, va_list args);
|
|
||||||
|
|
||||||
void all_log(srslte::LOG_LEVEL_ENUM level, uint32_t tti, char *msg);
|
|
||||||
void all_log(srslte::LOG_LEVEL_ENUM level, uint32_t tti, char *msg, uint8_t *hex, int size);
|
|
||||||
void all_log_line(srslte::LOG_LEVEL_ENUM level, uint32_t tti, std::string file, int line, char *msg);
|
|
||||||
std::string now_time();
|
|
||||||
std::string hex_string(uint8_t *hex, int size);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -0,0 +1,76 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \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: logger_file.h
|
||||||
|
* Description: Common log object. Maintains a queue of log messages
|
||||||
|
* and runs a thread to read messages and write to file.
|
||||||
|
* Multiple producers, single consumer. If full, producers
|
||||||
|
* increase queue size. If empty, consumer blocks.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef LOGGER_FILE_H
|
||||||
|
#define LOGGER_FILE_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <deque>
|
||||||
|
#include <string>
|
||||||
|
#include "srslte/common/logger.h"
|
||||||
|
#include "srslte/common/threads.h"
|
||||||
|
|
||||||
|
namespace srslte {
|
||||||
|
|
||||||
|
typedef std::string* str_ptr;
|
||||||
|
|
||||||
|
class logger_file : public thread, public logger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
logger_file();
|
||||||
|
logger_file(std::string file);
|
||||||
|
~logger_file();
|
||||||
|
void init(std::string file);
|
||||||
|
// Implementation of log_out
|
||||||
|
void log(str_ptr msg);
|
||||||
|
void log(const char *msg);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void run_thread();
|
||||||
|
void flush();
|
||||||
|
|
||||||
|
FILE* logfile;
|
||||||
|
bool inited;
|
||||||
|
bool not_done;
|
||||||
|
std::string filename;
|
||||||
|
pthread_cond_t not_empty;
|
||||||
|
pthread_cond_t not_full;
|
||||||
|
pthread_mutex_t mutex;
|
||||||
|
pthread_t thread;
|
||||||
|
std::deque<str_ptr> buffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace srsue
|
||||||
|
|
||||||
|
#endif // LOGGER_H
|
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \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: logger_stdout.h
|
||||||
|
* Description: Interface for logging output
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef LOGGER_STDOUT_H
|
||||||
|
#define LOGGER_STDOUT_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
#include "srslte/common/logger.h"
|
||||||
|
|
||||||
|
namespace srslte {
|
||||||
|
|
||||||
|
class logger_stdout : public logger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void log(std::string *msg) {
|
||||||
|
fprintf(stdout, "%s", msg->c_str());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace srslte
|
||||||
|
|
||||||
|
#endif // LOGGER_H
|
@ -0,0 +1,122 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2015 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* \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 Affero 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 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: turbodecoder.h
|
||||||
|
*
|
||||||
|
* Description: Turbo Decoder.
|
||||||
|
* Parallel Concatenated Convolutional Code (PCCC) with two 8-state constituent
|
||||||
|
* encoders and one turbo code internal interleaver. The coding rate of turbo
|
||||||
|
* encoder is 1/3.
|
||||||
|
* MAP_GEN is the MAX-LOG-MAP generic implementation of the decoder.
|
||||||
|
*
|
||||||
|
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.1.3.2
|
||||||
|
*********************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef TURBODECODER_SSE_
|
||||||
|
#define TURBODECODER_SSE_
|
||||||
|
|
||||||
|
#include "srslte/config.h"
|
||||||
|
#include "srslte/phy/fec/tc_interl.h"
|
||||||
|
#include "srslte/phy/fec/cbsegm.h"
|
||||||
|
|
||||||
|
// Define maximum number of CB decoded in parallel (2 for AVX2)
|
||||||
|
#define SRSLTE_TDEC_MAX_NPAR 2
|
||||||
|
|
||||||
|
#define SRSLTE_TCOD_RATE 3
|
||||||
|
#define SRSLTE_TCOD_TOTALTAIL 12
|
||||||
|
|
||||||
|
#define SRSLTE_TCOD_MAX_LEN_CB 6144
|
||||||
|
#define SRSLTE_TCOD_MAX_LEN_CODED (SRSLTE_TCOD_RATE*SRSLTE_TCOD_MAX_LEN_CB+SRSLTE_TCOD_TOTALTAIL)
|
||||||
|
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
uint32_t max_long_cb;
|
||||||
|
uint32_t max_par_cb;
|
||||||
|
int16_t *alpha;
|
||||||
|
int16_t *branch;
|
||||||
|
} map_gen_t;
|
||||||
|
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
uint32_t max_long_cb;
|
||||||
|
uint32_t max_par_cb;
|
||||||
|
|
||||||
|
map_gen_t dec;
|
||||||
|
|
||||||
|
int16_t *app1[SRSLTE_TDEC_MAX_NPAR];
|
||||||
|
int16_t *app2[SRSLTE_TDEC_MAX_NPAR];
|
||||||
|
int16_t *ext1[SRSLTE_TDEC_MAX_NPAR];
|
||||||
|
int16_t *ext2[SRSLTE_TDEC_MAX_NPAR];
|
||||||
|
int16_t *syst[SRSLTE_TDEC_MAX_NPAR];
|
||||||
|
int16_t *parity0[SRSLTE_TDEC_MAX_NPAR];
|
||||||
|
int16_t *parity1[SRSLTE_TDEC_MAX_NPAR];
|
||||||
|
|
||||||
|
int cb_mask;
|
||||||
|
int current_cbidx;
|
||||||
|
srslte_tc_interl_t interleaver[SRSLTE_NOF_TC_CB_SIZES];
|
||||||
|
int n_iter[SRSLTE_TDEC_MAX_NPAR];
|
||||||
|
} srslte_tdec_simd_t;
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_tdec_simd_init(srslte_tdec_simd_t * h,
|
||||||
|
uint32_t max_par_cb,
|
||||||
|
uint32_t max_long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_tdec_simd_free(srslte_tdec_simd_t * h);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_tdec_simd_reset(srslte_tdec_simd_t * h,
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_tdec_simd_get_nof_iterations_cb(srslte_tdec_simd_t * h,
|
||||||
|
uint32_t cb_idx);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_tdec_simd_reset_cb(srslte_tdec_simd_t * h,
|
||||||
|
uint32_t cb_idx);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_tdec_simd_iteration(srslte_tdec_simd_t * h,
|
||||||
|
int16_t * input[SRSLTE_TDEC_MAX_NPAR],
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_tdec_simd_decision(srslte_tdec_simd_t * h,
|
||||||
|
uint8_t *output[SRSLTE_TDEC_MAX_NPAR],
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_tdec_simd_decision_byte(srslte_tdec_simd_t * h,
|
||||||
|
uint8_t *output[SRSLTE_TDEC_MAX_NPAR],
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_tdec_simd_decision_byte_cb(srslte_tdec_simd_t * h,
|
||||||
|
uint8_t *output,
|
||||||
|
uint32_t cbidx,
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_tdec_simd_run_all(srslte_tdec_simd_t * h,
|
||||||
|
int16_t * input[SRSLTE_TDEC_MAX_NPAR],
|
||||||
|
uint8_t *output[SRSLTE_TDEC_MAX_NPAR],
|
||||||
|
uint32_t nof_iterations,
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,119 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2015 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* \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 Affero 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 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: turbodecoder.h
|
||||||
|
*
|
||||||
|
* Description: Turbo Decoder.
|
||||||
|
* Parallel Concatenated Convolutional Code (PCCC) with two 8-state constituent
|
||||||
|
* encoders and one turbo code internal interleaver. The coding rate of turbo
|
||||||
|
* encoder is 1/3.
|
||||||
|
* MAP_GEN is the MAX-LOG-MAP generic implementation of the decoder.
|
||||||
|
*
|
||||||
|
* Reference: 3GPP TS 36.212 version 10.0.0 Release 10 Sec. 5.1.3.2
|
||||||
|
*********************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef TURBODECODER_SSE_INTER_
|
||||||
|
#define TURBODECODER_SSE_INTER_
|
||||||
|
|
||||||
|
|
||||||
|
/** This is an simd inter-frame parallel turbo decoder. Parallizes 8 code-blocks using SSE
|
||||||
|
* This implementation is currently not functional and not used by the rest of the code
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "srslte/config.h"
|
||||||
|
#include "srslte/phy/fec/tc_interl.h"
|
||||||
|
#include "srslte/phy/fec/cbsegm.h"
|
||||||
|
|
||||||
|
#if LV_HAVE_AVX2
|
||||||
|
#define SRSLTE_TDEC_MAX_NPAR 16
|
||||||
|
#else
|
||||||
|
#define SRSLTE_TDEC_MAX_NPAR 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
int max_long_cb;
|
||||||
|
|
||||||
|
int16_t *syst0;
|
||||||
|
int16_t *parity0;
|
||||||
|
int16_t *syst1;
|
||||||
|
int16_t *parity1;
|
||||||
|
int16_t *llr1;
|
||||||
|
int16_t *llr2;
|
||||||
|
int16_t *w;
|
||||||
|
int16_t *alpha;
|
||||||
|
|
||||||
|
uint32_t max_par_cb;
|
||||||
|
int current_cbidx;
|
||||||
|
uint32_t current_long_cb;
|
||||||
|
srslte_tc_interl_t interleaver[SRSLTE_NOF_TC_CB_SIZES];
|
||||||
|
int n_iter[SRSLTE_TDEC_MAX_NPAR];
|
||||||
|
} srslte_tdec_simd_inter_t;
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_tdec_simd_inter_init(srslte_tdec_simd_inter_t * h,
|
||||||
|
uint32_t max_par_cb,
|
||||||
|
uint32_t max_long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_tdec_simd_inter_free(srslte_tdec_simd_inter_t * h);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_tdec_simd_inter_reset(srslte_tdec_simd_inter_t * h,
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_tdec_simd_inter_get_nof_iterations_cb(srslte_tdec_simd_inter_t * h,
|
||||||
|
uint32_t cb_idx);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_tdec_simd_inter_reset_cb(srslte_tdec_simd_inter_t * h,
|
||||||
|
uint32_t cb_idx);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_tdec_simd_inter_iteration(srslte_tdec_simd_inter_t * h,
|
||||||
|
int16_t * input[SRSLTE_TDEC_MAX_NPAR],
|
||||||
|
uint32_t nof_cb,
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_tdec_simd_inter_decision(srslte_tdec_simd_inter_t * h,
|
||||||
|
uint8_t *output[SRSLTE_TDEC_MAX_NPAR],
|
||||||
|
uint32_t nof_cb,
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_tdec_simd_inter_decision_byte(srslte_tdec_simd_inter_t * h,
|
||||||
|
uint8_t *output[SRSLTE_TDEC_MAX_NPAR],
|
||||||
|
uint32_t nof_cb,
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_tdec_simd_inter_decision_byte_cb(srslte_tdec_simd_inter_t * h,
|
||||||
|
uint8_t *output,
|
||||||
|
uint32_t cbidx,
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_tdec_simd_inter_run_all(srslte_tdec_simd_inter_t * h,
|
||||||
|
int16_t *input[SRSLTE_TDEC_MAX_NPAR],
|
||||||
|
uint8_t *output[SRSLTE_TDEC_MAX_NPAR],
|
||||||
|
uint32_t nof_iterations,
|
||||||
|
uint32_t nof_cb,
|
||||||
|
uint32_t long_cb);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,152 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2015 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* \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 Affero 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 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: pmch.h
|
||||||
|
*
|
||||||
|
* Description: Physical multicast channel
|
||||||
|
*
|
||||||
|
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6.5
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef PMCH_
|
||||||
|
#define PMCH_
|
||||||
|
|
||||||
|
#include "srslte/config.h"
|
||||||
|
#include "srslte/phy/common/phy_common.h"
|
||||||
|
#include "srslte/phy/mimo/precoding.h"
|
||||||
|
#include "srslte/phy/mimo/layermap.h"
|
||||||
|
#include "srslte/phy/modem/mod.h"
|
||||||
|
#include "srslte/phy/modem/demod_soft.h"
|
||||||
|
#include "srslte/phy/scrambling/scrambling.h"
|
||||||
|
#include "srslte/phy/phch/dci.h"
|
||||||
|
#include "srslte/phy/phch/regs.h"
|
||||||
|
#include "srslte/phy/phch/sch.h"
|
||||||
|
#include "srslte/phy/common/sequence.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
srslte_sequence_t seq[SRSLTE_NSUBFRAMES_X_FRAME];
|
||||||
|
} srslte_pmch_seq_t;
|
||||||
|
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
srslte_cbsegm_t cb_segm;
|
||||||
|
srslte_ra_dl_grant_t grant;
|
||||||
|
srslte_ra_nbits_t nbits[SRSLTE_MAX_CODEWORDS];
|
||||||
|
uint32_t sf_idx;
|
||||||
|
} srslte_pmch_cfg_t;
|
||||||
|
|
||||||
|
/* PMCH object */
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
srslte_cell_t cell;
|
||||||
|
|
||||||
|
uint32_t nof_rx_antennas;
|
||||||
|
|
||||||
|
uint32_t max_re;
|
||||||
|
|
||||||
|
/* buffers */
|
||||||
|
// void buffers are shared for tx and rx
|
||||||
|
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
|
||||||
|
cf_t *symbols[SRSLTE_MAX_PORTS];
|
||||||
|
cf_t *x[SRSLTE_MAX_PORTS];
|
||||||
|
cf_t *d;
|
||||||
|
void *e;
|
||||||
|
|
||||||
|
/* tx & rx objects */
|
||||||
|
srslte_modem_table_t mod[4];
|
||||||
|
|
||||||
|
// This is to generate the scrambling seq for multiple MBSFN Area IDs
|
||||||
|
srslte_pmch_seq_t **seqs;
|
||||||
|
|
||||||
|
srslte_sch_t dl_sch;
|
||||||
|
|
||||||
|
} srslte_pmch_t;
|
||||||
|
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pmch_init(srslte_pmch_t *q,
|
||||||
|
uint32_t max_prb);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pmch_init_multi(srslte_pmch_t *q,
|
||||||
|
uint32_t max_prb,
|
||||||
|
uint32_t nof_rx_antennas);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_pmch_free(srslte_pmch_t *q);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pmch_set_area_id(srslte_pmch_t *q, uint16_t area_id);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_pmch_free_area_id(srslte_pmch_t *q, uint16_t area_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pmch_get(srslte_pmch_t *q, cf_t *sf_symbols, cf_t *symbols, uint32_t lstart);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pmch_put(srslte_pmch_t *q, cf_t *symbols, cf_t *sf_symbols, uint32_t lstart);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pmch_cp(srslte_pmch_t *q, cf_t *input, cf_t *output, uint32_t lstart_grant, bool put);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SRSLTE_API float srslte_pmch_coderate(uint32_t tbs,
|
||||||
|
uint32_t nof_re);
|
||||||
|
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pmch_cfg(srslte_pdsch_cfg_t *cfg,
|
||||||
|
srslte_cell_t cell,
|
||||||
|
srslte_ra_dl_grant_t *grant,
|
||||||
|
uint32_t cfi,
|
||||||
|
uint32_t sf_idx);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pmch_encode(srslte_pmch_t *q,
|
||||||
|
srslte_pdsch_cfg_t *cfg,
|
||||||
|
srslte_softbuffer_tx_t *softbuffer,
|
||||||
|
uint8_t *data,
|
||||||
|
uint16_t area_id,
|
||||||
|
cf_t *sf_symbols[SRSLTE_MAX_PORTS]);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pmch_decode(srslte_pmch_t *q,
|
||||||
|
srslte_pdsch_cfg_t *cfg,
|
||||||
|
srslte_softbuffer_rx_t *softbuffer,
|
||||||
|
cf_t *sf_symbols,
|
||||||
|
cf_t *ce[SRSLTE_MAX_PORTS],
|
||||||
|
float noise_estimate,
|
||||||
|
uint16_t area_id,
|
||||||
|
uint8_t *data);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pmch_decode_multi(srslte_pmch_t *q,
|
||||||
|
srslte_pdsch_cfg_t *cfg,
|
||||||
|
srslte_softbuffer_rx_t *softbuffer,
|
||||||
|
cf_t *sf_symbols[SRSLTE_MAX_PORTS],
|
||||||
|
cf_t *ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS],
|
||||||
|
float noise_estimate,
|
||||||
|
uint16_t area_id,
|
||||||
|
uint8_t *data);
|
||||||
|
|
||||||
|
SRSLTE_API float srslte_pmch_average_noi(srslte_pmch_t *q);
|
||||||
|
|
||||||
|
SRSLTE_API uint32_t srslte_pmch_last_noi(srslte_pmch_t *q);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,115 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2015 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* \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 Affero 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 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/.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_MAT_H
|
||||||
|
#define SRSLTE_MAT_H
|
||||||
|
|
||||||
|
#include "srslte/phy/utils/simd.h"
|
||||||
|
#include "srslte/config.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generic Macros
|
||||||
|
*/
|
||||||
|
#define RANDOM_CF() (((float)rand())/((float)RAND_MAX) + _Complex_I*((float)rand())/((float)RAND_MAX))
|
||||||
|
|
||||||
|
/* Generic implementation for complex reciprocal */
|
||||||
|
SRSLTE_API cf_t srslte_mat_cf_recip_gen(cf_t a);
|
||||||
|
|
||||||
|
/* Generic implementation for 2x2 determinant */
|
||||||
|
SRSLTE_API cf_t srslte_mat_2x2_det_gen(cf_t a00, cf_t a01, cf_t a10, cf_t a11);
|
||||||
|
|
||||||
|
/* Generic implementation for 2x2 Matrix Inversion */
|
||||||
|
SRSLTE_API void srslte_mat_2x2_inv_gen(cf_t a00, cf_t a01, cf_t a10, cf_t a11,
|
||||||
|
cf_t *r00, cf_t *r01, cf_t *r10, cf_t *r11);
|
||||||
|
|
||||||
|
/* Generic implementation for Zero Forcing (ZF) solver */
|
||||||
|
SRSLTE_API void srslte_mat_2x2_zf_gen(cf_t y0, cf_t y1,
|
||||||
|
cf_t h00, cf_t h01, cf_t h10, cf_t h11,
|
||||||
|
cf_t *x0, cf_t *x1,
|
||||||
|
float norm);
|
||||||
|
|
||||||
|
/* Generic implementation for Minimum Mean Squared Error (MMSE) solver */
|
||||||
|
SRSLTE_API void srslte_mat_2x2_mmse_gen(cf_t y0, cf_t y1,
|
||||||
|
cf_t h00, cf_t h01, cf_t h10, cf_t h11,
|
||||||
|
cf_t *x0, cf_t *x1,
|
||||||
|
float noise_estimate,
|
||||||
|
float norm);
|
||||||
|
|
||||||
|
SRSLTE_API float srslte_mat_2x2_cn(cf_t h00,
|
||||||
|
cf_t h01,
|
||||||
|
cf_t h10,
|
||||||
|
cf_t h11);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef LV_HAVE_SSE
|
||||||
|
#include <smmintrin.h>
|
||||||
|
|
||||||
|
/* SSE implementation for complex reciprocal */
|
||||||
|
SRSLTE_API __m128 srslte_mat_cf_recip_sse(__m128 a);
|
||||||
|
|
||||||
|
/* SSE implementation for 2x2 determinant */
|
||||||
|
SRSLTE_API __m128 srslte_mat_2x2_det_sse(__m128 a00, __m128 a01, __m128 a10, __m128 a11);
|
||||||
|
|
||||||
|
/* SSE implementation for Zero Forcing (ZF) solver */
|
||||||
|
SRSLTE_API void srslte_mat_2x2_zf_sse(__m128 y0, __m128 y1,
|
||||||
|
__m128 h00, __m128 h01, __m128 h10, __m128 h11,
|
||||||
|
__m128 *x0, __m128 *x1,
|
||||||
|
float norm);
|
||||||
|
|
||||||
|
/* SSE implementation for Minimum Mean Squared Error (MMSE) solver */
|
||||||
|
SRSLTE_API void srslte_mat_2x2_mmse_sse(__m128 y0, __m128 y1,
|
||||||
|
__m128 h00, __m128 h01, __m128 h10, __m128 h11,
|
||||||
|
__m128 *x0, __m128 *x1,
|
||||||
|
float noise_estimate, float norm);
|
||||||
|
|
||||||
|
#endif /* LV_HAVE_SSE */
|
||||||
|
|
||||||
|
#ifdef LV_HAVE_AVX
|
||||||
|
|
||||||
|
#include <immintrin.h>
|
||||||
|
|
||||||
|
/* AVX implementation for complex reciprocal */
|
||||||
|
SRSLTE_API __m256 srslte_mat_cf_recip_avx(__m256 a);
|
||||||
|
|
||||||
|
/* AVX implementation for 2x2 determinant */
|
||||||
|
SRSLTE_API __m256 srslte_mat_2x2_det_avx(__m256 a00, __m256 a01, __m256 a10, __m256 a11);
|
||||||
|
|
||||||
|
/* AVX implementation for Zero Forcing (ZF) solver */
|
||||||
|
SRSLTE_API void srslte_mat_2x2_zf_avx(__m256 y0, __m256 y1,
|
||||||
|
__m256 h00, __m256 h01, __m256 h10, __m256 h11,
|
||||||
|
__m256 *x0, __m256 *x1,
|
||||||
|
float norm);
|
||||||
|
|
||||||
|
/* AVX implementation for Minimum Mean Squared Error (MMSE) solver */
|
||||||
|
SRSLTE_API void srslte_mat_2x2_mmse_avx(__m256 y0, __m256 y1,
|
||||||
|
__m256 h00, __m256 h01, __m256 h10, __m256 h11,
|
||||||
|
__m256 *x0, __m256 *x1,
|
||||||
|
float noise_estimate, float norm);
|
||||||
|
|
||||||
|
#endif /* LV_HAVE_AVX */
|
||||||
|
|
||||||
|
#endif /* SRSLTE_MAT_H */
|
@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2015 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* \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 Affero 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 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/.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_SIMD_H_H
|
||||||
|
#define SRSLTE_SIMD_H_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SSE Macros
|
||||||
|
*/
|
||||||
|
#ifdef LV_HAVE_SSE
|
||||||
|
#define _MM_SWAP(X) ((__m128)_mm_shuffle_ps(X, X, _MM_SHUFFLE(2,3,0,1)))
|
||||||
|
#define _MM_PERM(X) ((__m128)_mm_shuffle_ps(X, X, _MM_SHUFFLE(2,1,3,0)))
|
||||||
|
#define _MM_MULJ_PS(X) _MM_SWAP(_MM_CONJ_PS(X))
|
||||||
|
#define _MM_CONJ_PS(X) (_mm_xor_ps(X, _mm_set_ps(-0.0f, 0.0f, -0.0f, 0.0f)))
|
||||||
|
#define _MM_SQMOD_PS(X) _MM_PERM(_mm_hadd_ps(_mm_mul_ps(X,X), _mm_set_ps(0.0f, 0.0f, 0.0f, 0.0f)))
|
||||||
|
#define _MM_PROD_PS(a, b) _mm_addsub_ps(_mm_mul_ps(a,_mm_moveldup_ps(b)),_mm_mul_ps(\
|
||||||
|
_mm_shuffle_ps(a,a,0xB1),_mm_movehdup_ps(b)))
|
||||||
|
|
||||||
|
#endif /* LV_HAVE_SSE */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AVX Macros
|
||||||
|
*/
|
||||||
|
#ifdef LV_HAVE_AVX
|
||||||
|
|
||||||
|
#define _MM256_MULJ_PS(X) _mm256_permute_ps(_MM256_CONJ_PS(X), 0b10110001)
|
||||||
|
#define _MM256_CONJ_PS(X) (_mm256_xor_ps(X, _mm256_set_ps(-0.0f, 0.0f, -0.0f, 0.0f, -0.0f, 0.0f, -0.0f, 0.0f)))
|
||||||
|
|
||||||
|
#ifdef LV_HAVE_FMA
|
||||||
|
#define _MM256_SQMOD_PS(A, B) _mm256_permute_ps(_mm256_hadd_ps(_mm256_fmadd_ps(A, A, _mm256_mul_ps(B,B)), \
|
||||||
|
_mm256_set_ps(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)), 0b11011100)
|
||||||
|
#define _MM256_PROD_PS(a, b) _mm256_fmaddsub_ps(a,_mm256_moveldup_ps(b),\
|
||||||
|
_mm256_mul_ps(_mm256_shuffle_ps(a,a,0xB1),_mm256_movehdup_ps(b)))
|
||||||
|
#else
|
||||||
|
#define _MM256_SQMOD_PS(A, B) _mm256_permute_ps(_mm256_hadd_ps(_mm256_add_ps(_mm256_mul_ps(A,A), _mm256_mul_ps(B,B)), \
|
||||||
|
_mm256_set_ps(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)), 0b11011100)
|
||||||
|
#define _MM256_PROD_PS(a, b) _mm256_addsub_ps(_mm256_mul_ps(a,_mm256_moveldup_ps(b)),\
|
||||||
|
_mm256_mul_ps(_mm256_shuffle_ps(a,a,0xB1),_mm256_movehdup_ps(b)))
|
||||||
|
#endif /* LV_HAVE_FMA */
|
||||||
|
#endif /* LV_HAVE_AVX */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AVX extension with FMA Macros
|
||||||
|
*/
|
||||||
|
#ifdef LV_HAVE_FMA
|
||||||
|
|
||||||
|
#define _MM256_SQMOD_ADD_PS(A, B, C) _mm256_permute_ps(_mm256_hadd_ps(_mm256_fmadd_ps(A, A, _mm256_fmadd_ps(B, B, C)),\
|
||||||
|
_mm256_set_ps(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)), 0b11011100)
|
||||||
|
|
||||||
|
#define _MM256_PROD_ADD_PS(A, B, C) _mm256_fmaddsub_ps(A,_mm256_moveldup_ps(B),\
|
||||||
|
_mm256_fmaddsub_ps(_mm256_shuffle_ps(A,A,0xB1),_mm256_movehdup_ps(B), C))
|
||||||
|
|
||||||
|
#define _MM256_PROD_SUB_PS(A, B, C) _mm256_fmaddsub_ps(A,_mm256_moveldup_ps(B),\
|
||||||
|
_mm256_fmsubadd_ps(_mm256_shuffle_ps(A,A,0xB1),_mm256_movehdup_ps(B), C))
|
||||||
|
#endif /* LV_HAVE_FMA */
|
||||||
|
|
||||||
|
#endif //SRSLTE_SIMD_H_H
|
@ -0,0 +1,126 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \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/.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef RLC_INTERFACE_H
|
||||||
|
#define RLC_INTERFACE_H
|
||||||
|
|
||||||
|
// for custom constructors
|
||||||
|
#include "srslte/asn1/liblte_rrc.h"
|
||||||
|
|
||||||
|
namespace srslte {
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
RLC_UMD_SN_SIZE_5_BITS = 0,
|
||||||
|
RLC_UMD_SN_SIZE_10_BITS,
|
||||||
|
RLC_UMD_SN_SIZE_N_ITEMS,
|
||||||
|
}rlc_umd_sn_size_t;
|
||||||
|
static const char rlc_umd_sn_size_text[RLC_UMD_SN_SIZE_N_ITEMS][20] = {"5 bits", "10 bits"};
|
||||||
|
static const uint16_t rlc_umd_sn_size_num[RLC_UMD_SN_SIZE_N_ITEMS] = {5, 10};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/****************************************************************************
|
||||||
|
* Configurable parameters
|
||||||
|
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
// TX configs
|
||||||
|
int32_t t_poll_retx; // Poll retx timeout (ms)
|
||||||
|
int32_t poll_pdu; // Insert poll bit after this many PDUs
|
||||||
|
int32_t poll_byte; // Insert poll bit after this much data (KB)
|
||||||
|
uint32_t max_retx_thresh; // Max number of retx
|
||||||
|
|
||||||
|
// RX configs
|
||||||
|
int32_t t_reordering; // Timer used by rx to detect PDU loss (ms)
|
||||||
|
int32_t t_status_prohibit; // Timer used by rx to prohibit tx of status PDU (ms)
|
||||||
|
} srslte_rlc_am_config_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/****************************************************************************
|
||||||
|
* Configurable parameters
|
||||||
|
* Ref: 3GPP TS 36.322 v10.0.0 Section 7
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
int32_t t_reordering; // Timer used by rx to detect PDU loss (ms)
|
||||||
|
rlc_umd_sn_size_t tx_sn_field_length; // Number of bits used for tx (UL) sequence number
|
||||||
|
rlc_umd_sn_size_t rx_sn_field_length; // Number of bits used for rx (DL) sequence number
|
||||||
|
|
||||||
|
uint32_t rx_window_size;
|
||||||
|
uint32_t rx_mod; // Rx counter modulus
|
||||||
|
uint32_t tx_mod; // Tx counter modulus
|
||||||
|
} srslte_rlc_um_config_t;
|
||||||
|
|
||||||
|
|
||||||
|
class srslte_rlc_config_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LIBLTE_RRC_RLC_MODE_ENUM rlc_mode;
|
||||||
|
srslte_rlc_am_config_t am;
|
||||||
|
srslte_rlc_um_config_t um;
|
||||||
|
|
||||||
|
// Constructor based on liblte's RLC config
|
||||||
|
srslte_rlc_config_t(LIBLTE_RRC_RLC_CONFIG_STRUCT *cnfg) : rlc_mode(cnfg->rlc_mode), am(), um()
|
||||||
|
{
|
||||||
|
switch(rlc_mode)
|
||||||
|
{
|
||||||
|
case LIBLTE_RRC_RLC_MODE_AM:
|
||||||
|
am.t_poll_retx = liblte_rrc_t_poll_retransmit_num[cnfg->ul_am_rlc.t_poll_retx];
|
||||||
|
am.poll_pdu = liblte_rrc_poll_pdu_num[cnfg->ul_am_rlc.poll_pdu];
|
||||||
|
am.poll_byte = liblte_rrc_poll_byte_num[cnfg->ul_am_rlc.poll_byte]*1000; // KB
|
||||||
|
am.max_retx_thresh = liblte_rrc_max_retx_threshold_num[cnfg->ul_am_rlc.max_retx_thresh];
|
||||||
|
am.t_reordering = liblte_rrc_t_reordering_num[cnfg->dl_am_rlc.t_reordering];
|
||||||
|
am.t_status_prohibit = liblte_rrc_t_status_prohibit_num[cnfg->dl_am_rlc.t_status_prohibit];
|
||||||
|
break;
|
||||||
|
case LIBLTE_RRC_RLC_MODE_UM_BI:
|
||||||
|
um.t_reordering = liblte_rrc_t_reordering_num[cnfg->dl_um_bi_rlc.t_reordering];
|
||||||
|
um.rx_sn_field_length = (rlc_umd_sn_size_t)cnfg->dl_um_bi_rlc.sn_field_len;
|
||||||
|
um.rx_window_size = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 16 : 512;
|
||||||
|
um.rx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 32 : 1024;
|
||||||
|
um.tx_sn_field_length = (rlc_umd_sn_size_t)cnfg->ul_um_bi_rlc.sn_field_len;
|
||||||
|
um.tx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.tx_sn_field_length) ? 32 : 1024;
|
||||||
|
break;
|
||||||
|
case LIBLTE_RRC_RLC_MODE_UM_UNI_UL:
|
||||||
|
um.tx_sn_field_length = (rlc_umd_sn_size_t)cnfg->ul_um_uni_rlc.sn_field_len;
|
||||||
|
um.tx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.tx_sn_field_length) ? 32 : 1024;
|
||||||
|
break;
|
||||||
|
case LIBLTE_RRC_RLC_MODE_UM_UNI_DL:
|
||||||
|
um.t_reordering = liblte_rrc_t_reordering_num[cnfg->dl_um_uni_rlc.t_reordering];
|
||||||
|
um.rx_sn_field_length = (rlc_umd_sn_size_t)cnfg->dl_um_uni_rlc.sn_field_len;
|
||||||
|
um.rx_window_size = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 16 : 512;
|
||||||
|
um.rx_mod = (RLC_UMD_SN_SIZE_5_BITS == um.rx_sn_field_length) ? 32 : 1024;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Handle default case
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace srslte
|
||||||
|
|
||||||
|
#endif // RLC_INTERFACE_H
|
@ -1,290 +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/.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <string>
|
|
||||||
#include <string.h>
|
|
||||||
#include <strings.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "srslte/common/log_stdout.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace srslte {
|
|
||||||
|
|
||||||
void log_stdout::all_log(srslte::LOG_LEVEL_ENUM level,
|
|
||||||
uint32_t tti,
|
|
||||||
char *msg)
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
|
|
||||||
ss << now_time() << " ";
|
|
||||||
ss << "[" <<get_service_name() << "] ";
|
|
||||||
ss << log_level_text[level] << " ";
|
|
||||||
ss << "[" << std::setfill('0') << std::setw(5) << tti << "] ";
|
|
||||||
ss << msg;
|
|
||||||
|
|
||||||
cout << ss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
void log_stdout::all_log(srslte::LOG_LEVEL_ENUM level,
|
|
||||||
uint32_t tti,
|
|
||||||
char *msg,
|
|
||||||
uint8_t *hex,
|
|
||||||
int size)
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
|
|
||||||
ss << now_time() << " ";
|
|
||||||
ss << "[" <<get_service_name() << "] ";
|
|
||||||
ss << log_level_text[level] << " ";
|
|
||||||
ss << "[" << std::setfill('0') << std::setw(5) << tti << "] ";
|
|
||||||
ss << msg << std::endl;
|
|
||||||
ss << hex_string(hex, size);
|
|
||||||
|
|
||||||
cout << ss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
void log_stdout::all_log_line(srslte::LOG_LEVEL_ENUM level,
|
|
||||||
uint32_t tti,
|
|
||||||
std::string file,
|
|
||||||
int line,
|
|
||||||
char *msg)
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
|
|
||||||
ss << now_time() << " ";
|
|
||||||
ss << "[" <<get_service_name() << "] ";
|
|
||||||
ss << log_level_text[level] << " ";
|
|
||||||
ss << "[" << std::setfill('0') << std::setw(5) << tti << "] ";
|
|
||||||
ss << msg;
|
|
||||||
|
|
||||||
cout << ss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
void log_stdout::console(std::string message, ...) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
printf("%s",args_msg); // Print directly to stdout
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void log_stdout::error(std::string message, ...) {
|
|
||||||
if (level >= LOG_LEVEL_ERROR) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log(LOG_LEVEL_ERROR, tti, args_msg);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void log_stdout::warning(std::string message, ...) {
|
|
||||||
if (level >= LOG_LEVEL_WARNING) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log(LOG_LEVEL_WARNING, tti, args_msg);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void log_stdout::info(std::string message, ...) {
|
|
||||||
if (level >= LOG_LEVEL_INFO) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log(LOG_LEVEL_INFO, tti, args_msg);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void log_stdout::debug(std::string message, ...) {
|
|
||||||
if (level >= LOG_LEVEL_DEBUG) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log(LOG_LEVEL_DEBUG, tti, args_msg);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void log_stdout::error_hex(uint8_t *hex, int size, std::string message, ...) {
|
|
||||||
if (level >= LOG_LEVEL_ERROR) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log(LOG_LEVEL_ERROR, tti, args_msg, hex, size);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void log_stdout::warning_hex(uint8_t *hex, int size, std::string message, ...) {
|
|
||||||
if (level >= LOG_LEVEL_WARNING) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log(LOG_LEVEL_WARNING, tti, args_msg, hex, size);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void log_stdout::info_hex(uint8_t *hex, int size, std::string message, ...) {
|
|
||||||
if (level >= LOG_LEVEL_INFO) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log(LOG_LEVEL_INFO, tti, args_msg, hex, size);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void log_stdout::debug_hex(uint8_t *hex, int size, std::string message, ...) {
|
|
||||||
if (level >= LOG_LEVEL_DEBUG) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log(LOG_LEVEL_DEBUG, tti, args_msg, hex, size);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void log_stdout::error_line(std::string file, int line, std::string message, ...)
|
|
||||||
{
|
|
||||||
if (level >= LOG_LEVEL_ERROR) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log_line(LOG_LEVEL_ERROR, tti, file, line, args_msg);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void log_stdout::warning_line(std::string file, int line, std::string message, ...)
|
|
||||||
{
|
|
||||||
if (level >= LOG_LEVEL_WARNING) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log_line(LOG_LEVEL_WARNING, tti, file, line, args_msg);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void log_stdout::info_line(std::string file, int line, std::string message, ...)
|
|
||||||
{
|
|
||||||
if (level >= LOG_LEVEL_INFO) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log_line(LOG_LEVEL_INFO, tti, file, line, args_msg);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void log_stdout::debug_line(std::string file, int line, std::string message, ...)
|
|
||||||
{
|
|
||||||
if (level >= LOG_LEVEL_DEBUG) {
|
|
||||||
char *args_msg;
|
|
||||||
va_list args;
|
|
||||||
va_start(args, message);
|
|
||||||
if(vasprintf(&args_msg, message.c_str(), args) > 0)
|
|
||||||
all_log_line(LOG_LEVEL_DEBUG, tti, file, line, args_msg);
|
|
||||||
va_end(args);
|
|
||||||
free(args_msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string log_stdout::now_time()
|
|
||||||
{
|
|
||||||
struct timeval rawtime;
|
|
||||||
struct tm * timeinfo;
|
|
||||||
char buffer[64];
|
|
||||||
char us[16];
|
|
||||||
|
|
||||||
gettimeofday(&rawtime, NULL);
|
|
||||||
timeinfo = localtime(&rawtime.tv_sec);
|
|
||||||
|
|
||||||
strftime(buffer,64,"%H:%M:%S",timeinfo);
|
|
||||||
strcat(buffer,".");
|
|
||||||
snprintf(us,16,"%ld",rawtime.tv_usec);
|
|
||||||
strcat(buffer,us);
|
|
||||||
|
|
||||||
return std::string(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string log_stdout::hex_string(uint8_t *hex, int size)
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
int c = 0;
|
|
||||||
|
|
||||||
ss << std::hex << std::setfill('0');
|
|
||||||
if(hex_limit >= 0) {
|
|
||||||
size = (size > hex_limit) ? hex_limit : size;
|
|
||||||
}
|
|
||||||
while(c < size) {
|
|
||||||
ss << " " << std::setw(4) << static_cast<unsigned>(c) << ": ";
|
|
||||||
int tmp = (size-c < 16) ? size-c : 16;
|
|
||||||
for(int i=0;i<tmp;i++) {
|
|
||||||
ss << std::setw(2) << static_cast<unsigned>(hex[c++]) << " ";
|
|
||||||
}
|
|
||||||
ss << "\n";
|
|
||||||
}
|
|
||||||
return ss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue