diff --git a/trx_examples/targeting/ADSB/AltVelCalc_ADI.m b/trx_examples/targeting/ADSB/AltVelCalc_ADI.m deleted file mode 100644 index db12afad..00000000 --- a/trx_examples/targeting/ADSB/AltVelCalc_ADI.m +++ /dev/null @@ -1,39 +0,0 @@ -function [nv,ev,uv] = AltVelCalc_ADI(msg) -% Calculate velocity data from message bits -% Copyright 2010-2011, The MathWorks, Inc. - -% Calculate East-West velocity -ewDir = msg(46); -if ewDir == 0 - ed = 1; -else - ed = -1; -end -velBits = msg(47:56)'; -ewVel = velBits*[512;256;128;64;32;16;8;4;2;1]-1; - -% Calculate North-South velocity -nsDir = msg(57); -if nsDir == 0 - nd = 1; -else - nd = -1; -end -velBits = msg(58:67)'; -nsVel = velBits*[512;256;128;64;32;16;8;4;2;1]-1; - -% Calculate rate of climb/descent -udDir = msg(69); -if udDir == 0 - ud = 1; -else - ud = -1; -end -velBits = msg(70:78)'; -udVel = (velBits*[256;128;64;32;16;8;4;2;1]-1)*64; - -nv = nd*nsVel; -ev = ed*ewVel; -uv = ud*udVel; - - diff --git a/trx_examples/targeting/ADSB/DecodeBitsTest.m b/trx_examples/targeting/ADSB/DecodeBitsTest.m deleted file mode 100644 index ef9cda7e..00000000 --- a/trx_examples/targeting/ADSB/DecodeBitsTest.m +++ /dev/null @@ -1,85 +0,0 @@ -% DecodeBitsTest -% Detailed explanation goes here - -% currentLat = input('Enter current latitude: ') -% currentLong = input('Enter current longitude: ') -currentLat = 42.3; -currentLong = -71.1; - -InputBytes{1} = '8DA3CC3790C380976B152295D11F'; -InputBytes{2} = '8DA3CC37994483ACB004003CB62A'; -InputBytes{3} = '8d00000060c38037389c0e000000'; % From dat1090_558.mat -InputBytes{4} = '8d00000060c387be2f010e000000'; -InputBytes{5} = '8D00000060C377BA050257E9ED2B'; -InputBytes{6} = '8DA19E9F5017385A14972C52A6E4'; -InputBytes{7} = '8DAA8A8360C377BA050257E9ED2B'; -InputBytes{8} = '8DAA8A8360C370328A9D465859A0'; -InputBytes{9} = '8DA66A13604B501232B9B99ADF83'; -InputBytes{10} = '8DA66A13604B301276B9B184ECF9'; -InputBytes{11} = '8DA19E9F5017385A14972C52A6E4'; -InputBytes{12} = '8D40067860C380460CB5B2EB8D3A'; -InputBytes{13} = '8D40067860C38009169B555F8602'; -InputBytes{14} = '8D40067860C38791B7009F951703'; -InputBytes{15} = '8D80043C68CD8091591227B39B4B'; -InputBytes{16} = '8D80043C68C93048989EC9A068CA'; -InputBytes{17} = '8D4B187E60C3805296A6FB255599'; -InputBytes{18} = '8D4B187E60ADA797F0F8A564914B'; -InputBytes{19} = '8DA6CC4190C380832AA8128A8921'; -InputBytes{20} = '8DA3CC3790C380976B152295D11F'; -InputBytes{21} = '8DABDEEC99153E09802C013F4BDF'; -InputBytes{22} = '8DA66A1399104CAA80A406129D1D'; -InputBytes{23} = '8DAA8A83991502A7000411EE1091'; -InputBytes{24} = '8D40067899050CA680050D26CFB1'; -InputBytes{25} = '8D4CA74E9914C0AC80040F8D6965'; -InputBytes{26} = '8D80043C9904E4A7A0070D597008'; -InputBytes{27} = '8DABC6519904AFAC000513E3A869'; -InputBytes{28} = '8D4B187E9944CDAAA8040F67994E'; -InputBytes{29} = '8DA6CC41990488AE00070049848E'; -InputBytes{30} = '8DA9BF4B99948BB0A0040E5828F0'; -InputBytes{31} = '8D40067899050CA680050D26CFB1'; -InputBytes{32} = '8DA3CC3790C380976B152295D11F'; % Bad results -InputBytes{33} = '8DA3CC37994483ACB004003CB62A'; - -for jj=1:33 - a = hex2dec(InputBytes{jj}'); - b = dec2bin(a); - bin = reshape(b',1,length(InputBytes{jj})*4); - InputBits = true(112,1); - for ii=1:112 - InputBits(ii)=logical(bin2dec(bin(ii))); - end - - [nV,eV,aV,alt,lat,long,type] = DecodeBits_ADI(InputBits, currentLat, currentLong); - - speed = sqrt(nV^2 + eV^2); - - if nV>=0 - nDir='North'; - else - nDir='South'; - end - if eV>=0 - eDir='East'; - else - eDir='West'; - end - if aV>=0 - aDir='Up'; - else - aDir='Down'; - end - - fprintf('Aircraft ID %s Long Message CRC: %s\n', InputBytes{jj}(3:8), InputBytes{jj}); - if type == 'L' - fprintf('Aircraft ID %s is at altitude %6.0f\n', InputBytes{jj}(3:8), alt); - fprintf('Aircraft ID %s is at latitude %d %d %4.1f, longitude %d %d %4.1f\n', InputBytes{jj}(3:8), degrees2dms(lat), degrees2dms(long)); - elseif type == 'A' - fprintf('Aircraft ID %s is traveling at %f knots\nDirection %s at %f knots, direction %s at %f knots \n', InputBytes{jj}(3:8), speed, eDir, abs(eV), nDir, abs(nV)); - fprintf('Aircraft ID %s is going %s at %f feet/min\n', InputBytes{jj}(3:8), aDir, abs(aV)); - end - fprintf('\n'); -end - - - - diff --git a/trx_examples/targeting/ADSB/DecodeBits_ADI.m b/trx_examples/targeting/ADSB/DecodeBits_ADI.m deleted file mode 100644 index dfa8f404..00000000 --- a/trx_examples/targeting/ADSB/DecodeBits_ADI.m +++ /dev/null @@ -1,30 +0,0 @@ -function [nV, eV, aV, alt, lat, long, type, id] = DecodeBits_ADI(bits, currentLat, currentLong) -% Copyright 2015, The MathWorks, Inc. - -% Read message bits and decode valid messages for position, velocity and -% altitude data - -% Initialize data -nV = 0; -eV = 0; -aV = 0; -alt = 0; -lat = 0; -long = 0; -type = 'X'; -id = [bits(9:12)'*[8;4;2;1] bits(13:16)'*[8;4;2;1] bits(17:20)'*[8;4;2;1] bits(21:24)'*[8;4;2;1] bits(25:28)'*[8;4;2;1] bits(29:32)'*[8;4;2;1]] - -% Check 9th and 10th hex characters for mesasge type -tf1 = bits(33:36)'*[8;4;2;1]; -tf2 = bits(37:40)'*[8;4;2;1]; -if tf1 == 9 && tf2 == 9 - [nV, eV, aV] = AltVelCalc_ADI(bits); - type = 'A'; -elseif tf1 == 5 || tf1 == 6 - [lat, long, alt] = LatLongCalcSingle_ADI(bits, currentLat, currentLong); - type = 'L'; -elseif tf1 == 9 && tf2 == 0 - [lat, long, alt] = LatLongCalcSingle_ADI(bits, currentLat, currentLong); - type = 'L'; -end - diff --git a/trx_examples/targeting/ADSB/DecodeBits_ADI.prj b/trx_examples/targeting/ADSB/DecodeBits_ADI.prj deleted file mode 100644 index cc803be3..00000000 --- a/trx_examples/targeting/ADSB/DecodeBits_ADI.prj +++ /dev/null @@ -1,883 +0,0 @@ - - - - - false - option.WorkingFolder.Project - - option.BuildFolder.Project - - - - - - - option.GlobalDataSyncMethod.SyncAlways - true - option.DynamicMemoryAllocation.Threshold - 65536 - 200000 - option.FilePartitionMethod.MapMFileToCFile - true - false - - true - - true - false - - false - option.VerificationMode.None - - - - - - - - - - false - 40000 - 100 - option.PreserveVariableNames.UserNames - option.TargetLang.C - - 10 - 200 - 4000 - true - 64 - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - option.WorkingFolder.Project - - option.BuildFolder.Project - - - false - false - false - true - option.DynamicMemoryAllocation.Threshold - 65536 - 200000 - false - option.FilePartitionMethod.MapMFileToCFile - true - option.CommentStyle.Auto - false - true - option.DataTypeReplacement.CBuiltIn - false - true - true - option.ParenthesesLevel.Nominal - 31 - $M$N - $M$N - $M$N - $M$N - $M$N - $M$N - emxArray_$M$N - emx$M$N - - true - false - true - true - false - false - false - false - false - - false - false - option.VerificationMode.None - option.VerificationStatus.Passed - - - - - - - - - C89/C90 (ANSI) - None - false - true - Generic - MATLAB Host Computer - - true - 8 - 16 - 32 - 32 - 64 - 32 - 64 - 32 - 32 - option.HardwareEndianness.Little - false - false - option.HardwareAtomicIntegerSize.Char - option.HardwareAtomicFloatSize.None - option.HardwareDivisionRounding.Undefined - Generic - MATLAB Host Computer - - false - 8 - 16 - 32 - 32 - 64 - 32 - 64 - 32 - 32 - option.HardwareEndianness.Little - false - false - option.HardwareAtomicIntegerSize.Char - option.HardwareAtomicFloatSize.None - option.HardwareDivisionRounding.Undefined - Automatically locate an installed toolchain - Faster Builds - - option.CastingMode.Nominal - option.IndentStyle.K&R - 2 - 40000 - 100 - true - option.GenerateExampleMain.GenerateCodeOnly - option.PreserveVariableNames.UserNames - option.TargetLang.C - option.CCompilerOptimization.Off - - true - false - make_rtw - default_tmf - - 10 - 200 - 4000 - true - 64 - true - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - option.WorkingFolder.Project - - option.BuildFolder.Project - - - - - - - - - - - - - - - - - true - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - option.objective.c - generateCode - - DecodeBitsTest - - config - option.UseGlobals.No - ${PROJECT_ROOT}\codegen\lib\DecodeBits_ADI\DecodeBits_ADI.lib - R2012a - true - - - true - - false - false - 1024 - 2048 - false - 1112512871 - - false - false - - true - - DecodeBits_ADI_mex - DecodeBits_ADI - option.target.artifact.lib - ${PROJECT_ROOT}\codegen\lib\DecodeBits_ADI\DecodeBits_ADI.lib - true - false - - option.FixedPointMode.None - false - - - 16 - 4 - 0 - fimath('RoundingMethod', 'Floor', 'OverflowAction', 'Wrap', 'ProductMode', 'FullPrecision', 'MaxProductWordLength', 128, 'SumMode', 'FullPrecision', 'MaxSumWordLength', 128) - option.FixedPointTypeSource.SimAndDerived - - false - false - false - false - true - - - - - - - - - true - false - _fixpt - - false - false - option.DefaultFixedPointSignedness.Automatic - option.FixedPointTypeProposalMode.ProposeFractionLengths - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - logical - 112 x 1 - - - false - - - double - 1 x 1 - - - false - false - - - double - 1 x 1 - - - false - false - - - - - - - C:\Users\acozma\Documents\Projects\Radio\ADSB\src\codegen\lib\DecodeBits_ADI\DecodeBits_ADI.lib - - - - C:\MATLAB\R2015a - - - - - - - - - true - - - - - true - - - - - true - - - - - true - - - - - false - false - true - false - false - false - false - false - 6.1 - false - true - win64 - true - - - \ No newline at end of file diff --git a/trx_examples/targeting/ADSB/LICENSE b/trx_examples/targeting/ADSB/LICENSE deleted file mode 100644 index 90fc865d..00000000 --- a/trx_examples/targeting/ADSB/LICENSE +++ /dev/null @@ -1,33 +0,0 @@ -Copyright 2015(c) Analog Devices, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of Analog Devices, Inc. nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - The use of this software may or may not infringe the patent rights of one - or more patent holders. This license does not release you from the - requirement that you obtain separate licenses from these patent holders to - use this software. - - Use of the software either in source or binary form or filter designs - resulting from the use of this software, must be connected to, run on or - loaded to an Analog Devices Inc. component. - -THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - -IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/trx_examples/targeting/ADSB/LatLongCalcSingle_ADI.m b/trx_examples/targeting/ADSB/LatLongCalcSingle_ADI.m deleted file mode 100644 index fd67422d..00000000 --- a/trx_examples/targeting/ADSB/LatLongCalcSingle_ADI.m +++ /dev/null @@ -1,99 +0,0 @@ -function [Rlat,Rlon,alt] = LatLongCalcSingle_ADI(msg, inputLat, inputLong) -% Calculate latitude, longitude and altitude from message bits -% Copyright 2010, The MathWorks, Inc. - -persistent NL -persistent latzones -persistent Dlat0 -persistent Dlat1 -persistent latOffset0 -persistent latOffset1 - -if isempty(NL) - Dlat0 = 360/(4*15-0); - latOffset0 = floor(inputLat/Dlat0); - Dlat1 = 360/(4*15-1); - latOffset1 = floor(inputLat/Dlat1); - NL=2:59; - latzones = [(180/pi)*acos(sqrt((1-cos(pi/2/15))./(1-cos(2*pi./NL)))) 0]; -end - -% Altitude calculation -q = msg(48); -if q == 0 - af = 100; -else - af = 25; -end -altBits=[msg(41:47);msg(49:52)]'; -alt = altBits*[1024;512;256;128;64;32;16;8;4;2;1]*af - 1000; - -evenOdd1 = msg(54); -latBits = msg(55:71)'; -longBits = msg(72:88)'; -la1 = latBits*[65536;32768;16384;8192;4096;2048;1024;512;256;128;64;32;16;8;4;2;1]; -lo1 = longBits*[65536;32768;16384;8192;4096;2048;1024;512;256;128;64;32;16;8;4;2;1]; - -% Technically you need both even and odd messages to calculate lat/long -% unambiguously. For this code, use a single message and then check to see -% if the lat/long values are reasonable. If not, change the lat/long base -% factors (LL.a1, LL.a2, etc.) and recompute. - -% Latitude calculation -if evenOdd1 == 0 - Rlat = Dlat0*(latOffset0 + la1/131072); -else - Rlat = Dlat1*(latOffset1 + la1/131072); -end - -% Compare latitude to known location. If it's off by more than two degrees, -% use new base factors. -if Rlat > inputLat+2 - if strcmp(evenOdd1,'Even') - Rlat = Dlat0*(latOffset0 - 1 + la1/131072); - else - Rlat = Dlat1*(latOffset1 - 1 + la1/131072); - end -elseif Rlat < inputLat-2 - if strcmp(evenOdd1,'Even') - Rlat = Dlat0*(latOffset0 + 1 + la1/131072); - else - Rlat = Dlat1*(latOffset1 + 1 + la1/131072); - end -end - -% Based on latitude, calculate longitude -NL0 = find(latzones inputLong+2 - if strcmp(evenOdd1,'Even') - Rlon = Dlon0*(longOffset0 - 1 + lo1/131072); - else - Rlon = Dlon1*(longOffset1 - 1 + lo1/131072); - end -elseif Rlon < inputLong-2 - if strcmp(evenOdd1,'Even') - Rlon = Dlon0*(longOffset0 + 1 + lo1/131072); - else - Rlon = Dlon1*(longOffset1 + 1 + lo1/131072); - end -end - -% disp(sprintf('Plane is at altitude %d\nLatitude value: %d\nLongitude value: %d', alt, la1, lo1)); - -% GoogleMap(aircraftID, alt1, Rlat, Rlon) \ No newline at end of file diff --git a/trx_examples/targeting/ADSB/ModeS_ADI_Codegen.slx b/trx_examples/targeting/ADSB/ModeS_ADI_Codegen.slx deleted file mode 100644 index a3d8e82e..00000000 Binary files a/trx_examples/targeting/ADSB/ModeS_ADI_Codegen.slx and /dev/null differ diff --git a/trx_examples/targeting/ADSB/data_Yb.mat b/trx_examples/targeting/ADSB/data_Yb.mat deleted file mode 100644 index fa15b4c5..00000000 Binary files a/trx_examples/targeting/ADSB/data_Yb.mat and /dev/null differ diff --git a/trx_examples/targeting/ADSB/data_noise.mat b/trx_examples/targeting/ADSB/data_noise.mat deleted file mode 100644 index a9f15f29..00000000 Binary files a/trx_examples/targeting/ADSB/data_noise.mat and /dev/null differ diff --git a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI.c b/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI.c deleted file mode 100644 index b3b56a96..00000000 --- a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * File: DecodeBits_ADI.c - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -/* Include Files */ -#include "DecodeBits_ADI.h" -#include "LatLongCalcSingle_ADI.h" - -/* Function Definitions */ - -/* - * Read message bits and decode valid messages for position, velocity and - * altitude data - * Arguments : const boolean_T bits[112] - * double currentLat - * double currentLong - * double *nV - * double *eV - * double *aV - * double *alt - * double *lat - * double *b_long - * char *type - * double id[6] - * Return Type : void - */ -void DecodeBits_ADI(const boolean_T bits[112], double currentLat, double - currentLong, double *nV, double *eV, double *aV, double *alt, - double *lat, double *b_long, char *type, double id[6]) -{ - double d0; - double d1; - double d2; - double d3; - double d4; - double d5; - int i0; - static const signed char b[4] = { 8, 4, 2, 1 }; - - static const short b_b[10] = { 512, 256, 128, 64, 32, 16, 8, 4, 2, 1 }; - - int b_bits; - int c_bits; - static const short c_b[9] = { 256, 128, 64, 32, 16, 8, 4, 2, 1 }; - - int d_bits; - - /* Initialize data */ - *nV = 0.0; - *eV = 0.0; - *aV = 0.0; - *alt = 0.0; - *lat = 0.0; - *b_long = 0.0; - *type = 'X'; - d0 = 0.0; - d1 = 0.0; - d2 = 0.0; - d3 = 0.0; - d4 = 0.0; - d5 = 0.0; - for (i0 = 0; i0 < 4; i0++) { - d0 += (double)bits[8 + i0] * (double)b[i0]; - d1 += (double)bits[12 + i0] * (double)b[i0]; - d2 += (double)bits[16 + i0] * (double)b[i0]; - d3 += (double)bits[20 + i0] * (double)b[i0]; - d4 += (double)bits[24 + i0] * (double)b[i0]; - d5 += (double)bits[28 + i0] * (double)b[i0]; - } - - id[0] = d0; - id[1] = d1; - id[2] = d2; - id[3] = d3; - id[4] = d4; - id[5] = d5; - - /* Check 9th and 10th hex characters for mesasge type */ - d0 = 0.0; - for (i0 = 0; i0 < 4; i0++) { - d0 += (double)bits[32 + i0] * (double)b[i0]; - } - - d1 = 0.0; - for (i0 = 0; i0 < 4; i0++) { - d1 += (double)bits[36 + i0] * (double)b[i0]; - } - - if ((d0 == 9.0) && (d1 == 9.0)) { - /* Calculate velocity data from message bits */ - /* Copyright 2010-2011, The MathWorks, Inc. */ - /* Calculate East-West velocity */ - /* Calculate North-South velocity */ - /* Calculate rate of climb/descent */ - d0 = 0.0; - for (i0 = 0; i0 < 10; i0++) { - d0 += (double)bits[57 + i0] * (double)b_b[i0]; - } - - if (!bits[56]) { - b_bits = 1; - } else { - b_bits = -1; - } - - *nV = (double)b_bits * (d0 - 1.0); - d0 = 0.0; - for (i0 = 0; i0 < 10; i0++) { - d0 += (double)bits[46 + i0] * (double)b_b[i0]; - } - - if (!bits[45]) { - c_bits = 1; - } else { - c_bits = -1; - } - - *eV = (double)c_bits * (d0 - 1.0); - d0 = 0.0; - for (i0 = 0; i0 < 9; i0++) { - d0 += (double)bits[69 + i0] * (double)c_b[i0]; - } - - if (!bits[68]) { - d_bits = 1; - } else { - d_bits = -1; - } - - *aV = (double)d_bits * ((d0 - 1.0) * 64.0); - *type = 'A'; - } else if ((d0 == 5.0) || (d0 == 6.0)) { - LatLongCalcSingle_ADI(bits, currentLat, currentLong, lat, b_long, alt); - *type = 'L'; - } else { - if ((d0 == 9.0) && (d1 == 0.0)) { - LatLongCalcSingle_ADI(bits, currentLat, currentLong, lat, b_long, alt); - *type = 'L'; - } - } -} - -/* - * File trailer for DecodeBits_ADI.c - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI.h b/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI.h deleted file mode 100644 index 0732563a..00000000 --- a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * File: DecodeBits_ADI.h - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -#ifndef __DECODEBITS_ADI_H__ -#define __DECODEBITS_ADI_H__ - -/* Include Files */ -#include -#include -#include -#include "rtwtypes.h" -#include "DecodeBits_ADI_types.h" - -/* Function Declarations */ -extern void DecodeBits_ADI(const boolean_T bits[112], double currentLat, double - currentLong, double *nV, double *eV, double *aV, double *alt, double *lat, - double *b_long, char *type, double id[6]); - -#endif - -/* - * File trailer for DecodeBits_ADI.h - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_initialize.c b/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_initialize.c deleted file mode 100644 index bb4cdc8c..00000000 --- a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_initialize.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * File: DecodeBits_ADI_initialize.c - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -/* Include Files */ -#include "DecodeBits_ADI.h" -#include "DecodeBits_ADI_initialize.h" -#include "LatLongCalcSingle_ADI.h" - -/* Function Definitions */ - -/* - * Arguments : void - * Return Type : void - */ -void DecodeBits_ADI_initialize(void) -{ - NL_not_empty_init(); - LatLongCalcSingle_ADI_init(); -} - -/* - * File trailer for DecodeBits_ADI_initialize.c - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_initialize.h b/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_initialize.h deleted file mode 100644 index 748a74a6..00000000 --- a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_initialize.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * File: DecodeBits_ADI_initialize.h - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -#ifndef __DECODEBITS_ADI_INITIALIZE_H__ -#define __DECODEBITS_ADI_INITIALIZE_H__ - -/* Include Files */ -#include -#include -#include -#include "rtwtypes.h" -#include "DecodeBits_ADI_types.h" - -/* Function Declarations */ -extern void DecodeBits_ADI_initialize(void); - -#endif - -/* - * File trailer for DecodeBits_ADI_initialize.h - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_terminate.c b/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_terminate.c deleted file mode 100644 index 131fc59a..00000000 --- a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_terminate.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * File: DecodeBits_ADI_terminate.c - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -/* Include Files */ -#include "DecodeBits_ADI.h" -#include "DecodeBits_ADI_terminate.h" - -/* Function Definitions */ - -/* - * Arguments : void - * Return Type : void - */ -void DecodeBits_ADI_terminate(void) -{ - /* (no terminate code required) */ -} - -/* - * File trailer for DecodeBits_ADI_terminate.c - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_terminate.h b/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_terminate.h deleted file mode 100644 index 53495bd8..00000000 --- a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_terminate.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * File: DecodeBits_ADI_terminate.h - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -#ifndef __DECODEBITS_ADI_TERMINATE_H__ -#define __DECODEBITS_ADI_TERMINATE_H__ - -/* Include Files */ -#include -#include -#include -#include "rtwtypes.h" -#include "DecodeBits_ADI_types.h" - -/* Function Declarations */ -extern void DecodeBits_ADI_terminate(void); - -#endif - -/* - * File trailer for DecodeBits_ADI_terminate.h - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_types.h b/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_types.h deleted file mode 100644 index 12fdbdc5..00000000 --- a/trx_examples/targeting/ADSB/linux_app/DecodeBits_ADI_types.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * File: DecodeBits_ADI_types.h - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -#ifndef __DECODEBITS_ADI_TYPES_H__ -#define __DECODEBITS_ADI_TYPES_H__ - -/* Include Files */ -#include "rtwtypes.h" -#endif - -/* - * File trailer for DecodeBits_ADI_types.h - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/LatLongCalcSingle_ADI.c b/trx_examples/targeting/ADSB/linux_app/LatLongCalcSingle_ADI.c deleted file mode 100644 index 27c1f5cb..00000000 --- a/trx_examples/targeting/ADSB/linux_app/LatLongCalcSingle_ADI.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * File: LatLongCalcSingle_ADI.c - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -/* Include Files */ -#include -#include "DecodeBits_ADI.h" -#include "LatLongCalcSingle_ADI.h" -#include "mrdivide.h" - -/* Variable Definitions */ -static double NL[58]; -static boolean_T NL_not_empty; -static double latzones[59]; -static double latOffset0; -static double latOffset1; - -/* Function Definitions */ - -/* - * Calculate latitude, longitude and altitude from message bits - * Copyright 2010, The MathWorks, Inc. - * Arguments : const boolean_T msg[112] - * double inputLat - * double inputLong - * double *Rlat - * double *Rlon - * double *alt - * Return Type : void - */ -void LatLongCalcSingle_ADI(const boolean_T msg[112], double inputLat, double - inputLong, double *Rlat, double *Rlon, double *alt) -{ - int i1; - signed char b_msg[11]; - double d6; - static const short b[11] = { 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1 }; - - int c_msg; - static const int b_b[17] = { 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, - 256, 128, 64, 32, 16, 8, 4, 2, 1 }; - - double d7; - int idx; - signed char ii_data[1]; - signed char ii_size[2]; - int ii; - boolean_T exitg1; - double NL0_data[1]; - double Dlon0; - double b_NL0_data[1]; - double Dlon1; - double longOffset1; - if (!NL_not_empty) { - latOffset0 = inputLat / 6.0; - latOffset0 = floor(latOffset0); - latOffset1 = inputLat / 6.101694915254237; - latOffset1 = floor(latOffset1); - NL_not_empty = true; - for (i1 = 0; i1 < 58; i1++) { - latzones[i1] = 57.295779513082323 * acos(sqrt(0.00547810463172671 / (1.0 - - cos(6.2831853071795862 / NL[i1])))); - } - - latzones[58] = 0.0; - } - - /* Altitude calculation */ - for (i1 = 0; i1 < 7; i1++) { - b_msg[i1] = (signed char)msg[40 + i1]; - } - - for (i1 = 0; i1 < 4; i1++) { - b_msg[i1 + 7] = (signed char)msg[48 + i1]; - } - - d6 = 0.0; - for (i1 = 0; i1 < 11; i1++) { - d6 += (double)(b_msg[i1] * b[i1]); - } - - if (!msg[47]) { - c_msg = 100; - } else { - c_msg = 25; - } - - *alt = d6 * (double)c_msg; - d6 = 0.0; - for (i1 = 0; i1 < 17; i1++) { - d6 += (double)msg[54 + i1] * (double)b_b[i1]; - } - - d7 = 0.0; - for (i1 = 0; i1 < 17; i1++) { - d7 += (double)msg[71 + i1] * (double)b_b[i1]; - } - - /* Technically you need both even and odd messages to calculate lat/long */ - /* unambiguously. For this code, use a single message and then check to see */ - /* if the lat/long values are reasonable. If not, change the lat/long base */ - /* factors (LL.a1, LL.a2, etc.) and recompute. */ - /* Latitude calculation */ - if (!msg[53]) { - *Rlat = 6.0 * (latOffset0 + d6 / 131072.0); - } else { - *Rlat = 6.101694915254237 * (latOffset1 + d6 / 131072.0); - } - - /* Compare latitude to known location. If it's off by more than two degrees, */ - /* use new base factors. */ - if (*Rlat > inputLat + 2.0) { - *Rlat = 6.101694915254237 * ((latOffset1 - 1.0) + d6 / 131072.0); - } else { - if (*Rlat < inputLat - 2.0) { - *Rlat = 6.101694915254237 * ((latOffset1 + 1.0) + d6 / 131072.0); - } - } - - /* Based on latitude, calculate longitude */ - idx = 0; - for (i1 = 0; i1 < 2; i1++) { - ii_size[i1] = 1; - } - - ii = 1; - exitg1 = false; - while ((!exitg1) && (ii < 60)) { - if (latzones[ii - 1] < *Rlat) { - idx = 1; - ii_data[0] = (signed char)ii; - exitg1 = true; - } else { - ii++; - } - } - - if (idx == 0) { - ii_size[1] = 0; - } - - ii = ii_size[1]; - i1 = 0; - while (i1 <= ii - 1) { - NL0_data[0] = ii_data[0]; - i1 = 1; - } - - Dlon0 = mrdivide(NL0_data); - ii = ii_size[1]; - i1 = 0; - while (i1 <= ii - 1) { - b_NL0_data[0] = NL0_data[0] - 1.0; - i1 = 1; - } - - Dlon1 = mrdivide(b_NL0_data); - longOffset1 = floor(inputLong / Dlon1); - if (!msg[53]) { - *Rlon = Dlon0 * (floor(inputLong / Dlon0) + d7 / 131072.0); - } else { - *Rlon = Dlon1 * (longOffset1 + d7 / 131072.0); - } - - /* Compare longitude to known location. If it's off by more than two */ - /* degrees, use new base factors. */ - if (*Rlon > inputLong + 2.0) { - *Rlon = Dlon1 * ((longOffset1 - 1.0) + d7 / 131072.0); - } else { - if (*Rlon < inputLong - 2.0) { - *Rlon = Dlon1 * ((longOffset1 + 1.0) + d7 / 131072.0); - } - } - - /* disp(sprintf('Plane is at altitude %d\nLatitude value: %d\nLongitude value: %d', alt, la1, lo1)); */ - /* GoogleMap(aircraftID, alt1, Rlat, Rlon) */ -} - -/* - * Arguments : void - * Return Type : void - */ -void LatLongCalcSingle_ADI_init(void) -{ - int i2; - for (i2 = 0; i2 < 58; i2++) { - NL[i2] = 2.0 + (double)i2; - } -} - -/* - * Arguments : void - * Return Type : void - */ -void NL_not_empty_init(void) -{ - NL_not_empty = false; -} - -/* - * File trailer for LatLongCalcSingle_ADI.c - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/LatLongCalcSingle_ADI.h b/trx_examples/targeting/ADSB/linux_app/LatLongCalcSingle_ADI.h deleted file mode 100644 index f59fe886..00000000 --- a/trx_examples/targeting/ADSB/linux_app/LatLongCalcSingle_ADI.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * File: LatLongCalcSingle_ADI.h - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -#ifndef __LATLONGCALCSINGLE_ADI_H__ -#define __LATLONGCALCSINGLE_ADI_H__ - -/* Include Files */ -#include -#include -#include -#include "rtwtypes.h" -#include "DecodeBits_ADI_types.h" - -/* Function Declarations */ -extern void LatLongCalcSingle_ADI(const boolean_T msg[112], double inputLat, - double inputLong, double *Rlat, double *Rlon, double *alt); -extern void LatLongCalcSingle_ADI_init(void); -extern void NL_not_empty_init(void); - -#endif - -/* - * File trailer for LatLongCalcSingle_ADI.h - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/Makefile b/trx_examples/targeting/ADSB/linux_app/Makefile deleted file mode 100644 index dd83bae5..00000000 --- a/trx_examples/targeting/ADSB/linux_app/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# libiio - Library for interfacing industrial I/O (IIO) devices -# -# Copyright (C) 2014 Analog Devices, Inc. -# Author: Paul Cercueil -# -# This library 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 2.1 of the License, or (at your option) any later version. -# -# This library 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. - - -TARGETS := adsb_decode - -CFLAGS = -Wall - -.PHONY: all clean - -all: $(TARGETS) - -adsb_decode.o : adsb_decode.c - $(CC) adsb_decode.c -c $(CFLAGS) - -DecodeBits_ADI.o : DecodeBits_ADI.c DecodeBits_ADI.h - $(CC) DecodeBits_ADI.c -c $(CFLAGS) - -DecodeBits_ADI_initialize.o : DecodeBits_ADI_initialize.c DecodeBits_ADI_initialize.h - $(CC) DecodeBits_ADI_initialize.c -c $(CFLAGS) - -DecodeBits_ADI_terminate.o : DecodeBits_ADI_terminate.c DecodeBits_ADI_terminate.h - $(CC) DecodeBits_ADI_terminate.c -c $(CFLAGS) - -LatLongCalcSingle_ADI.o : LatLongCalcSingle_ADI.c LatLongCalcSingle_ADI.h - $(CC) LatLongCalcSingle_ADI.c -c $(CFLAGS) - -mrdivide.o : mrdivide.c mrdivide.h - $(CC) mrdivide.c -c $(CFLAGS) - -adsb_decode : adsb_decode.o DecodeBits_ADI.o DecodeBits_ADI_initialize.o DecodeBits_ADI_terminate.o LatLongCalcSingle_ADI.o mrdivide.o - $(CC) -o $@ $^ $(LDFLAGS) -liio -lm -clean: - rm -f $(TARGETS) *.o diff --git a/trx_examples/targeting/ADSB/linux_app/adsb_decode b/trx_examples/targeting/ADSB/linux_app/adsb_decode deleted file mode 100644 index 3e1c0f04..00000000 Binary files a/trx_examples/targeting/ADSB/linux_app/adsb_decode and /dev/null differ diff --git a/trx_examples/targeting/ADSB/linux_app/adsb_decode.c b/trx_examples/targeting/ADSB/linux_app/adsb_decode.c deleted file mode 100644 index dfbe7ab4..00000000 --- a/trx_examples/targeting/ADSB/linux_app/adsb_decode.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * adsb_decode - ADS-B signals decoding example - * - * Copyright (C) 2015 Analog Devices Inc. - * - **/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rtwtypes.h" -#include "DecodeBits_ADI_types.h" -#include "DecodeBits_ADI.h" -#include "DecodeBits_ADI_terminate.h" -#include "DecodeBits_ADI_initialize.h" - -/* helper macros */ -#define MHZ(x) ((long long)(x*1000000.0 + .5)) -#define GHZ(x) ((long long)(x*1000000000.0 + .5)) - -/* RX is input, TX is output */ -enum iodev { RX, TX }; - -/* common RX and TX streaming params */ -struct stream_cfg { - long long bw_hz; // Analog banwidth in Hz - long long fs_hz; // Baseband sample rate in Hz - long long lo_hz; // Local oscillator frequency in Hz - const char* rfport; // Port name - const char* agc_mode; // AGC mode - manual, slow_attack, fast_attack -}; - -/* static scratch mem for strings */ -static char tmpstr[64]; - -/* IIO structs required for streaming */ -static struct iio_context *ctx = NULL; -static struct iio_channel *rx0_i = NULL; -static struct iio_channel *rx0_q = NULL; -static struct iio_buffer *rxbuf = NULL; - -/* cleanup and exit */ -void shutdown(int s) -{ - printf("* Destroying buffers\n"); - if (rxbuf) { iio_buffer_destroy(rxbuf); } - - printf("* Disabling streaming channels\n"); - if (rx0_i) { iio_channel_disable(rx0_i); } - if (rx0_q) { iio_channel_disable(rx0_q); } - - printf("* Destroying context\n"); - if (ctx) { iio_context_destroy(ctx); } - exit(0); -} - -/* check return value of attr_write function */ -static void errchk(int v, const char* what) { - if (v < 0) { fprintf(stderr, "Error %d writing to channel \"%s\"\nvalue may not be supported.\n", v, what); shutdown(0); } -} - -/* write attribute: long long int */ -static void wr_ch_lli(struct iio_channel *chn, const char* what, long long val) -{ - errchk(iio_channel_attr_write_longlong(chn, what, val), what); -} - -/* write attribute: string */ -static void wr_ch_str(struct iio_channel *chn, const char* what, const char* str) -{ - errchk(iio_channel_attr_write(chn, what, str), what); -} - -/* helper function generating channel names */ -static char* get_ch_name(const char* type, int id) -{ - snprintf(tmpstr, sizeof(tmpstr), "%s%d", type, id); - return tmpstr; -} - -/* returns ad9361 phy device */ -static struct iio_device* get_ad9361_phy(struct iio_context *ctx) -{ - struct iio_device *dev = iio_context_find_device(ctx, "ad9361-phy"); - assert(dev && "No ad9361-phy found"); - return dev; -} - -/* finds AD9361 streaming IIO devices */ -static bool get_ad9361_stream_dev(struct iio_context *ctx, enum iodev d, struct iio_device **dev) -{ - switch (d) { - case TX: *dev = iio_context_find_device(ctx, "cf-ad9361-dds-core-lpc"); return *dev != NULL; - case RX: *dev = iio_context_find_device(ctx, "cf-ad9361-lpc"); return *dev != NULL; - default: assert(0); return false; - } -} - -/* finds AD9361 streaming IIO channels */ -static bool get_ad9361_stream_ch(struct iio_context *ctx, enum iodev d, struct iio_device *dev, int chid, struct iio_channel **chn) -{ - *chn = iio_device_find_channel(dev, get_ch_name("voltage", chid), d == TX); - if (!*chn) - *chn = iio_device_find_channel(dev, get_ch_name("altvoltage", chid), d == TX); - return *chn != NULL; -} - -/* finds AD9361 phy IIO configuration channel with id chid */ -static bool get_phy_chan(struct iio_context *ctx, enum iodev d, int chid, struct iio_channel **chn) -{ - switch (d) { - case RX: *chn = iio_device_find_channel(get_ad9361_phy(ctx), get_ch_name("voltage", chid), false); return *chn != NULL; - case TX: *chn = iio_device_find_channel(get_ad9361_phy(ctx), get_ch_name("voltage", chid), true); return *chn != NULL; - default: assert(0); return false; - } -} - -/* finds AD9361 local oscillator IIO configuration channels */ -static bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn) -{ - switch (d) { - // LO chan is always output, i.e. true - case RX: *chn = iio_device_find_channel(get_ad9361_phy(ctx), get_ch_name("altvoltage", 0), true); return *chn != NULL; - case TX: *chn = iio_device_find_channel(get_ad9361_phy(ctx), get_ch_name("altvoltage", 1), true); return *chn != NULL; - default: assert(0); return false; - } -} - -/* applies streaming configuration through IIO */ -bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, enum iodev type, int chid) -{ - struct iio_channel *chn = NULL; - - // Configure phy and lo channels - printf("* Acquiring AD9361 phy channel %d\n", chid); - if (!get_phy_chan(ctx, type, chid, &chn)) { return false; } - wr_ch_str(chn, "rf_port_select", cfg->rfport); - wr_ch_lli(chn, "rf_bandwidth", cfg->bw_hz); - wr_ch_lli(chn, "sampling_frequency", cfg->fs_hz); - wr_ch_str(chn, "gain_control_mode", cfg->agc_mode); - - // Configure LO channel - printf("* Acquiring AD9361 %s lo channel\n", type == TX ? "TX" : "RX"); - if (!get_lo_chan(ctx, type, &chn)) { return false; } - wr_ch_lli(chn, "frequency", cfg->lo_hz); - return true; -} - -static void main_DecodeBits_ADI(boolean_T *bv0, double input_lat, double input_long) -{ - char type; - double lng; - double lat; - double alt; - double aV; - double eV; - double nV; - double id[6]; - double speed; - - /* Initialize function 'DecodeBits_ADI' input arguments. */ - /* Initialize function input argument 'bits'. */ - /* Call the entry-point 'DecodeBits_ADI'. */ - DecodeBits_ADI(bv0, input_lat, input_long, - &nV, &eV, &aV, &alt, - &lat, &lng, &type, id); - speed = sqrt(eV*eV + nV*nV); - - switch(type) - { - case 'A': - printf("Aircraft ID: %x%x%x%x%x%x is travelling at %.6f knots\n", (int)id[0], (int)id[1], (int)id[2], (int)id[3], (int)id[4], (int)id[5], speed); - printf("Direction %s at %f knots, direction %s at %f knots\n", - eV < 0 ? "West" : "Est", eV < 0 ? -eV : eV, - nV < 0 ? "South" : "North", nV < 0 ? -nV : nV); - - printf("Aircraft ID: %x%x%x%x%x%x is going %s at %f feet/min\n\n", (int)id[0], (int)id[1], (int)id[2], (int)id[3], (int)id[4], (int)id[5], - aV < 0 ? "Down" : "Up", - aV < 0 ? -aV : aV); - break; - case 'L': - printf("Aircraft ID: %x%x%x%x%x%x is at altitude %d\n", (int)id[0], (int)id[1], (int)id[2], (int)id[3], (int)id[4], (int)id[5], - (int)alt); - - printf("Aircraft ID: %x%x%x%x%x%x is at latitude %4.3f, longitude %4.3f\n\n", (int)id[0], (int)id[1], (int)id[2], (int)id[3], (int)id[4], (int)id[5], - lat, lng); - break; - } -} - -/* simple configuration and streaming */ -int main (int argc, char **argv) -{ - // Current position coordinates - double input_lat, input_long; - - // Streaming devices - struct iio_device *rx; - - // Stream configurations - struct stream_cfg rxcfg; - - // Listen to ctrl+c and assert - signal(SIGINT, shutdown); - - // RX stream config - rxcfg.bw_hz = MHZ(4.0); // RF bandwidth - rxcfg.fs_hz = MHZ(12.5); // Rx sample rate - rxcfg.lo_hz = GHZ(1.09); // LO frequency - rxcfg.rfport = "A_BALANCED"; // Rx port selection - rxcfg.agc_mode = "fast_attack"; // AGC mode - - // Get current position - if(argc < 3) - { - printf("Not enough input arguments!\n"); - printf("Usage:\n - adsb_decode latitude logitude\n"); - printf(" - where: latitude - current latitude in degrees (negative values for southern hemisphere) (example: 42.36 for Boston)\n"); - printf(" - where: longitude - current longitude in degrees (negative values for western hemisphere) (example: -71.06 for Boston)\n"); - printf(" - example: adsb_decode 42.36 -71.06\n"); - - return 0; - } - else - { - sscanf(argv[1], "%lf", &input_lat); - sscanf(argv[2], "%lf", &input_long); - } - - printf("* Acquiring IIO context\n"); - assert((ctx = iio_create_default_context()) && "No context"); - assert(iio_context_get_devices_count(ctx) > 0 && "No devices"); - - printf("* Acquiring AD9361 streaming devices\n"); - assert(get_ad9361_stream_dev(ctx, RX, &rx) && "No rx dev found"); - - printf("* Configuring AD9361 for streaming\n"); - assert(cfg_ad9361_streaming_ch(ctx, &rxcfg, RX, 0) && "RX port 0 not found"); - - printf("* Initializing AD9361 IIO streaming channels\n"); - assert(get_ad9361_stream_ch(ctx, RX, rx, 0, &rx0_i) && "RX chan i not found"); - assert(get_ad9361_stream_ch(ctx, RX, rx, 1, &rx0_q) && "RX chan q not found"); - - - printf("* Enabling IIO streaming channels\n"); - iio_channel_enable(rx0_i); - iio_channel_enable(rx0_q); - - - printf("* Creating non-cyclic IIO buffers with 1 MiS\n"); - rxbuf = iio_device_create_buffer(rx, 4*1024*1024, false); - - - printf("* Starting IO streaming (press CTRL+C to cancel)\n"); - - // Initialize the ADS-B decoding - DecodeBits_ADI_initialize(); - - while (1) - { - ssize_t nbytes_rx; - void *p_dat, *p_end; - ptrdiff_t p_inc; - - static const int packet_length = 111; - int idx = 0; - int bit_idx = 0; - boolean_T bv0[112]; - - // Refill RX buffer - nbytes_rx = iio_buffer_refill(rxbuf); - if (nbytes_rx < 0) { printf("Error refilling buf %d\n",(int) nbytes_rx); shutdown(0); } - - // Process the data in the Rx buffer - p_inc = iio_buffer_step(rxbuf); - p_end = iio_buffer_end(rxbuf); - for (p_dat = iio_buffer_first(rxbuf, rx0_i) + packet_length * p_inc, idx = 0; p_dat < p_end; p_dat += p_inc, idx += p_inc) - { - // Find the frame valid marker - if(((int16_t*)p_dat)[1] == 1) - { - // Copy the data frame from the Rx buffer into a temporary buffer - for(bit_idx = packet_length; bit_idx > 0; bit_idx--) - { - bv0[bit_idx] = ((int16_t*)(p_dat - (packet_length-bit_idx) * p_inc))[0]; - } - - // Decode and display the ADS-B data - main_DecodeBits_ADI(bv0, input_lat, input_long); - } - } - } - - // Terminate the ADS-B decoding - DecodeBits_ADI_terminate(); - - shutdown(0); - - return 0; -} diff --git a/trx_examples/targeting/ADSB/linux_app/mrdivide.c b/trx_examples/targeting/ADSB/linux_app/mrdivide.c deleted file mode 100644 index b3dacfe6..00000000 --- a/trx_examples/targeting/ADSB/linux_app/mrdivide.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * File: mrdivide.c - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -/* Include Files */ -#include "DecodeBits_ADI.h" -#include "mrdivide.h" - -/* Function Definitions */ - -/* - * Arguments : const double B_data[] - * Return Type : double - */ -double mrdivide(const double B_data[]) -{ - return 1.0 / B_data[0] * 360.0; -} - -/* - * File trailer for mrdivide.c - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/mrdivide.h b/trx_examples/targeting/ADSB/linux_app/mrdivide.h deleted file mode 100644 index 538af46b..00000000 --- a/trx_examples/targeting/ADSB/linux_app/mrdivide.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * File: mrdivide.h - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -#ifndef __MRDIVIDE_H__ -#define __MRDIVIDE_H__ - -/* Include Files */ -#include -#include -#include -#include "rtwtypes.h" -#include "DecodeBits_ADI_types.h" - -/* Function Declarations */ -extern double mrdivide(const double B_data[]); - -#endif - -/* - * File trailer for mrdivide.h - * - * [EOF] - */ diff --git a/trx_examples/targeting/ADSB/linux_app/rtwtypes.h b/trx_examples/targeting/ADSB/linux_app/rtwtypes.h deleted file mode 100644 index 77bdae90..00000000 --- a/trx_examples/targeting/ADSB/linux_app/rtwtypes.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * File: rtwtypes.h - * - * MATLAB Coder version : 2.8 - * C/C++ source code generated on : 10-Aug-2015 17:40:17 - */ - -#ifndef __RTWTYPES_H__ -#define __RTWTYPES_H__ -#ifndef __TMWTYPES__ -#define __TMWTYPES__ - -/*=======================================================================* - * Target hardware information - * Device type: Generic->MATLAB Host Computer - * Number of bits: char: 8 short: 16 int: 32 - * long: 32 long long: 64 - * native word size: 32 - * Byte ordering: LittleEndian - * Signed integer division rounds to: Undefined - * Shift right on a signed integer as arithmetic shift: on - *=======================================================================*/ - -/*=======================================================================* - * Fixed width word size data types: * - * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * - * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * - * real32_T, real64_T - 32 and 64 bit floating point numbers * - *=======================================================================*/ -typedef signed char int8_T; -typedef unsigned char uint8_T; -typedef short int16_T; -typedef unsigned short uint16_T; -typedef int int32_T; -typedef unsigned int uint32_T; -typedef long long int64_T; -typedef unsigned long long uint64_T; -typedef float real32_T; -typedef double real64_T; - -/*===========================================================================* - * Generic type definitions: real_T, time_T, boolean_T, int_T, uint_T, * - * ulong_T, ulonglong_T, char_T and byte_T. * - *===========================================================================*/ -typedef double real_T; -typedef double time_T; -typedef unsigned char boolean_T; -typedef int int_T; -typedef unsigned int uint_T; -typedef unsigned long ulong_T; -typedef unsigned long long ulonglong_T; -typedef char char_T; -typedef char_T byte_T; - -/*===========================================================================* - * Complex number type definitions * - *===========================================================================*/ -#define CREAL_T - -typedef struct { - real32_T re; - real32_T im; -} creal32_T; - -typedef struct { - real64_T re; - real64_T im; -} creal64_T; - -typedef struct { - real_T re; - real_T im; -} creal_T; - -typedef struct { - int8_T re; - int8_T im; -} cint8_T; - -typedef struct { - uint8_T re; - uint8_T im; -} cuint8_T; - -typedef struct { - int16_T re; - int16_T im; -} cint16_T; - -typedef struct { - uint16_T re; - uint16_T im; -} cuint16_T; - -typedef struct { - int32_T re; - int32_T im; -} cint32_T; - -typedef struct { - uint32_T re; - uint32_T im; -} cuint32_T; - -typedef struct { - int64_T re; - int64_T im; -} cint64_T; - -typedef struct { - uint64_T re; - uint64_T im; -} cuint64_T; - -/*=======================================================================* - * Min and Max: * - * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * - * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * - *=======================================================================*/ -#define MAX_int8_T ((int8_T)(127)) -#define MIN_int8_T ((int8_T)(-128)) -#define MAX_uint8_T ((uint8_T)(255)) -#define MIN_uint8_T ((uint8_T)(0)) -#define MAX_int16_T ((int16_T)(32767)) -#define MIN_int16_T ((int16_T)(-32768)) -#define MAX_uint16_T ((uint16_T)(65535)) -#define MIN_uint16_T ((uint16_T)(0)) -#define MAX_int32_T ((int32_T)(2147483647)) -#define MIN_int32_T ((int32_T)(-2147483647-1)) -#define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU)) -#define MIN_uint32_T ((uint32_T)(0)) -#define MAX_int64_T ((int64_T)(9223372036854775807LL)) -#define MIN_int64_T ((int64_T)(-9223372036854775807LL-1LL)) -#define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFULL)) -#define MIN_uint64_T ((uint64_T)(0ULL)) - -/* Logical type definitions */ -#if !defined(__cplusplus) && !defined(__true_false_are_keywords) -# ifndef false -# define false (0U) -# endif - -# ifndef true -# define true (1U) -# endif -#endif - -/* - * Maximum length of a MATLAB identifier (function/variable) - * including the null-termination character. Referenced by - * rt_logging.c and rt_matrx.c. - */ -#define TMW_NAME_LENGTH_MAX 64 -#endif -#endif - -/* - * File trailer for rtwtypes.h - * - * [EOF] - */