From 7cce2467e26ca7bbebada21829a443a027279bb2 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Thu, 9 Jun 2016 17:09:20 +0200 Subject: [PATCH] Fixed cmake not linking fftw in mex --- matlab/common/bin2hex.m | 21 +++++++++++++++++++++ matlab/tests/pdsch_decode_signal.m | 19 +++++++++---------- srslte/lib/CMakeLists.txt | 5 +++++ 3 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 matlab/common/bin2hex.m diff --git a/matlab/common/bin2hex.m b/matlab/common/bin2hex.m new file mode 100644 index 000000000..45ca9ea4f --- /dev/null +++ b/matlab/common/bin2hex.m @@ -0,0 +1,21 @@ +function [ s ] = bin2hex( in ) +%BIN2HEX Summary of this function goes here +% Detailed explanation goes here + +a=reshape(in,8,[]); +t=size(a); +s=cell(1,t(2)); +nbit=2.^(7:-1:0); +for i=1:t(2) + s{i}=dec2hex(sum(nbit'.*double(a(:,i)))); +end +for i=1:t(2) + if (length(s{i})==1) + fprintf('0%s ',s{i}) + else + fprintf('%s ',s{i}) + end +end +fprintf('\n'); +end + diff --git a/matlab/tests/pdsch_decode_signal.m b/matlab/tests/pdsch_decode_signal.m index 29812f8f6..6208a5210 100644 --- a/matlab/tests/pdsch_decode_signal.m +++ b/matlab/tests/pdsch_decode_signal.m @@ -1,6 +1,6 @@ -enb=struct('NCellID',0,'NDLRB',25,'NSubframe',4,'CFI',3,'CyclicPrefix','Normal','CellRefP',1,'Ng','One','PHICHDuration','Normal','DuplexMode','FDD'); +enb=struct('NCellID',1,'NDLRB',25,'NSubframe',5,'CFI',2,'CyclicPrefix','Normal','CellRefP',1,'Ng','Sixth','PHICHDuration','Normal','DuplexMode','FDD'); -RNTI=62; +RNTI=65535; addpath('../../build/srslte/lib/phch/test') @@ -11,8 +11,8 @@ cec.InterpType = 'linear'; % 2D interpolation type cec.InterpWindow = 'Causal'; % Interpolation window type cec.InterpWinSize = 1; % Interpolation window size -subframe_rx=lteOFDMDemodulate(enb,x); -%subframe_rx=reshape(input,[],14); +%subframe_rx=lteOFDMDemodulate(enb,x); +subframe_rx=reshape(x,[],14); [hest,nest] = lteDLChannelEstimate(enb, cec, subframe_rx); % Search PDCCH @@ -20,7 +20,7 @@ pdcchIndices = ltePDCCHIndices(enb); [pdcchRx, pdcchHest] = lteExtractResources(pdcchIndices, subframe_rx, hest); [dciBits, pdcchSymbols] = ltePDCCHDecode(enb, pdcchRx, pdcchHest, nest); pdcch = struct('RNTI', RNTI); -dci = ltePDCCHSearch(enb, pdcch, dciBits); % Search PDCCH for DCI +[dci, dcidecBits] = ltePDCCHSearch(enb, pdcch, dciBits); % Search PDCCH for DCI if ~isempty(dci) @@ -30,9 +30,8 @@ if ~isempty(dci) % Get the PDSCH configuration from the DCI [pdsch, trblklen] = hPDSCHConfiguration(enb, dci, pdcch.RNTI); pdsch.NTurboDecIts = 10; - pdsch.Modulation = {'64QAM'}; + %pdsch.Modulation = {'64QAM'}; pdsch.RV=0; - trblklen=14112; fprintf('PDSCH settings after DCI decoding:\n'); disp(pdsch); @@ -45,9 +44,9 @@ if ~isempty(dci) [sib1, crc] = lteDLSCHDecode(enb, pdsch, trblklen, dlschBits); - %[dec2, data, pdschRx2, pdschSymbols2, e_bits] = srslte_pdsch(enb, pdsch, ... - % trblklen, ... - % subframe_rx, hest, nest); + [dec2, data, pdschRx2, pdschSymbols2, e_bits] = srslte_pdsch(enb, pdsch, ... + trblklen, ... + subframe_rx, hest, 0); scatter(real(pdschSymbols{1}),imag(pdschSymbols{1})) diff --git a/srslte/lib/CMakeLists.txt b/srslte/lib/CMakeLists.txt index 4e0990563..355720a8c 100644 --- a/srslte/lib/CMakeLists.txt +++ b/srslte/lib/CMakeLists.txt @@ -80,6 +80,11 @@ target_link_libraries(srslte pthread m ${FFTW3F_LIBRARIES}) set_target_properties(srslte PROPERTIES VERSION ${SRSLTE_VERSION_MAJOR}.${SRSLTE_VERSION_MINOR}) +if(NOT DisableMEX) + target_link_libraries(srslte_static ${FFTW3F_LIBRARIES}) +endif(NOT DisableMEX) + + if(RF_FOUND) if(UHD_FOUND) target_link_libraries(srslte ${UHD_LIBRARIES})