From 27ef1a58bc717f6943c45a6ba99b5f8b7a6d174a Mon Sep 17 00:00:00 2001 From: Paul Sutton Date: Fri, 13 Jun 2014 12:42:29 +0100 Subject: [PATCH] Adding explicit visibility settings for the library --- CMakeLists.txt | 17 ++++-- graphics/include/plot.h | 6 +- graphics/include/plot/plot_complex.h | 17 +++--- graphics/include/plot/plot_real.h | 19 +++--- graphics/include/plot/plot_scatter.h | 17 +++--- graphics/include/plot/plot_waterfall.h | 29 ++++----- graphics/lib/CMakeLists.txt | 8 +-- graphics/lib/scatterplot/Scatterplot.h | 5 +- lte/include/lte.h | 2 + lte/include/lte/ch_estimation/chest.h | 37 ++++++------ lte/include/lte/ch_estimation/refsignal.h | 11 ++-- lte/include/lte/channel/ch_awgn.h | 13 ++-- lte/include/lte/common/base.h | 26 ++++---- lte/include/lte/common/fft.h | 15 ++--- lte/include/lte/common/sequence.h | 17 +++--- lte/include/lte/config.h | 55 +++++++++++++++++ lte/include/lte/fec/convcoder.h | 15 +++-- lte/include/lte/fec/crc.h | 12 ++-- lte/include/lte/fec/rm_conv.h | 14 +++-- lte/include/lte/fec/rm_turbo.h | 20 +++--- lte/include/lte/fec/tc_interl.h | 16 ++--- lte/include/lte/fec/turbocoder.h | 15 +++-- lte/include/lte/fec/turbodecoder.h | 23 ++++--- lte/include/lte/fec/viterbi.h | 19 +++--- lte/include/lte/filter/filter2d.h | 16 ++--- lte/include/lte/io/binsource.h | 27 +++++---- lte/include/lte/io/filesink.h | 19 +++--- lte/include/lte/io/filesource.h | 21 ++++--- lte/include/lte/io/format.h | 2 +- lte/include/lte/io/udpsink.h | 23 +++---- lte/include/lte/io/udpsource.h | 23 +++---- lte/include/lte/mimo/layermap.h | 20 +++--- lte/include/lte/mimo/precoding.h | 16 ++--- lte/include/lte/modem/demod_hard.h | 19 +++--- lte/include/lte/modem/demod_soft.h | 25 ++++---- lte/include/lte/modem/mod.h | 13 ++-- lte/include/lte/modem/modem_table.h | 18 +++--- lte/include/lte/phch/dci.h | 38 ++++++------ lte/include/lte/phch/pbch.h | 25 ++++---- lte/include/lte/phch/pcfich.h | 19 +++--- lte/include/lte/phch/pdcch.h | 33 +++++----- lte/include/lte/phch/phich.h | 23 +++---- lte/include/lte/phch/ra.h | 74 ++++++++++++----------- lte/include/lte/phch/regs.h | 45 +++++++------- lte/include/lte/resampling/interp.h | 12 +++- lte/include/lte/resampling/resample_arb.h | 8 ++- lte/include/lte/scrambling/scrambling.h | 19 +++--- lte/include/lte/sync/cfo.h | 18 +++--- lte/include/lte/sync/pss.h | 49 ++++++--------- lte/include/lte/sync/sfo.h | 8 ++- lte/include/lte/sync/sss.h | 41 +++++++------ lte/include/lte/sync/sync.h | 37 ++++++------ lte/include/lte/utils/bit.h | 14 +++-- lte/include/lte/utils/cexptab.h | 17 +++--- lte/include/lte/utils/convolution.h | 13 ++-- lte/include/lte/utils/debug.h | 11 ++-- lte/include/lte/utils/dft.h | 34 +++++------ lte/include/lte/utils/matrix.h | 29 +++++---- lte/include/lte/utils/mux.h | 10 +-- lte/include/lte/utils/pack.h | 8 ++- lte/include/lte/utils/vector.h | 43 ++++++------- lte/lib/fec/src/rm_conv.c | 12 ++-- lte/lib/resampling/src/resample_arb.c | 10 +-- lte/lib/utils/src/bit.c | 2 + 64 files changed, 730 insertions(+), 592 deletions(-) create mode 100644 lte/include/lte/config.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 143fd68ac..845aa2d7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,13 +23,11 @@ ######################################################################## # Prevent in-tree builds ######################################################################## - if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(FATAL_ERROR "Prevented in-tree build. This is bad practice.") endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - ######################################################################## # Project setup ######################################################################## @@ -66,12 +64,23 @@ SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") ######################################################################## # Compiler specific setup ######################################################################## +macro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have) + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG(${flag} ${have}) + if(${have}) + add_definitions(${flag}) + endif(${have}) +endmacro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE) + IF(CMAKE_COMPILER_IS_GNUCXX) -# do something + #Any additional flags for CXX ENDIF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-format-extra-args -Winline -Wno-unused-result -Wno-format -std=c99 -D_GNU_SOURCE") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-format-extra-args -Winline -Wno-unused-result -Wno-format -std=c99 -D_GNU_SOURCE") + IF(NOT WIN32) + ADD_CXX_COMPILER_FLAG_IF_AVAILABLE(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN) + ENDIF(NOT WIN32) ENDIF(CMAKE_COMPILER_IS_GNUCC) IF(MSVC) diff --git a/graphics/include/plot.h b/graphics/include/plot.h index 64d0d3e52..18fd04acf 100644 --- a/graphics/include/plot.h +++ b/graphics/include/plot.h @@ -33,13 +33,15 @@ extern "C" { #endif +#include "lte/config.h" + #include "plot/plot_real.h" #include "plot/plot_scatter.h" #include "plot/plot_complex.h" #include "plot/plot_waterfall.h" -int plot_init(); -void plot_exit(); +LIBLTE_API int plot_init(); +LIBLTE_API void plot_exit(); #ifdef __cplusplus } diff --git a/graphics/include/plot/plot_complex.h b/graphics/include/plot/plot_complex.h index 3febaf50a..10b6af9f1 100644 --- a/graphics/include/plot/plot_complex.h +++ b/graphics/include/plot/plot_complex.h @@ -35,6 +35,7 @@ extern "C" { #endif #include +#include "lte/config.h" typedef enum { Ip, Q, Magnitude, Phase @@ -42,15 +43,15 @@ typedef enum { typedef void* plot_complex_t; -int plot_complex_init(plot_complex_t *h); -void plot_complex_setTitle(plot_complex_t *h, char *title); -void plot_complex_setNewData(plot_complex_t *h, _Complex float *data, +LIBLTE_API int plot_complex_init(plot_complex_t *h); +LIBLTE_API void plot_complex_setTitle(plot_complex_t *h, char *title); +LIBLTE_API void plot_complex_setNewData(plot_complex_t *h, _Complex float *data, int num_points); -void plot_complex_setXAxisAutoScale(plot_complex_t *h, plot_complex_id_t id, bool on); -void plot_complex_setYAxisAutoScale(plot_complex_t *h, plot_complex_id_t id, bool on); -void plot_complex_setXAxisScale(plot_complex_t *h, plot_complex_id_t id, double xMin, double xMax); -void plot_complex_setYAxisScale(plot_complex_t *h, plot_complex_id_t id, double yMin, double yMax); -void plot_complex_setXAxisRange(plot_complex_t *h, double xMin, double xMax); +LIBLTE_API void plot_complex_setXAxisAutoScale(plot_complex_t *h, plot_complex_id_t id, bool on); +LIBLTE_API void plot_complex_setYAxisAutoScale(plot_complex_t *h, plot_complex_id_t id, bool on); +LIBLTE_API void plot_complex_setXAxisScale(plot_complex_t *h, plot_complex_id_t id, double xMin, double xMax); +LIBLTE_API void plot_complex_setYAxisScale(plot_complex_t *h, plot_complex_id_t id, double yMin, double yMax); +LIBLTE_API void plot_complex_setXAxisRange(plot_complex_t *h, double xMin, double xMax); #ifdef __cplusplus } diff --git a/graphics/include/plot/plot_real.h b/graphics/include/plot/plot_real.h index bd8fe58d7..e2ba7039f 100644 --- a/graphics/include/plot/plot_real.h +++ b/graphics/include/plot/plot_real.h @@ -34,19 +34,20 @@ extern "C" { #endif #include +#include "lte/config.h" typedef void* plot_real_t; -int plot_real_init(plot_real_t *h); -void plot_real_setTitle(plot_real_t *h, char *title); -void plot_real_setNewData(plot_real_t *h, float *data, +LIBLTE_API int plot_real_init(plot_real_t *h); +LIBLTE_API void plot_real_setTitle(plot_real_t *h, char *title); +LIBLTE_API void plot_real_setNewData(plot_real_t *h, float *data, int num_points); -void plot_real_setXAxisAutoScale(plot_real_t *h, bool on); -void plot_real_setYAxisAutoScale(plot_real_t *h, bool on); -void plot_real_setXAxisScale(plot_real_t *h, double xMin, double xMax); -void plot_real_setYAxisScale(plot_real_t *h, double yMin, double yMax); -void plot_real_setXAxisRange(plot_real_t *h, double xMin, double xMax); -void plot_real_setLabels(plot_real_t *h, char *xLabel, char *yLabel); +LIBLTE_API void plot_real_setXAxisAutoScale(plot_real_t *h, bool on); +LIBLTE_API void plot_real_setYAxisAutoScale(plot_real_t *h, bool on); +LIBLTE_API void plot_real_setXAxisScale(plot_real_t *h, double xMin, double xMax); +LIBLTE_API void plot_real_setYAxisScale(plot_real_t *h, double yMin, double yMax); +LIBLTE_API void plot_real_setXAxisRange(plot_real_t *h, double xMin, double xMax); +LIBLTE_API void plot_real_setLabels(plot_real_t *h, char *xLabel, char *yLabel); #ifdef __cplusplus } diff --git a/graphics/include/plot/plot_scatter.h b/graphics/include/plot/plot_scatter.h index bd9536903..647285f5e 100644 --- a/graphics/include/plot/plot_scatter.h +++ b/graphics/include/plot/plot_scatter.h @@ -34,18 +34,19 @@ extern "C" { #endif #include +#include "lte/config.h" typedef void* plot_scatter_t; -int plot_scatter_init(plot_scatter_t *h); -void plot_scatter_setTitle(plot_scatter_t *h, char *title); -void plot_scatter_setNewData(plot_scatter_t *h, _Complex float *data, +LIBLTE_API int plot_scatter_init(plot_scatter_t *h); +LIBLTE_API void plot_scatter_setTitle(plot_scatter_t *h, char *title); +LIBLTE_API void plot_scatter_setNewData(plot_scatter_t *h, _Complex float *data, int num_points); -void plot_scatter_setXAxisAutoScale(plot_scatter_t *h, bool on); -void plot_scatter_setYAxisAutoScale(plot_scatter_t *h, bool on); -void plot_scatter_setXAxisScale(plot_scatter_t *h, double xMin, double xMax); -void plot_scatter_setYAxisScale(plot_scatter_t *h, double yMin, double yMax); -void plot_scatter_setAxisLabels(plot_scatter_t *h, char *xLabel, char *yLabel); +LIBLTE_API void plot_scatter_setXAxisAutoScale(plot_scatter_t *h, bool on); +LIBLTE_API void plot_scatter_setYAxisAutoScale(plot_scatter_t *h, bool on); +LIBLTE_API void plot_scatter_setXAxisScale(plot_scatter_t *h, double xMin, double xMax); +LIBLTE_API void plot_scatter_setYAxisScale(plot_scatter_t *h, double yMin, double yMax); +LIBLTE_API void plot_scatter_setAxisLabels(plot_scatter_t *h, char *xLabel, char *yLabel); #ifdef __cplusplus } diff --git a/graphics/include/plot/plot_waterfall.h b/graphics/include/plot/plot_waterfall.h index 341b7d9d1..1641fe531 100644 --- a/graphics/include/plot/plot_waterfall.h +++ b/graphics/include/plot/plot_waterfall.h @@ -34,24 +34,25 @@ extern "C" { #endif #include +#include "lte/config.h" typedef void* plot_waterfall_t; -int plot_waterfall_init(plot_waterfall_t *h); -void plot_waterfall_setTitle(plot_waterfall_t *h, char *title); -void plot_waterfall_appendNewData(plot_waterfall_t *h, float *data, +LIBLTE_API int plot_waterfall_init(plot_waterfall_t *h); +LIBLTE_API void plot_waterfall_setTitle(plot_waterfall_t *h, char *title); +LIBLTE_API void plot_waterfall_appendNewData(plot_waterfall_t *h, float *data, int num_points); -void plot_complex_setPlotXLabel(plot_waterfall_t *h, char *xLabel); -void plot_complex_setPlotYLabel(plot_waterfall_t *h, char *yLabel); -void plot_waterfall_setPlotXAxisRange(plot_waterfall_t *h, double xMin, double xMax); -void plot_waterfall_setPlotXAxisScale(plot_waterfall_t *h, double xMin, double xMax); -void plot_waterfall_setPlotYAxisScale(plot_waterfall_t *h, double yMin, double yMax); - -void plot_waterfall_setSpectrogramXLabel(plot_waterfall_t *h, char* xLabel); -void plot_waterfall_setSpectrogramYLabel(plot_waterfall_t *h, char* yLabel); -void plot_waterfall_setSpectrogramXAxisRange(plot_waterfall_t *h, double xMin, double xMax); -void plot_waterfall_setSpectrogramYAxisRange(plot_waterfall_t *h, double yMin, double yMax); -void plot_waterfall_setSpectrogramZAxisScale(plot_waterfall_t *h, double zMin, double zMax); +LIBLTE_API void plot_complex_setPlotXLabel(plot_waterfall_t *h, char *xLabel); +LIBLTE_API void plot_complex_setPlotYLabel(plot_waterfall_t *h, char *yLabel); +LIBLTE_API void plot_waterfall_setPlotXAxisRange(plot_waterfall_t *h, double xMin, double xMax); +LIBLTE_API void plot_waterfall_setPlotXAxisScale(plot_waterfall_t *h, double xMin, double xMax); +LIBLTE_API void plot_waterfall_setPlotYAxisScale(plot_waterfall_t *h, double yMin, double yMax); + +LIBLTE_API void plot_waterfall_setSpectrogramXLabel(plot_waterfall_t *h, char* xLabel); +LIBLTE_API void plot_waterfall_setSpectrogramYLabel(plot_waterfall_t *h, char* yLabel); +LIBLTE_API void plot_waterfall_setSpectrogramXAxisRange(plot_waterfall_t *h, double xMin, double xMax); +LIBLTE_API void plot_waterfall_setSpectrogramYAxisRange(plot_waterfall_t *h, double yMin, double yMax); +LIBLTE_API void plot_waterfall_setSpectrogramZAxisScale(plot_waterfall_t *h, double zMin, double zMax); #ifdef __cplusplus diff --git a/graphics/lib/CMakeLists.txt b/graphics/lib/CMakeLists.txt index 681e2cf4f..40a1e4ce5 100644 --- a/graphics/lib/CMakeLists.txt +++ b/graphics/lib/CMakeLists.txt @@ -75,10 +75,10 @@ IF(QT4_FOUND AND QWT_FOUND AND QWT_MAJOR_VERSION EQUAL 6) APPEND_INTERNAL_LIST(OPTIONAL_LIBS graphics) - ADD_SUBDIRECTORY(complexplot/test) - ADD_SUBDIRECTORY(realplot/test) - ADD_SUBDIRECTORY(scatterplot/test) - ADD_SUBDIRECTORY(waterfallplot/test) + #ADD_SUBDIRECTORY(complexplot/test) + #ADD_SUBDIRECTORY(realplot/test) + #ADD_SUBDIRECTORY(scatterplot/test) + #ADD_SUBDIRECTORY(waterfallplot/test) MESSAGE(STATUS " GRAPHICS library will be installed.") diff --git a/graphics/lib/scatterplot/Scatterplot.h b/graphics/lib/scatterplot/Scatterplot.h index 19b340c43..158846655 100644 --- a/graphics/lib/scatterplot/Scatterplot.h +++ b/graphics/lib/scatterplot/Scatterplot.h @@ -3,10 +3,11 @@ #include #include +#include "lte/config.h" class ScatterplotWrapper; -class Scatterplot +class LIBLTE_API Scatterplot { public: Scatterplot(); @@ -28,7 +29,7 @@ private: }; template -void Scatterplot::setNewData(Iterator begin, Iterator end) +LIBLTE_API void Scatterplot::setNewData(Iterator begin, Iterator end) { int numPoints = end-begin; std::complex* data = new std::complex[numPoints]; diff --git a/lte/include/lte.h b/lte/include/lte.h index 213205d61..19c492dc2 100644 --- a/lte/include/lte.h +++ b/lte/include/lte.h @@ -36,6 +36,8 @@ extern "C" { #endif +#include "lte/config.h" + #include "lte/utils/bit.h" #include "lte/utils/convolution.h" #include "lte/utils/debug.h" diff --git a/lte/include/lte/ch_estimation/chest.h b/lte/include/lte/ch_estimation/chest.h index 0f55580de..831914a43 100644 --- a/lte/include/lte/ch_estimation/chest.h +++ b/lte/include/lte/ch_estimation/chest.h @@ -32,6 +32,7 @@ #include +#include "lte/config.h" #include "lte/ch_estimation/refsignal.h" #include "lte/filter/filter2d.h" #include "lte/common/base.h" @@ -49,7 +50,7 @@ typedef void (*interpolate_fnc_t) (cf_t *input, cf_t *output, int M, int len, in */ /* Low-level API */ -typedef struct { +typedef struct LIBLTE_API{ int nof_ports; int nof_symbols; int nof_prb; @@ -58,28 +59,28 @@ typedef struct { interpolate_fnc_t interp; }chest_t; -int chest_init(chest_t *q, chest_interp_t interp, lte_cp_t cp, int nof_prb, int nof_ports); -void chest_free(chest_t *q); +LIBLTE_API int chest_init(chest_t *q, chest_interp_t interp, lte_cp_t cp, int nof_prb, int nof_ports); +LIBLTE_API void chest_free(chest_t *q); -int chest_ref_LTEDL_slot_port(chest_t *q, int port, int nslot, int cell_id); -int chest_ref_LTEDL_slot(chest_t *q, int nslot, int cell_id); -int chest_ref_LTEDL(chest_t *q, int cell_id); +LIBLTE_API int chest_ref_LTEDL_slot_port(chest_t *q, int port, int nslot, int cell_id); +LIBLTE_API int chest_ref_LTEDL_slot(chest_t *q, int nslot, int cell_id); +LIBLTE_API int chest_ref_LTEDL(chest_t *q, int cell_id); -void chest_ce_ref(chest_t *q, cf_t *input, int nslot, int port_id, int nref); -void chest_ce_slot_port(chest_t *q, cf_t *input, cf_t *ce, int nslot, int port_id); -void chest_ce_slot(chest_t *q, cf_t *input, cf_t **ce, int nslot); +LIBLTE_API void chest_ce_ref(chest_t *q, cf_t *input, int nslot, int port_id, int nref); +LIBLTE_API void chest_ce_slot_port(chest_t *q, cf_t *input, cf_t *ce, int nslot, int port_id); +LIBLTE_API void chest_ce_slot(chest_t *q, cf_t *input, cf_t **ce, int nslot); -void chest_fprint(chest_t *q, FILE *stream, int nslot, int port_id); -void chest_ref_fprint(chest_t *q, FILE *stream, int nslot, int port_id); -void chest_recvsig_fprint(chest_t *q, FILE *stream, int nslot, int port_id); -void chest_ce_fprint(chest_t *q, FILE *stream, int nslot, int port_id); -int chest_ref_symbols(chest_t *q, int port_id, int nslot, int l[2]); +LIBLTE_API void chest_fprint(chest_t *q, FILE *stream, int nslot, int port_id); +LIBLTE_API void chest_ref_fprint(chest_t *q, FILE *stream, int nslot, int port_id); +LIBLTE_API void chest_recvsig_fprint(chest_t *q, FILE *stream, int nslot, int port_id); +LIBLTE_API void chest_ce_fprint(chest_t *q, FILE *stream, int nslot, int port_id); +LIBLTE_API int chest_ref_symbols(chest_t *q, int port_id, int nslot, int l[2]); /* High-level API */ /** TODO: The high-level API has N interfaces, one for each port */ -typedef struct { +typedef struct LIBLTE_API{ chest_t obj; struct chest_init { int nof_symbols; // 7 for normal cp, 6 for extended @@ -99,8 +100,8 @@ typedef struct { #define DEFAULT_FRAME_SIZE 2048 -int chest_initialize(chest_hl* h); -int chest_work(chest_hl* hl); -int chest_stop(chest_hl* hl); +LIBLTE_API int chest_initialize(chest_hl* h); +LIBLTE_API int chest_work(chest_hl* hl); +LIBLTE_API int chest_stop(chest_hl* hl); #endif diff --git a/lte/include/lte/ch_estimation/refsignal.h b/lte/include/lte/ch_estimation/refsignal.h index 707788361..71127ca11 100644 --- a/lte/include/lte/ch_estimation/refsignal.h +++ b/lte/include/lte/ch_estimation/refsignal.h @@ -37,18 +37,19 @@ * */ +#include "lte/config.h" #include "lte/common/base.h" typedef _Complex float cf_t; -typedef struct { +typedef struct LIBLTE_API{ int time_idx; int freq_idx; cf_t simbol; cf_t recv_simbol; }ref_t; -typedef struct { +typedef struct LIBLTE_API{ int nof_refs; // number of reference signals int *symbols_ref; // symbols with at least one reference int nsymbols; // number of symbols with at least one reference @@ -58,10 +59,10 @@ typedef struct { cf_t *ch_est; } refsignal_t; -int refsignal_init_LTEDL(refsignal_t *q, int port_id, int nslot, +LIBLTE_API int refsignal_init_LTEDL(refsignal_t *q, int port_id, int nslot, int cell_id, lte_cp_t cp, int nof_prb); -void refsignal_free(refsignal_t *q); +LIBLTE_API void refsignal_free(refsignal_t *q); -void refsignal_put(refsignal_t *q, cf_t *slot_symbols); +LIBLTE_API void refsignal_put(refsignal_t *q, cf_t *slot_symbols); #endif diff --git a/lte/include/lte/channel/ch_awgn.h b/lte/include/lte/channel/ch_awgn.h index 2e6ada48d..c6b704dfa 100644 --- a/lte/include/lte/channel/ch_awgn.h +++ b/lte/include/lte/channel/ch_awgn.h @@ -27,18 +27,19 @@ #include +#include "lte/config.h" #ifndef CH_AWGN_ #define CH_AWGN_ typedef _Complex float cf_t; -void ch_awgn_c(const cf_t* input, cf_t* output, float variance, int buff_sz); -void ch_awgn_f(const float* x, float* y, float variance, int buff_sz); +LIBLTE_API void ch_awgn_c(const cf_t* input, cf_t* output, float variance, int buff_sz); +LIBLTE_API void ch_awgn_f(const float* x, float* y, float variance, int buff_sz); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API{ const cf_t* input; int in_len; struct ch_awgn_ctrl_in { @@ -49,8 +50,8 @@ typedef struct { int out_len; }ch_awgn_hl; -int ch_awgn_initialize(ch_awgn_hl* hl); -int ch_awgn_work(ch_awgn_hl* hl); -int ch_awgn_stop(ch_awgn_hl* hl); +LIBLTE_API int ch_awgn_initialize(ch_awgn_hl* hl); +LIBLTE_API int ch_awgn_work(ch_awgn_hl* hl); +LIBLTE_API int ch_awgn_stop(ch_awgn_hl* hl); #endif diff --git a/lte/include/lte/common/base.h b/lte/include/lte/common/base.h index 22de8bd37..9a101dad3 100644 --- a/lte/include/lte/common/base.h +++ b/lte/include/lte/common/base.h @@ -29,6 +29,8 @@ #ifndef _LTEBASE_ #define _LTEBASE_ +#include "lte/config.h" + #define NSUBFRAMES_X_FRAME 10 #define NSLOTS_X_FRAME (2*NSUBFRAMES_X_FRAME) @@ -90,9 +92,9 @@ typedef enum {CPNORM, CPEXT} lte_cp_t; #define SAMPLE_IDX(nof_prb, symbol_idx, sample_idx) (symbol_idx*nof_prb*RE_X_RB + sample_idx) -const int lte_symbol_sz(int nof_prb); -int lte_re_x_prb(int ns, int symbol, int nof_ports, int nof_symbols); -int lte_voffset(int symbol_id, int cell_id, int nof_ports); +LIBLTE_API const int lte_symbol_sz(int nof_prb); +LIBLTE_API int lte_re_x_prb(int ns, int symbol, int nof_ports, int nof_symbols); +LIBLTE_API int lte_voffset(int symbol_id, int cell_id, int nof_ports); #define NOF_LTE_BANDS 29 @@ -107,7 +109,7 @@ typedef enum { PHICH_NORM, PHICH_EXT} phich_length_t; typedef enum { R_1_6, R_1_2, R_1, R_2} phich_resources_t; -typedef struct { +typedef struct LIBLTE_API{ int id; float fd; }lte_earfcn_t; @@ -116,16 +118,16 @@ enum band_geographical_area { ALL, NAR, APAC, EMEA, JAPAN, CALA, NA }; -int lte_cb_size(int index); -int lte_find_cb_index(int long_cb); +LIBLTE_API int lte_cb_size(int index); +LIBLTE_API int lte_find_cb_index(int long_cb); -float lte_band_fd(int earfcn); -int lte_band_get_fd_band(int band, lte_earfcn_t *earfcn, int earfcn_start, int earfcn_end, int max_elems); -int lte_band_get_fd_band_all(int band, lte_earfcn_t *earfcn, int max_nelems); -int lte_band_get_fd_region(enum band_geographical_area region, lte_earfcn_t *earfcn, int max_elems); +LIBLTE_API float lte_band_fd(int earfcn); +LIBLTE_API int lte_band_get_fd_band(int band, lte_earfcn_t *earfcn, int earfcn_start, int earfcn_end, int max_elems); +LIBLTE_API int lte_band_get_fd_band_all(int band, lte_earfcn_t *earfcn, int max_nelems); +LIBLTE_API int lte_band_get_fd_region(enum band_geographical_area region, lte_earfcn_t *earfcn, int max_elems); -int lte_str2mimotype(char *mimo_type_str, lte_mimo_type_t *type); -char *lte_mimotype2str(lte_mimo_type_t type); +LIBLTE_API int lte_str2mimotype(char *mimo_type_str, lte_mimo_type_t *type); +LIBLTE_API char *lte_mimotype2str(lte_mimo_type_t type); #endif diff --git a/lte/include/lte/common/fft.h b/lte/include/lte/common/fft.h index e84342f13..bf1fd7585 100644 --- a/lte/include/lte/common/fft.h +++ b/lte/include/lte/common/fft.h @@ -33,13 +33,14 @@ #include #include +#include "lte/config.h" #include "lte/common/base.h" #include "lte/utils/dft.h" typedef _Complex float cf_t; /* this is only a shortcut */ /* This is common for both directions */ -typedef struct { +typedef struct LIBLTE_API{ dft_plan_t fft_plan; int nof_symbols; int symbol_sz; @@ -49,12 +50,12 @@ typedef struct { cf_t *tmp; // for removing zero padding }lte_fft_t; -int lte_fft_init(lte_fft_t *q, lte_cp_t cp_type, int nof_prb); -void lte_fft_free(lte_fft_t *q); -void lte_fft_run(lte_fft_t *q, cf_t *input, cf_t *output); +LIBLTE_API int lte_fft_init(lte_fft_t *q, lte_cp_t cp_type, int nof_prb); +LIBLTE_API void lte_fft_free(lte_fft_t *q); +LIBLTE_API void lte_fft_run(lte_fft_t *q, cf_t *input, cf_t *output); -int lte_ifft_init(lte_fft_t *q, lte_cp_t cp_type, int nof_prb); -void lte_ifft_free(lte_fft_t *q); -void lte_ifft_run(lte_fft_t *q, cf_t *input, cf_t *output); +LIBLTE_API int lte_ifft_init(lte_fft_t *q, lte_cp_t cp_type, int nof_prb); +LIBLTE_API void lte_ifft_free(lte_fft_t *q); +LIBLTE_API void lte_ifft_run(lte_fft_t *q, cf_t *input, cf_t *output); #endif diff --git a/lte/include/lte/common/sequence.h b/lte/include/lte/common/sequence.h index e4fcca153..ab11d78d7 100644 --- a/lte/include/lte/common/sequence.h +++ b/lte/include/lte/common/sequence.h @@ -29,21 +29,22 @@ #ifndef LTESEQ_ #define LTESEQ_ +#include "lte/config.h" #include "lte/common/base.h" -typedef struct { +typedef struct LIBLTE_API{ char *c; int len; }sequence_t; -int sequence_init(sequence_t *q, int len); -void sequence_free(sequence_t *q); +LIBLTE_API int sequence_init(sequence_t *q, int len); +LIBLTE_API void sequence_free(sequence_t *q); -int sequence_LTEPRS(sequence_t *q, int len, int seed); +LIBLTE_API int sequence_LTEPRS(sequence_t *q, int len, int seed); -int sequence_pbch(sequence_t *seq, lte_cp_t cp, int cell_id); -int sequence_pcfich(sequence_t *seq, int nslot, int cell_id); -int sequence_phich(sequence_t *seq, int nslot, int cell_id); -int sequence_pdcch(sequence_t *seq, int nslot, int cell_id, int len); +LIBLTE_API int sequence_pbch(sequence_t *seq, lte_cp_t cp, int cell_id); +LIBLTE_API int sequence_pcfich(sequence_t *seq, int nslot, int cell_id); +LIBLTE_API int sequence_phich(sequence_t *seq, int nslot, int cell_id); +LIBLTE_API int sequence_pdcch(sequence_t *seq, int nslot, int cell_id, int len); #endif diff --git a/lte/include/lte/config.h b/lte/include/lte/config.h new file mode 100644 index 000000000..a1dfc3937 --- /dev/null +++ b/lte/include/lte/config.h @@ -0,0 +1,55 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2014 The libLTE Developers. See the + * COPYRIGHT file at the top-level directory of this distribution. + * + * \section LICENSE + * + * This file is part of the libLTE library. + * + * libLTE 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. + * + * libLTE 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/. + * + */ + +#ifndef CONFIG_H +#define CONFIG_H + +// Generic helper definitions for shared library support +#if defined _WIN32 || defined __CYGWIN__ + #define LIBLTE_IMPORT __declspec(dllimport) + #define LIBLTE_EXPORT __declspec(dllexport) + #define LIBLTE_LOCAL +#else + #if __GNUC__ >= 4 + #define LIBLTE_IMPORT __attribute__ ((visibility ("default"))) + #define LIBLTE_EXPORT __attribute__ ((visibility ("default"))) + #else + #define LIBLTE_IMPORT + #define LIBLTE_EXPORT + #define LIBLTE_LOCAL + #endif +#endif + +// Define LIBLTE_API +// LIBLTE_API is used for the public API symbols. +#ifdef LIBLTE_DLL_EXPORTS // defined if we are building the LIBLTE DLL (instead of using it) + #define LIBLTE_API LIBLTE_EXPORT +#else + #define LIBLTE_API LIBLTE_IMPORT +#endif + +#endif // CONFIG_H diff --git a/lte/include/lte/fec/convcoder.h b/lte/include/lte/fec/convcoder.h index 54f9eb723..ec6f120fd 100644 --- a/lte/include/lte/fec/convcoder.h +++ b/lte/include/lte/fec/convcoder.h @@ -31,21 +31,20 @@ #define CONVCODER_ #include +#include "lte/config.h" - - -typedef struct { +typedef struct LIBLTE_API { int R; int K; int poly[3]; bool tail_biting; }convcoder_t; -int convcoder_encode(convcoder_t *q, char *input, char *output, int frame_length); +LIBLTE_API int convcoder_encode(convcoder_t *q, char *input, char *output, int frame_length); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { convcoder_t obj; struct convcoder_ctrl_in { int rate; @@ -62,8 +61,8 @@ typedef struct { int out_len; }convcoder_hl; -int convcoder_initialize(convcoder_hl* h); -int convcoder_work(convcoder_hl* hl); -int convcoder_stop(convcoder_hl* h); +LIBLTE_API int convcoder_initialize(convcoder_hl* h); +LIBLTE_API int convcoder_work(convcoder_hl* hl); +LIBLTE_API int convcoder_stop(convcoder_hl* h); #endif diff --git a/lte/include/lte/fec/crc.h b/lte/include/lte/fec/crc.h index a08e1568c..45fd8fc4b 100644 --- a/lte/include/lte/fec/crc.h +++ b/lte/include/lte/fec/crc.h @@ -29,7 +29,9 @@ #ifndef CRC_ #define CRC_ -typedef struct { +#include "lte/config.h" + +typedef struct LIBLTE_API { unsigned long table[256]; unsigned char byte; int polynom; @@ -40,9 +42,9 @@ typedef struct { unsigned int crc_out; } crc_t; -int crc_init(crc_t *h, unsigned int crc_poly, int crc_order); -int crc_set_init(crc_t *h, unsigned long crc_init_value); -void crc_attach(crc_t *h, char *data, int len); -unsigned int crc_checksum(crc_t *h, char *data, int len); +LIBLTE_API int crc_init(crc_t *h, unsigned int crc_poly, int crc_order); +LIBLTE_API int crc_set_init(crc_t *h, unsigned long crc_init_value); +LIBLTE_API void crc_attach(crc_t *h, char *data, int len); +LIBLTE_API unsigned int crc_checksum(crc_t *h, char *data, int len); #endif diff --git a/lte/include/lte/fec/rm_conv.h b/lte/include/lte/fec/rm_conv.h index 0eee8c0ad..40339bc8f 100644 --- a/lte/include/lte/fec/rm_conv.h +++ b/lte/include/lte/fec/rm_conv.h @@ -29,16 +29,18 @@ #ifndef RM_CONV_ #define RM_CONV_ +#include "lte/config.h" + #define RX_NULL 10000 #define TX_NULL 80 -int rm_conv_tx(char *input, int in_len, char *output, int out_len); -int rm_conv_rx(float *input, int in_len, float *output, int out_len); +LIBLTE_API int rm_conv_tx(char *input, int in_len, char *output, int out_len); +LIBLTE_API int rm_conv_rx(float *input, int in_len, float *output, int out_len); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { struct rm_conv_init { int direction; } init; @@ -52,8 +54,8 @@ typedef struct { int out_len; }rm_conv_hl; -int rm_conv_initialize(rm_conv_hl* h); -int rm_conv_work(rm_conv_hl* hl); -int rm_conv_stop(rm_conv_hl* hl); +LIBLTE_API int rm_conv_initialize(rm_conv_hl* h); +LIBLTE_API int rm_conv_work(rm_conv_hl* hl); +LIBLTE_API int rm_conv_stop(rm_conv_hl* hl); #endif diff --git a/lte/include/lte/fec/rm_turbo.h b/lte/include/lte/fec/rm_turbo.h index fcee08fe3..3faa8216c 100644 --- a/lte/include/lte/fec/rm_turbo.h +++ b/lte/include/lte/fec/rm_turbo.h @@ -29,6 +29,8 @@ #ifndef RM_TURBO_ #define RM_TURBO_ +#include "lte/config.h" + #ifndef RX_NULL #define RX_NULL 10000 #endif @@ -37,20 +39,20 @@ #define TX_NULL 80 #endif -typedef struct { +typedef struct LIBLTE_API { int buffer_len; char *buffer; int *d2_perm; } rm_turbo_t; -int rm_turbo_init(rm_turbo_t *q, int max_codeblock_len); -void rm_turbo_free(rm_turbo_t *q); -int rm_turbo_tx(rm_turbo_t *q, char *input, int in_len, char *output, int out_len, int rv_idx); -int rm_turbo_rx(rm_turbo_t *q, float *input, int in_len, float *output, int out_len, int rv_idx); +LIBLTE_API int rm_turbo_init(rm_turbo_t *q, int max_codeblock_len); +LIBLTE_API void rm_turbo_free(rm_turbo_t *q); +LIBLTE_API int rm_turbo_tx(rm_turbo_t *q, char *input, int in_len, char *output, int out_len, int rv_idx); +LIBLTE_API int rm_turbo_rx(rm_turbo_t *q, float *input, int in_len, float *output, int out_len, int rv_idx); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { rm_turbo_t q; struct rm_turbo_init { int direction; @@ -66,8 +68,8 @@ typedef struct { int out_len; }rm_turbo_hl; -int rm_turbo_initialize(rm_turbo_hl* h); -int rm_turbo_work(rm_turbo_hl* hl); -int rm_turbo_stop(rm_turbo_hl* hl); +LIBLTE_API int rm_turbo_initialize(rm_turbo_hl* h); +LIBLTE_API int rm_turbo_work(rm_turbo_hl* hl); +LIBLTE_API int rm_turbo_stop(rm_turbo_hl* hl); #endif diff --git a/lte/include/lte/fec/tc_interl.h b/lte/include/lte/fec/tc_interl.h index 1fbaa8293..22e8df878 100644 --- a/lte/include/lte/fec/tc_interl.h +++ b/lte/include/lte/fec/tc_interl.h @@ -25,17 +25,19 @@ * */ -#ifndef _PERMUTE_H -#define _PERMUTE_H +#ifndef TC_INTERL_H +#define TC_INTERL_H -typedef struct { +#include "lte/config.h" + +typedef struct LIBLTE_API{ int *forward; int *reverse; }tc_interl_t; -int tc_interl_LTE_init(tc_interl_t *h, int long_cb); -int tc_interl_UMTS_init(tc_interl_t *h, int long_cb); +LIBLTE_API int tc_interl_LTE_init(tc_interl_t *h, int long_cb); +LIBLTE_API int tc_interl_UMTS_init(tc_interl_t *h, int long_cb); -void tc_interl_free(tc_interl_t *h); +LIBLTE_API void tc_interl_free(tc_interl_t *h); -#endif +#endif // TC_INTERL_H diff --git a/lte/include/lte/fec/turbocoder.h b/lte/include/lte/fec/turbocoder.h index ea215972d..ead896fb5 100644 --- a/lte/include/lte/fec/turbocoder.h +++ b/lte/include/lte/fec/turbocoder.h @@ -25,21 +25,24 @@ * */ +#ifndef TURBOCODER_H +#define TURBOCODER_H + +#include "lte/config.h" #define NUMREGS 3 #define RATE 3 #define TOTALTAIL 12 -typedef struct { +typedef struct LIBLTE_API{ int long_cb; tc_interl_t interl; }tcod_t; -int tcod_init(tcod_t *h, int long_cb); -void tcod_free(tcod_t *h); -void tcod_encode(tcod_t *h, char *input, char *output); - - +LIBLTE_API int tcod_init(tcod_t *h, int long_cb); +LIBLTE_API void tcod_free(tcod_t *h); +LIBLTE_API void tcod_encode(tcod_t *h, char *input, char *output); +#endif // TURBOCODER_H diff --git a/lte/include/lte/fec/turbodecoder.h b/lte/include/lte/fec/turbodecoder.h index fc97de5cd..5d545d7d9 100644 --- a/lte/include/lte/fec/turbodecoder.h +++ b/lte/include/lte/fec/turbodecoder.h @@ -1,3 +1,8 @@ +#ifndef TURBODECODER_H +#define TURBODECODER_H + +#include "lte/config.h" + #define RATE 3 #define TOTALTAIL 12 @@ -16,12 +21,12 @@ typedef float llr_t; -typedef struct { +typedef struct LIBLTE_API{ int long_cb; llr_t *beta; }map_gen_t; -typedef struct { +typedef struct LIBLTE_API{ int long_cb; map_gen_t dec; @@ -35,10 +40,12 @@ typedef struct { tc_interl_t interleaver; }tdec_t; -int tdec_init(tdec_t *h, int long_cb); -void tdec_free(tdec_t *h); +LIBLTE_API int tdec_init(tdec_t *h, int long_cb); +LIBLTE_API void tdec_free(tdec_t *h); + +LIBLTE_API void tdec_reset(tdec_t *h); +LIBLTE_API void tdec_iteration(tdec_t *h, llr_t *input); +LIBLTE_API void tdec_decision(tdec_t *h, char *output); +LIBLTE_API void tdec_run_all(tdec_t *h, llr_t *input, char *output, int nof_iterations); -void tdec_reset(tdec_t *h); -void tdec_iteration(tdec_t *h, llr_t *input); -void tdec_decision(tdec_t *h, char *output); -void tdec_run_all(tdec_t *h, llr_t *input, char *output, int nof_iterations); +#endif // TURBODECODER_H diff --git a/lte/include/lte/fec/viterbi.h b/lte/include/lte/fec/viterbi.h index 02bbe4383..d41e46c59 100644 --- a/lte/include/lte/fec/viterbi.h +++ b/lte/include/lte/fec/viterbi.h @@ -30,12 +30,13 @@ #define VITERBI_ #include +#include "lte/config.h" typedef enum { viterbi_27, viterbi_29, viterbi_37, viterbi_39 }viterbi_type_t; -typedef struct { +typedef struct LIBLTE_API{ void *ptr; int R; int K; @@ -48,14 +49,14 @@ typedef struct { unsigned char *symbols_uc; }viterbi_t; -int viterbi_init(viterbi_t *q, viterbi_type_t type, int poly[3], int max_frame_length, bool tail_bitting); -void viterbi_free(viterbi_t *q); -int viterbi_decode_f(viterbi_t *q, float *symbols, char *data, int frame_length); -int viterbi_decode_uc(viterbi_t *q, unsigned char *symbols, char *data, int frame_length); +LIBLTE_API int viterbi_init(viterbi_t *q, viterbi_type_t type, int poly[3], int max_frame_length, bool tail_bitting); +LIBLTE_API void viterbi_free(viterbi_t *q); +LIBLTE_API int viterbi_decode_f(viterbi_t *q, float *symbols, char *data, int frame_length); +LIBLTE_API int viterbi_decode_uc(viterbi_t *q, unsigned char *symbols, char *data, int frame_length); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API{ viterbi_t obj; struct viterbi_init { int rate; @@ -72,8 +73,8 @@ typedef struct { int out_len; }viterbi_hl; -int viterbi_initialize(viterbi_hl* h); -int viterbi_work(viterbi_hl* hl); -int viterbi_stop(viterbi_hl* h); +LIBLTE_API int viterbi_initialize(viterbi_hl* h); +LIBLTE_API int viterbi_work(viterbi_hl* hl); +LIBLTE_API int viterbi_stop(viterbi_hl* h); #endif diff --git a/lte/include/lte/filter/filter2d.h b/lte/include/lte/filter/filter2d.h index 44325c08d..8dc9d63aa 100644 --- a/lte/include/lte/filter/filter2d.h +++ b/lte/include/lte/filter/filter2d.h @@ -30,12 +30,14 @@ #ifndef FILTER2D_ #define FILTER2D_ +#include "lte/config.h" + /* 2-D real filter of complex input * */ typedef _Complex float cf_t; -typedef struct { +typedef struct LIBLTE_API{ int sztime; // Output signal size in the time domain int szfreq; // Output signal size in the freq domain int ntime; // 2-D Filter size in time domain @@ -44,10 +46,10 @@ typedef struct { cf_t *output; // Output signal } filter2d_t; -int filter2d_init (filter2d_t* q, float **taps, int ntime, int nfreq, int sztime, int szfreq); -int filter2d_init_default (filter2d_t* q, int ntime, int nfreq, int sztime, int szfreq); -void filter2d_free(filter2d_t *q); -void filter2d_reset(filter2d_t *q); -void filter2d_add(filter2d_t *q, cf_t h, int time_idx, int freq_idx); +LIBLTE_API int filter2d_init (filter2d_t* q, float **taps, int ntime, int nfreq, int sztime, int szfreq); +LIBLTE_API int filter2d_init_default (filter2d_t* q, int ntime, int nfreq, int sztime, int szfreq); +LIBLTE_API void filter2d_free(filter2d_t *q); +LIBLTE_API void filter2d_reset(filter2d_t *q); +LIBLTE_API void filter2d_add(filter2d_t *q, cf_t h, int time_idx, int freq_idx); -#endif +#endif // FILTER2D_ diff --git a/lte/include/lte/io/binsource.h b/lte/include/lte/io/binsource.h index 67e525bab..ed9b762af 100644 --- a/lte/include/lte/io/binsource.h +++ b/lte/include/lte/io/binsource.h @@ -31,9 +31,10 @@ #include +#include "lte/config.h" /* Low-level API */ -typedef struct { +typedef struct LIBLTE_API{ unsigned int seed; uint32_t *seq_buff; int seq_buff_nwords; @@ -41,16 +42,16 @@ typedef struct { int seq_cache_rp; }binsource_t; -void binsource_init(binsource_t* q); -void binsource_free(binsource_t* q); -void binsource_seed_set(binsource_t* q, unsigned int seed); -void binsource_seed_time(binsource_t *q); -int binsource_cache_gen(binsource_t* q, int nbits); -void binsource_cache_cpy(binsource_t* q, char *bits, int nbits); -int binsource_generate(binsource_t* q, char *bits, int nbits); +LIBLTE_API void binsource_init(binsource_t* q); +LIBLTE_API void binsource_free(binsource_t* q); +LIBLTE_API void binsource_seed_set(binsource_t* q, unsigned int seed); +LIBLTE_API void binsource_seed_time(binsource_t *q); +LIBLTE_API int binsource_cache_gen(binsource_t* q, int nbits); +LIBLTE_API void binsource_cache_cpy(binsource_t* q, char *bits, int nbits); +LIBLTE_API int binsource_generate(binsource_t* q, char *bits, int nbits); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { binsource_t obj; struct binsource_init { int cache_seq_nbits; // If non-zero, generates random bits on init @@ -63,8 +64,8 @@ typedef struct { int out_len; }binsource_hl; -int binsource_initialize(binsource_hl* h); -int binsource_work( binsource_hl* hl); -int binsource_stop(binsource_hl* hl); +LIBLTE_API int binsource_initialize(binsource_hl* h); +LIBLTE_API int binsource_work( binsource_hl* hl); +LIBLTE_API int binsource_stop(binsource_hl* hl); -#endif +#endif // BINSOURCE_ diff --git a/lte/include/lte/io/filesink.h b/lte/include/lte/io/filesink.h index 2d0f2d99b..57658d2e3 100644 --- a/lte/include/lte/io/filesink.h +++ b/lte/include/lte/io/filesink.h @@ -32,22 +32,23 @@ #include #include +#include "lte/config.h" #include "lte/io/format.h" /* Low-level API */ -typedef struct { +typedef struct LIBLTE_API { FILE *f; data_type_t type; }filesink_t; -int filesink_init(filesink_t *q, char *filename, data_type_t type); -void filesink_free(filesink_t *q); +LIBLTE_API int filesink_init(filesink_t *q, char *filename, data_type_t type); +LIBLTE_API void filesink_free(filesink_t *q); -int filesink_write(filesink_t *q, void *buffer, int nsamples); +LIBLTE_API int filesink_write(filesink_t *q, void *buffer, int nsamples); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { filesink_t obj; struct filesink_init { char *file_name; @@ -58,8 +59,8 @@ typedef struct { int in_len; }filesink_hl; -int filesink_initialize(filesink_hl* h); -int filesink_work( filesink_hl* hl); -int filesink_stop(filesink_hl* h); +LIBLTE_API int filesink_initialize(filesink_hl* h); +LIBLTE_API int filesink_work( filesink_hl* hl); +LIBLTE_API int filesink_stop(filesink_hl* h); -#endif +#endif // FILESINK_ diff --git a/lte/include/lte/io/filesource.h b/lte/include/lte/io/filesource.h index d8c787cc2..a06f1f362 100644 --- a/lte/include/lte/io/filesource.h +++ b/lte/include/lte/io/filesource.h @@ -32,23 +32,24 @@ #include #include +#include "lte/config.h" #include "lte/io/format.h" /* Low-level API */ -typedef struct { +typedef struct LIBLTE_API { FILE *f; data_type_t type; }filesource_t; -int filesource_init(filesource_t *q, char *filename, data_type_t type); -void filesource_free(filesource_t *q); +LIBLTE_API int filesource_init(filesource_t *q, char *filename, data_type_t type); +LIBLTE_API void filesource_free(filesource_t *q); -void filesource_seek(filesource_t *q, int pos); -int filesource_read(filesource_t *q, void *buffer, int nsamples); +LIBLTE_API void filesource_seek(filesource_t *q, int pos); +LIBLTE_API int filesource_read(filesource_t *q, void *buffer, int nsamples); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { filesource_t obj; struct filesource_init { char *file_name; @@ -62,8 +63,8 @@ typedef struct { int out_len; }filesource_hl; -int filesource_initialize(filesource_hl* h); -int filesource_work( filesource_hl* hl); -int filesource_stop(filesource_hl* h); +LIBLTE_API int filesource_initialize(filesource_hl* h); +LIBLTE_API int filesource_work( filesource_hl* hl); +LIBLTE_API int filesource_stop(filesource_hl* h); -#endif +#endif // FILESOURCE_ diff --git a/lte/include/lte/io/format.h b/lte/include/lte/io/format.h index 0c313a37f..517acf2d0 100644 --- a/lte/include/lte/io/format.h +++ b/lte/include/lte/io/format.h @@ -31,4 +31,4 @@ typedef enum { FLOAT, COMPLEX_FLOAT, COMPLEX_SHORT, FLOAT_BIN, COMPLEX_FLOAT_BIN, COMPLEX_SHORT_BIN} data_type_t; -#endif +#endif // FORMAT_ diff --git a/lte/include/lte/io/udpsink.h b/lte/include/lte/io/udpsink.h index e0acd2c3a..d052f2681 100644 --- a/lte/include/lte/io/udpsink.h +++ b/lte/include/lte/io/udpsink.h @@ -26,8 +26,8 @@ */ -#ifndef udpsink_ -#define udpsink_ +#ifndef UDPSINK_ +#define UDPSINK_ #include #include @@ -35,23 +35,24 @@ #include #include +#include "lte/config.h" #include "lte/io/format.h" /* Low-level API */ -typedef struct { +typedef struct LIBLTE_API { int sockfd; struct sockaddr_in servaddr; data_type_t type; }udpsink_t; -int udpsink_init(udpsink_t *q, char *address, int port, data_type_t type); -void udpsink_free(udpsink_t *q); +LIBLTE_API int udpsink_init(udpsink_t *q, char *address, int port, data_type_t type); +LIBLTE_API void udpsink_free(udpsink_t *q); -int udpsink_write(udpsink_t *q, void *buffer, int nsamples); +LIBLTE_API int udpsink_write(udpsink_t *q, void *buffer, int nsamples); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { udpsink_t obj; struct udpsink_init { char *address; @@ -63,8 +64,8 @@ typedef struct { int in_len; }udpsink_hl; -int udpsink_initialize(udpsink_hl* h); -int udpsink_work( udpsink_hl* hl); -int udpsink_stop(udpsink_hl* h); +LIBLTE_API int udpsink_initialize(udpsink_hl* h); +LIBLTE_API int udpsink_work( udpsink_hl* hl); +LIBLTE_API int udpsink_stop(udpsink_hl* h); -#endif +#endif // UDPSINK_ diff --git a/lte/include/lte/io/udpsource.h b/lte/include/lte/io/udpsource.h index 42d6839ae..9d391b772 100644 --- a/lte/include/lte/io/udpsource.h +++ b/lte/include/lte/io/udpsource.h @@ -26,8 +26,8 @@ */ -#ifndef udpsource_ -#define udpsource_ +#ifndef UDPSOURCE_ +#define UDPSOURCE_ #include @@ -36,23 +36,24 @@ #include #include +#include "lte/config.h" #include "lte/io/format.h" /* Low-level API */ -typedef struct { +typedef struct LIBLTE_API { int sockfd; struct sockaddr_in servaddr; data_type_t type; }udpsource_t; -int udpsource_init(udpsource_t *q, char *address, int port, data_type_t type); -void udpsource_free(udpsource_t *q); +LIBLTE_API int udpsource_init(udpsource_t *q, char *address, int port, data_type_t type); +LIBLTE_API void udpsource_free(udpsource_t *q); -int udpsource_read(udpsource_t *q, void *buffer, int nsamples); +LIBLTE_API int udpsource_read(udpsource_t *q, void *buffer, int nsamples); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { udpsource_t obj; struct udpsource_init { char *address; @@ -66,8 +67,8 @@ typedef struct { int out_len; }udpsource_hl; -int udpsource_initialize(udpsource_hl* h); -int udpsource_work( udpsource_hl* hl); -int udpsource_stop(udpsource_hl* h); +LIBLTE_API int udpsource_initialize(udpsource_hl* h); +LIBLTE_API int udpsource_work( udpsource_hl* hl); +LIBLTE_API int udpsource_stop(udpsource_hl* h); -#endif +#endif // UDPSOURCE_ diff --git a/lte/include/lte/mimo/layermap.h b/lte/include/lte/mimo/layermap.h index 3a472c34a..645986c5f 100644 --- a/lte/include/lte/mimo/layermap.h +++ b/lte/include/lte/mimo/layermap.h @@ -29,25 +29,27 @@ #ifndef LAYERMAP_H_ #define LAYERMAP_H_ +#include "lte/config.h" + typedef _Complex float cf_t; /* Generates the vector of layer-mapped symbols "x" based on the vector of data symbols "d" */ -int layermap_single(cf_t *d, cf_t *x, int nof_symbols); -int layermap_diversity(cf_t *d, cf_t *x[MAX_LAYERS], int nof_layers, int nof_symbols); -int layermap_multiplex(cf_t *d[MAX_CODEWORDS], cf_t *x[MAX_LAYERS], int nof_cw, int nof_layers, +LIBLTE_API int layermap_single(cf_t *d, cf_t *x, int nof_symbols); +LIBLTE_API int layermap_diversity(cf_t *d, cf_t *x[MAX_LAYERS], int nof_layers, int nof_symbols); +LIBLTE_API int layermap_multiplex(cf_t *d[MAX_CODEWORDS], cf_t *x[MAX_LAYERS], int nof_cw, int nof_layers, int nof_symbols[MAX_CODEWORDS]); -int layermap_type(cf_t *d[MAX_CODEWORDS], cf_t *x[MAX_LAYERS], int nof_cw, int nof_layers, +LIBLTE_API int layermap_type(cf_t *d[MAX_CODEWORDS], cf_t *x[MAX_LAYERS], int nof_cw, int nof_layers, int nof_symbols[MAX_CODEWORDS], lte_mimo_type_t type); /* Generates the vector of data symbols "d" based on the vector of layer-mapped symbols "x" */ -int layerdemap_single(cf_t *x, cf_t *d, int nof_symbols); -int layerdemap_diversity(cf_t *x[MAX_LAYERS], cf_t *d, int nof_layers, int nof_layer_symbols); -int layerdemap_multiplex(cf_t *x[MAX_LAYERS], cf_t *d[MAX_CODEWORDS], int nof_layers, int nof_cw, +LIBLTE_API int layerdemap_single(cf_t *x, cf_t *d, int nof_symbols); +LIBLTE_API int layerdemap_diversity(cf_t *x[MAX_LAYERS], cf_t *d, int nof_layers, int nof_layer_symbols); +LIBLTE_API int layerdemap_multiplex(cf_t *x[MAX_LAYERS], cf_t *d[MAX_CODEWORDS], int nof_layers, int nof_cw, int nof_layer_symbols, int nof_symbols[MAX_CODEWORDS]); -int layerdemap_type(cf_t *x[MAX_LAYERS], cf_t *d[MAX_CODEWORDS], int nof_layers, int nof_cw, +LIBLTE_API int layerdemap_type(cf_t *x[MAX_LAYERS], cf_t *d[MAX_CODEWORDS], int nof_layers, int nof_cw, int nof_layer_symbols, int nof_symbols[MAX_CODEWORDS], lte_mimo_type_t type); -#endif +#endif // LAYERMAP_H_ diff --git a/lte/include/lte/mimo/precoding.h b/lte/include/lte/mimo/precoding.h index 0a4cc18f7..e49331e1a 100644 --- a/lte/include/lte/mimo/precoding.h +++ b/lte/include/lte/mimo/precoding.h @@ -29,6 +29,8 @@ #ifndef PRECODING_H_ #define PRECODING_H_ +#include "lte/config.h" + typedef _Complex float cf_t; /** The precoder takes as input nlayers vectors "x" from the @@ -38,19 +40,19 @@ typedef _Complex float cf_t; /* Generates the vector "y" from the input vector "x" */ -int precoding_single(cf_t *x, cf_t *y, int nof_symbols); -int precoding_diversity(cf_t *x[MAX_LAYERS], cf_t *y[MAX_PORTS], int nof_ports, int nof_symbols); -int precoding_type(cf_t *x[MAX_LAYERS], cf_t *y[MAX_PORTS], int nof_layers, int nof_ports, +LIBLTE_API int precoding_single(cf_t *x, cf_t *y, int nof_symbols); +LIBLTE_API int precoding_diversity(cf_t *x[MAX_LAYERS], cf_t *y[MAX_PORTS], int nof_ports, int nof_symbols); +LIBLTE_API int precoding_type(cf_t *x[MAX_LAYERS], cf_t *y[MAX_PORTS], int nof_layers, int nof_ports, int nof_symbols, lte_mimo_type_t type); /* Estimates the vector "x" based on the received signal "y" and the channel estimates "ce" */ -int predecoding_single_zf(cf_t *y, cf_t *ce, cf_t *x, int nof_symbols); -int predecoding_diversity_zf(cf_t *y[MAX_PORTS], cf_t *ce[MAX_PORTS], +LIBLTE_API int predecoding_single_zf(cf_t *y, cf_t *ce, cf_t *x, int nof_symbols); +LIBLTE_API int predecoding_diversity_zf(cf_t *y[MAX_PORTS], cf_t *ce[MAX_PORTS], cf_t *x[MAX_LAYERS], int nof_ports, int nof_symbols); -int predecoding_type(cf_t *y[MAX_PORTS], cf_t *ce[MAX_PORTS], +LIBLTE_API int predecoding_type(cf_t *y[MAX_PORTS], cf_t *ce[MAX_PORTS], cf_t *x[MAX_LAYERS], int nof_ports, int nof_layers, int nof_symbols, lte_mimo_type_t type); -#endif /* PRECODING_H_ */ +#endif // PRECODING_H_ diff --git a/lte/include/lte/modem/demod_hard.h b/lte/include/lte/modem/demod_hard.h index c7608b5d8..1f8dad77a 100644 --- a/lte/include/lte/modem/demod_hard.h +++ b/lte/include/lte/modem/demod_hard.h @@ -32,23 +32,24 @@ #include #include +#include "lte/config.h" #include "modem_table.h" typedef _Complex float cf_t; -typedef struct { +typedef struct LIBLTE_API { enum modem_std table; /* In this implementation, mapping table is hard-coded */ }demod_hard_t; -void demod_hard_init(demod_hard_t* q); -void demod_hard_table_set(demod_hard_t* q, enum modem_std table); -int demod_hard_demodulate(demod_hard_t* q, cf_t* symbols, char *bits, int nsymbols); +LIBLTE_API void demod_hard_init(demod_hard_t* q); +LIBLTE_API void demod_hard_table_set(demod_hard_t* q, enum modem_std table); +LIBLTE_API int demod_hard_demodulate(demod_hard_t* q, cf_t* symbols, char *bits, int nsymbols); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { demod_hard_t obj; struct demod_hard_init { enum modem_std std; // Symbol mapping standard (see modem_table.h) @@ -61,9 +62,9 @@ typedef struct { int out_len; }demod_hard_hl; -int demod_hard_initialize(demod_hard_hl* hl); -int demod_hard_work(demod_hard_hl* hl); -int demod_hard_stop(demod_hard_hl* hl); +LIBLTE_API int demod_hard_initialize(demod_hard_hl* hl); +LIBLTE_API int demod_hard_work(demod_hard_hl* hl); +LIBLTE_API int demod_hard_stop(demod_hard_hl* hl); -#endif +#endif // DEMOD_HARD_ diff --git a/lte/include/lte/modem/demod_soft.h b/lte/include/lte/modem/demod_soft.h index 39fa2c993..4786fd72c 100644 --- a/lte/include/lte/modem/demod_soft.h +++ b/lte/include/lte/modem/demod_soft.h @@ -32,29 +32,30 @@ #include #include +#include "lte/config.h" #include "modem_table.h" enum alg { EXACT, APPROX }; -typedef struct { +typedef struct LIBLTE_API { float sigma; // noise power enum alg alg_type; // soft demapping algorithm (EXACT or APPROX) modem_table_t *table; // symbol mapping table (see modem_table.h) }demod_soft_t; -void demod_soft_init(demod_soft_t *q); -void demod_soft_table_set(demod_soft_t *q, modem_table_t *table); -void demod_soft_alg_set(demod_soft_t *q, enum alg alg_type); -void demod_soft_sigma_set(demod_soft_t *q, float sigma); -int demod_soft_demodulate(demod_soft_t *q, const cf_t* symbols, float* llr, int nsymbols); +LIBLTE_API void demod_soft_init(demod_soft_t *q); +LIBLTE_API void demod_soft_table_set(demod_soft_t *q, modem_table_t *table); +LIBLTE_API void demod_soft_alg_set(demod_soft_t *q, enum alg alg_type); +LIBLTE_API void demod_soft_sigma_set(demod_soft_t *q, float sigma); +LIBLTE_API int demod_soft_demodulate(demod_soft_t *q, const cf_t* symbols, float* llr, int nsymbols); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { demod_soft_t obj; modem_table_t table; - struct demod_soft_init { + struct demod_soft_init{ enum modem_std std; // symbol mapping standard (see modem_table.h) } init; @@ -71,9 +72,9 @@ typedef struct { }demod_soft_hl; -int demod_soft_initialize(demod_soft_hl* hl); -int demod_soft_work(demod_soft_hl* hl); -int demod_soft_stop(demod_soft_hl* hl); +LIBLTE_API int demod_soft_initialize(demod_soft_hl* hl); +LIBLTE_API int demod_soft_work(demod_soft_hl* hl); +LIBLTE_API int demod_soft_stop(demod_soft_hl* hl); -#endif +#endif // DEMOD_SOFT_ diff --git a/lte/include/lte/modem/mod.h b/lte/include/lte/modem/mod.h index 33df9cca1..359469ffc 100644 --- a/lte/include/lte/modem/mod.h +++ b/lte/include/lte/modem/mod.h @@ -32,14 +32,15 @@ #include #include +#include "lte/config.h" #include "modem_table.h" typedef _Complex float cf_t; -int mod_modulate(modem_table_t* table, const char *bits, cf_t* symbols, int nbits); +LIBLTE_API int mod_modulate(modem_table_t* table, const char *bits, cf_t* symbols, int nbits); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { modem_table_t obj; struct mod_init { enum modem_std std; // symbol mapping standard (see modem_table.h) @@ -52,8 +53,8 @@ typedef struct { int out_len; }mod_hl; -int mod_initialize(mod_hl* hl); -int mod_work(mod_hl* hl); -int mod_stop(mod_hl* hl); +LIBLTE_API int mod_initialize(mod_hl* hl); +LIBLTE_API int mod_work(mod_hl* hl); +LIBLTE_API int mod_stop(mod_hl* hl); -#endif +#endif // MOD_ diff --git a/lte/include/lte/modem/modem_table.h b/lte/include/lte/modem/modem_table.h index f52bb1482..e6d82dbc1 100644 --- a/lte/include/lte/modem/modem_table.h +++ b/lte/include/lte/modem/modem_table.h @@ -34,12 +34,14 @@ #include #include +#include "lte/config.h" + typedef _Complex float cf_t; -typedef struct { +typedef struct LIBLTE_API { int idx[2][6][32]; }soft_table_t; -typedef struct { +typedef struct LIBLTE_API { cf_t* symbol_table; // bit-to-symbol mapping soft_table_t soft_table; // symbol-to-bit mapping (used in soft demodulating) int nsymbols; // number of modulation symbols @@ -52,10 +54,10 @@ enum modem_std { LTE_BPSK = 1, LTE_QPSK = 2, LTE_QAM16 = 4, LTE_QAM64 = 6 }; -void modem_table_init(modem_table_t* q); -void modem_table_free(modem_table_t* q); -void modem_table_reset(modem_table_t* q); -int modem_table_set(modem_table_t* q, cf_t* table, soft_table_t *soft_table, int nsymbols, int nbits_x_symbol); -int modem_table_std(modem_table_t* q, enum modem_std table, bool compute_soft_demod); +LIBLTE_API void modem_table_init(modem_table_t* q); +LIBLTE_API void modem_table_free(modem_table_t* q); +LIBLTE_API void modem_table_reset(modem_table_t* q); +LIBLTE_API int modem_table_set(modem_table_t* q, cf_t* table, soft_table_t *soft_table, int nsymbols, int nbits_x_symbol); +LIBLTE_API int modem_table_std(modem_table_t* q, enum modem_std table, bool compute_soft_demod); -#endif +#endif // MODEM_TABLE_ diff --git a/lte/include/lte/phch/dci.h b/lte/include/lte/phch/dci.h index 06c6a6f3d..f18f8d07e 100644 --- a/lte/include/lte/phch/dci.h +++ b/lte/include/lte/phch/dci.h @@ -28,8 +28,10 @@ #ifndef DCI_ #define DCI_ -#include "lte/common/base.h" #include + +#include "lte/config.h" +#include "lte/common/base.h" #include "lte/phch/ra.h" typedef _Complex float cf_t; @@ -48,7 +50,7 @@ typedef enum { } dci_format_t; // Each type is for a different interface to packing/unpacking functions -typedef struct { +typedef struct LIBLTE_API { enum { PUSCH_SCHED, PDSCH_SCHED, MCCH_CHANGE, TPC_COMMAND, RA_PROC_PDCCH } type; @@ -59,42 +61,42 @@ typedef enum { DCI_COMMON = 0, DCI_UE = 1 } dci_spec_t; -typedef struct { +typedef struct LIBLTE_API { unsigned char nof_bits; unsigned char L; // Aggregation level unsigned char ncce; // Position of first CCE of the dci unsigned short rnti; } dci_candidate_t; -typedef struct { +typedef struct LIBLTE_API { char data[DCI_MAX_BITS]; dci_candidate_t location; } dci_msg_t; -typedef struct { +typedef struct LIBLTE_API { dci_msg_t *msg; int nof_dcis; int max_dcis; } dci_t; -int dci_init(dci_t *q, int max_dci); -void dci_free(dci_t *q); -char* dci_format_string(dci_format_t format); +LIBLTE_API int dci_init(dci_t *q, int max_dci); +LIBLTE_API void dci_free(dci_t *q); +LIBLTE_API char* dci_format_string(dci_format_t format); -int dci_msg_candidate_set(dci_msg_t *msg, int L, int nCCE, unsigned short rnti); -void dci_candidate_fprint(FILE *f, dci_candidate_t *q); +LIBLTE_API int dci_msg_candidate_set(dci_msg_t *msg, int L, int nCCE, unsigned short rnti); +LIBLTE_API void dci_candidate_fprint(FILE *f, dci_candidate_t *q); -int dci_msg_get_type(dci_msg_t *msg, dci_msg_type_t *type, int nof_prb, unsigned short crnti); -void dci_msg_type_fprint(FILE *f, dci_msg_type_t type); +LIBLTE_API int dci_msg_get_type(dci_msg_t *msg, dci_msg_type_t *type, int nof_prb, unsigned short crnti); +LIBLTE_API void dci_msg_type_fprint(FILE *f, dci_msg_type_t type); // For dci_msg_type_t = PUSCH_SCHED -int dci_msg_pack_pusch(ra_pusch_t *data, dci_msg_t *msg, int nof_prb); -int dci_msg_unpack_pusch(dci_msg_t *msg, ra_pusch_t *data, int nof_prb); +LIBLTE_API int dci_msg_pack_pusch(ra_pusch_t *data, dci_msg_t *msg, int nof_prb); +LIBLTE_API int dci_msg_unpack_pusch(dci_msg_t *msg, ra_pusch_t *data, int nof_prb); // For dci_msg_type_t = PDSCH_SCHED -int dci_msg_pack_pdsch(ra_pdsch_t *data, dci_msg_t *msg, dci_format_t format, int nof_prb, bool crc_is_crnti); -int dci_msg_unpack_pdsch(dci_msg_t *msg, ra_pdsch_t *data, int nof_prb, bool crc_is_crnti); +LIBLTE_API int dci_msg_pack_pdsch(ra_pdsch_t *data, dci_msg_t *msg, dci_format_t format, int nof_prb, bool crc_is_crnti); +LIBLTE_API int dci_msg_unpack_pdsch(dci_msg_t *msg, ra_pdsch_t *data, int nof_prb, bool crc_is_crnti); -int dci_format_sizeof(dci_format_t format, int nof_prb); +LIBLTE_API int dci_format_sizeof(dci_format_t format, int nof_prb); -#endif +#endif // DCI_ diff --git a/lte/include/lte/phch/pbch.h b/lte/include/lte/phch/pbch.h index 877dd6439..bcffc4411 100644 --- a/lte/include/lte/phch/pbch.h +++ b/lte/include/lte/phch/pbch.h @@ -29,6 +29,7 @@ #ifndef PBCH_ #define PBCH_ +#include "lte/config.h" #include "lte/common/base.h" #include "lte/mimo/precoding.h" #include "lte/mimo/layermap.h" @@ -45,7 +46,7 @@ typedef _Complex float cf_t; -typedef struct { +typedef struct LIBLTE_API { int nof_ports; int nof_prb; int sfn; @@ -54,7 +55,7 @@ typedef struct { }pbch_mib_t; /* PBCH object */ -typedef struct { +typedef struct LIBLTE_API { int cell_id; lte_cp_t cp; int nof_prb; @@ -84,15 +85,15 @@ typedef struct { }pbch_t; -int pbch_init(pbch_t *q, int nof_prb, int cell_id, lte_cp_t cp); -void pbch_free(pbch_t *q); -int pbch_decode(pbch_t *q, cf_t *slot1_symbols, cf_t *ce[MAX_PORTS_CTRL], float ebno, pbch_mib_t *mib); -void pbch_encode(pbch_t *q, pbch_mib_t *mib, cf_t *slot1_symbols[MAX_PORTS_CTRL], int nof_ports); -void pbch_decode_reset(pbch_t *q); +LIBLTE_API int pbch_init(pbch_t *q, int nof_prb, int cell_id, lte_cp_t cp); +LIBLTE_API void pbch_free(pbch_t *q); +LIBLTE_API int pbch_decode(pbch_t *q, cf_t *slot1_symbols, cf_t *ce[MAX_PORTS_CTRL], float ebno, pbch_mib_t *mib); +LIBLTE_API void pbch_encode(pbch_t *q, pbch_mib_t *mib, cf_t *slot1_symbols[MAX_PORTS_CTRL], int nof_ports); +LIBLTE_API void pbch_decode_reset(pbch_t *q); -void pbch_mib_fprint(FILE *stream, pbch_mib_t *mib); -bool pbch_exists(int nframe, int nslot); -int pbch_put(cf_t *pbch, cf_t *slot1_data, int nof_prb, lte_cp_t cp, int cell_id); -int pbch_get(cf_t *pbch, cf_t *slot1_data, int nof_prb, lte_cp_t cp, int cell_id); +LIBLTE_API void pbch_mib_fprint(FILE *stream, pbch_mib_t *mib); +LIBLTE_API bool pbch_exists(int nframe, int nslot); +LIBLTE_API int pbch_put(cf_t *pbch, cf_t *slot1_data, int nof_prb, lte_cp_t cp, int cell_id); +LIBLTE_API int pbch_get(cf_t *pbch, cf_t *slot1_data, int nof_prb, lte_cp_t cp, int cell_id); -#endif +#endif // PBCH_ diff --git a/lte/include/lte/phch/pcfich.h b/lte/include/lte/phch/pcfich.h index df8d87e17..67e27cb35 100644 --- a/lte/include/lte/phch/pcfich.h +++ b/lte/include/lte/phch/pcfich.h @@ -29,6 +29,7 @@ #ifndef PCFICH_ #define PCFICH_ +#include "lte/config.h" #include "lte/common/base.h" #include "lte/mimo/precoding.h" #include "lte/mimo/layermap.h" @@ -44,7 +45,7 @@ typedef _Complex float cf_t; /* PCFICH object */ -typedef struct { +typedef struct LIBLTE_API { int cell_id; lte_cp_t cp; int nof_symbols; @@ -70,13 +71,13 @@ typedef struct { }pcfich_t; -int pcfich_init(pcfich_t *q, regs_t *regs, int cell_id, int nof_prb, int nof_tx_ports, lte_cp_t cp); -void pcfich_free(pcfich_t *q); -int pcfich_decode(pcfich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS_CTRL], int nsubframe, int *cfi, int *distance); -int pcfich_encode(pcfich_t *q, int cfi, cf_t *slot_symbols[MAX_PORTS_CTRL], int nsubframe); +LIBLTE_API int pcfich_init(pcfich_t *q, regs_t *regs, int cell_id, int nof_prb, int nof_tx_ports, lte_cp_t cp); +LIBLTE_API void pcfich_free(pcfich_t *q); +LIBLTE_API int pcfich_decode(pcfich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS_CTRL], int nsubframe, int *cfi, int *distance); +LIBLTE_API int pcfich_encode(pcfich_t *q, int cfi, cf_t *slot_symbols[MAX_PORTS_CTRL], int nsubframe); -bool pcfich_exists(int nframe, int nslot); -int pcfich_put(regs_t *h, cf_t *pcfich, cf_t *slot_data); -int pcfich_get(regs_t *h, cf_t *pcfich, cf_t *slot_data); +LIBLTE_API bool pcfich_exists(int nframe, int nslot); +LIBLTE_API int pcfich_put(regs_t *h, cf_t *pcfich, cf_t *slot_data); +LIBLTE_API int pcfich_get(regs_t *h, cf_t *pcfich, cf_t *slot_data); -#endif +#endif // PCFICH_ diff --git a/lte/include/lte/phch/pdcch.h b/lte/include/lte/phch/pdcch.h index b7767d0b5..d26fa673d 100644 --- a/lte/include/lte/phch/pdcch.h +++ b/lte/include/lte/phch/pdcch.h @@ -29,6 +29,7 @@ #ifndef PDCCH_ #define PDCCH_ +#include "lte/config.h" #include "lte/common/base.h" #include "lte/mimo/precoding.h" #include "lte/mimo/layermap.h" @@ -54,13 +55,13 @@ typedef enum { * A search mode is indicated by higher layers to look for SI/C/RA-RNTI * DCI messages as defined in Section 7.1 of 36.213 */ -typedef struct { +typedef struct LIBLTE_API { int nof_candidates; dci_candidate_t *candidates[NSUBFRAMES_X_FRAME]; }pdcch_search_t; /* PDCCH object */ -typedef struct { +typedef struct LIBLTE_API { int cell_id; lte_cp_t cp; int nof_prb; @@ -91,11 +92,11 @@ typedef struct { crc_t crc; }pdcch_t; -int pdcch_init(pdcch_t *q, regs_t *regs, int nof_prb, int nof_ports, int cell_id, lte_cp_t cp); -void pdcch_free(pdcch_t *q); +LIBLTE_API int pdcch_init(pdcch_t *q, regs_t *regs, int nof_prb, int nof_ports, int cell_id, lte_cp_t cp); +LIBLTE_API void pdcch_free(pdcch_t *q); /* Encoding functions */ -int pdcch_encode(pdcch_t *q, dci_t *dci, cf_t *slot1_symbols[MAX_PORTS_CTRL], int nsubframe); +LIBLTE_API int pdcch_encode(pdcch_t *q, dci_t *dci, cf_t *slot1_symbols[MAX_PORTS_CTRL], int nsubframe); /* Decoding functions */ @@ -105,22 +106,22 @@ int pdcch_encode(pdcch_t *q, dci_t *dci, cf_t *slot1_symbols[MAX_PORTS_CTRL], in * b) call pdcch_extract_llr() and then call pdcch_decode_si/ue/ra */ -int pdcch_decode(pdcch_t *q, cf_t *slot1_symbols, cf_t *ce[MAX_PORTS_CTRL], +LIBLTE_API int pdcch_decode(pdcch_t *q, cf_t *slot1_symbols, cf_t *ce[MAX_PORTS_CTRL], dci_t *dci, int nsubframe, float ebno); -int pdcch_extract_llr(pdcch_t *q, cf_t *slot1_symbols, cf_t *ce[MAX_PORTS_CTRL], float *llr, +LIBLTE_API int pdcch_extract_llr(pdcch_t *q, cf_t *slot1_symbols, cf_t *ce[MAX_PORTS_CTRL], float *llr, int nsubframe, float ebno); -void pdcch_init_search_si(pdcch_t *q); -void pdcch_set_search_si(pdcch_t *q); -int pdcch_decode_si(pdcch_t *q, float *llr, dci_t *dci); +LIBLTE_API void pdcch_init_search_si(pdcch_t *q); +LIBLTE_API void pdcch_set_search_si(pdcch_t *q); +LIBLTE_API int pdcch_decode_si(pdcch_t *q, float *llr, dci_t *dci); -void pdcch_init_search_ue(pdcch_t *q, unsigned short c_rnti); -void pdcch_set_search_ue(pdcch_t *q); -int pdcch_decode_ue(pdcch_t *q, float *llr, dci_t *dci, int nsubframe); +LIBLTE_API void pdcch_init_search_ue(pdcch_t *q, unsigned short c_rnti); +LIBLTE_API void pdcch_set_search_ue(pdcch_t *q); +LIBLTE_API int pdcch_decode_ue(pdcch_t *q, float *llr, dci_t *dci, int nsubframe); -void pdcch_init_search_ra(pdcch_t *q, unsigned short ra_rnti); -void pdcch_set_search_ra(pdcch_t *q); -int pdcch_decode_ra(pdcch_t *q, float *llr, dci_t *dci); +LIBLTE_API void pdcch_init_search_ra(pdcch_t *q, unsigned short ra_rnti); +LIBLTE_API void pdcch_set_search_ra(pdcch_t *q); +LIBLTE_API int pdcch_decode_ra(pdcch_t *q, float *llr, dci_t *dci); #endif diff --git a/lte/include/lte/phch/phich.h b/lte/include/lte/phch/phich.h index 80028a785..a763cf7e8 100644 --- a/lte/include/lte/phch/phich.h +++ b/lte/include/lte/phch/phich.h @@ -29,6 +29,7 @@ #ifndef PHICH_ #define PHICH_ +#include "lte/config.h" #include "lte/common/base.h" #include "lte/mimo/precoding.h" #include "lte/mimo/layermap.h" @@ -53,7 +54,7 @@ typedef _Complex float cf_t; #define PHICH_EXT_NSF 2 /* phich object */ -typedef struct { +typedef struct LIBLTE_API { lte_cp_t cp; int nof_prb; int nof_tx_ports; @@ -79,18 +80,18 @@ typedef struct { }phich_t; -int phich_init(phich_t *q, regs_t *regs, int cell_id, int nof_prb, int nof_tx_ports, lte_cp_t cp); -void phich_free(phich_t *q); -int phich_decode(phich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS_CTRL], +LIBLTE_API int phich_init(phich_t *q, regs_t *regs, int cell_id, int nof_prb, int nof_tx_ports, lte_cp_t cp); +LIBLTE_API void phich_free(phich_t *q); +LIBLTE_API int phich_decode(phich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS_CTRL], int ngroup, int nseq, int nsubframe, char *ack, int *distance); -int phich_encode(phich_t *q, char ack, int ngroup, int nseq, int nsubframe, +LIBLTE_API int phich_encode(phich_t *q, char ack, int ngroup, int nseq, int nsubframe, cf_t *slot_symbols[MAX_PORTS_CTRL]); -void phich_reset(phich_t *q, cf_t *slot_symbols[MAX_PORTS_CTRL]); -int phich_ngroups(phich_t *q); -bool phich_exists(int nframe, int nslot); -int phich_put(regs_t *h, cf_t *phich, cf_t *slot_data); -int phich_get(regs_t *h, cf_t *phich, cf_t *slot_data); +LIBLTE_API void phich_reset(phich_t *q, cf_t *slot_symbols[MAX_PORTS_CTRL]); +LIBLTE_API int phich_ngroups(phich_t *q); +LIBLTE_API bool phich_exists(int nframe, int nslot); +LIBLTE_API int phich_put(regs_t *h, cf_t *phich, cf_t *slot_data); +LIBLTE_API int phich_get(regs_t *h, cf_t *phich, cf_t *slot_data); -#endif +#endif // PHICH_ diff --git a/lte/include/lte/phch/ra.h b/lte/include/lte/phch/ra.h index 0519dc51d..32332cd66 100644 --- a/lte/include/lte/phch/ra.h +++ b/lte/include/lte/phch/ra.h @@ -31,6 +31,8 @@ #include #include +#include "lte/config.h" + /** Structures and utility functions for DL/UL resource * allocation. */ @@ -39,7 +41,7 @@ typedef enum { MOD_NULL = 0, BPSK = 1, QPSK = 2, QAM16 = 4, QAM64 = 16 } ra_mod_t; -typedef struct { +typedef struct LIBLTE_API { ra_mod_t mod; // By default, mod = MOD_NULL and the mcs_idx value is taken by the packing functions // otherwise mod + tbs values are used to generate the mcs_idx automatically. uint8_t tbs_idx; @@ -53,17 +55,17 @@ typedef enum { alloc_type0 = 0, alloc_type1 = 1, alloc_type2 = 2 }ra_type_t; -typedef struct { +typedef struct LIBLTE_API { uint32_t rbg_bitmask; }ra_type0_t; -typedef struct { +typedef struct LIBLTE_API { uint32_t vrb_bitmask; uint8_t rbg_subset; bool shift; }ra_type1_t; -typedef struct { +typedef struct LIBLTE_API { uint32_t riv; // if L_crb==0, DCI message packer will take this value directly uint16_t L_crb; uint16_t RB_start; @@ -72,7 +74,7 @@ typedef struct { enum {t2_loc = 0, t2_dist = 1} mode; }ra_type2_t; -typedef struct { +typedef struct LIBLTE_API { unsigned short rnti; ra_type_t alloc_type; union { @@ -86,7 +88,7 @@ typedef struct { bool ndi; } ra_pdsch_t; -typedef struct { +typedef struct LIBLTE_API { /* 36.213 Table 8.4-2: hop_half is 0 for < 10 Mhz and 10 for > 10 Mh. * hop_quart is 00 for > 10 Mhz and hop_quart_neg is 01 for > 10 Mhz. */ @@ -107,50 +109,50 @@ typedef struct { } ra_pusch_t; -typedef struct { +typedef struct LIBLTE_API { uint8_t prb_idx[110]; int nof_prb; }ra_prb_slot_t; -typedef struct { +typedef struct LIBLTE_API { ra_prb_slot_t slot1; ra_prb_slot_t slot2; bool is_dist; }ra_prb_t; -void ra_prb_fprint(FILE *f, ra_prb_slot_t *prb); -int ra_prb_get_dl(ra_prb_t *prb, ra_pdsch_t *ra, int nof_prb); -int ra_prb_get_ul(ra_prb_slot_t *prb, ra_pusch_t *ra, int nof_prb); -int ra_nprb_dl(ra_pdsch_t *ra, int nof_prb); -int ra_nprb_ul(ra_pusch_t *ra, int nof_prb); +LIBLTE_API void ra_prb_fprint(FILE *f, ra_prb_slot_t *prb); +LIBLTE_API int ra_prb_get_dl(ra_prb_t *prb, ra_pdsch_t *ra, int nof_prb); +LIBLTE_API int ra_prb_get_ul(ra_prb_slot_t *prb, ra_pusch_t *ra, int nof_prb); +LIBLTE_API int ra_nprb_dl(ra_pdsch_t *ra, int nof_prb); +LIBLTE_API int ra_nprb_ul(ra_pusch_t *ra, int nof_prb); -uint8_t ra_mcs_to_table_idx(ra_mcs_t *mcs); -int ra_mcs_from_idx_dl(uint8_t idx, ra_mcs_t *mcs); -int ra_mcs_from_idx_ul(uint8_t idx, ra_mcs_t *mcs); -int ra_tbs_from_idx_format1c(uint8_t tbs_idx); -int ra_tbs_to_table_idx_format1c(int tbs); -int ra_tbs_from_idx(uint8_t tbs_idx, int n_prb); -int ra_tbs_to_table_idx(int tbs, int n_prb); +LIBLTE_API uint8_t ra_mcs_to_table_idx(ra_mcs_t *mcs); +LIBLTE_API int ra_mcs_from_idx_dl(uint8_t idx, ra_mcs_t *mcs); +LIBLTE_API int ra_mcs_from_idx_ul(uint8_t idx, ra_mcs_t *mcs); +LIBLTE_API int ra_tbs_from_idx_format1c(uint8_t tbs_idx); +LIBLTE_API int ra_tbs_to_table_idx_format1c(int tbs); +LIBLTE_API int ra_tbs_from_idx(uint8_t tbs_idx, int n_prb); +LIBLTE_API int ra_tbs_to_table_idx(int tbs, int n_prb); -uint8_t ra_mcs_to_table_idx(ra_mcs_t *mcs); -int ra_mcs_from_idx_dl(uint8_t idx, ra_mcs_t *mcs); -int ra_mcs_from_idx_ul(uint8_t idx, ra_mcs_t *mcs); +LIBLTE_API uint8_t ra_mcs_to_table_idx(ra_mcs_t *mcs); +LIBLTE_API int ra_mcs_from_idx_dl(uint8_t idx, ra_mcs_t *mcs); +LIBLTE_API int ra_mcs_from_idx_ul(uint8_t idx, ra_mcs_t *mcs); -char *ra_mod_string(ra_mod_t mod); +LIBLTE_API char *ra_mod_string(ra_mod_t mod); -int ra_type0_P(int nof_prb); +LIBLTE_API int ra_type0_P(int nof_prb); -uint32_t ra_type2_to_riv(uint16_t L_crb, uint16_t RB_start, int nof_prb); -void ra_type2_from_riv(uint32_t riv, uint16_t *L_crb, uint16_t *RB_start, int nof_prb, int nof_vrb); -int ra_type2_n_vrb_dl(int nof_prb, bool ngap_is_1); -int ra_type2_n_rb_step(int nof_prb); -int ra_type2_ngap(int nof_prb, bool ngap_is_1); -int ra_type1_N_rb(int nof_prb); +LIBLTE_API uint32_t ra_type2_to_riv(uint16_t L_crb, uint16_t RB_start, int nof_prb); +LIBLTE_API void ra_type2_from_riv(uint32_t riv, uint16_t *L_crb, uint16_t *RB_start, int nof_prb, int nof_vrb); +LIBLTE_API int ra_type2_n_vrb_dl(int nof_prb, bool ngap_is_1); +LIBLTE_API int ra_type2_n_rb_step(int nof_prb); +LIBLTE_API int ra_type2_ngap(int nof_prb, bool ngap_is_1); +LIBLTE_API int ra_type1_N_rb(int nof_prb); -void ra_pdsch_set_mcs_index(ra_pdsch_t *ra, uint8_t mcs_idx); -void ra_pdsch_set_mcs(ra_pdsch_t *ra, ra_mod_t mod, uint8_t tbs_idx); -void ra_pdsch_fprint(FILE *f, ra_pdsch_t *ra, int nof_prb); -void ra_pusch_fprint(FILE *f, ra_pusch_t *ra, int nof_prb); +LIBLTE_API void ra_pdsch_set_mcs_index(ra_pdsch_t *ra, uint8_t mcs_idx); +LIBLTE_API void ra_pdsch_set_mcs(ra_pdsch_t *ra, ra_mod_t mod, uint8_t tbs_idx); +LIBLTE_API void ra_pdsch_fprint(FILE *f, ra_pdsch_t *ra, int nof_prb); +LIBLTE_API void ra_pusch_fprint(FILE *f, ra_pusch_t *ra, int nof_prb); -#endif /* RB_ALLOC_H_ */ +#endif // RB_ALLOC_H_ diff --git a/lte/include/lte/phch/regs.h b/lte/include/lte/phch/regs.h index 657776650..e104b6f4c 100644 --- a/lte/include/lte/phch/regs.h +++ b/lte/include/lte/phch/regs.h @@ -30,6 +30,7 @@ #define _REGS_H_ #include +#include "lte/config.h" #include "lte/common/base.h" #define REGS_PHICH_NSYM 12 @@ -43,19 +44,19 @@ typedef _Complex float cf_t; -typedef struct { +typedef struct LIBLTE_API { int k[4]; int k0; int l; bool assigned; }regs_reg_t; -typedef struct { +typedef struct LIBLTE_API { int nof_regs; regs_reg_t **regs; }regs_ch_t; -typedef struct { +typedef struct LIBLTE_API { int cell_id; int nof_prb; int max_ctrl_symbols; @@ -73,28 +74,28 @@ typedef struct { regs_reg_t *regs; }regs_t; -int regs_init(regs_t *h, int cell_id, int nof_prb, int nof_ports, +LIBLTE_API int regs_init(regs_t *h, int cell_id, int nof_prb, int nof_ports, phich_resources_t phich_res, phich_length_t phich_len, lte_cp_t cp); -void regs_free(regs_t *h); -int regs_set_cfi(regs_t *h, int nof_ctrl_symbols); +LIBLTE_API void regs_free(regs_t *h); +LIBLTE_API int regs_set_cfi(regs_t *h, int nof_ctrl_symbols); -int regs_put_reg(regs_reg_t *reg, cf_t *reg_data, cf_t *slot_symbols, int nof_prb); -int regs_add_reg(regs_reg_t *reg, cf_t *reg_data, cf_t *slot_symbols, int nof_prb); -int regs_get_reg(regs_reg_t *reg, cf_t *slot_symbols, cf_t *reg_data, int nof_prb); -int regs_reset_reg(regs_reg_t *reg, cf_t *slot_symbols, int nof_prb); +LIBLTE_API int regs_put_reg(regs_reg_t *reg, cf_t *reg_data, cf_t *slot_symbols, int nof_prb); +LIBLTE_API int regs_add_reg(regs_reg_t *reg, cf_t *reg_data, cf_t *slot_symbols, int nof_prb); +LIBLTE_API int regs_get_reg(regs_reg_t *reg, cf_t *slot_symbols, cf_t *reg_data, int nof_prb); +LIBLTE_API int regs_reset_reg(regs_reg_t *reg, cf_t *slot_symbols, int nof_prb); -int regs_pcfich_nregs(regs_t *h); -int regs_pcfich_put(regs_t *h, cf_t pcfich_symbols[REGS_PCFICH_NSYM], cf_t *slot_symbols); -int regs_pcfich_get(regs_t *h, cf_t *slot_symbols, cf_t pcfich_symbols[REGS_PCFICH_NSYM]); +LIBLTE_API int regs_pcfich_nregs(regs_t *h); +LIBLTE_API int regs_pcfich_put(regs_t *h, cf_t pcfich_symbols[REGS_PCFICH_NSYM], cf_t *slot_symbols); +LIBLTE_API int regs_pcfich_get(regs_t *h, cf_t *slot_symbols, cf_t pcfich_symbols[REGS_PCFICH_NSYM]); -int regs_phich_nregs(regs_t *h); -int regs_phich_add(regs_t *h, cf_t phich_symbols[REGS_PHICH_NSYM], int ngroup, cf_t *slot_symbols); -int regs_phich_get(regs_t *h, cf_t *slot_symbols, cf_t phich_symbols[REGS_PHICH_NSYM], int ngroup); -int regs_phich_ngroups(regs_t *h); -int regs_phich_reset(regs_t *h, cf_t *slot_symbols); +LIBLTE_API int regs_phich_nregs(regs_t *h); +LIBLTE_API int regs_phich_add(regs_t *h, cf_t phich_symbols[REGS_PHICH_NSYM], int ngroup, cf_t *slot_symbols); +LIBLTE_API int regs_phich_get(regs_t *h, cf_t *slot_symbols, cf_t phich_symbols[REGS_PHICH_NSYM], int ngroup); +LIBLTE_API int regs_phich_ngroups(regs_t *h); +LIBLTE_API int regs_phich_reset(regs_t *h, cf_t *slot_symbols); -int regs_pdcch_nregs(regs_t *h); -int regs_pdcch_put(regs_t *h, cf_t *pdcch_symbols, cf_t *slot_symbols); -int regs_pdcch_get(regs_t *h, cf_t *slot_symbols, cf_t *pdcch_symbols); +LIBLTE_API int regs_pdcch_nregs(regs_t *h); +LIBLTE_API int regs_pdcch_put(regs_t *h, cf_t *pdcch_symbols, cf_t *slot_symbols); +LIBLTE_API int regs_pdcch_get(regs_t *h, cf_t *slot_symbols, cf_t *pdcch_symbols); -#endif +#endif // REGS_H_ diff --git a/lte/include/lte/resampling/interp.h b/lte/include/lte/resampling/interp.h index 39267ca36..d41c83c47 100644 --- a/lte/include/lte/resampling/interp.h +++ b/lte/include/lte/resampling/interp.h @@ -25,10 +25,16 @@ * */ +#ifndef INTERP_H +#define INTERP_H_ + +#include "lte/config.h" typedef _Complex float cf_t; -void interp_linear_offset(cf_t *input, cf_t *output, int M, int len, int off_st, int off_end); -void interp_linear(cf_t *input, cf_t *output, int M, int len); -void interp_linear_f(float *input, float *output, int M, int len); +LIBLTE_API void interp_linear_offset(cf_t *input, cf_t *output, int M, int len, int off_st, int off_end); +LIBLTE_API void interp_linear(cf_t *input, cf_t *output, int M, int len); +LIBLTE_API void interp_linear_f(float *input, float *output, int M, int len); + +#endif // INTERP_H diff --git a/lte/include/lte/resampling/resample_arb.h b/lte/include/lte/resampling/resample_arb.h index 122e52a6d..7a77435e7 100644 --- a/lte/include/lte/resampling/resample_arb.h +++ b/lte/include/lte/resampling/resample_arb.h @@ -31,19 +31,21 @@ #include #include +#include "lte/config.h" + typedef _Complex float cf_t; #define RESAMPLE_ARB_N 32 // Polyphase filter rows #define RESAMPLE_ARB_M 8 // Polyphase filter columns -typedef struct { +typedef struct LIBLTE_API { float rate; // Resample rate float step; // Step increment through filter float acc; // Index into filter cf_t reg[RESAMPLE_ARB_M]; // Our window of samples }resample_arb_t; -void resample_arb_init(resample_arb_t *q, float rate); -int resample_arb_compute(resample_arb_t *q, cf_t *input, cf_t *output, int n_in); +LIBLTE_API void resample_arb_init(resample_arb_t *q, float rate); +LIBLTE_API int resample_arb_compute(resample_arb_t *q, cf_t *input, cf_t *output, int n_in); #endif //RESAMPLE_ARB_ diff --git a/lte/include/lte/scrambling/scrambling.h b/lte/include/lte/scrambling/scrambling.h index 65f12cfb4..ba0a770f7 100644 --- a/lte/include/lte/scrambling/scrambling.h +++ b/lte/include/lte/scrambling/scrambling.h @@ -29,20 +29,21 @@ #ifndef SCRAMBLING_ #define SCRAMBLING_ +#include "lte/config.h" #include "lte/common/sequence.h" #include "lte/common/base.h" typedef _Complex float cf_t; /* Scrambling has no state */ -void scrambling_b(sequence_t *s, char *data); -void scrambling_b_offset(sequence_t *s, char *data, int offset, int len); +LIBLTE_API void scrambling_b(sequence_t *s, char *data); +LIBLTE_API void scrambling_b_offset(sequence_t *s, char *data, int offset, int len); -void scrambling_f(sequence_t *s, float *data); -void scrambling_f_offset(sequence_t *s, float *data, int offset, int len); +LIBLTE_API void scrambling_f(sequence_t *s, float *data); +LIBLTE_API void scrambling_f_offset(sequence_t *s, float *data, int offset, int len); -void scrambling_c(sequence_t *s, cf_t *data); -void scrambling_c_offset(sequence_t *s, cf_t *data, int offset, int len); +LIBLTE_API void scrambling_c(sequence_t *s, cf_t *data); +LIBLTE_API void scrambling_c_offset(sequence_t *s, cf_t *data, int offset, int len); /* High-level API */ @@ -55,11 +56,11 @@ void scrambling_c_offset(sequence_t *s, cf_t *data, int offset, int len); #define SCRAMBLING_PMCH 4 #define SCRAMBLING_PUCCH 5 -typedef struct { +typedef struct LIBLTE_API { sequence_t seq[NSUBFRAMES_X_FRAME]; }scrambling_t; -typedef struct { +typedef struct LIBLTE_API { scrambling_t obj; struct scrambling_init { int hard; @@ -79,4 +80,4 @@ typedef struct { int out_len; }scrambling_hl; -#endif +#endif // SCRAMBLING_ diff --git a/lte/include/lte/sync/cfo.h b/lte/include/lte/sync/cfo.h index 76bc9aafa..136eabb6c 100644 --- a/lte/include/lte/sync/cfo.h +++ b/lte/include/lte/sync/cfo.h @@ -26,11 +26,13 @@ */ -#ifndef _cfo_ -#define _cfo_ +#ifndef CFO_ +#define CFO_ #include +#include "lte/config.h" + typedef _Complex float cf_t; /** If the frequency is changed more than the tolerance, a new table is generated */ @@ -38,7 +40,7 @@ typedef _Complex float cf_t; #define CFO_CEXPTAB_SIZE 4096 -typedef struct { +typedef struct LIBLTE_API { float last_freq; float tol; int nsamples; @@ -46,10 +48,10 @@ typedef struct { cf_t *cur_cexp; }cfo_t; -int cfo_init(cfo_t *h, int nsamples); -void cfo_free(cfo_t *h); +LIBLTE_API int cfo_init(cfo_t *h, int nsamples); +LIBLTE_API void cfo_free(cfo_t *h); -void cfo_set_tol(cfo_t *h, float tol); -void cfo_correct(cfo_t *h, cf_t *x, float freq); +LIBLTE_API void cfo_set_tol(cfo_t *h, float tol); +LIBLTE_API void cfo_correct(cfo_t *h, cf_t *x, float freq); -#endif +#endif // CFO_ diff --git a/lte/include/lte/sync/pss.h b/lte/include/lte/sync/pss.h index f1329dd97..78b4c1e0d 100644 --- a/lte/include/lte/sync/pss.h +++ b/lte/include/lte/sync/pss.h @@ -32,6 +32,7 @@ #include #include +#include "lte/config.h" #include "lte/common/base.h" #include "lte/utils/convolution.h" @@ -60,7 +61,7 @@ typedef _Complex float cf_t; /* this is only a shortcut */ /* Low-level API */ -typedef struct { +typedef struct LIBLTE_API { #ifdef CONVOLUTION_FFT conv_fft_cc_t conv_fft; @@ -87,39 +88,29 @@ typedef struct { typedef enum { PSS_TX, PSS_RX } pss_direction_t; /* Basic functionality */ +LIBLTE_API int pss_synch_init(pss_synch_t *q, int frame_size); +LIBLTE_API void pss_synch_free(pss_synch_t *q); +LIBLTE_API int pss_generate(cf_t *signal, int N_id_2); +LIBLTE_API void pss_put_slot(cf_t *pss_signal, cf_t *slot, int nof_prb, lte_cp_t cp); -int pss_synch_init(pss_synch_t *q, int frame_size); -void pss_synch_free(pss_synch_t *q); -int pss_generate(cf_t *signal, int N_id_2); -void pss_put_slot(cf_t *pss_signal, cf_t *slot, int nof_prb, lte_cp_t cp); - -int pss_synch_set_N_id_2(pss_synch_t *q, int N_id_2); -int pss_synch_find_pss(pss_synch_t *q, cf_t *input, float *corr_peak_value, float *corr_mean_value); -float pss_synch_cfo_compute(pss_synch_t* q, cf_t *pss_recv); - - - - +LIBLTE_API int pss_synch_set_N_id_2(pss_synch_t *q, int N_id_2); +LIBLTE_API int pss_synch_find_pss(pss_synch_t *q, cf_t *input, float *corr_peak_value, float *corr_mean_value); +LIBLTE_API float pss_synch_cfo_compute(pss_synch_t* q, cf_t *pss_recv); /* Automatic frame management functions (for periodic calling) */ -int pss_synch_periodic(pss_synch_t *q, cf_t *input, cf_t *output, int nsamples); -void pss_synch_set_timeout(pss_synch_t *q, int nof_frames); -void pss_synch_set_threshold(pss_synch_t *q, float threshold); -void pss_synch_set_cfo_mode(pss_synch_t *q, bool cfo_auto); -float pss_synch_get_cfo(pss_synch_t *q); -int pss_synch_get_frame_start_idx(pss_synch_t *q); - - - - - +LIBLTE_API int pss_synch_periodic(pss_synch_t *q, cf_t *input, cf_t *output, int nsamples); +LIBLTE_API void pss_synch_set_timeout(pss_synch_t *q, int nof_frames); +LIBLTE_API void pss_synch_set_threshold(pss_synch_t *q, float threshold); +LIBLTE_API void pss_synch_set_cfo_mode(pss_synch_t *q, bool cfo_auto); +LIBLTE_API float pss_synch_get_cfo(pss_synch_t *q); +LIBLTE_API int pss_synch_get_frame_start_idx(pss_synch_t *q); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { pss_synch_t obj; struct pss_synch_init { int frame_size; // if 0, 2048 @@ -139,9 +130,9 @@ typedef struct { #define DEFAULT_FRAME_SIZE 2048 -int pss_synch_initialize(pss_synch_hl* h); -int pss_synch_work(pss_synch_hl* hl); -int pss_synch_stop(pss_synch_hl* hl); +LIBLTE_API int pss_synch_initialize(pss_synch_hl* h); +LIBLTE_API int pss_synch_work(pss_synch_hl* hl); +LIBLTE_API int pss_synch_stop(pss_synch_hl* hl); -#endif +#endif // PSS_ diff --git a/lte/include/lte/sync/sfo.h b/lte/include/lte/sync/sfo.h index 11b5ba02c..92234976b 100644 --- a/lte/include/lte/sync/sfo.h +++ b/lte/include/lte/sync/sfo.h @@ -29,7 +29,9 @@ #ifndef SFO_ #define SFO_ -float sfo_estimate(int *t0, int len, float period); -float sfo_estimate_period(int *t0, int *t, int len, float period); +#include "lte/config.h" -#endif +LIBLTE_API float sfo_estimate(int *t0, int len, float period); +LIBLTE_API float sfo_estimate_period(int *t0, int *t, int len, float period); + +#endif // SFO_ diff --git a/lte/include/lte/sync/sss.h b/lte/include/lte/sync/sss.h index d7227a540..538d6efb7 100644 --- a/lte/include/lte/sync/sss.h +++ b/lte/include/lte/sync/sss.h @@ -32,6 +32,7 @@ #include #include +#include "lte/config.h" #include "lte/common/base.h" #include "lte/utils/dft.h" @@ -48,7 +49,7 @@ typedef _Complex float cf_t; /* this is only a shortcut */ #define N_SSS 31 #define SSS_LEN 2*N_SSS -struct sss_tables { +struct sss_tables{ int z1[N_SSS][N_SSS]; int c[2][N_SSS]; int s[N_SSS][N_SSS]; @@ -58,7 +59,7 @@ struct sss_tables { /* Allocate 32 complex to make it multiple of 32-byte AVX instructions alignment requirement. * Should use vect_malloc() to make it platform agnostic. */ -struct fc_tables { +struct fc_tables{ cf_t z1[N_SSS+1][N_SSS+1]; cf_t c[2][N_SSS+1]; cf_t s[N_SSS+1][N_SSS+1]; @@ -66,7 +67,7 @@ struct fc_tables { /* Low-level API */ -typedef struct { +typedef struct LIBLTE_API { dft_plan_t dftp_input; @@ -81,27 +82,27 @@ typedef struct { /* Basic functionality */ -int sss_synch_init(sss_synch_t *q); -void sss_synch_free(sss_synch_t *q); -void sss_generate(float *signal0, float *signal5, int cell_id); -void sss_put_slot(float *sss, cf_t *symbol, int nof_prb, lte_cp_t cp); +LIBLTE_API int sss_synch_init(sss_synch_t *q); +LIBLTE_API void sss_synch_free(sss_synch_t *q); +LIBLTE_API void sss_generate(float *signal0, float *signal5, int cell_id); +LIBLTE_API void sss_put_slot(float *sss, cf_t *symbol, int nof_prb, lte_cp_t cp); -int sss_synch_set_N_id_2(sss_synch_t *q, int N_id_2); +LIBLTE_API int sss_synch_set_N_id_2(sss_synch_t *q, int N_id_2); -void sss_synch_m0m1(sss_synch_t *q, cf_t *input, int *m0, float *m0_value, +LIBLTE_API void sss_synch_m0m1(sss_synch_t *q, cf_t *input, int *m0, float *m0_value, int *m1, float *m1_value); -int sss_synch_subframe(int m0, int m1); -int sss_synch_N_id_1(sss_synch_t *q, int m0, int m1); +LIBLTE_API int sss_synch_subframe(int m0, int m1); +LIBLTE_API int sss_synch_N_id_1(sss_synch_t *q, int m0, int m1); -int sss_synch_frame(sss_synch_t *q, cf_t *input, int *subframe_idx, int *N_id_1); -void sss_synch_set_threshold(sss_synch_t *q, float threshold); -void sss_synch_set_symbol_sz(sss_synch_t *q, int symbol_sz); -void sss_synch_set_subframe_sz(sss_synch_t *q, int subframe_sz); +LIBLTE_API int sss_synch_frame(sss_synch_t *q, cf_t *input, int *subframe_idx, int *N_id_1); +LIBLTE_API void sss_synch_set_threshold(sss_synch_t *q, float threshold); +LIBLTE_API void sss_synch_set_symbol_sz(sss_synch_t *q, int symbol_sz); +LIBLTE_API void sss_synch_set_subframe_sz(sss_synch_t *q, int subframe_sz); /* High-level API */ -typedef struct { +typedef struct LIBLTE_API { sss_synch_t obj; struct sss_synch_init { int N_id_2; @@ -121,9 +122,9 @@ typedef struct { #define DEFAULT_FRAME_SIZE 2048 -int sss_synch_initialize(sss_synch_hl* h); -int sss_synch_work(sss_synch_hl* hl); -int sss_synch_stop(sss_synch_hl* hl); +LIBLTE_API int sss_synch_initialize(sss_synch_hl* h); +LIBLTE_API int sss_synch_work(sss_synch_hl* hl); +LIBLTE_API int sss_synch_stop(sss_synch_hl* hl); -#endif +#endif // SSS_ diff --git a/lte/include/lte/sync/sync.h b/lte/include/lte/sync/sync.h index 706c45fd2..2a581d087 100644 --- a/lte/include/lte/sync/sync.h +++ b/lte/include/lte/sync/sync.h @@ -31,6 +31,7 @@ #include +#include "lte/config.h" #include "pss.h" #include "sss.h" #include "sfo.h" @@ -48,7 +49,7 @@ enum sync_pss_det { ABSOLUTE, PEAK_MEAN}; -typedef struct { +typedef struct LIBLTE_API { pss_synch_t pss[3]; // One for each N_id_2 sss_synch_t sss[3]; // One for each N_id_2 enum sync_pss_det pss_mode; @@ -65,41 +66,41 @@ typedef struct { }sync_t; -int sync_init(sync_t *q, int frame_size); -void sync_free(sync_t *q); +LIBLTE_API int sync_init(sync_t *q, int frame_size); +LIBLTE_API void sync_free(sync_t *q); /* Runs the synchronization algorithm. input signal must be sampled at 1.92 MHz and should be frame_size long at least */ -int sync_run(sync_t *q, cf_t *input); +LIBLTE_API int sync_run(sync_t *q, cf_t *input); /* Sets the threshold for peak comparison */ -void sync_set_threshold(sync_t *q, float threshold); +LIBLTE_API void sync_set_threshold(sync_t *q, float threshold); /* Set peak comparison to absolute value */ -void sync_pss_det_absolute(sync_t *q); +LIBLTE_API void sync_pss_det_absolute(sync_t *q); /* Set peak comparison to relative to the mean */ -void sync_pss_det_peak_to_avg(sync_t *q); +LIBLTE_API void sync_pss_det_peak_to_avg(sync_t *q); /* Forces the synchronizer to check one N_id_2 PSS sequence only (useful for tracking mode) */ -void sync_force_N_id_2(sync_t *q, int force_N_id_2); +LIBLTE_API void sync_force_N_id_2(sync_t *q, int force_N_id_2); /* Forces the synchronizer to skip CP detection (useful for tracking mode) */ -void sync_force_cp(sync_t *q, lte_cp_t cp); +LIBLTE_API void sync_force_cp(sync_t *q, lte_cp_t cp); /* Enables/Disables SSS detection (useful for tracking mode) */ -void sync_sss_en(sync_t *q, bool enabled); +LIBLTE_API void sync_sss_en(sync_t *q, bool enabled); /* Gets the slot id (0 or 10) */ -int sync_get_slot_id(sync_t *q); +LIBLTE_API int sync_get_slot_id(sync_t *q); /* Gets the last peak-to-average ratio */ -float sync_get_peak_to_avg(sync_t *q); +LIBLTE_API float sync_get_peak_to_avg(sync_t *q); /* Gets the N_id_2 from the last call to synch_run() */ -int sync_get_N_id_2(sync_t *q); +LIBLTE_API int sync_get_N_id_2(sync_t *q); /* Gets the N_id_1 from the last call to synch_run() */ -int sync_get_N_id_1(sync_t *q); +LIBLTE_API int sync_get_N_id_1(sync_t *q); /* Gets the Physical CellId from the last call to synch_run() */ -int sync_get_cell_id(sync_t *q); +LIBLTE_API int sync_get_cell_id(sync_t *q); /* Gets the CFO estimation from the last call to synch_run() */ -float sync_get_cfo(sync_t *q); +LIBLTE_API float sync_get_cfo(sync_t *q); /* Gets the CP length estimation from the last call to synch_run() */ -lte_cp_t sync_get_cp(sync_t *q); +LIBLTE_API lte_cp_t sync_get_cp(sync_t *q); -#endif +#endif // SYNC_ diff --git a/lte/include/lte/utils/bit.h b/lte/include/lte/utils/bit.h index 18ef23e9e..94099f25f 100644 --- a/lte/include/lte/utils/bit.h +++ b/lte/include/lte/utils/bit.h @@ -32,11 +32,13 @@ #include #include -uint32_t bit_unpack(char **bits, int nof_bits); -void bit_pack(uint32_t value, char **bits, int nof_bits); -void bit_fprint(FILE *stream, char *bits, int nof_bits); -unsigned int bit_diff(char *x, char *y, int nbits); -int bit_count(unsigned int n); +#include "lte/config.h" -#endif +LIBLTE_API uint32_t bit_unpack(char **bits, int nof_bits); +LIBLTE_API void bit_pack(uint32_t value, char **bits, int nof_bits); +LIBLTE_API void bit_fprint(FILE *stream, char *bits, int nof_bits); +LIBLTE_API unsigned int bit_diff(char *x, char *y, int nbits); +LIBLTE_API int bit_count(unsigned int n); + +#endif // BIT_ diff --git a/lte/include/lte/utils/cexptab.h b/lte/include/lte/utils/cexptab.h index 2063eb0cd..5ebdfd690 100644 --- a/lte/include/lte/utils/cexptab.h +++ b/lte/include/lte/utils/cexptab.h @@ -26,22 +26,23 @@ */ -#ifndef _cexptab_ -#define _cexptab_ +#ifndef CEXPTAB_ +#define CEXPTAB_ #include +#include "lte/config.h" typedef _Complex float cf_t; -typedef struct { +typedef struct LIBLTE_API { int size; cf_t *tab; }cexptab_t; -int cexptab_init(cexptab_t *nco, int size); -void cexptab_free(cexptab_t *nco); +LIBLTE_API int cexptab_init(cexptab_t *nco, int size); +LIBLTE_API void cexptab_free(cexptab_t *nco); -void cexptab_gen(cexptab_t *nco, cf_t *x, float freq, int len); -void cexptab_gen_direct(cf_t *x, float freq, int len); +LIBLTE_API void cexptab_gen(cexptab_t *nco, cf_t *x, float freq, int len); +LIBLTE_API void cexptab_gen_direct(cf_t *x, float freq, int len); -#endif +#endif // CEXPTAB_ diff --git a/lte/include/lte/utils/convolution.h b/lte/include/lte/utils/convolution.h index 403c2c44f..ab6924022 100644 --- a/lte/include/lte/utils/convolution.h +++ b/lte/include/lte/utils/convolution.h @@ -29,9 +29,10 @@ #ifndef CONVOLUTION_H_ #define CONVOLUTION_H_ +#include "lte/config.h" #include "lte/utils/dft.h" -typedef struct { +typedef struct LIBLTE_API { _Complex float *input_fft; _Complex float *filter_fft; _Complex float *output_fft; @@ -44,10 +45,10 @@ typedef struct { dft_plan_t output_plan; }conv_fft_cc_t; -int conv_fft_cc_init(conv_fft_cc_t *state, int input_len, int filter_len); -void conv_fft_cc_free(conv_fft_cc_t *state); -int conv_fft_cc_run(conv_fft_cc_t *state, _Complex float *input, _Complex float *filter, _Complex float *output); +LIBLTE_API int conv_fft_cc_init(conv_fft_cc_t *state, int input_len, int filter_len); +LIBLTE_API void conv_fft_cc_free(conv_fft_cc_t *state); +LIBLTE_API int conv_fft_cc_run(conv_fft_cc_t *state, _Complex float *input, _Complex float *filter, _Complex float *output); -int conv_cc(_Complex float *input, _Complex float *filter, _Complex float *output, int input_len, int filter_len); +LIBLTE_API int conv_cc(_Complex float *input, _Complex float *filter, _Complex float *output, int input_len, int filter_len); -#endif +#endif // CONVOLUTION_H_ diff --git a/lte/include/lte/utils/debug.h b/lte/include/lte/utils/debug.h index 993bab615..4ded02ce0 100644 --- a/lte/include/lte/utils/debug.h +++ b/lte/include/lte/utils/debug.h @@ -29,17 +29,18 @@ #define DEBUG_H #include +#include "lte/config.h" #define VERBOSE_DEBUG 2 #define VERBOSE_INFO 1 #define VERBOSE_NONE 0 #include -void get_time_interval(struct timeval * tdata); +LIBLTE_API void get_time_interval(struct timeval * tdata); #ifndef DEBUG_DISABLED -extern int verbose; +LIBLTE_API extern int verbose; #define VERBOSE_ISINFO() (verbose>=VERBOSE_INFO) #define VERBOSE_ISDEBUG() (verbose>=VERBOSE_DEBUG) @@ -54,11 +55,11 @@ extern int verbose; #define INFO(_fmt, ...) if (verbose >= VERBOSE_INFO) \ fprintf(stdout, "[INFO]: " _fmt, __VA_ARGS__) -#else +#else // DEBUG_DISABLED #define DEBUG #define INFO -#endif +#endif // DEBUG_DISABLED -#endif +#endif // DEBUG_H diff --git a/lte/include/lte/utils/dft.h b/lte/include/lte/utils/dft.h index 6833a7ff1..1f981c4f2 100644 --- a/lte/include/lte/utils/dft.h +++ b/lte/include/lte/utils/dft.h @@ -30,6 +30,7 @@ #define DFT_H_ #include +#include "lte/config.h" /* dft is a frontend to the fftw3 library. It facilitates the computation of complex or real DFT, @@ -55,7 +56,7 @@ typedef enum { #define DFT_NORMALIZE 16 #define DFT_DC_OFFSET 32 -typedef struct { +typedef struct LIBLTE_API { int size; int sign; void *in; @@ -71,32 +72,31 @@ typedef float dft_r_t; /* Create DFT plans */ -int dft_plan(const int dft_points, dft_mode_t mode, dft_dir_t dir, dft_plan_t *plan); -int dft_plan_c2c(const int dft_points, dft_dir_t dir, dft_plan_t *plan); -int dft_plan_r2r(const int dft_points, dft_dir_t dir, dft_plan_t *plan); -int dft_plan_c2r(const int dft_points, dft_dir_t dir, dft_plan_t *plan); - -void dft_plan_free(dft_plan_t *plan); +LIBLTE_API int dft_plan(const int dft_points, dft_mode_t mode, dft_dir_t dir, dft_plan_t *plan); +LIBLTE_API int dft_plan_c2c(const int dft_points, dft_dir_t dir, dft_plan_t *plan); +LIBLTE_API int dft_plan_r2r(const int dft_points, dft_dir_t dir, dft_plan_t *plan); +LIBLTE_API int dft_plan_c2r(const int dft_points, dft_dir_t dir, dft_plan_t *plan); +LIBLTE_API void dft_plan_free(dft_plan_t *plan); /* Create a vector of DFT plans */ -int dft_plan_vector(const int *dft_points, dft_mode_t *modes, dft_dir_t *dirs, +LIBLTE_API int dft_plan_vector(const int *dft_points, dft_mode_t *modes, dft_dir_t *dirs, int nof_plans, dft_plan_t *plans); -int dft_plan_multi_c2c(const int *dft_points, dft_dir_t dir, int nof_plans, +LIBLTE_API int dft_plan_multi_c2c(const int *dft_points, dft_dir_t dir, int nof_plans, dft_plan_t *plans); -int dft_plan_multi_c2r(const int *dft_points, dft_dir_t dir, int nof_plans, +LIBLTE_API int dft_plan_multi_c2r(const int *dft_points, dft_dir_t dir, int nof_plans, dft_plan_t *plans); -int dft_plan_multi_r2r(const int *dft_points, dft_dir_t dir, int nof_plans, +LIBLTE_API int dft_plan_multi_r2r(const int *dft_points, dft_dir_t dir, int nof_plans, dft_plan_t *plans); -void dft_plan_free_vector(dft_plan_t *plan, int nof_plans); +LIBLTE_API void dft_plan_free_vector(dft_plan_t *plan, int nof_plans); /* Compute DFT */ -void dft_run(dft_plan_t *plan, void *in, void *out); -void dft_run_c2c(dft_plan_t *plan, dft_c_t *in, dft_c_t *out); -void dft_run_r2r(dft_plan_t *plan, dft_r_t *in, dft_r_t *out); -void dft_run_c2r(dft_plan_t *plan, dft_c_t *in, dft_r_t *out); +LIBLTE_API void dft_run(dft_plan_t *plan, void *in, void *out); +LIBLTE_API void dft_run_c2c(dft_plan_t *plan, dft_c_t *in, dft_c_t *out); +LIBLTE_API void dft_run_r2r(dft_plan_t *plan, dft_r_t *in, dft_r_t *out); +LIBLTE_API void dft_run_c2r(dft_plan_t *plan, dft_c_t *in, dft_r_t *out); -#endif +#endif // DFT_H_ diff --git a/lte/include/lte/utils/matrix.h b/lte/include/lte/utils/matrix.h index a74884b77..0d8baa266 100644 --- a/lte/include/lte/utils/matrix.h +++ b/lte/include/lte/utils/matrix.h @@ -25,24 +25,23 @@ * */ - - -#include - #ifndef MATRIX_ #define MATRIX_ -typedef _Complex float cf_t; +#include +#include "lte/config.h" -int matrix_init(void ***m, int sz_x, int sz_y, int elem_sz); -void matrix_free(void **q, int sz_x); -void matrix_bzero(void **q, int sz_x, int sz_y, int elem_sz); -void matrix_fprintf_cf(FILE *f, cf_t **q, int sz_x, int sz_y); -void matrix_fprintf_f(FILE *f, float **q, int sz_x, int sz_y); -void matrix_copy(void **dst, void **src, int sz_x, int sz_y, int elem_sz); -void matrix_dotprod_cf(cf_t **x, cf_t **y, cf_t **out, int sz_x, int sz_y); -void matrix_dotprod_float(float **x, float **y, float **out, int sz_x, int sz_y); -void matrix_dotprod_int(int **x, int **y, int **out, int sz_x, int sz_y); +typedef _Complex float cf_t; -#endif +LIBLTE_API int matrix_init(void ***m, int sz_x, int sz_y, int elem_sz); +LIBLTE_API void matrix_free(void **q, int sz_x); +LIBLTE_API void matrix_bzero(void **q, int sz_x, int sz_y, int elem_sz); +LIBLTE_API void matrix_fprintf_cf(FILE *f, cf_t **q, int sz_x, int sz_y); +LIBLTE_API void matrix_fprintf_f(FILE *f, float **q, int sz_x, int sz_y); +LIBLTE_API void matrix_copy(void **dst, void **src, int sz_x, int sz_y, int elem_sz); +LIBLTE_API void matrix_dotprod_cf(cf_t **x, cf_t **y, cf_t **out, int sz_x, int sz_y); +LIBLTE_API void matrix_dotprod_float(float **x, float **y, float **out, int sz_x, int sz_y); +LIBLTE_API void matrix_dotprod_int(int **x, int **y, int **out, int sz_x, int sz_y); + +#endif // MATRIX_ diff --git a/lte/include/lte/utils/mux.h b/lte/include/lte/utils/mux.h index 8d01e8c74..bcc42f564 100644 --- a/lte/include/lte/utils/mux.h +++ b/lte/include/lte/utils/mux.h @@ -25,16 +25,16 @@ * */ - - #ifndef MUX_ #define MUX_ -void mux(void **input, void *output, int *input_lengths, int *input_padding_pre, int nof_inputs, +#include "lte/config.h" + +LIBLTE_API void mux(void **input, void *output, int *input_lengths, int *input_padding_pre, int nof_inputs, int sample_sz); -void demux(void *input, void **output, int *output_lengths, +LIBLTE_API void demux(void *input, void **output, int *output_lengths, int *output_padding_pre, int *output_padding_post, int nof_outputs, int sample_sz); -#endif +#endif // MUX_ diff --git a/lte/include/lte/utils/pack.h b/lte/include/lte/utils/pack.h index ea64cfbef..50193a145 100644 --- a/lte/include/lte/utils/pack.h +++ b/lte/include/lte/utils/pack.h @@ -29,7 +29,9 @@ #ifndef PACK_ #define PACK_ -unsigned int unpack_bits(char **bits, int nof_bits); -void pack_bits(unsigned int value, char **bits, int nof_bits); +#include "lte/config.h" -#endif +LIBLTE_API unsigned int unpack_bits(char **bits, int nof_bits); +LIBLTE_API void pack_bits(unsigned int value, char **bits, int nof_bits); + +#endif // PACK_ diff --git a/lte/include/lte/utils/vector.h b/lte/include/lte/utils/vector.h index 806952896..fb983cc33 100644 --- a/lte/include/lte/utils/vector.h +++ b/lte/include/lte/utils/vector.h @@ -30,50 +30,51 @@ #define VECTOR_ #include +#include "lte/config.h" typedef _Complex float cf_t; /** Return the sum of all the elements */ -int vec_acc_ii(int *x, int len); -float vec_acc_ff(float *x, int len); -cf_t vec_acc_cc(cf_t *x, int len); +LIBLTE_API int vec_acc_ii(int *x, int len); +LIBLTE_API float vec_acc_ff(float *x, int len); +LIBLTE_API cf_t vec_acc_cc(cf_t *x, int len); -void *vec_malloc(int size); +LIBLTE_API void *vec_malloc(int size); /* print vectors */ -void vec_fprint_c(FILE *stream, cf_t *x, int len); -void vec_fprint_f(FILE *stream, float *x, int len); -void vec_fprint_b(FILE *stream, char *x, int len); -void vec_fprint_i(FILE *stream, int *x, int len); +LIBLTE_API void vec_fprint_c(FILE *stream, cf_t *x, int len); +LIBLTE_API void vec_fprint_f(FILE *stream, float *x, int len); +LIBLTE_API void vec_fprint_b(FILE *stream, char *x, int len); +LIBLTE_API void vec_fprint_i(FILE *stream, int *x, int len); /* sum two vectors */ -void vec_sum_ch(char *z, char *x, char *y, int len); -void vec_sum_ccc(cf_t *z, cf_t *x, cf_t *y, int len); +LIBLTE_API void vec_sum_ch(char *z, char *x, char *y, int len); +LIBLTE_API void vec_sum_ccc(cf_t *z, cf_t *x, cf_t *y, int len); /* scalar product */ -void vec_sc_prod_cfc(cf_t *x, float h, cf_t *z, int len); -void vec_sc_prod_ccc(cf_t *x, cf_t h, cf_t *z, int len); +LIBLTE_API void vec_sc_prod_cfc(cf_t *x, float h, cf_t *z, int len); +LIBLTE_API void vec_sc_prod_ccc(cf_t *x, cf_t h, cf_t *z, int len); /* vector product (element-wise) */ -void vec_prod_ccc(cf_t *x, cf_t *y, cf_t *z, int len); -void vec_prod_ccc_unalign(cf_t *x, cf_t *y, cf_t *z, int len); +LIBLTE_API void vec_prod_ccc(cf_t *x, cf_t *y, cf_t *z, int len); +LIBLTE_API void vec_prod_ccc_unalign(cf_t *x, cf_t *y, cf_t *z, int len); /* z=x/y vector division (element-wise) */ -void vec_div_ccc(cf_t *x, cf_t *y, cf_t *z, int len); +LIBLTE_API void vec_div_ccc(cf_t *x, cf_t *y, cf_t *z, int len); /* conjugate */ -void vec_conj_cc(cf_t *x, cf_t *y, int len); +LIBLTE_API void vec_conj_cc(cf_t *x, cf_t *y, int len); /* average vector power */ -float vec_avg_power_cf(cf_t *x, int len); +LIBLTE_API float vec_avg_power_cf(cf_t *x, int len); /* return the index of the maximum value in the vector */ -int vec_max_fi(float *x, int len); +LIBLTE_API int vec_max_fi(float *x, int len); /* quantify vector of floats and convert to unsigned char */ -void vec_quant_fuc(float *in, unsigned char *out, float gain, float offset, float clip, int len); +LIBLTE_API void vec_quant_fuc(float *in, unsigned char *out, float gain, float offset, float clip, int len); /* magnitude of each vector element */ -void vec_abs_cf(cf_t *x, float *abs, int len); +LIBLTE_API void vec_abs_cf(cf_t *x, float *abs, int len); -#endif +#endif // VECTOR_ diff --git a/lte/lib/fec/src/rm_conv.c b/lte/lib/fec/src/rm_conv.c index d8270d243..66afbd0a4 100644 --- a/lte/lib/fec/src/rm_conv.c +++ b/lte/lib/fec/src/rm_conv.c @@ -34,10 +34,10 @@ #define NROWS_MAX NCOLS #define RATE 3 -unsigned char RM_PERM_TC[NCOLS] = +unsigned char RM_CONV_PERM_TC[NCOLS] = { 1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31, 0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30 }; -unsigned char RM_PERM_TC_INV[NCOLS] = { 16, 0, 24, 8, 20, 4, 28, 12, 18, 2, 26, +unsigned char RM_CONV_PERM_TC_INV[NCOLS] = { 16, 0, 24, 8, 20, 4, 28, 12, 18, 2, 26, 10, 22, 6, 30, 14, 17, 1, 25, 9, 21, 5, 29, 13, 19, 3, 27, 11, 23, 7, 31, 15 }; @@ -64,10 +64,10 @@ int rm_conv_tx(char *input, int in_len, char *output, int out_len) { for (s = 0; s < 3; s++) { for (j = 0; j < NCOLS; j++) { for (i = 0; i < nrows; i++) { - if (i*NCOLS + RM_PERM_TC[j] < ndummy) { + if (i*NCOLS + RM_CONV_PERM_TC[j] < ndummy) { tmp[k] = TX_NULL; } else { - tmp[k] = input[(i*NCOLS + RM_PERM_TC[j]-ndummy)*3+s]; + tmp[k] = input[(i*NCOLS + RM_CONV_PERM_TC[j]-ndummy)*3+s]; } k++; } @@ -125,7 +125,7 @@ int rm_conv_rx(float *input, int in_len, float *output, int out_len) { d_i = (j % K_p) / nrows; d_j = (j % K_p) % nrows; - if (d_j * NCOLS + RM_PERM_TC[d_i] >= ndummy) { + if (d_j * NCOLS + RM_CONV_PERM_TC[d_i] >= ndummy) { if (tmp[j] == RX_NULL) { tmp[j] = input[k]; } else if (input[k] != RX_NULL) { @@ -144,7 +144,7 @@ int rm_conv_rx(float *input, int in_len, float *output, int out_len) { d_i = (i + ndummy) / NCOLS; d_j = (i + ndummy) % NCOLS; for (j = 0; j < RATE; j++) { - float o = tmp[K_p * j + RM_PERM_TC_INV[d_j] * nrows + float o = tmp[K_p * j + RM_CONV_PERM_TC_INV[d_j] * nrows + d_i]; if (o != RX_NULL) { output[i * RATE + j] = o; diff --git a/lte/lib/resampling/src/resample_arb.c b/lte/lib/resampling/src/resample_arb.c index 8ba00995a..044012b2d 100644 --- a/lte/lib/resampling/src/resample_arb.c +++ b/lte/lib/resampling/src/resample_arb.c @@ -30,7 +30,7 @@ #include "lte/resampling/resample_arb.h" #include "lte/utils/debug.h" -float polyfilt[RESAMPLE_ARB_N][RESAMPLE_ARB_M] = +float resample_arb_polyfilt[RESAMPLE_ARB_N][RESAMPLE_ARB_M] = {{0,0.002400347599485495,-0.006922416132556366,0.0179104136912176,0.99453086623794,-0.008521087756729117,0.0008598969867484128,0.0004992625165376107}, {-0.001903604727400391,0.004479591950094871,-0.01525319260830623,0.04647449496926549,0.9910477342662829,-0.03275243420114668,0.008048813755373533,-0.001216900416836847}, {-0.001750442300940216,0.006728826416921727,-0.02407540632178267,0.07708575473589654,0.9841056525667189,-0.05473739187922162,0.01460652754040275,-0.002745266140572769}, @@ -66,7 +66,7 @@ float polyfilt[RESAMPLE_ARB_N][RESAMPLE_ARB_M] = // TODO: use lte/utils/vector.h and Volk -cf_t dot_prod(cf_t* x, float *y, int len) +cf_t resample_arb_dot_prod(cf_t* x, float *y, int len) { cf_t res = 0+0*I; for(int i=0;ireg[1], &q->reg[0], (RESAMPLE_ARB_M-1)*sizeof(cf_t)); q->reg[0] = x; @@ -98,7 +98,7 @@ int resample_arb_compute(resample_arb_t *q, cf_t *input, cf_t *output, int n_in) while(cnt < n_in) { - *output = dot_prod(q->reg, polyfilt[idx], RESAMPLE_ARB_M); + *output = resample_arb_dot_prod(q->reg, resample_arb_polyfilt[idx], RESAMPLE_ARB_M); output++; n_out++; q->acc += q->step; @@ -107,7 +107,7 @@ int resample_arb_compute(resample_arb_t *q, cf_t *input, cf_t *output, int n_in) q->acc -= RESAMPLE_ARB_N; idx -= RESAMPLE_ARB_N; if(cnt < n_in) - push(q, input[cnt++]); + resample_arb_push(q, input[cnt++]); } } return n_out; diff --git a/lte/lib/utils/src/bit.c b/lte/lib/utils/src/bit.c index 5b6e09aee..22b356f9f 100644 --- a/lte/lib/utils/src/bit.c +++ b/lte/lib/utils/src/bit.c @@ -29,6 +29,8 @@ #include #include +#include "lte/utils/bit.h" + void bit_pack(uint32_t value, char **bits, int nof_bits) { int i;