- add radio to build system
- added farrow test git-svn-id: http://moon:8086/svn/software/trunk/libsrc/cpp@946 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+25
-18
@@ -1,23 +1,30 @@
|
|||||||
include ../config.mk
|
include ./config.mk
|
||||||
|
|
||||||
SRCDIR := .
|
NAME := Radio
|
||||||
OBJS := real.o cpx.o ringbuf.o equalizer.o interpolation.o agc.o nco.o statistics.o symbol.o synchronization.o Frame.o Symbolizer.o Formatter.o Scrambler.o
|
|
||||||
|
|
||||||
LIB := $(BUILD_DIR)/libradio.a
|
CXX_SRCS := $(LIBSRC_PATH)/cpp/radio/Formatter.cpp
|
||||||
|
CXX_SRCS += $(LIBSRC_PATH)/cpp/radio/Symbolizer.cpp
|
||||||
|
CXX_SRCS += $(LIBSRC_PATH)/cpp/radio/Scrambler.cpp
|
||||||
|
CXX_SRCS += $(LIBSRC_PATH)/cpp/radio/Frame.cpp
|
||||||
|
CXX_SRCS += $(LIBSRC_PATH)/cpp/radio/interpolation/Interpolator.cpp
|
||||||
|
CXX_SRCS += $(LIBSRC_PATH)/cpp/radio/interpolation/Farrow.cpp
|
||||||
|
CXX_SRCS += $(LIBSRC_PATH)/cpp/radio/interpolation/PolyPhase.cpp
|
||||||
|
CXX_SRCS += $(LIBSRC_PATH)/cpp/radio/interpolation/UpSampler.cpp
|
||||||
|
CXX_SRCS += $(LIBSRC_PATH)/cpp/radio/interpolation/DownSampler.cpp
|
||||||
|
|
||||||
INCLUDES := . ..
|
GCC_SRCS := $(LIBSRC_PATH)/radio/real.c
|
||||||
DEFINES := radio_float_t=float fir_float_t=float
|
GCC_SRCS += $(LIBSRC_PATH)/radio/cpx.c
|
||||||
|
GCC_SRCS += $(LIBSRC_PATH)/radio/ringbuf.c
|
||||||
|
GCC_SRCS += $(LIBSRC_PATH)/radio/equalizer.c
|
||||||
|
GCC_SRCS += $(LIBSRC_PATH)/radio/interpolation.c
|
||||||
|
GCC_SRCS += $(LIBSRC_PATH)/radio/agc.c
|
||||||
|
GCC_SRCS += $(LIBSRC_PATH)/radio/nco.c
|
||||||
|
GCC_SRCS += $(LIBSRC_PATH)/radio/statistics.c
|
||||||
|
GCC_SRCS += $(LIBSRC_PATH)/radio/symbol.c
|
||||||
|
GCC_SRCS += $(LIBSRC_PATH)/radio/synchronization.c
|
||||||
|
|
||||||
all : $(LIB)
|
INCLUDES += -I $(LIBSRC_PATH) -I $(BLAZE_PATH)
|
||||||
|
DEFINES += -Dradio_float_t=float -Dfir_float_t=float
|
||||||
$(LIB) : $(OBJS)
|
CXXFLAGS += -std=c++20
|
||||||
$(AR) -r $(LIB) $(OBJS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o
|
|
||||||
rm -f *.a
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
|
|
||||||
include ../compile.mk
|
|
||||||
|
|
||||||
|
include $(MAKE_HOME)/compile.mk
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
MAKE_HOME ?= /home/jens/work/software/make
|
||||||
|
CONFIG ?= debug
|
||||||
|
BUILD_DIR ?= ./build/${CONFIG}
|
||||||
|
|
||||||
|
LIBSRC_PATH ?= $(realpath ../../../libsrc)
|
||||||
|
BLAZE_PATH ?= $(realpath ../../../extlib/blaze)
|
||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include <cpp/radio/Vector.hpp>
|
#include <cpp/radio/Vector.hpp>
|
||||||
#include <cpp/radio/FirComplex.hpp>
|
#include <cpp/radio/FirComplex.hpp>
|
||||||
|
#include <cpp/radio/processor/src/Buffer.hpp>
|
||||||
|
#include <cpp/radio/interpolation/Interpolator.hpp>
|
||||||
|
|
||||||
namespace Radio
|
namespace Radio
|
||||||
{
|
{
|
||||||
@@ -37,6 +39,8 @@ public:
|
|||||||
, m_b(M)
|
, m_b(M)
|
||||||
, m_h(M)
|
, m_h(M)
|
||||||
, m_fifo(N)
|
, m_fifo(N)
|
||||||
|
, m_bufferIn(1024)
|
||||||
|
, m_bufferOut(1024)
|
||||||
{
|
{
|
||||||
init(M, N);
|
init(M, N);
|
||||||
}
|
}
|
||||||
@@ -56,6 +60,8 @@ public:
|
|||||||
m_h.resize(M);
|
m_h.resize(M);
|
||||||
m_fifo.resize(N);
|
m_fifo.resize(N);
|
||||||
m_fifo = ComplexScalar(0,0);
|
m_fifo = ComplexScalar(0,0);
|
||||||
|
// m_bufferIn.fill(ComplexScalar(0,0));
|
||||||
|
// m_bufferOut.fill(ComplexScalar(0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void feed(ComplexScalar const &x, uint32_t push)
|
void feed(ComplexScalar const &x, uint32_t push)
|
||||||
@@ -64,11 +70,60 @@ public:
|
|||||||
m_fifo[m_w] = x;
|
m_fifo[m_w] = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ComplexScalar process(ComplexScalar const &xin, RealScalar dmu)
|
||||||
|
{
|
||||||
|
size_t adv = m_interpolator.process(dmu);
|
||||||
|
m_bufferIn.write(&xin, 1);
|
||||||
|
|
||||||
|
if (adv)
|
||||||
|
{
|
||||||
|
ComplexScalar xout;
|
||||||
|
m_bufferIn.read(&xout, 1);
|
||||||
|
FirComplex::feed(xout);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Partial filter responses
|
||||||
|
for (int i=0; i < m_M; i++)
|
||||||
|
{
|
||||||
|
m_h[i] = FirComplex::processReal(column(m_coeff, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Combine
|
||||||
|
ComplexScalar yout = horner(m_interpolator.getMu());
|
||||||
|
m_bufferOut.write(&yout, 1);
|
||||||
|
|
||||||
|
return yout;
|
||||||
|
}
|
||||||
|
|
||||||
ComplexScalar process(RealScalar mu, uint32_t pop)
|
ComplexScalar process(RealScalar mu, uint32_t pop)
|
||||||
{
|
{
|
||||||
uint32_t i, r;
|
uint32_t i, r;
|
||||||
int32_t j;
|
int32_t j;
|
||||||
|
|
||||||
|
if (pop and m_bufferIn.len() == 0)
|
||||||
|
{
|
||||||
|
return ComplexScalar(0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int n=0; n < m_bufferIn.len(); n++)
|
||||||
|
{
|
||||||
|
ComplexScalar x;
|
||||||
|
m_bufferIn.read(&x, 1);
|
||||||
|
FirComplex::feed(x);
|
||||||
|
|
||||||
|
// Partial filter responses
|
||||||
|
for (i=0; i < m_M; i++)
|
||||||
|
{
|
||||||
|
m_h[i] = FirComplex::processReal(column(m_coeff, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Combine
|
||||||
|
ComplexScalar y = horner(mu);
|
||||||
|
m_bufferOut.write(&y, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
m_r = (m_r + pop) % m_N;
|
m_r = (m_r + pop) % m_N;
|
||||||
|
|
||||||
if (pop)
|
if (pop)
|
||||||
@@ -85,15 +140,7 @@ public:
|
|||||||
m_state[j--] = m_fifo[r++];
|
m_state[j--] = m_fifo[r++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Partial filter responses
|
|
||||||
for (i=0; i < m_M; i++)
|
|
||||||
{
|
|
||||||
m_h[i] = FirComplex::processReal(column(m_coeff, i));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Combine
|
|
||||||
return horner(mu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void load(const char *pFilename)
|
void load(const char *pFilename)
|
||||||
@@ -138,6 +185,11 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Processor::Buffer<ComplexScalar>& getOutputBuffer()
|
||||||
|
{
|
||||||
|
return m_bufferOut;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_M;
|
uint32_t m_M;
|
||||||
uint32_t m_N;
|
uint32_t m_N;
|
||||||
@@ -147,7 +199,10 @@ private:
|
|||||||
CVec m_b;
|
CVec m_b;
|
||||||
CVec m_h;
|
CVec m_h;
|
||||||
CVec m_fifo;
|
CVec m_fifo;
|
||||||
|
Processor::Buffer<ComplexScalar> m_bufferIn;
|
||||||
|
Processor::Buffer<ComplexScalar> m_bufferOut;
|
||||||
|
Interpolator m_interpolator;
|
||||||
|
|
||||||
ComplexScalar horner(RealScalar mu)
|
ComplexScalar horner(RealScalar mu)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@@ -160,7 +215,7 @@ private:
|
|||||||
|
|
||||||
return m_b[m_M-1];
|
return m_b[m_M-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Radio::Interpolation
|
} // Radio::Interpolation
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
include ./config.mk
|
||||||
|
|
||||||
|
DEFINES := -Dradio_float_t=float -Dfir_float_t=float
|
||||||
|
CXXFLAGS_release := -O3 -flto
|
||||||
|
CFLAGS_release := -O3 -flto
|
||||||
|
LDFLAGS_release := -O3 -flto
|
||||||
|
TARGET_ARCH := -march=native
|
||||||
|
CXXFLAGS += -std=c++20
|
||||||
|
|
||||||
|
LIBS := -lstdc++ -lm -lpthread -lrt
|
||||||
|
LDFLAGS += $(TARGET_ARCH) $(LIBDIR)
|
||||||
|
DEFINES += -DPROCESSOR_BUFFER_USE_EXCEPTIONS
|
||||||
|
INCLUDES += -I $(BLAZE_PATH)
|
||||||
|
|
||||||
|
all: app
|
||||||
|
app: objects link
|
||||||
|
|
||||||
|
.PHONY: Radio
|
||||||
|
|
||||||
|
objects: Radio
|
||||||
|
|
||||||
|
Radio:
|
||||||
|
@$(MAKE) -C $(LIBSRC_PATH)/cpp/radio
|
||||||
|
|
||||||
|
|
||||||
|
include $(MAKE_HOME)/link.mk
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
MAKE_HOME ?= /home/jens/work/software/make
|
||||||
|
CONFIG ?= debug
|
||||||
|
TARGET ?= farrow_test
|
||||||
|
BUILD_DIR ?= $(shell pwd)/build/${CONFIG}
|
||||||
|
MAKEFLAGS += --no-print-directory
|
||||||
|
|
||||||
|
LIBSRC_PATH ?= $(realpath ../../../../../../libsrc)
|
||||||
|
BLAZE_PATH ?= $(realpath ../../../../../../extlib/blaze)
|
||||||
|
|
||||||
|
export
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user