├── .gitignore ├── .gitlab-ci.yml ├── .gitmodules ├── CHANGELOG.md ├── CMakeLists.txt ├── LICENSE ├── README.md ├── _cni-private ├── licenseheaders │ ├── CODE_OF_CONDUCT.md │ ├── LICENSE.txt │ ├── MANIFEST.in │ ├── README.md │ ├── licenseheaders.py │ ├── setup.py │ └── templates │ │ ├── agpl-v3-falcon.tmpl │ │ ├── agpl-v3.tmpl │ │ ├── apache-2.tmpl │ │ ├── bsd-3.tmpl │ │ ├── cecill-B.tmpl │ │ ├── cecill-C.tmpl │ │ ├── cecill.tmpl │ │ ├── gpl-v3.tmpl │ │ ├── lgpl-v2.1.tmpl │ │ └── lgpl-v3.tmpl └── update-license-headers.sh ├── _gitlab-ci ├── README.md ├── docker │ ├── Archlinux │ │ └── Dockerfile │ └── Ubuntu │ │ └── Dockerfile ├── run-local-archlinux.sh ├── run-local-ubuntu.sh └── testscripts │ ├── test_FalconEye.sh │ ├── test_all.sh │ ├── test_build.sh │ └── test_imdea_cc_decoder.sh ├── benchmark ├── CMakeLists.txt └── imdeaowl │ ├── CMakeLists.txt │ ├── archiv │ ├── cni_capture_sync.c │ ├── cni_capture_sync.cc │ ├── cni_capture_sync_rc.cc │ └── cni_capture_sync_rc_recv.cc │ ├── cni_cc_decoder.c │ ├── imdea_capture_sync.c │ └── imdea_cc_decoder.c ├── cmake └── modules │ ├── FindCMNALIB.cmake │ ├── FindFFTW3F.cmake │ ├── FindLimeSDR.cmake │ ├── FindMKL.cmake │ ├── FindSRSGUI.cmake │ ├── FindSRSLTE.cmake │ ├── FindSSE.cmake │ ├── FindSoapySDR.cmake │ ├── FindUHD.cmake │ └── FindbladeRF.cmake ├── external └── cmake │ ├── cmnalib.CMakeLists.txt.in │ └── srsLTE.CMakeLists.txt.in ├── gfx ├── CNI_full+margin.png ├── CNI_full.png ├── CNI_small.png ├── DFG_full.gif ├── DFG_small.png ├── FALCON_banner.png ├── FALCON_banner_small.png ├── FALCON_header.jpg ├── FalconEye.png ├── FalconGUI.png ├── Logo_FALCON_button.png ├── Logo_FALCON_full_button.png ├── SFB876_full.png ├── SFB876_small.png ├── images.qrc ├── tu-dortmund_full+margin.png ├── tu-dortmund_full.png └── tu-dortmund_small.png ├── import ├── CMakeLists.txt ├── qcustomplot │ ├── CMakeLists.txt │ ├── GPL.txt │ ├── qcustomplot.cpp │ └── qcustomplot.h └── rangewidget │ ├── CMakeLists.txt │ ├── LICENSE │ ├── RangeWidget.cpp │ └── RangeWidget.h ├── lib ├── CMakeLists.txt ├── include │ └── falcon │ │ ├── CCSnifferInterfaces.h │ │ ├── common │ │ ├── BufferedFileSink.h │ │ ├── CSV.h │ │ ├── FileSink.h │ │ ├── Settings.h │ │ ├── SignalManager.h │ │ ├── SubframeBuffer.h │ │ ├── SystemInfo.h │ │ ├── ThreadSafeQueue.h │ │ └── Version.h │ │ ├── definitions.h │ │ ├── meas │ │ ├── AuxModem.h │ │ ├── AuxModemGPS.h │ │ ├── BroadcastMaster.h │ │ ├── BroadcastSlave.h │ │ ├── Cancelable.h │ │ ├── DummyEventHandler.h │ │ ├── GPS.h │ │ ├── NetsyncCommon.h │ │ ├── NetsyncController.h │ │ ├── NetsyncMaster.h │ │ ├── NetsyncReceiverBase.h │ │ ├── NetsyncSlave.h │ │ ├── TrafficGenerator.h │ │ ├── TrafficGeneratorEventHandler.h │ │ ├── TrafficResultsToFile.h │ │ ├── broadcast_master.h │ │ ├── broadcast_slave.h │ │ └── probe_modem.h │ │ ├── phy │ │ ├── common │ │ │ └── falcon_phy_common.h │ │ ├── falcon_phch │ │ │ ├── DCIFormats.h │ │ │ ├── falcon_dci.h │ │ │ └── falcon_pdcch.h │ │ ├── falcon_rf │ │ │ ├── rf_imp.h │ │ │ └── rf_utils.h │ │ └── falcon_ue │ │ │ ├── BufferPool.h │ │ │ └── falcon_ue_dl.h │ │ ├── prof │ │ ├── Lifetime.h │ │ └── Stopwatch.h │ │ └── util │ │ ├── Histogram.h │ │ ├── Interval.h │ │ ├── RNTIManager.h │ │ └── rnti_manager_c.h ├── src │ ├── CMakeLists.txt │ ├── common │ │ ├── BufferedFileSink.cc │ │ ├── CMakeLists.txt │ │ ├── CSV.cc │ │ ├── FileSink.cc │ │ ├── SignalManager.cc │ │ ├── SubframeBuffer.cc │ │ ├── SystemInfo.cc │ │ ├── Version.cc │ │ └── Version.cmake │ ├── meas │ │ ├── AuxModem.cc │ │ ├── AuxModemGPS.cc │ │ ├── BroadcastMaster.cc │ │ ├── BroadcastSlave.cc │ │ ├── CMakeLists.txt │ │ ├── Cancelable.cc │ │ ├── DummyEventHandler.cc │ │ ├── GPS.cc │ │ ├── NetsyncController.cc │ │ ├── NetsyncMaster.cc │ │ ├── NetsyncReceiverBase.cc │ │ ├── NetsyncSlave.cc │ │ ├── TrafficGenerator.cc │ │ ├── TrafficGeneratorEventHandler.cc │ │ ├── TrafficResultsToFile.cc │ │ ├── broadcast_master.c │ │ ├── broadcast_slave.c │ │ └── probe_modem.c │ ├── phy │ │ ├── CMakeLists.txt │ │ ├── falcon_phch │ │ │ ├── CMakeLists.txt │ │ │ ├── DCIFormats.cc │ │ │ ├── falcon_dci.c │ │ │ └── falcon_pdcch.c │ │ ├── falcon_rf │ │ │ ├── CMakeLists.txt │ │ │ ├── rf_imp.c │ │ │ └── rf_utils.c │ │ └── falcon_ue │ │ │ ├── BufferPool.cc │ │ │ ├── CMakeLists.txt │ │ │ ├── falcon_ue_dl.c │ │ │ └── falcon_ue_dl.c.orig │ ├── prof │ │ ├── CMakeLists.txt │ │ ├── Lifetime.cc │ │ └── Stopwatch.cc │ └── util │ │ ├── CMakeLists.txt │ │ ├── Histogram.cc │ │ ├── Interval.cc │ │ ├── Interval.h │ │ └── RNTIManager.cc └── test │ ├── CMakeLists.txt │ ├── TestAuxModem.cc │ └── TestTrafficGenerator.cc ├── logo.png ├── misc └── CodeStyle_for_qtcreator.xml └── src ├── CMakeLists.txt ├── FalconCaptureProbe.cc ├── FalconCaptureWarden.cc ├── FalconEye.cc ├── Loop-FalconCaptureProbe.sh ├── Loop-FalconEye.sh ├── PullCaptureFiles.sh ├── Settings-Loop-FalconEye.sh ├── Warden-short-noGPS.sh ├── Warden-short.sh ├── allow-realtime.sh ├── archiv ├── Falcon.cc ├── Falcon.h ├── FalconMain.cc ├── lte │ ├── CCSniffer.cc │ ├── CCSniffer.h │ ├── CMakeLists.txt │ ├── metrics_csv.cc │ ├── metrics_stdout.cc │ ├── ue.cc │ └── ue_base.cc ├── main.cc ├── metrics_csv.cc ├── metrics_stdout.cc ├── ue.cc └── ue_base.cc ├── capture_probe ├── ArgManager.cc ├── ArgManager.h ├── CMakeLists.txt ├── CaptureProbeCore.cc └── CaptureProbeCore.h ├── eye ├── ArgManager.cc ├── ArgManager.h ├── CMakeLists.txt ├── DataProvider.cc ├── DataProvider.h ├── EyeCore.cc ├── EyeCore.h └── phy │ ├── CMakeLists.txt │ ├── DCICollection.cc │ ├── DCICollection.h │ ├── DCIPrint.cc │ ├── DCIPrint.h │ ├── DCISearch.cc │ ├── DCISearch.h │ ├── Helper.c │ ├── Helper.h │ ├── MetaFormats.cc │ ├── MetaFormats.h │ ├── Phy.cc │ ├── Phy.h │ ├── PhyCommon.cc │ ├── PhyCommon.h │ ├── SubframeInfo.cc │ ├── SubframeInfo.h │ ├── SubframeInfoConsumer.cc │ ├── SubframeInfoConsumer.h │ ├── SubframePower.cc │ ├── SubframePower.h │ ├── SubframeWorker.cc │ ├── SubframeWorker.h │ ├── SubframeWorkerThread.cc │ └── SubframeWorkerThread.h ├── gui ├── CMakeLists.txt ├── adapters_qt │ ├── CMakeLists.txt │ ├── SpectrumAdapter.cc │ └── SpectrumAdapter.h ├── colorpicker.cpp ├── colorpicker.h ├── dynamic_options.cpp ├── file_input_output.cpp ├── file_input_output.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── model │ ├── CMakeLists.txt │ ├── EyeThread.cc │ └── EyeThread.h ├── model_dummy │ ├── CMakeLists.txt │ ├── ScanThread.cc │ ├── ScanThread.h │ ├── cni_cc_decoder.c │ ├── cni_cc_decoder.h │ ├── cni_cc_decoderThread.cc │ └── cni_cc_decoderThread.h ├── performance_plot.cpp ├── performance_plot.h ├── plots.h ├── rnti_table.cpp ├── rnti_table.h ├── setting_slots.cpp ├── settings.cpp ├── settings.h ├── spectrum.cpp ├── spectrum.h ├── waterfall.cpp └── waterfall.h ├── misc ├── CMakeLists.txt └── SearchSpace.cc ├── performance-mode.sh ├── powersave-mode.sh └── set-cpu-governor.sh /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Ignore all hidden files 3 | .* 4 | # Hidden files exceptions 5 | !/.gitignore 6 | 7 | # Ignore private files 8 | _* 9 | 10 | # Other local files 11 | CMakeLists.txt.user 12 | 13 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/.gitmodules -------------------------------------------------------------------------------- /_cni-private/licenseheaders/LICENSE.txt: -------------------------------------------------------------------------------- 1 | :: 2 | 3 | Copyright (c) 2016 Johann Petrak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE.txt 2 | include README.md 3 | 4 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | """Packaging script.""" 5 | 6 | import os 7 | from setuptools import setup, find_packages 8 | 9 | here = os.path.abspath(os.path.dirname(__file__)) 10 | readme = open(os.path.join(here, 'README.md')).read() 11 | 12 | setup( 13 | name="licenseheaders", 14 | version="0.6", 15 | author="Johann Petrak", 16 | author_email="johann.petrak@gmail.com", 17 | description='Add or change license headers for all files in a directory', 18 | long_description=readme, 19 | long_description_content_type="text/markdown", 20 | setup_requires=[], 21 | install_requires=[], 22 | python_requires=">=3.5", 23 | license="MIT", 24 | keywords="", 25 | url="http://github.com/johann-petrak/licenseheaders", 26 | py_modules=['licenseheaders'], 27 | packages=find_packages(), 28 | package_data={'': ['templates/*']}, 29 | include_package_data=True, 30 | entry_points={'console_scripts': ['licenseheaders=licenseheaders:main']}, 31 | # test_suite='tests', 32 | # tests_require=['mock'], 33 | classifiers=["Development Status :: 5 - Production/Stable", 34 | "License :: OSI Approved :: MIT License", 35 | "Environment :: Console", 36 | "Natural Language :: English", 37 | "Programming Language :: Python :: 3", 38 | "Topic :: Software Development", 39 | "Topic :: Software Development :: Code Generators", 40 | "Intended Audience :: Developers", 41 | ], 42 | ) 43 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/templates/agpl-v3-falcon.tmpl: -------------------------------------------------------------------------------- 1 | Copyright (c) ${years} ${owner}. 2 | 3 | This file is part of ${projectname} 4 | (see ${projecturl}). 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Affero General Public License as 8 | published by the Free Software Foundation, either version 3 of the 9 | License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Affero General Public License for more details. 15 | 16 | A copy of the GNU Affero General Public License can be found in 17 | the LICENSE file in the top-level directory of this distribution 18 | and at http://www.gnu.org/licenses/. 19 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/templates/agpl-v3.tmpl: -------------------------------------------------------------------------------- 1 | Copyright (c) ${years} ${owner}. 2 | 3 | This file is part of ${projectname} 4 | (see ${projecturl}). 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Affero General Public License as 8 | published by the Free Software Foundation, either version 3 of the 9 | License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Affero General Public License for more details. 15 | 16 | You should have received a copy of the GNU Affero General Public License 17 | along with this program. If not, see . 18 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/templates/apache-2.tmpl: -------------------------------------------------------------------------------- 1 | Copyright (c) ${years} ${owner}. 2 | 3 | This file is part of ${projectname} 4 | (see ${projecturl}). 5 | 6 | Licensed to the Apache Software Foundation (ASF) under one 7 | or more contributor license agreements. See the NOTICE file 8 | distributed with this work for additional information 9 | regarding copyright ownership. The ASF licenses this file 10 | to you under the Apache License, Version 2.0 (the 11 | "License"); you may not use this file except in compliance 12 | with the License. You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, 17 | software distributed under the License is distributed on an 18 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 19 | KIND, either express or implied. See the License for the 20 | specific language governing permissions and limitations 21 | under the License. 22 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/templates/bsd-3.tmpl: -------------------------------------------------------------------------------- 1 | Copyright (c) ${years} ${owner}. 2 | 3 | This file is part of ${projectname} 4 | (see ${projecturl}). 5 | 6 | License: 3-clause BSD, see https://opensource.org/licenses/BSD-3-Clause 7 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/templates/cecill-B.tmpl: -------------------------------------------------------------------------------- 1 | Copyright © ${owner} ${years} 2 | 3 | This software is governed by the CeCILL-B license under French law and 4 | abiding by the rules of distribution of free software. You can use, 5 | modify and/ or redistribute the software under the terms of the CeCILL-B 6 | license as circulated by CEA, CNRS and INRIA at the following URL 7 | "http://www.cecill.info". 8 | 9 | As a counterpart to the access to the source code and rights to copy, 10 | modify and redistribute granted by the license, users are provided only 11 | with a limited warranty and the software's author, the holder of the 12 | economic rights, and the successive licensors have only limited liability. 13 | 14 | In this respect, the user's attention is drawn to the risks associated 15 | with loading, using, modifying and/or developing or reproducing the 16 | software by the user in light of its specific status of free software, 17 | that may mean that it is complicated to manipulate, and that also 18 | therefore means that it is reserved for developers and experienced 19 | professionals having in-depth computer knowledge. Users are therefore 20 | encouraged to load and test the software's suitability as regards their 21 | requirements in conditions enabling the security of their systemsand/or 22 | data to be ensured and, more generally, to use and operate it in the 23 | same conditions as regards security. 24 | 25 | The fact that you are presently reading this means that you have had 26 | knowledge of the CeCILL-B license and that you accept its terms. 27 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/templates/cecill-C.tmpl: -------------------------------------------------------------------------------- 1 | Copyright © ${owner} ${years} 2 | 3 | This software is governed by the CeCILL-C license under French law and 4 | abiding by the rules of distribution of free software. You can use, 5 | modify and/ or redistribute the software under the terms of the CeCILL-C 6 | license as circulated by CEA, CNRS and INRIA at the following URL 7 | "http://www.cecill.info". 8 | 9 | As a counterpart to the access to the source code and rights to copy, 10 | modify and redistribute granted by the license, users are provided only 11 | with a limited warranty and the software's author, the holder of the 12 | economic rights, and the successive licensors have only limited liability. 13 | 14 | In this respect, the user's attention is drawn to the risks associated 15 | with loading, using, modifying and/or developing or reproducing the 16 | software by the user in light of its specific status of free software, 17 | that may mean that it is complicated to manipulate, and that also 18 | therefore means that it is reserved for developers and experienced 19 | professionals having in-depth computer knowledge. Users are therefore 20 | encouraged to load and test the software's suitability as regards their 21 | requirements in conditions enabling the security of their systemsand/or 22 | data to be ensured and, more generally, to use and operate it in the 23 | same conditions as regards security. 24 | 25 | The fact that you are presently reading this means that you have had 26 | knowledge of the CeCILL-C license and that you accept its terms. 27 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/templates/cecill.tmpl: -------------------------------------------------------------------------------- 1 | Copyright © ${owner} ${years} 2 | 3 | This software is governed by the CeCILL license under French law and 4 | abiding by the rules of distribution of free software. You can use, 5 | modify and/ or redistribute the software under the terms of the CeCILL 6 | license as circulated by CEA, CNRS and INRIA at the following URL 7 | "http://www.cecill.info". 8 | 9 | As a counterpart to the access to the source code and rights to copy, 10 | modify and redistribute granted by the license, users are provided only 11 | with a limited warranty and the software's author, the holder of the 12 | economic rights, and the successive licensors have only limited liability. 13 | 14 | In this respect, the user's attention is drawn to the risks associated 15 | with loading, using, modifying and/or developing or reproducing the 16 | software by the user in light of its specific status of free software, 17 | that may mean that it is complicated to manipulate, and that also 18 | therefore means that it is reserved for developers and experienced 19 | professionals having in-depth computer knowledge. Users are therefore 20 | encouraged to load and test the software's suitability as regards their 21 | requirements in conditions enabling the security of their systemsand/or 22 | data to be ensured and, more generally, to use and operate it in the 23 | same conditions as regards security. 24 | 25 | The fact that you are presently reading this means that you have had 26 | knowledge of the CeCILL license and that you accept its terms. 27 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/templates/gpl-v3.tmpl: -------------------------------------------------------------------------------- 1 | Copyright (c) ${years} ${owner}. 2 | 3 | This file is part of ${projectname} 4 | (see ${projecturl}). 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/templates/lgpl-v2.1.tmpl: -------------------------------------------------------------------------------- 1 | Copyright (c) ${years} ${owner}. 2 | 3 | This file is part of ${projectname} 4 | (see ${projecturl}). 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2.1 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with this program. If not, see . 18 | -------------------------------------------------------------------------------- /_cni-private/licenseheaders/templates/lgpl-v3.tmpl: -------------------------------------------------------------------------------- 1 | Copyright (c) ${years} ${owner}. 2 | 3 | This file is part of ${projectname} 4 | (see ${projecturl}). 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with this program. If not, see . 18 | -------------------------------------------------------------------------------- /_cni-private/update-license-headers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | directories=( 4 | "../lib" 5 | "../src" 6 | ) 7 | 8 | LICENSE="agpl-v3-falcon" 9 | YEARS="2019" 10 | OWNER="Robert Falkenberg" 11 | PROGRAM_NAME="FALCON" 12 | PROGRAM_URL="https://github.com/falkenber9/falcon" 13 | 14 | for target in ${directories[*]}; do 15 | echo "Processing directory $target" 16 | licenseheaders/licenseheaders.py -t $LICENSE -y "$YEARS" -o "$OWNER" -n "$PROGRAM_NAME" -u "$PROGRAM_URL" -d $target 17 | done 18 | -------------------------------------------------------------------------------- /_gitlab-ci/run-local-archlinux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Helper script to run CI test locally without a gitlab runner. This file should be in sync with some pipeline from .gitlab-ci.yml. 4 | 5 | docker rmi archlinux_base:latest --force || true 6 | cd docker/Archlinux 7 | 8 | BUILD_PARAMS=( 9 | --no-cache 10 | -t archlinux_base:latest 11 | --target archlinux_base 12 | --build-arg OS_VERSION=latest 13 | --build-arg INCLUDE_UHD=false 14 | --build-arg INCLUDE_LIMESDR=false 15 | --build-arg INCLUDE_CMNALIB_DEPS_FOR_SUBPROJECT=false 16 | --build-arg INCLUDE_CMNALIB_GIT=false 17 | --build-arg INCLUDE_CMNALIB_PKG=false 18 | --build-arg INCLUDE_CMNALIB=true 19 | --build-arg INCLUDE_SRSLTE_PATCHED_DEPS_FOR_SUBPROJECT=false 20 | --build-arg INCLUDE_SRSLTE_PATCHED_GIT=false 21 | --build-arg INCLUDE_SRSLTE_PATCHED_PKG=false 22 | --build-arg INCLUDE_SRSLTE_PATCHED=true 23 | --build-arg INCLUDE_SRSLTE=false 24 | . 25 | ) 26 | echo ${BUILD_PARAMS[@]} 27 | docker build ${BUILD_PARAMS[@]} 28 | 29 | cd ../../ 30 | 31 | RUN_PARAMS=( 32 | -v `pwd`/../.:/falcon 33 | -v `pwd`/../../../falcon-testdata:/falcon/_gitlab-ci/testdata 34 | -v /tmp:/tmp/tmp-host 35 | -i 36 | -t archlinux_base:latest 37 | ) 38 | echo ${RUN_PARAMS[@]} 39 | docker run ${RUN_PARAMS[@]} /bin/bash -c "/falcon/_gitlab-ci/testscripts/./test_all.sh /falcon-build /tmp; bash" 40 | -------------------------------------------------------------------------------- /_gitlab-ci/run-local-ubuntu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Helper script to run CI test locally without a gitlab runner. This file should be in sync with some pipeline from .gitlab-ci.yml. 4 | 5 | docker rmi ubnt20_full:latest --force || true 6 | cd docker/Ubuntu 7 | 8 | BUILD_PARAMS=( 9 | --no-cache 10 | -t ubnt20_full:latest 11 | --build-arg OS_VERSION=focal 12 | --build-arg INCLUDE_CMNALIB=true 13 | --build-arg INCLUDE_UHD=false 14 | --build-arg INCLUDE_LIMESDR=false 15 | --build-arg INCLUDE_SRSLTE=false 16 | . 17 | ) 18 | docker build ${BUILD_PARAMS[@]} 19 | 20 | cd ../../ 21 | 22 | RUN_PARAMS=( 23 | -v `pwd`/../.:/falcon 24 | -v `pwd`/../../../falcon-testdata:/falcon/_gitlab-ci/testdata 25 | -v /tmp:/tmp/tmp-host 26 | -i 27 | -t ubnt20_full:latest 28 | ) 29 | echo ${RUN_PARAMS[@]} 30 | docker run ${RUN_PARAMS[@]} /bin/bash -c "/falcon/_gitlab-ci/testscripts/./test_all.sh /falcon-build /tmp; bash" 31 | -------------------------------------------------------------------------------- /_gitlab-ci/testscripts/test_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | builddir=$1 4 | workdir=$2 5 | 6 | oldpwd=`pwd` 7 | scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 8 | 9 | #srcdir="/falcon" 10 | # 11 | #mkdir -p $builddir 12 | #cd $builddir 13 | #cmake $srcdir 14 | #make -j 15 | # 16 | #echo "Build successfull" 17 | 18 | cd $scriptdir 19 | 20 | #exit immediately if any command fails 21 | set -e 22 | 23 | ./test_build.sh $builddir $workdir 24 | ./test_imdea_cc_decoder.sh $builddir $workdir 25 | #./test_FalconEye_histogram.sh $builddir $workdir 26 | ./test_FalconEye.sh $builddir $workdir 27 | 28 | cd $oldpwd 29 | -------------------------------------------------------------------------------- /_gitlab-ci/testscripts/test_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | templatedir="../testdata" 4 | builddir=$1 5 | workdir=$2 6 | 7 | #exit immediately if any command fails 8 | set -e 9 | 10 | echo "Testing download, build and install" 11 | 12 | srcdir="/falcon" 13 | 14 | mkdir -p $builddir 15 | cd $builddir 16 | cmake -DCMAKE_INSTALL_PREFIX=/usr $srcdir 17 | make -j 18 | 19 | echo "Build successful" 20 | 21 | make install 22 | 23 | echo "Installation successful" 24 | -------------------------------------------------------------------------------- /_gitlab-ci/testscripts/test_imdea_cc_decoder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo -e "\n********************* STARTING TEST *********************\n" 4 | 5 | templatedir="../testdata" 6 | builddir=$1 7 | workdir=$2 8 | 9 | uut="benchmark/imdeaowl/imdea_cc_decoder" 10 | 11 | subtest="normal-10-MHz" 12 | source "$templatedir/$subtest/args.sh" 13 | variant="-owl" 14 | 15 | input_dir=$templatedir/$subtest 16 | input_iq=$basename-$iq_suffix 17 | input_dci=$basename$variant-$dci_suffix 18 | input_stats=$basename$variant-$stats_suffix 19 | 20 | output_dir=$workdir 21 | output_dci=test$variant-$dci_suffix 22 | output_stats=test$variant-$stats_suffix 23 | 24 | uut_params="-i $input_dir/$input_iq -p $nof_prb -P $antenna_ports -c $cell_id -n $nof_subframes -D $output_dir/$output_dci -E $output_dir/$output_stats -d" 25 | 26 | #exit immediately if any command fails 27 | set -e 28 | 29 | echo "Running subtest '$subtest', variant '$variant': $uut $uut_params" 30 | $builddir/$uut $uut_params 31 | 32 | #copy dci to tmp (e.g. for updating tests) 33 | mkdir -p /tmp/tmp-host/$subtest 34 | cp $output_dir/$output_dci /tmp/tmp-host/$subtest 35 | cp $input_dir/$input_dci /tmp/tmp-host/$subtest 36 | 37 | #copy stats to tmp 38 | cp $output_dir/$output_stats /tmp/tmp-host/$subtest 39 | cp $input_dir/$input_stats /tmp/tmp-host/$subtest 40 | 41 | echo "Comparing DCI" 42 | cmp $output_dir/$output_dci $input_dir/$input_dci 43 | 44 | echo "Comparing stats" 45 | cmp $output_dir/$output_stats $input_dir/$input_stats 46 | 47 | echo "Success" 48 | -------------------------------------------------------------------------------- /benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(imdeaowl) 3 | -------------------------------------------------------------------------------- /benchmark/imdeaowl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Link libstdc++ and libgcc 3 | if(BUILD_STATIC) 4 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc") 5 | endif(BUILD_STATIC) 6 | 7 | find_package(SRSGUI) 8 | if(SRSGUI_FOUND) 9 | add_definitions(-DENABLE_GUI) 10 | include_directories(${SRSGUI_INCLUDE_DIRS}) 11 | link_directories(${SRSGUI_LIBRARY_DIRS}) 12 | else(SRSGUI_FOUND) 13 | add_definitions(-DDISABLE_GRAPHICS) 14 | set(SRSGUI_LIBRARIES "") 15 | endif(SRSGUI_FOUND) 16 | 17 | set(INSTALL_BUNDLE) 18 | 19 | if(RF_FOUND) 20 | add_executable(imdea_capture_sync imdea_capture_sync.c) 21 | target_link_libraries(imdea_capture_sync 22 | ${SRSLTE_LIBRARIES} 23 | ${FFT_LIBRARIES} 24 | falcon_phy 25 | falcon_util 26 | ) 27 | list(APPEND INSTALL_BUNDLE imdea_capture_sync) 28 | else(RF_FOUND) 29 | add_definitions(-DDISABLE_RF) 30 | #unset(SRSGUI_LIBRARIES) 31 | endif(RF_FOUND) 32 | 33 | message("STATUS GUI:") 34 | message(SRSGUI_FOUND) 35 | 36 | if(SRSGUI_FOUND) 37 | add_executable(imdea_cc_decoder imdea_cc_decoder.c) 38 | target_link_libraries(imdea_cc_decoder 39 | eye_phy 40 | falcon_phy 41 | falcon_util 42 | ${SRSLTE_LIBRARIES} 43 | ${SRSGUI_LIBRARIES} 44 | ${FFT_LIBRARIES} 45 | ) 46 | list(APPEND INSTALL_BUNDLE imdea_cc_decoder) 47 | 48 | add_executable(cni_cc_decoder cni_cc_decoder.c) 49 | target_link_libraries(cni_cc_decoder 50 | eye_phy 51 | falcon_phy 52 | falcon_util 53 | falcon_common 54 | ${SRSLTE_LIBRARIES} 55 | ${SRSGUI_LIBRARIES} 56 | ${FFT_LIBRARIES} 57 | ) 58 | list(APPEND INSTALL_BUNDLE cni_cc_decoder) 59 | else(SRSGUI_FOUND) 60 | message(WARNING "imdea_cc_decoder and cni_cc_decoder won't be built sind SRSGUI was not found.") 61 | endif(SRSGUI_FOUND) 62 | 63 | ################################################################# 64 | # Compile options (compatibility) 65 | ################################################################# 66 | 67 | if(RF_FOUND) 68 | target_compile_options(imdea_capture_sync PUBLIC "-std=gnu99") 69 | endif(RF_FOUND) 70 | if(SRSGUI_FOUND) 71 | target_compile_options(imdea_cc_decoder PUBLIC "-std=gnu99") 72 | target_compile_options(cni_cc_decoder PUBLIC "-std=gnu99") 73 | endif(SRSGUI_FOUND) 74 | 75 | install( 76 | TARGETS ${INSTALL_BUNDLE} 77 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 78 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 79 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} 80 | ) 81 | -------------------------------------------------------------------------------- /benchmark/imdeaowl/archiv/cni_capture_sync_rc.cc: -------------------------------------------------------------------------------- 1 | #include "falcon/meas/NetsyncMaster.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int main(int argc, char** argv) { 10 | NetsyncMaster* netsync = new NetsyncMaster("127.255.255.255", 4567); 11 | netsync->launchReceiver(); 12 | netsync->start("DummID", 0); 13 | netsync->stop(); 14 | netsync->poll(); 15 | sleep(30); 16 | printf("Terminating recv thread...\n"); 17 | delete netsync; 18 | printf("Deleted netsync\n"); 19 | 20 | return EXIT_SUCCESS; 21 | } 22 | -------------------------------------------------------------------------------- /benchmark/imdeaowl/archiv/cni_capture_sync_rc_recv.cc: -------------------------------------------------------------------------------- 1 | #include "falcon/meas/NetsyncSlave.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int main(int argc, char** argv) { 10 | NetsyncSlave* netsync = new NetsyncSlave(4567); 11 | netsync->launchReceiver(); 12 | 13 | sleep(120); 14 | printf("Terminating recv thread...\n"); 15 | delete netsync; 16 | printf("Deleted netsync\n"); 17 | 18 | return EXIT_SUCCESS; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /cmake/modules/FindCMNALIB.cmake: -------------------------------------------------------------------------------- 1 | 2 | # - Try to find srslte 3 | # 4 | # Once done this will define 5 | # CMNALIB_FOUND - System has srslte 6 | # CMNALIB_INCLUDE_DIRS - The srslte include directories 7 | # CMNALIB_LIBRARIES - The srslte libraries 8 | # 9 | # The following variables are used: 10 | # CMNALIB_DIR - Environment variable giving srslte install directory 11 | # CMNALIB_SRCDIR - Directory containing srslte sources 12 | # CMNALIB_BUILDDIR - Directory containing srslte build 13 | 14 | find_package(PkgConfig) 15 | pkg_check_modules(PC_CMNALIB QUIET cmnalib) 16 | set(CMNALIB_DEFINITIONS ${PC_CMNALIB_CFLAGS_OTHER}) 17 | 18 | #FIND_PATH( 19 | # CMNALIB_INCLUDE_DIRS 20 | # NAMES cmnalib/cmnalib.h 21 | # HINTS $ENV{CMNALIB_DIR}/include 22 | # ${CMNALIB_SRCDIR}/cmnalib/include 23 | # ${PC_CMNALIB_INCLUDEDIR} 24 | # ${CMAKE_INSTALL_PREFIX}/include 25 | # PATHS /usr/local/include 26 | # /usr/include 27 | #) 28 | 29 | FIND_LIBRARY( 30 | CMNALIB_LIBRARY 31 | NAMES cmnalib 32 | HINTS $ENV{CMNALIB_DIR}/lib 33 | ${CMNALIB_BUILDDIR}/cmnalib/lib 34 | ${PC_CMNALIB_LIBDIR} 35 | ${CMAKE_INSTALL_PREFIX}/lib 36 | ${CMAKE_INSTALL_PREFIX}/lib64 37 | PATHS /usr/local/lib 38 | /usr/local/lib64 39 | /usr/lib 40 | /usr/lib64 41 | ) 42 | 43 | IF(DEFINED CMNALIB_SRCDIR) 44 | set(CMNALIB_INCLUDE_DIRS ${CMNALIB_SRCDIR}) 45 | 46 | ENDIF(DEFINED CMNALIB_SRCDIR) 47 | 48 | SET(CMNALIB_LIBRARIES ${CMNALIB_LIBRARY}) 49 | 50 | message(STATUS "CMNALIB LIBRARIES: " ${CMNALIB_LIBRARIES}) 51 | #message(STATUS "CMNALIB INCLUDE DIRS: " ${CMNALIB_INCLUDE_DIRS}) 52 | 53 | INCLUDE(FindPackageHandleStandardArgs) 54 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(CMNALIB DEFAULT_MSG CMNALIB_LIBRARIES) 55 | #CMNALIB_INCLUDE_DIRS 56 | MARK_AS_ADVANCED(CMNALIB_LIBRARIES) 57 | #CMNALIB_INCLUDE_DIRS 58 | -------------------------------------------------------------------------------- /cmake/modules/FindFFTW3F.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find fftw3f - the single-precision version of FFTW3 2 | # Once done this will define 3 | # FFTW3F_FOUND - System has fftw3f 4 | # FFTW3F_INCLUDE_DIRS - The fftw3f include directories 5 | # FFTW3F_LIBRARIES - The libraries needed to use fftw3f 6 | # FFTW3F_DEFINITIONS - Compiler switches required for using fftw3f 7 | 8 | find_package(PkgConfig) 9 | pkg_check_modules(PC_FFTW3F "fftw3f >= 3.0") 10 | set(FFTW3F_DEFINITIONS ${PC_FFTW3F_CFLAGS_OTHER}) 11 | 12 | find_path(FFTW3F_INCLUDE_DIR 13 | NAMES fftw3.h 14 | HINTS ${PC_FFTW3F_INCLUDEDIR} ${PC_FFTW3F_INCLUDE_DIRS} $ENV{FFTW3_DIR}/include 15 | PATHS /usr/local/include 16 | /usr/include ) 17 | 18 | find_library(FFTW3F_STATIC_LIBRARY 19 | NAMES fftw3f.a libfftw3f.a libfftw3f-3.a 20 | HINTS ${PC_FFTW3F_LIBDIR} ${PC_FFTW3F_LIBRARY_DIRS} $ENV{FFTW3_DIR}/lib 21 | PATHS /usr/local/lib 22 | /usr/lib) 23 | 24 | find_library(FFTW3F_LIBRARY 25 | NAMES fftw3f libfftw3f libfftw3f-3 26 | HINTS ${PC_FFTW3F_LIBDIR} ${PC_FFTW3F_LIBRARY_DIRS} $ENV{FFTW3_DIR}/lib 27 | PATHS /usr/local/lib 28 | /usr/lib) 29 | 30 | set(FFTW3F_LIBRARIES ${FFTW3F_LIBRARY} ) 31 | set(FFTW3F_STATIC_LIBRARIES ${FFTW3F_STATIC_LIBRARY} ) 32 | set(FFTW3F_INCLUDE_DIRS ${FFTW3F_INCLUDE_DIR} ) 33 | 34 | message(STATUS "FFTW3F LIBRARIES: " ${FFTW3F_LIBRARIES}) 35 | message(STATUS "FFTW3F STATIC LIBRARIES: " ${FFTW3F_STATIC_LIBRARIES}) 36 | message(STATUS "FFTW3F INCLUDE DIRS: " ${FFTW3F_INCLUDE_DIRS}) 37 | 38 | include(FindPackageHandleStandardArgs) 39 | # handle the QUIETLY and REQUIRED arguments and set FFTW3F_FOUND to TRUE 40 | # if all listed variables are TRUE 41 | find_package_handle_standard_args(fftw3f DEFAULT_MSG 42 | FFTW3F_LIBRARY FFTW3F_INCLUDE_DIR) 43 | 44 | mark_as_advanced(FFTW3F_INCLUDE_DIR FFTW3F_STATIC_LIBRARY FFTW3F_LIBRARY ) 45 | -------------------------------------------------------------------------------- /cmake/modules/FindLimeSDR.cmake: -------------------------------------------------------------------------------- 1 | if(NOT LIMESDR_FOUND) 2 | pkg_check_modules (LIMESDR_PKG LimeSuite) 3 | 4 | find_path(LIMESDR_INCLUDE_DIRS 5 | NAMES LimeSuite.h 6 | PATHS ${LIMESDR_PKG_INCLUDE_DIRS} 7 | /usr/include/lime 8 | /usr/local/include/lime 9 | ) 10 | 11 | find_library(LIMESDR_LIBRARIES 12 | NAMES LimeSuite 13 | PATHS ${LIMESDR_PKG_LIBRARY_DIRS} 14 | /usr/lib 15 | /usr/local/lib 16 | ) 17 | 18 | if(LIMESDR_INCLUDE_DIRS AND LIMESDR_LIBRARIES) 19 | set(LIMESDR_FOUND TRUE CACHE INTERNAL "libLimeSuite found") 20 | message(STATUS "Found libLimeSuite: ${LIMESDR_INCLUDE_DIRS}, ${LIMESDR_LIBRARIES}") 21 | else(LIMESDR_INCLUDE_DIRS AND LIMESDR_LIBRARIES) 22 | set(LIMESDR_FOUND FALSE CACHE INTERNAL "libLimeSuite found") 23 | message(STATUS "libLimeSuite not found.") 24 | endif(LIMESDR_INCLUDE_DIRS AND LIMESDR_LIBRARIES) 25 | 26 | mark_as_advanced(LIMESDR_LIBRARIES LIMESDR_INCLUDE_DIRS) 27 | 28 | endif(NOT LIMESDR_FOUND) 29 | -------------------------------------------------------------------------------- /cmake/modules/FindMKL.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find mkl - the Intel Math Kernel Library 2 | # Once done this will define 3 | # MKL_FOUND - System has mkl 4 | # MKL_INCLUDE_DIRS - The mkl include directories 5 | # MKL_LIBRARIES - The libraries needed to use mkl 6 | # MKL_DEFINITIONS - Compiler switches required for using mkl 7 | 8 | find_path(MKL_INCLUDE_DIR 9 | NAMES mkl.h 10 | HINTS $ENV{MKL_DIR}/include 11 | PATHS) 12 | 13 | find_path(MKL_FFTW_INCLUDE_DIR 14 | NAMES fftw3.h 15 | HINTS $ENV{MKL_DIR}/include/fftw 16 | PATHS) 17 | 18 | find_library(MKL_LIBRARIES 19 | NAMES mkl_rt 20 | HINTS $ENV{MKL_DIR}/lib/intel64 21 | PATHS) 22 | 23 | find_library(MKL_CORE 24 | NAMES libmkl_core.a 25 | HINTS $ENV{MKL_DIR}/lib/intel64 26 | PATHS) 27 | 28 | find_library(MKL_ILP 29 | NAMES libmkl_intel_ilp64.a 30 | HINTS $ENV{MKL_DIR}/lib/intel64 31 | PATHS) 32 | 33 | find_library(MKL_SEQ 34 | NAMES libmkl_sequential.a 35 | HINTS $ENV{MKL_DIR}/lib/intel64 36 | PATHS) 37 | 38 | set(MKL_STATIC_LIBRARIES -Wl,--start-group ${MKL_CORE} ${MKL_ILP} ${MKL_SEQ} -Wl,--end-group -lpthread -lm -ldl) 39 | set(MKL_INCLUDE_DIRS ${MKL_INCLUDE_DIR} ${MKL_FFTW_INCLUDE_DIR}) 40 | 41 | include(FindPackageHandleStandardArgs) 42 | # handle the QUIETLY and REQUIRED arguments and set MKL_FOUND to TRUE 43 | # if all listed variables are TRUE 44 | find_package_handle_standard_args(mkl DEFAULT_MSG 45 | MKL_LIBRARIES MKL_CORE MKL_ILP MKL_SEQ MKL_INCLUDE_DIRS) 46 | 47 | if(MKL_FOUND) 48 | MESSAGE(STATUS "Found MKL_INCLUDE_DIRS: ${MKL_INCLUDE_DIRS}" ) 49 | MESSAGE(STATUS "Found MKL_LIBRARIES: ${MKL_LIBRARIES}" ) 50 | MESSAGE(STATUS "Found MKL_STATIC_LIBRARIES: ${MKL_STATIC_LIBRARIES}" ) 51 | endif(MKL_FOUND) 52 | 53 | mark_as_advanced(MKL_INCLUDE_DIR MKL_FFTW_INCLUDE_DIR MKL_LIBRARIES MKL_CORE MKL_ILP MKL_SEQ) 54 | -------------------------------------------------------------------------------- /cmake/modules/FindSRSGUI.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find SRSGUI 2 | # Once done this will define 3 | # SRSGUI_FOUND - System has srsgui 4 | # SRSGUI_INCLUDE_DIRS - The srsgui include directories 5 | # SRSGUI_LIBRARIES - The srsgui library 6 | 7 | find_package(PkgConfig) 8 | pkg_check_modules(PC_SRSGUI QUIET srsgui) 9 | IF(NOT SRSGUI_FOUND) 10 | 11 | FIND_PATH( 12 | SRSGUI_INCLUDE_DIRS 13 | NAMES srsgui/srsgui.h 14 | HINTS ${PC_SRSGUI_INCLUDEDIR} 15 | ${PC_SRSGUI_INCLUDE_DIRS} 16 | $ENV{SRSGUI_DIR}/include 17 | PATHS /usr/local/include 18 | /usr/include 19 | ) 20 | 21 | FIND_LIBRARY( 22 | SRSGUI_LIBRARIES 23 | NAMES srsgui 24 | HINTS ${PC_SRSGUI_LIBDIR} 25 | ${CMAKE_INSTALL_PREFIX}/lib 26 | ${CMAKE_INSTALL_PREFIX}/lib64 27 | $ENV{SRSGUI_DIR}/lib 28 | PATHS /usr/local/lib 29 | /usr/local/lib64 30 | /usr/lib 31 | /usr/lib64 32 | ) 33 | 34 | message(STATUS "SRSGUI LIBRARIES " ${SRSGUI_LIBRARIES}) 35 | message(STATUS "SRSGUI INCLUDE DIRS " ${SRSGUI_INCLUDE_DIRS}) 36 | 37 | INCLUDE(FindPackageHandleStandardArgs) 38 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(SRSGUI DEFAULT_MSG SRSGUI_LIBRARIES SRSGUI_INCLUDE_DIRS) 39 | MARK_AS_ADVANCED(SRSGUI_LIBRARIES SRSGUI_INCLUDE_DIRS) 40 | 41 | ENDIF(NOT SRSGUI_FOUND) 42 | 43 | -------------------------------------------------------------------------------- /cmake/modules/FindSoapySDR.cmake: -------------------------------------------------------------------------------- 1 | 2 | message(STATUS "FINDING SOAPY.") 3 | if(NOT SOAPYSDR_FOUND) 4 | pkg_check_modules (SOAPYSDR_PKG SoapySDR) 5 | 6 | find_path(SOAPYSDR_INCLUDE_DIRS 7 | NAMES Device.h 8 | PATHS ${SOAPYSDR_PKG_INCLUDE_DIRS} 9 | /usr/include/SoapySDR 10 | /usr/local/include/SoapySDR 11 | ) 12 | 13 | find_library(SOAPYSDR_LIBRARIES 14 | NAMES SoapySDR 15 | PATHS ${LIMESDR_PKG_LIBRARY_DIRS} 16 | /usr/lib 17 | /usr/local/lib 18 | /usr/lib/arm-linux-gnueabihf 19 | ) 20 | 21 | 22 | if(SOAPYSDR_INCLUDE_DIRS AND SOAPYSDR_LIBRARIES) 23 | set(SOAPYSDR_FOUND TRUE CACHE INTERNAL "libSOAPYSDR found") 24 | message(STATUS "Found libSOAPYSDR: ${SOAPYSDR_INCLUDE_DIRS}, ${SOAPYSDR_LIBRARIES}") 25 | else(SOAPYSDR_INCLUDE_DIRS AND SOAPYSDR_LIBRARIES) 26 | set(SOAPYSDR_FOUND FALSE CACHE INTERNAL "libSOAPYSDR found") 27 | message(STATUS "libSOAPYSDR not found.") 28 | endif(SOAPYSDR_INCLUDE_DIRS AND SOAPYSDR_LIBRARIES) 29 | 30 | mark_as_advanced(SOAPYSDR_LIBRARIES SOAPYSDR_INCLUDE_DIRS) 31 | 32 | endif(NOT SOAPYSDR_FOUND) 33 | -------------------------------------------------------------------------------- /cmake/modules/FindUHD.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE(FindPkgConfig) 2 | #PKG_CHECK_MODULES(UHD uhd) 3 | IF(NOT UHD_FOUND) 4 | 5 | FIND_PATH( 6 | UHD_INCLUDE_DIRS 7 | NAMES uhd.h 8 | HINTS $ENV{UHD_DIR}/include 9 | PATHS /usr/local/include 10 | /usr/include 11 | ) 12 | 13 | FIND_LIBRARY( 14 | UHD_LIBRARIES 15 | NAMES uhd 16 | HINTS $ENV{UHD_DIR}/lib 17 | PATHS /usr/local/lib 18 | /usr/lib 19 | /usr/lib/x86_64-linux-gnu 20 | /usr/local/lib64 21 | /usr/local/lib32 22 | ) 23 | 24 | message(STATUS "UHD LIBRARIES " ${UHD_LIBRARIES}) 25 | message(STATUS "UHD INCLUDE DIRS " ${UHD_INCLUDE_DIRS}) 26 | 27 | INCLUDE(FindPackageHandleStandardArgs) 28 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS) 29 | MARK_AS_ADVANCED(UHD_LIBRARIES UHD_INCLUDE_DIRS) 30 | 31 | ENDIF(NOT UHD_FOUND) 32 | -------------------------------------------------------------------------------- /cmake/modules/FindbladeRF.cmake: -------------------------------------------------------------------------------- 1 | if(NOT BLADERF_FOUND) 2 | pkg_check_modules (BLADERF_PKG libbladeRF) 3 | find_path(BLADERF_INCLUDE_DIRS NAMES libbladeRF.h 4 | PATHS 5 | ${BLADERF_PKG_INCLUDE_DIRS} 6 | /usr/include 7 | /usr/local/include 8 | ) 9 | 10 | find_library(BLADERF_LIBRARIES NAMES bladeRF 11 | PATHS 12 | ${BLADERF_PKG_LIBRARY_DIRS} 13 | /usr/lib 14 | /usr/local/lib 15 | ) 16 | 17 | if(BLADERF_INCLUDE_DIRS AND BLADERF_LIBRARIES) 18 | CHECK_LIBRARY_EXISTS(bladeRF bladerf_get_board_name BLADERF_LIBRARIES BLADERF_VERSION_OK) 19 | if (BLADERF_VERSION_OK) 20 | set(BLADERF_FOUND TRUE CACHE INTERNAL "libbladeRF found") 21 | message(STATUS "Found libbladeRF: ${BLADERF_INCLUDE_DIRS}, ${BLADERF_LIBRARIES}") 22 | else (BLADERF_VERSION_OK) 23 | set(BLADERF_FOUND FALSE CACHE INTERNAL "libbladeRF found") 24 | message(STATUS "libbladeRF found but not compatible. Upgrade your driver or use SoapySDR.") 25 | endif (BLADERF_VERSION_OK) 26 | else(BLADERF_INCLUDE_DIRS AND BLADERF_LIBRARIES) 27 | set(BLADERF_FOUND FALSE CACHE INTERNAL "libbladeRF found") 28 | message(STATUS "libbladeRF not found.") 29 | endif(BLADERF_INCLUDE_DIRS AND BLADERF_LIBRARIES) 30 | 31 | mark_as_advanced(BLADERF_LIBRARIES BLADERF_INCLUDE_DIRS) 32 | 33 | endif(NOT BLADERF_FOUND) 34 | -------------------------------------------------------------------------------- /external/cmake/cmnalib.CMakeLists.txt.in: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 2.8.2) 3 | 4 | project(cmnalib-download NONE) 5 | 6 | include(ExternalProject) 7 | ExternalProject_Add(cmnalib 8 | GIT_REPOSITORY https://github.com/falkenber9/c-mnalib.git 9 | GIT_TAG v1.0.0 10 | # GIT_TAG develop 11 | SOURCE_DIR "${CMAKE_BINARY_DIR}/cmnalib-src" 12 | BINARY_DIR "${CMAKE_BINARY_DIR}/cmnalib-build" 13 | CONFIGURE_COMMAND "" 14 | BUILD_COMMAND "" 15 | INSTALL_COMMAND "" 16 | TEST_COMMAND "" 17 | ) 18 | -------------------------------------------------------------------------------- /external/cmake/srsLTE.CMakeLists.txt.in: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 2.8.2) 3 | 4 | project(srsLTE-download NONE) 5 | 6 | include(ExternalProject) 7 | ExternalProject_Add(srsLTE 8 | # GIT_REPOSITORY https://github.com/srsLTE/srsLTE.git 9 | GIT_REPOSITORY https://github.com/falkenber9/srsLTE.git 10 | GIT_TAG falcon-dev 11 | # GIT_TAG falcon_v0.1 12 | SOURCE_DIR "${CMAKE_BINARY_DIR}/srsLTE-src" 13 | BINARY_DIR "${CMAKE_BINARY_DIR}/srsLTE-build" 14 | CONFIGURE_COMMAND "" 15 | BUILD_COMMAND "" 16 | INSTALL_COMMAND "" 17 | TEST_COMMAND "" 18 | ) 19 | -------------------------------------------------------------------------------- /gfx/CNI_full+margin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/CNI_full+margin.png -------------------------------------------------------------------------------- /gfx/CNI_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/CNI_full.png -------------------------------------------------------------------------------- /gfx/CNI_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/CNI_small.png -------------------------------------------------------------------------------- /gfx/DFG_full.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/DFG_full.gif -------------------------------------------------------------------------------- /gfx/DFG_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/DFG_small.png -------------------------------------------------------------------------------- /gfx/FALCON_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/FALCON_banner.png -------------------------------------------------------------------------------- /gfx/FALCON_banner_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/FALCON_banner_small.png -------------------------------------------------------------------------------- /gfx/FALCON_header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/FALCON_header.jpg -------------------------------------------------------------------------------- /gfx/FalconEye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/FalconEye.png -------------------------------------------------------------------------------- /gfx/FalconGUI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/FalconGUI.png -------------------------------------------------------------------------------- /gfx/Logo_FALCON_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/Logo_FALCON_button.png -------------------------------------------------------------------------------- /gfx/Logo_FALCON_full_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/Logo_FALCON_full_button.png -------------------------------------------------------------------------------- /gfx/SFB876_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/SFB876_full.png -------------------------------------------------------------------------------- /gfx/SFB876_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/SFB876_small.png -------------------------------------------------------------------------------- /gfx/images.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Logo_FALCON_button.png 4 | Logo_FALCON_full_button.png 5 | FALCON_banner.png 6 | SFB876_full.png 7 | tu-dortmund_full+margin.png 8 | CNI_full+margin.png 9 | 10 | 11 | -------------------------------------------------------------------------------- /gfx/tu-dortmund_full+margin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/tu-dortmund_full+margin.png -------------------------------------------------------------------------------- /gfx/tu-dortmund_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/tu-dortmund_full.png -------------------------------------------------------------------------------- /gfx/tu-dortmund_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/gfx/tu-dortmund_small.png -------------------------------------------------------------------------------- /import/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(qcustomplot) 3 | add_subdirectory(rangewidget) 4 | -------------------------------------------------------------------------------- /import/qcustomplot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCES "*.cpp") 2 | 3 | # Instruct CMake to run moc automatically when needed 4 | set(CMAKE_AUTOMOC ON) 5 | # Create code from a list of Qt designer ui files 6 | set(CMAKE_AUTOUIC ON) 7 | # Find the QtWidgets library 8 | 9 | add_library(qcustomplot STATIC ${SOURCES}) 10 | target_link_libraries(qcustomplot Qt5::Core) 11 | 12 | -------------------------------------------------------------------------------- /import/rangewidget/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SOURCES "*.cpp") 2 | 3 | # Instruct CMake to run moc automatically when needed 4 | set(CMAKE_AUTOMOC ON) 5 | # Create code from a list of Qt designer ui files 6 | set(CMAKE_AUTOUIC ON) 7 | # Find the QtWidgets library 8 | 9 | add_library(rangewidget STATIC ${SOURCES}) 10 | target_link_libraries(rangewidget Qt5::Core Qt5::Widgets Qt5::Gui) 11 | 12 | -------------------------------------------------------------------------------- /import/rangewidget/RangeWidget.h: -------------------------------------------------------------------------------- 1 | #ifndef RANGEWIDGET_H 2 | #define RANGEWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class RangeWidget : public QWidget 10 | { 11 | Q_OBJECT 12 | private: 13 | Q_DISABLE_COPY(RangeWidget) 14 | 15 | Qt::Orientation _orientation; 16 | 17 | int _handleWidth; 18 | int _handleHeight; 19 | 20 | int _minimum; 21 | int _maximum; 22 | 23 | int _firstValue; 24 | int _secondValue; 25 | 26 | bool _firstHandlePressed; 27 | bool _secondHandlePressed; 28 | 29 | bool _firstHandleHovered; 30 | bool _secondHandleHovered; 31 | 32 | QColor _firstHandleColor; 33 | QColor _secondHandleColor; 34 | 35 | protected: 36 | void paintEvent(QPaintEvent* event); 37 | void mousePressEvent(QMouseEvent* event); 38 | void mouseMoveEvent(QMouseEvent* event); 39 | void mouseReleaseEvent(QMouseEvent* event); 40 | 41 | QRectF firstHandleRect() const; 42 | QRectF secondHandleRect() const; 43 | QRectF handleRect(int value) const; 44 | qreal span() const; 45 | 46 | public: 47 | RangeWidget(Qt::Orientation orientation = Qt::Vertical, QWidget *parent = nullptr); 48 | 49 | QSize minimumSizeHint() const; 50 | 51 | inline int firstValue() const { return _firstValue; } 52 | inline int secondValue() const { return _secondValue; } 53 | inline int minimum() const { return _minimum; } 54 | inline int maximum() const { return _maximum; } 55 | inline Qt::Orientation orientation() const { return _orientation; } 56 | inline int interval() const { return secondValue()-firstValue(); } 57 | inline unsigned int absInterval() const { return qAbs(interval()); } 58 | 59 | signals: 60 | void firstValueChanged(int firstValue); 61 | void secondValueChanged(int secondValue); 62 | void rangeChanged(int min, int max); 63 | void sliderPressed(); 64 | void sliderReleased(); 65 | 66 | public slots: 67 | void setFirstValue(int firstValue); 68 | void setSecondValue(int secondValue); 69 | void setMinimum(int min); 70 | void setMaximum(int max); 71 | void setRange(int min, int max); 72 | void setOrientation(Qt::Orientation orientation); 73 | 74 | }; 75 | 76 | #endif // RANGEWIDGET_H 77 | -------------------------------------------------------------------------------- /lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(src) 3 | add_subdirectory(test) 4 | 5 | ######################################################################## 6 | # Install library headers 7 | ######################################################################## 8 | install( DIRECTORY include/ 9 | DESTINATION "${INCLUDE_DIR}" 10 | FILES_MATCHING PATTERN "*.h" ) 11 | 12 | ######################################################################## 13 | # Install libs 14 | ######################################################################## 15 | # nested install targets are not supported by old Cmake on Ubuntu 18 16 | #install( 17 | # TARGETS 18 | # falcon_common 19 | # falcon_meas 20 | # falcon_phy 21 | # falcon_prof 22 | # falcon_util 23 | # ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 24 | # LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 25 | # RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 26 | -------------------------------------------------------------------------------- /lib/include/falcon/common/CSV.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include 25 | 26 | class CSV { 27 | public: 28 | virtual ~CSV() {} 29 | virtual std::string toCSV(const char delim) const = 0; 30 | virtual std::string fromCSV(const std::string& str, const char delim) = 0; 31 | 32 | static std::string splitString(const std::string& str, 33 | const char delim, 34 | std::vector& tokens, 35 | const int nTokens = 0); 36 | }; 37 | -------------------------------------------------------------------------------- /lib/include/falcon/common/FileSink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | // include C-only headers 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | #include "srslte/phy/io/format.h" 33 | #include "srslte/phy/io/filesink.h" 34 | 35 | 36 | #ifdef __cplusplus 37 | } 38 | #undef I // Fix complex.h #define I nastiness when using C++ 39 | #endif 40 | 41 | template 42 | class FileSink { 43 | public: 44 | FileSink(); 45 | FileSink(const FileSink&) = delete; //prevent copy 46 | FileSink& operator=(const FileSink&) = delete; //prevent copy 47 | virtual ~FileSink() { 48 | FileSink::close(); 49 | } 50 | 51 | virtual void open(const std::string& filename) { 52 | char tmp[1024]; /* WTF! srslte_filesink_init takes char*, not const char* ! */ 53 | strncpy(tmp, filename.c_str(), 1024); 54 | srslte_filesink_init(&filesink, tmp, type); 55 | isOpen = true; 56 | } 57 | 58 | virtual void close() { 59 | if(isOpen) { 60 | srslte_filesink_free(&filesink); 61 | isOpen = false; 62 | } 63 | } 64 | virtual size_t write(SampleType* buffer, size_t nSamples) { 65 | return srslte_filesink_write(&filesink, static_cast(buffer), nSamples); 66 | } 67 | 68 | private: 69 | bool isOpen; 70 | srslte_filesink_t filesink; 71 | srslte_datatype_t type; 72 | }; 73 | 74 | -------------------------------------------------------------------------------- /lib/include/falcon/common/Settings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | // general 24 | #define DIRECTION_UPLINK 0 25 | #define DIRECTION_DOWNLINK 1 26 | 27 | // network settings 28 | #define DEFAULT_PROBING_URL_UPLINK "http://129.217.211.19:6137/index.html" 29 | #define DEFAULT_PROBING_URL_DOWNLINK "http://129.217.211.19:6137/testfiles/100MB.bin" 30 | 31 | #define DEFAULT_NETSYNC_PORT 4567 32 | 33 | // probing settings 34 | #define DEFAULT_NOF_SUBFRAMES_TO_CAPTURE 20000 35 | #define DEFAULT_PROBING_DELAY_MS 10000 36 | #define DEFAULT_PROBING_PAYLOAD_SIZE (5*1024*1024) 37 | #define DEFAULT_PROBING_DIRECTION DIRECTION_UPLINK 38 | #define DEFAULT_POLL_INTERVAL_SEC 1 39 | #define DEFAULT_AUTO_INTERVAL_SEC 60 40 | #define DEFAULT_TX_POWER_SAMPLING_INTERVAL_US 250000 41 | 42 | #define DEFAULT_MIB_SEARCH_TIMEOUT_MS 1000 43 | #define DEFAULT_PROBING_TIMEOUT_MS 10000 44 | 45 | // eye settings 46 | #define DEFAULT_NOF_SUBFRAMES_TO_SHOW 0 47 | #define DEFAULT_NOF_PRB 50 48 | #define DEFAULT_NOF_PORTS 2 49 | #define DEFAULT_NOF_RX_ANT 1 50 | 51 | #define DEFAULT_NOF_WORKERS 20 52 | 53 | //#define DEFAULT_DCI_FORMAT_SPLIT_RATIO 1.0 54 | #define DEFAULT_DCI_FORMAT_SPLIT_RATIO 0.99 55 | #define DEFAULT_DCI_FORMAT_SPLIT_UPDATE_INTERVAL_MS 500 56 | #define DEFAULT_RNTI_HISTOGRAM_THRESHOLD 5 57 | 58 | -------------------------------------------------------------------------------- /lib/include/falcon/common/SignalManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | class SignalGate; 26 | 27 | class SignalHandler { 28 | public: 29 | SignalHandler(); 30 | SignalHandler(const SignalHandler&) = delete; //prevent copy 31 | SignalHandler& operator=(const SignalHandler&) = delete; //prevent copy 32 | virtual ~SignalHandler(); 33 | private: 34 | friend class SignalGate; 35 | virtual void handleSignal() = 0; 36 | void registerGate(SignalGate& gate); 37 | void deregisterGate(); 38 | SignalGate* gate; 39 | }; 40 | 41 | class SignalGate { 42 | public: 43 | static SignalGate& getInstance(); 44 | static void signalEntry(int sigNo); 45 | virtual ~SignalGate(); 46 | void init(); 47 | void attach(SignalHandler& handler); 48 | void detach(SignalHandler& handler); 49 | private: 50 | SignalGate(); 51 | SignalGate(const SignalGate&) = delete; //prevent copy 52 | SignalGate& operator=(const SignalGate&) = delete; //prevent copy 53 | void notify(); 54 | static SignalGate* instance; 55 | std::vector handlers; 56 | }; 57 | -------------------------------------------------------------------------------- /lib/include/falcon/common/SubframeBuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include "srslte/srslte.h" 25 | 26 | struct SubframeBuffer { 27 | SubframeBuffer(uint32_t rf_nof_rx_ant); 28 | SubframeBuffer(const SubframeBuffer&) = delete; //prevent copy 29 | SubframeBuffer& operator=(const SubframeBuffer&) = delete; //prevent copy 30 | ~SubframeBuffer(); 31 | const uint32_t rf_nof_rx_ant; 32 | cf_t *sf_buffer[SRSLTE_MAX_PORTS] = {nullptr}; 33 | }; 34 | -------------------------------------------------------------------------------- /lib/include/falcon/common/SystemInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | class SystemInfo { 30 | private: // no instances at all 31 | SystemInfo(); 32 | SystemInfo(const SystemInfo&) = delete; //prevent copy 33 | SystemInfo& operator=(const SystemInfo&) = delete; //prevent copy 34 | public: 35 | virtual ~SystemInfo(); 36 | static size_t getFreeRam(); 37 | static size_t getAvailableRam(); 38 | }; 39 | -------------------------------------------------------------------------------- /lib/include/falcon/common/ThreadSafeQueue.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | template 9 | class ThreadSafeQueue { 10 | public: 11 | ThreadSafeQueue() : 12 | q(), 13 | m(), 14 | c(), 15 | e(), 16 | canceled(false) 17 | { 18 | 19 | } 20 | 21 | ~ThreadSafeQueue() { 22 | e.notify_all(); 23 | } 24 | 25 | void enqueue(std::shared_ptr t) { 26 | std::lock_guard lock(m); 27 | q.push(std::move(t)); 28 | c.notify_one(); 29 | } 30 | 31 | // Waits until an element is available; 32 | // only returns nullptr if queue is canceled 33 | std::shared_ptr dequeue() { 34 | std::unique_lock lock(m); 35 | while(q.empty() && !canceled) { 36 | // release lock as long as waiting; reaquire lock afterwards. 37 | c.wait(lock); 38 | } 39 | 40 | std::shared_ptr result = nullptr; 41 | if(!canceled) { 42 | result = std::move(q.front()); 43 | q.pop(); 44 | e.notify_all(); //notify if anyone waits for empty queue 45 | } 46 | return result; 47 | } 48 | 49 | // Immediately returns an element or nullptr if empty/canceled 50 | std::shared_ptr dequeueImmediate() { 51 | std::unique_lock lock(m); 52 | std::shared_ptr result = nullptr; 53 | if(!q.empty()) { 54 | result = std::move(q.front()); 55 | q.pop(); 56 | e.notify_all(); //notify if anyone waits for empty queue 57 | } 58 | return result; 59 | } 60 | 61 | void cancel() { 62 | std::lock_guard lock(m); 63 | canceled = true; 64 | c.notify_all(); //wake all waiting consumers 65 | } 66 | 67 | bool waitEmpty() { 68 | std::unique_lock lock(m); 69 | while(!q.empty() && !canceled) { 70 | e.wait(lock); 71 | } 72 | return q.empty(); 73 | } 74 | 75 | private: 76 | std::queue> q; 77 | mutable std::mutex m; 78 | std::condition_variable c; 79 | std::condition_variable e; 80 | bool canceled; 81 | }; 82 | 83 | -------------------------------------------------------------------------------- /lib/include/falcon/common/Version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | // Variables autogenerated and compiled by the Version.cmake script 26 | //extern const char* GIT_TAG; 27 | //extern const char* GIT_REV; 28 | //extern const char* GIT_BRANCH; 29 | 30 | //const char* falcon_git_version(void); 31 | //const char* falcon_git_revision(void); 32 | //const char* falcon_git_branch(void); 33 | 34 | class Version { 35 | private: 36 | // Variables autogenerated and compiled by the Version.cmake script 37 | // Check "CurrentVersion.cc" in binary directory 38 | static const std::string GIT_TAG; 39 | static const std::string GIT_DIRTY; 40 | static const std::string GIT_REV; 41 | static const std::string GIT_BRANCH; 42 | public: 43 | static std::string gitTag(); 44 | static std::string gitDirty(); 45 | static std::string gitRevision(); 46 | static std::string gitBranch(); 47 | static std::string gitVersion(); 48 | }; 49 | -------------------------------------------------------------------------------- /lib/include/falcon/definitions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #ifndef DEFINITIONS_H 22 | #define DEFINITIONS_H 23 | 24 | #define SPECTROGRAM_LINE_COUNT 300 25 | #define SPECTROGRAM_LINE_SHOWN 100 26 | #define SPECTROGRAM_LINE_WIDTH 100 27 | 28 | #endif // DEFINITIONS_H 29 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/AuxModemGPS.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "GPS.h" 24 | #include "AuxModem.h" 25 | #include "probe_modem.h" 26 | 27 | class AuxModemGPS : public GPS { 28 | public: 29 | AuxModemGPS(); 30 | AuxModemGPS(const AuxModemGPS&) = delete; //prevent copy 31 | AuxModemGPS& operator=(const AuxModemGPS&) = delete; //prevent copy 32 | virtual ~AuxModemGPS(); 33 | bool init(SierraWirelessAuxModem* modem); 34 | GPSFix getFix(); 35 | private: 36 | SierraWirelessAuxModem* modem; 37 | }; 38 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/BroadcastMaster.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "broadcast_master.h" 24 | #include 25 | 26 | using namespace std; 27 | 28 | class BroadcastMaster { 29 | public: 30 | BroadcastMaster(const string& ip, const uint16_t port); 31 | ~BroadcastMaster(); 32 | bool sendBytes(const char* buf, size_t length); 33 | size_t receiveBytes(char* buf, size_t bufSize); 34 | private: 35 | broadcast_master_t* bmHandle; 36 | }; 37 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/BroadcastSlave.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "broadcast_slave.h" 24 | #include 25 | 26 | using namespace std; 27 | 28 | class BroadcastSlave { 29 | public: 30 | BroadcastSlave(const uint16_t port); 31 | ~BroadcastSlave(); 32 | bool replyBytes(const char* buf, size_t length); 33 | size_t receiveBytes(char* buf, size_t bufSize); 34 | private: 35 | broadcast_slave_t* bsHandle; 36 | }; 37 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/Cancelable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | class Cancelable { 24 | public: 25 | Cancelable(); 26 | Cancelable(const Cancelable&) = delete; //prevent copy 27 | Cancelable& operator=(const Cancelable&) = delete; //prevent copy 28 | virtual ~Cancelable(); 29 | 30 | virtual void cancel() = 0; 31 | }; 32 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/DummyEventHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "TrafficGeneratorEventHandler.h" 24 | 25 | class DummyEventHandler : public TrafficGeneratorEventHandler { 26 | public: 27 | virtual ~DummyEventHandler() {} 28 | 29 | void actionBeforeTransfer(); 30 | void actionDuringTransfer(); 31 | void actionAfterTransfer(); 32 | }; 33 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/GPS.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | struct GPSFix { 26 | double latitude; // canonical representation, e.g. 51.2849584 27 | double longitude; // canonical representation, e.g. -4.6948374 28 | // missing time 29 | // float loc_unc_angle; // degree 30 | // float loc_unc_a; // meter 31 | // float loc_unc_p; // meter 32 | // float hepe; // meter 33 | int altitude; // meter 34 | // float loc_unc_ve; // meter 35 | float heading; // degree 36 | float velocity_h; // meter/sec 37 | float velocity_v; // meter/sec 38 | int is_invalid; // if "Not Available" found in response 39 | GPSFix() : 40 | latitude(0.0), 41 | longitude(0.0), 42 | altitude(0), 43 | heading(0.0), 44 | velocity_h(0.0), 45 | is_invalid(true) 46 | {} 47 | }; 48 | 49 | class GPS { 50 | public: 51 | GPS(); 52 | GPS(const GPS&) = delete; //prevent copy 53 | GPS& operator=(const GPS&) = delete; //prevent copy 54 | virtual ~GPS(); 55 | virtual GPSFix getFix() = 0; 56 | static std::string toCSV(const GPSFix& obj, const std::string& delim); 57 | }; 58 | 59 | class DummyGPS : public GPS { 60 | public: 61 | DummyGPS(); 62 | DummyGPS(const DummyGPS&) = delete; //prevent copy 63 | DummyGPS& operator=(const DummyGPS&) = delete; //prevent copy 64 | ~DummyGPS() override; 65 | virtual GPSFix getFix() override; 66 | }; 67 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/NetsyncController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "falcon/meas/NetsyncMaster.h" 31 | 32 | class NetsyncController { 33 | public: 34 | NetsyncController(); 35 | ~NetsyncController(); 36 | void init(std::shared_ptr netsyncMaster, 37 | uint32_t defaultPollIntervalSec, 38 | uint32_t defaultAutoIntervalSec); 39 | bool parse(std::istream& params); 40 | private: 41 | void showHelp(); 42 | void unknownToken(const std::string token); 43 | void parsePoll(std::istream& params); 44 | void parseAuto(std::istream ¶ms); 45 | void parseStart(std::istream& params); 46 | static void* pollStart(void* obj); 47 | static void* autoStart(void* obj); 48 | void pollFunc(); 49 | void autoFunc(); 50 | string getTimestampString(); 51 | 52 | std::shared_ptr netsyncMaster; 53 | uint32_t defaultPollIntervalSec; 54 | uint32_t defaultAutoIntervalSec; 55 | uint32_t autoIntervalSec; 56 | pthread_t pollThread; 57 | pthread_t autoThread; 58 | volatile bool cancelPollThread; 59 | volatile bool cancelAutoThread; 60 | volatile bool pollThreadActive; 61 | volatile bool autoThreadActive; 62 | }; 63 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/NetsyncMaster.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "falcon/meas/NetsyncCommon.h" 24 | #include "falcon/meas/NetsyncReceiverBase.h" 25 | #include "falcon/meas/BroadcastMaster.h" 26 | 27 | #include "falcon/meas/GPS.h" 28 | 29 | 30 | class NetsyncMaster : public NetsyncReceiverBase { 31 | public: 32 | NetsyncMaster(const string& ip, const uint16_t port); 33 | ~NetsyncMaster(); 34 | void init(uint32_t nofSubframes, 35 | uint32_t offsetSubframes, 36 | size_t payloadSize, 37 | const string& urlUL, 38 | const string& urlDL, 39 | GPS* gps, 40 | uint32_t txPowerSamplingInterval); 41 | void start(const string& id, uint32_t direction); 42 | void stop(); 43 | void poll(); 44 | void location(); 45 | protected: 46 | void handle(NetsyncMessageText msg); 47 | private: 48 | void receive(); 49 | BroadcastMaster broadcastMaster; 50 | uint32_t nofSubframes; 51 | uint32_t offsetSubframes; 52 | size_t payloadSize; 53 | string urlUL; 54 | string urlDL; 55 | GPS* gps; 56 | uint32_t txPowerSamplingInterval; 57 | }; 58 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/NetsyncReceiverBase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "NetsyncCommon.h" 24 | #include 25 | #include 26 | 27 | class NetsyncReceiverBase { 28 | public: 29 | NetsyncReceiverBase(); 30 | virtual ~NetsyncReceiverBase(); 31 | void parse(const char* msg, size_t len); 32 | void launchReceiver(); 33 | protected: 34 | virtual void handle(NetsyncMessageStart msg); 35 | virtual void handle(NetsyncMessageStop msg); 36 | virtual void handle(NetsyncMessagePoll msg); 37 | virtual void handle(NetsyncMessageText msg); 38 | private: 39 | virtual void receive() = 0; 40 | static void* receiveStart(void* obj); 41 | 42 | pthread_t recvThread; 43 | 44 | protected: 45 | char* recvThreadBuf; 46 | size_t recvThreadBufSize; 47 | volatile bool cancelThread; 48 | }; 49 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/TrafficGenerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include 25 | #include "probe_modem.h" 26 | #include "falcon/common/CSV.h" 27 | 28 | #include "TrafficGeneratorEventHandler.h" 29 | 30 | class ProbeResult : public probe_result_t, public CSV { 31 | public: 32 | ProbeResult() : delimiter(",") {} 33 | void setDelimiter(const std::string dlm) { delimiter = dlm; } 34 | std::string toCSV(const char delim) const override; 35 | std::string fromCSV(const std::string& str, const char delim) override; 36 | private: 37 | std::string delimiter; 38 | friend std::ostream& operator<<(std::ostream &os, const ProbeResult& obj); 39 | }; 40 | 41 | class TrafficGenerator { 42 | public: 43 | TrafficGenerator(); 44 | TrafficGenerator(const TrafficGenerator&) = delete; //prevent copy 45 | TrafficGenerator& operator=(const TrafficGenerator&) = delete; //prevent copy 46 | virtual ~TrafficGenerator(); 47 | ProbeResult getStatus(); 48 | bool isBusy(); 49 | bool cleanup(); 50 | bool performUpload(size_t uploadSize, const std::string& url); 51 | bool performDownload(size_t maxDownloadSize, const std::string& url); 52 | void cancel(); 53 | 54 | bool setEventHandler(TrafficGeneratorEventHandler* handler); 55 | private: 56 | datatransfer_thread_t* hTransfer; 57 | TrafficGeneratorEventHandler* eventHandler; 58 | }; 59 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/TrafficGeneratorEventHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "probe_modem.h" 24 | 25 | class TrafficGeneratorEventHandler { 26 | public: 27 | virtual ~TrafficGeneratorEventHandler() {} 28 | 29 | virtual void actionBeforeTransfer() = 0; 30 | virtual void actionDuringTransfer() = 0; 31 | virtual void actionAfterTransfer() = 0; 32 | 33 | }; 34 | 35 | extern "C" void traffic_generator_action_before_transfer(void* obj); 36 | extern "C" void traffic_generator_action_during_transfer(void* obj); 37 | extern "C" void traffic_generator_action_after_transfer(void* obj); 38 | 39 | extern const probe_event_handlers_t ev_funcs_default; 40 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/broadcast_master.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #include 28 | 29 | typedef struct { 30 | int fd; 31 | struct sockaddr_in recv_addr; 32 | struct sockaddr_in send_addr; 33 | } broadcast_master_t; 34 | 35 | broadcast_master_t* broadcast_master_init(const char ip[], uint16_t port); 36 | void broadcast_master_destroy(broadcast_master_t* h); 37 | size_t broadcast_master_receive(broadcast_master_t* h, char *msg, size_t len); 38 | int32_t broadcast_master_send(broadcast_master_t* h, const char* msg, size_t len); 39 | 40 | 41 | int init_example(int argc, char* argv[]); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /lib/include/falcon/meas/broadcast_slave.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #include 28 | 29 | typedef struct { 30 | int fd; 31 | int send_ready; 32 | struct sockaddr_in recv_addr; 33 | struct sockaddr_in send_addr; 34 | } broadcast_slave_t; 35 | 36 | broadcast_slave_t* broadcast_slave_init(uint16_t port); 37 | void broadcast_slave_destroy(broadcast_slave_t* h); 38 | size_t broadcast_slave_receive(broadcast_slave_t* h, char *msg, size_t len); 39 | int32_t broadcast_slave_reply(broadcast_slave_t* h, const char* msg, size_t len); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | -------------------------------------------------------------------------------- /lib/include/falcon/phy/common/falcon_phy_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | 22 | #pragma once 23 | 24 | #define FALCON_ILLEGAL_RNTI 0x0000 25 | #define FALCON_UNSET_RNTI 0x0000 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | -------------------------------------------------------------------------------- /lib/include/falcon/phy/falcon_phch/DCIFormats.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //#include 4 | //#include "falcon/phy/falcon_phch/falcon_dci.h" 5 | 6 | //// remove in future version 7 | //struct srslte_dl_sf_cfg_t; 8 | //struct srslte_dci_cfg_t; 9 | 10 | //class DCIFormat { 11 | //public: 12 | // DCIFormat(srslte_cell_t* cell, 13 | // srslte_dl_sf_cfg_t* sf, 14 | // srslte_dci_cfg_t* cfg, 15 | // srslte_dci_format_t format, 16 | // uint32_t globalIndex); 17 | // virtual ~DCIFormat(); 18 | // uint32_t getSize() const { return size; } 19 | // srslte_dci_format_t getFormat() const { return format; } 20 | // uint32_t getGlobalIndex() const { return globalIndex; } 21 | 22 | //private: 23 | // srslte_dci_format_t format; 24 | // uint32_t globalIndex; 25 | // uint32_t size; 26 | 27 | //}; 28 | 29 | //class AbstractDCIFormatSet { 30 | //public: 31 | // AbstractDCIFormatSet(); 32 | // virtual ~AbstractDCIFormatSet(); 33 | // virtual size_t getNumberOfFormats() const = 0; 34 | // virtual std::vector const& getFormats() const = 0; 35 | //}; 36 | 37 | //class StaticDCIFormatSubset : public AbstractDCIFormatSet { 38 | //public: 39 | // StaticDCIFormatSubset(const std::vector selectionMask); 40 | //private: 41 | // std::vector formatVec; 42 | //}; 43 | 44 | //class StaticDCIFormatSet : public AbstractDCIFormatSet { 45 | //public: 46 | // StaticDCIFormatSet(const srslte_dci_format_t* formats, size_t nof_formats); 47 | // virtual ~StaticDCIFormatSet(); 48 | // StaticDCIFormatSubset getPrimarySubset(); 49 | // StaticDCIFormatSubset getSecondarySubset(); 50 | //private: 51 | // std::vector formatVec; 52 | //}; 53 | -------------------------------------------------------------------------------- /lib/include/falcon/phy/falcon_rf/rf_imp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "srslte/srslte.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #include "srslte/phy/rf/rf.h" 30 | 31 | int srslte_rf_kill_gain_thread(srslte_rf_t *rf); 32 | int falcon_rf_recv_wrapper(void *h, cf_t *data[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t *t); 33 | double falcon_rf_set_rx_gain_th_wrapper(void *h, double f); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | -------------------------------------------------------------------------------- /lib/include/falcon/phy/falcon_ue/BufferPool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "falcon/common/ThreadSafeQueue.h" 4 | #include "falcon/common/SubframeBuffer.h" 5 | 6 | class BufferPool { 7 | 8 | private: 9 | ThreadSafeQueue avail; 10 | ThreadSafeQueue pending; 11 | 12 | public: 13 | BufferPool(uint32_t rf_nof_rx_ant, uint32_t nof_buffers); 14 | ~BufferPool(); 15 | std::shared_ptr getAvail(); 16 | void putAvail(std::shared_ptr); 17 | std::shared_ptr getPending(); 18 | void putPending(std::shared_ptr); 19 | }; 20 | -------------------------------------------------------------------------------- /lib/include/falcon/prof/Lifetime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "Stopwatch.h" 24 | 25 | class Lifetime; 26 | 27 | class LifetimeCollector { 28 | public: 29 | virtual void collect(Lifetime& lt) = 0; 30 | virtual ~LifetimeCollector(); 31 | }; 32 | 33 | class Lifetime { 34 | public: 35 | Lifetime(LifetimeCollector& collector, const std::string& prefixText = ""); 36 | Lifetime(const Lifetime&) = delete; 37 | Lifetime& operator=(const Lifetime&) = delete; 38 | virtual ~Lifetime(); 39 | timeval getLifetime(); 40 | std::string getLifetimeString(); 41 | const std::string& getPrefixText() const; 42 | void setPrefixText(const std::string& prefixText); 43 | private: 44 | LifetimeCollector& collector; 45 | Stopwatch stopwatch; 46 | std::string prefixText; 47 | }; 48 | 49 | class PrintLifetime : public Lifetime { 50 | public: 51 | PrintLifetime(const std::string& prefixText = ""); 52 | PrintLifetime(const PrintLifetime&) = delete; 53 | PrintLifetime& operator=(const PrintLifetime&) = delete; 54 | ~PrintLifetime() override; 55 | }; 56 | 57 | class GlobalLifetimePrinter : public LifetimeCollector { 58 | public: 59 | static GlobalLifetimePrinter& getInstance(); 60 | void collect(Lifetime& lt) override; 61 | private: 62 | GlobalLifetimePrinter(); 63 | static GlobalLifetimePrinter* instance; 64 | }; 65 | -------------------------------------------------------------------------------- /lib/include/falcon/prof/Stopwatch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | class Stopwatch { 28 | public: 29 | Stopwatch(); 30 | Stopwatch(const Stopwatch&) = delete; 31 | Stopwatch& operator=(const Stopwatch&) = delete; 32 | ~Stopwatch() {} 33 | void start(); 34 | timeval getAndRestart(); 35 | timeval getAndContinue() const; 36 | static std::string toString(timeval t); 37 | static timeval subtract(const timeval& subtrahend, const timeval& minuend); 38 | private: 39 | timeval timeStart; 40 | static void zero(timeval& t); 41 | }; 42 | 43 | timeval operator-(const timeval& left, const timeval& right); 44 | bool operator==(const timeval& left, const timeval& right); 45 | bool operator<(const timeval& left, const timeval& right); 46 | -------------------------------------------------------------------------------- /lib/include/falcon/util/Histogram.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include 25 | 26 | class Histogram { 27 | public: 28 | Histogram(uint32_t itemCount, uint32_t valueRange); 29 | //Histogram(const Histogram& other); 30 | virtual ~Histogram(); 31 | virtual void add(uint16_t item); 32 | virtual void add(uint16_t item, uint32_t nTimes); 33 | virtual uint32_t getFrequency(uint16_t item) const; 34 | virtual const uint32_t* getFrequencyAll() const; 35 | virtual bool ready() const; 36 | virtual uint32_t getItemCount() const; 37 | virtual uint32_t getValueRange() const; 38 | private: 39 | //void initBuffers(); 40 | std::vector rnti_histogram; // the actual histogram 41 | std::vector rnti_history; // circular buffer of the recent seen RNTIs 42 | uint32_t rnti_history_current; // index to current head/(=foot) of rnti_history 43 | uint32_t rnti_history_end; // index to highest index in history array 44 | //int rnti_history_active_users; // number of currently active RNTIs 45 | bool rnti_histogram_ready; // ready-indicator, if history is filled 46 | uint32_t itemCount; 47 | uint32_t valueRange; 48 | }; 49 | -------------------------------------------------------------------------------- /lib/include/falcon/util/Interval.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #ifndef INTERVAL_H 22 | #define INTERVAL_H 23 | 24 | #include 25 | 26 | class Interval { 27 | public: 28 | Interval(uint16_t start_end); 29 | Interval(uint16_t start, uint16_t end); 30 | bool matches(uint16_t value) const; 31 | private: 32 | uint16_t start; 33 | uint16_t end; 34 | }; 35 | 36 | #endif // INTERVAL_H 37 | -------------------------------------------------------------------------------- /lib/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(common) 3 | add_subdirectory(prof) 4 | add_subdirectory(meas) 5 | add_subdirectory(phy) 6 | add_subdirectory(util) 7 | -------------------------------------------------------------------------------- /lib/src/common/BufferedFileSink.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/common/BufferedFileSink.h" 22 | 23 | // Header-only 24 | -------------------------------------------------------------------------------- /lib/src/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # virtual target which is always treated as out-of-date on each build 3 | # Note: a recompilation of depending targets is only triggered, if 4 | # "CurrentVersion.cc" is actually changed by the script "Version.cmake". 5 | # This happens only if the repos state has actually changed: 6 | # - 7 | add_custom_target(check_git 8 | ALL 9 | BYPRODUCTS 10 | ${CMAKE_CURRENT_BINARY_DIR}/CurrentVersion.cc 11 | COMMENT "Checking version information an state of the git repository" 12 | COMMAND 13 | ${CMAKE_COMMAND} 14 | -DTHE_SOURCE_DIR=${CMAKE_SOURCE_DIR} 15 | -P ${CMAKE_CURRENT_SOURCE_DIR}/Version.cmake 16 | ) 17 | 18 | file(GLOB SOURCES "*.cc" "*.c") 19 | add_library(falcon_common STATIC ${SOURCES} "${CMAKE_CURRENT_BINARY_DIR}/CurrentVersion.cc") 20 | add_dependencies(falcon_common check_git) 21 | target_compile_options(falcon_common PUBLIC $<$:-std=c++11>) 22 | install( 23 | TARGETS falcon_common 24 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 25 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 26 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 27 | -------------------------------------------------------------------------------- /lib/src/common/CSV.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/common/CSV.h" 22 | 23 | #include 24 | 25 | using namespace std; 26 | 27 | string CSV::splitString(const string& str, 28 | const char delim, 29 | vector& tokens, 30 | const int nTokens) 31 | { 32 | stringstream src(str); 33 | string value; 34 | int i = 0; 35 | 36 | //nTokens = 0: read until end... 37 | while((i < nTokens || nTokens == 0) && getline(src, value, delim)) { 38 | tokens.push_back(value); 39 | i++; 40 | } 41 | 42 | string rest; 43 | getline(src, rest); 44 | return rest; 45 | } 46 | -------------------------------------------------------------------------------- /lib/src/common/FileSink.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/common/FileSink.h" 22 | 23 | template <> 24 | FileSink::FileSink() : isOpen(false), type(SRSLTE_FLOAT_BIN) { } 25 | 26 | template <> 27 | FileSink<_Complex float>::FileSink() : isOpen(false), type(SRSLTE_COMPLEX_FLOAT_BIN) { } 28 | -------------------------------------------------------------------------------- /lib/src/common/SubframeBuffer.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/common/SubframeBuffer.h" 22 | 23 | SubframeBuffer::SubframeBuffer(uint32_t rf_nof_rx_ant) : rf_nof_rx_ant(rf_nof_rx_ant) { 24 | for (uint32_t i = 0; i < rf_nof_rx_ant; i++) { 25 | sf_buffer[i] = static_cast(srslte_vec_malloc(3*static_cast(sizeof(cf_t))*static_cast(SRSLTE_SF_LEN_PRB(100)))); 26 | } 27 | } 28 | 29 | SubframeBuffer::~SubframeBuffer() { 30 | for (uint32_t i = 0; i < rf_nof_rx_ant; i++) { 31 | free(sf_buffer[i]); 32 | sf_buffer[i] = nullptr; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/src/common/SystemInfo.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/common/SystemInfo.h" 22 | 23 | SystemInfo::SystemInfo() {} 24 | 25 | SystemInfo::~SystemInfo() {} 26 | 27 | size_t SystemInfo::getFreeRam() { 28 | size_t mem = 0; 29 | struct sysinfo sysInfo; 30 | int ret = sysinfo(&sysInfo); 31 | if(ret == 0) { 32 | mem = sysInfo.freeram; 33 | } 34 | return mem; 35 | } 36 | 37 | size_t SystemInfo::getAvailableRam() { 38 | size_t mem = 0; 39 | std::string token; 40 | std::ifstream infoFile("/proc/meminfo"); 41 | while(infoFile >> token) { 42 | if(token == "MemAvailable:") { 43 | if(infoFile >> mem) { 44 | // file reports in unit kB 45 | mem *= 1024; 46 | } 47 | } 48 | } 49 | return mem; 50 | } 51 | -------------------------------------------------------------------------------- /lib/src/common/Version.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/common/Version.h" 22 | 23 | 24 | std::string Version::gitTag() { 25 | return GIT_TAG; 26 | } 27 | 28 | std::string Version::gitDirty() { 29 | return GIT_DIRTY; 30 | } 31 | 32 | std::string Version::gitRevision() { 33 | return GIT_REV; 34 | } 35 | 36 | std::string Version::gitBranch() { 37 | return GIT_BRANCH; 38 | } 39 | 40 | std::string Version::gitVersion() { 41 | std::string result; 42 | if(GIT_REV != "N/A") { 43 | if(GIT_TAG != "") { 44 | result += GIT_TAG; 45 | } 46 | else { 47 | result += GIT_REV; 48 | } 49 | result += GIT_DIRTY; 50 | result += " on branch " + GIT_BRANCH; 51 | } 52 | else { 53 | result += "N/A"; 54 | } 55 | return result; 56 | } 57 | -------------------------------------------------------------------------------- /lib/src/common/Version.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Cmake script to generate/update version strings during compilation 3 | # to reflect the state of the git repository (tag, branch, commit, modifications) 4 | 5 | # Example call for this script from cmake: 6 | # cmake -DTHE_SOURCE_DIR=${CMAKE_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/Version.cmake 7 | 8 | execute_process( 9 | COMMAND git log --pretty=format:'%h' -n 1 10 | WORKING_DIRECTORY ${THE_SOURCE_DIR} 11 | OUTPUT_VARIABLE GIT_REV 12 | OUTPUT_STRIP_TRAILING_WHITESPACE 13 | ERROR_QUIET 14 | ) 15 | 16 | # Check if git version info is available or 17 | # if the source was downloaded as zip without git. 18 | if ("${GIT_REV}" STREQUAL "") 19 | set(GIT_REV "N/A") 20 | set(GIT_DIRTY "") 21 | set(GIT_TAG "N/A") 22 | set(GIT_BRANCH "N/A") 23 | else() 24 | execute_process( 25 | COMMAND bash -c "git diff --quiet --exit-code || echo +" 26 | WORKING_DIRECTORY ${THE_SOURCE_DIR} 27 | OUTPUT_VARIABLE GIT_DIRTY 28 | OUTPUT_STRIP_TRAILING_WHITESPACE 29 | ERROR_QUIET 30 | ) 31 | execute_process( 32 | COMMAND git describe --exact-match --tags 33 | WORKING_DIRECTORY ${THE_SOURCE_DIR} 34 | OUTPUT_VARIABLE GIT_TAG 35 | OUTPUT_STRIP_TRAILING_WHITESPACE 36 | ERROR_QUIET 37 | ) 38 | execute_process( 39 | COMMAND git rev-parse --abbrev-ref HEAD 40 | WORKING_DIRECTORY ${THE_SOURCE_DIR} 41 | OUTPUT_VARIABLE GIT_BRANCH 42 | OUTPUT_STRIP_TRAILING_WHITESPACE 43 | ERROR_QUIET 44 | ) 45 | 46 | string(SUBSTRING "${GIT_REV}" 1 7 GIT_REV) 47 | endif() 48 | 49 | # Generate a C++ file with version strings 50 | set(VERSION 51 | " 52 | #include \"falcon/common/Version.h\" 53 | 54 | const std::string Version::GIT_REV=\"${GIT_REV}\"; 55 | const std::string Version::GIT_DIRTY=\"${GIT_DIRTY}\"; 56 | const std::string Version::GIT_TAG=\"${GIT_TAG}\"; 57 | const std::string Version::GIT_BRANCH=\"${GIT_BRANCH}\"; 58 | " 59 | ) 60 | 61 | if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CurrentVersion.cc") 62 | file(READ "${CMAKE_CURRENT_SOURCE_DIR}/CurrentVersion.cc" VERSION_PREV) 63 | else() 64 | set(VERSION_PREV "--EMPTY--") 65 | endif() 66 | 67 | if (NOT "${VERSION}" STREQUAL "${VERSION_PREV}") 68 | message("Updating CurrentVersion.cc") 69 | file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/CurrentVersion.cc" "${VERSION}") 70 | else() 71 | message("CurrentVersion.cc is already up to date") 72 | endif() 73 | -------------------------------------------------------------------------------- /lib/src/meas/AuxModemGPS.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/meas/AuxModemGPS.h" 22 | 23 | AuxModemGPS::AuxModemGPS() { 24 | modem = nullptr; 25 | } 26 | 27 | AuxModemGPS::~AuxModemGPS() { 28 | 29 | } 30 | 31 | bool AuxModemGPS::init(SierraWirelessAuxModem* modem) { 32 | this->modem = modem; 33 | if(modem == nullptr) return false; 34 | if(modem->getModemHandle() == nullptr) return false; 35 | 36 | if(start_gps(modem->getModemHandle()) != 0) return false; 37 | 38 | return true; 39 | } 40 | 41 | GPSFix AuxModemGPS::getFix() { 42 | GPSFix result; 43 | result.is_invalid = true; 44 | modem_t* hModem = modem->getModemHandle(); 45 | sw_em7565_gpsloc_response_t location; 46 | if(0 == get_gps_fix(hModem, &location)) { 47 | result.latitude = location.latitude; 48 | result.longitude = location.longitude; 49 | result.altitude = location.altitude; 50 | result.heading = location.heading; 51 | result.velocity_h = location.velocity_h; 52 | result.velocity_v = location.velocity_v; 53 | result.is_invalid = location.is_invalid; 54 | } 55 | 56 | return result; 57 | } 58 | -------------------------------------------------------------------------------- /lib/src/meas/BroadcastMaster.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/meas/BroadcastMaster.h" 22 | 23 | BroadcastMaster::BroadcastMaster(const string& ip, const uint16_t port) : 24 | bmHandle(nullptr) 25 | { 26 | bmHandle = broadcast_master_init(ip.c_str(), port); 27 | } 28 | 29 | BroadcastMaster::~BroadcastMaster() { 30 | broadcast_master_destroy(bmHandle); 31 | } 32 | 33 | bool BroadcastMaster::sendBytes(const char *buf, size_t length) { 34 | return broadcast_master_send(bmHandle, buf, length) == 0; 35 | } 36 | 37 | size_t BroadcastMaster::receiveBytes(char *buf, size_t bufSize) { 38 | return broadcast_master_receive(bmHandle, buf, bufSize); 39 | } 40 | -------------------------------------------------------------------------------- /lib/src/meas/BroadcastSlave.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/meas/BroadcastSlave.h" 22 | 23 | BroadcastSlave::BroadcastSlave(const uint16_t port) : 24 | bsHandle(nullptr) 25 | { 26 | bsHandle = broadcast_slave_init(port); 27 | } 28 | 29 | BroadcastSlave::~BroadcastSlave() { 30 | broadcast_slave_destroy(bsHandle); 31 | } 32 | 33 | bool BroadcastSlave::replyBytes(const char *buf, size_t length) { 34 | return broadcast_slave_reply(bsHandle, buf, length) == 0; 35 | } 36 | 37 | size_t BroadcastSlave::receiveBytes(char *buf, size_t bufSize) { 38 | return broadcast_slave_receive(bsHandle, buf, bufSize); 39 | } 40 | -------------------------------------------------------------------------------- /lib/src/meas/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.cc" "*.c") 3 | add_library(falcon_meas STATIC ${SOURCES}) 4 | target_compile_options(falcon_meas PUBLIC $<$:-std=c++11>) 5 | 6 | target_link_libraries(falcon_meas 7 | falcon_common 8 | falcon_prof 9 | pthread 10 | ${CMNALIB_LIBRARIES} 11 | ${SRSLTE_LIBRARIES}) 12 | install( 13 | TARGETS falcon_meas 14 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 15 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 16 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 17 | -------------------------------------------------------------------------------- /lib/src/meas/Cancelable.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/meas/Cancelable.h" 22 | 23 | Cancelable::Cancelable() {} 24 | Cancelable::~Cancelable() {} 25 | -------------------------------------------------------------------------------- /lib/src/meas/DummyEventHandler.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/meas/DummyEventHandler.h" 22 | 23 | #include 24 | 25 | using namespace std; 26 | 27 | void DummyEventHandler::actionBeforeTransfer() { 28 | cout << "DummyEventHandler: actionBeforeTransfer()" << endl; 29 | } 30 | 31 | void DummyEventHandler::actionDuringTransfer() { 32 | cout << "DummyEventHandler: actionDuringTransfer()" << endl; 33 | } 34 | 35 | void DummyEventHandler::actionAfterTransfer() { 36 | cout << "DummyEventHandler: actionAfterTransfer()" << endl; 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/meas/GPS.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/meas/GPS.h" 22 | 23 | #include 24 | 25 | using namespace std; 26 | 27 | GPS::GPS() { 28 | 29 | } 30 | 31 | GPS::~GPS() { 32 | 33 | } 34 | 35 | string GPS::toCSV(const GPSFix& obj, const string& delim) { 36 | stringstream stream; 37 | stream << obj.latitude << delim; 38 | stream << obj.longitude; 39 | // maybe other members, too 40 | 41 | return stream.str(); 42 | } 43 | 44 | 45 | DummyGPS::DummyGPS() { 46 | 47 | } 48 | 49 | DummyGPS::~DummyGPS() { 50 | 51 | } 52 | 53 | GPSFix DummyGPS::getFix() { 54 | GPSFix result; 55 | result.is_invalid = true; 56 | return result; 57 | } 58 | -------------------------------------------------------------------------------- /lib/src/meas/TrafficGeneratorEventHandler.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/meas/TrafficGeneratorEventHandler.h" 22 | 23 | using namespace std; 24 | 25 | void traffic_generator_action_before_transfer(void* obj) { 26 | if(obj) static_cast(obj)->actionBeforeTransfer(); 27 | } 28 | 29 | void traffic_generator_action_during_transfer(void* obj) { 30 | if(obj) static_cast(obj)->actionDuringTransfer(); 31 | } 32 | 33 | void traffic_generator_action_after_transfer(void* obj) { 34 | if(obj) static_cast(obj)->actionAfterTransfer(); 35 | } 36 | 37 | const probe_event_handlers_t ev_funcs_default { 38 | traffic_generator_action_before_transfer, 39 | traffic_generator_action_during_transfer, 40 | traffic_generator_action_after_transfer 41 | }; 42 | -------------------------------------------------------------------------------- /lib/src/phy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(falcon_rf) 3 | add_subdirectory(falcon_ue) 4 | add_subdirectory(falcon_phch) 5 | 6 | set(falcon_objs 7 | $ 8 | $ 9 | $ 10 | ) 11 | 12 | add_library(falcon_phy STATIC ${falcon_objs}) 13 | target_link_libraries(falcon_phy 14 | ${SRSLTE_LIBRARIES} 15 | ${FFT_LIBRARIES} 16 | pthread 17 | ${Boost_LIBRARIES}) 18 | install( 19 | TARGETS falcon_phy 20 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 21 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 22 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 23 | -------------------------------------------------------------------------------- /lib/src/phy/falcon_phch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.c") 3 | add_library(falcon_phch OBJECT ${SOURCES}) 4 | -------------------------------------------------------------------------------- /lib/src/phy/falcon_phch/DCIFormats.cc: -------------------------------------------------------------------------------- 1 | #include "falcon/phy/falcon_phch/DCIFormats.h" 2 | 3 | //DCIFormat::DCIFormat(srslte_cell_t* cell, 4 | // srslte_dl_sf_cfg_t* sf, 5 | // srslte_dci_cfg_t* cfg, 6 | // srslte_dci_format_t format, uint32_t globalIndex) : 7 | // format(format), 8 | // globalIndex(globalIndex) 9 | //{ 10 | // size = srslte_dci_format_sizeof(format, cell->nof_prb, cell->nof_ports); 11 | // // future version 12 | // //size = srslte_dci_format_sizeof(cell, sf, cfg, format); 13 | //} 14 | 15 | //DCIFormat::~DCIFormat() {} 16 | -------------------------------------------------------------------------------- /lib/src/phy/falcon_rf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.c") 3 | add_library(falcon_rf OBJECT ${SOURCES}) 4 | -------------------------------------------------------------------------------- /lib/src/phy/falcon_rf/rf_imp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/phy/falcon_rf/rf_imp.h" 22 | 23 | #include 24 | #include 25 | 26 | int srslte_rf_kill_gain_thread(srslte_rf_t *rf) { 27 | if(rf->thread_gain) { 28 | if(!pthread_kill(rf->thread_gain, 0)) { 29 | pthread_cancel(rf->thread_gain); 30 | pthread_join(rf->thread_gain, NULL); 31 | } 32 | rf->thread_gain = 0; 33 | } 34 | return 0; 35 | } 36 | 37 | int falcon_rf_recv_wrapper(void *h, cf_t *data[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t *t) { 38 | (void)t; //unused 39 | DEBUG(" ---- Receive %d samples ---- \n", nsamples); 40 | void *ptr[SRSLTE_MAX_PORTS]; 41 | for (int i=0;i(new SubframeBuffer(rf_nof_rx_ant))); 6 | } 7 | } 8 | 9 | BufferPool::~BufferPool() { 10 | //please make sure, this object gets destroyed after all buffers have been returned to any queue 11 | 12 | // wake waiting consumers - give them nullptr 13 | avail.cancel(); 14 | pending.cancel(); 15 | 16 | // cleanup 17 | std::shared_ptr buffer = nullptr; 18 | do { 19 | buffer = avail.dequeueImmediate(); 20 | } while(buffer != nullptr); 21 | do { 22 | buffer = pending.dequeueImmediate(); 23 | } while(buffer != nullptr); 24 | } 25 | 26 | std::shared_ptr BufferPool::getAvail() { 27 | return avail.dequeue(); 28 | } 29 | 30 | void BufferPool::putAvail(std::shared_ptr buffer) { 31 | avail.enqueue(std::move(buffer)); 32 | } 33 | 34 | std::shared_ptr BufferPool::getPending() { 35 | return pending.dequeue(); 36 | } 37 | 38 | void BufferPool::putPending(std::shared_ptr buffer) { 39 | pending.enqueue(std::move(buffer)); 40 | } 41 | -------------------------------------------------------------------------------- /lib/src/phy/falcon_ue/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.c" "*.cc") 3 | add_library(falcon_ue OBJECT ${SOURCES}) 4 | 5 | if(DEFINED MAX_RECURSION_DEPTH) 6 | target_compile_definitions(falcon_ue PRIVATE -DMAX_RECURSION_DEPTH=${MAX_RECURSION_DEPTH}) 7 | endif() 8 | if(DEFINED DCI_DISAMBIGUATION_DEPTH) 9 | target_compile_definitions(falcon_ue PRIVATE -DDCI_DISAMBIGUATION_DEPTH=${DCI_DISAMBIGUATION_DEPTH}) 10 | endif() 11 | -------------------------------------------------------------------------------- /lib/src/prof/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.cc" "*.c") 3 | add_library(falcon_prof STATIC ${SOURCES}) 4 | target_compile_options(falcon_prof PUBLIC $<$:-std=c++11>) 5 | install( 6 | TARGETS falcon_prof 7 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 8 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 9 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 10 | -------------------------------------------------------------------------------- /lib/src/prof/Lifetime.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/prof/Lifetime.h" 22 | 23 | #include 24 | 25 | using namespace std; 26 | 27 | Lifetime::Lifetime(LifetimeCollector& collector, const string& prefixText) : 28 | collector(collector), 29 | prefixText(prefixText) 30 | { 31 | stopwatch.start(); 32 | } 33 | 34 | Lifetime::~Lifetime() { 35 | collector.collect(*this); 36 | } 37 | 38 | timeval Lifetime::getLifetime() { 39 | return stopwatch.getAndContinue(); 40 | } 41 | 42 | string Lifetime::getLifetimeString() { 43 | return Stopwatch::toString(getLifetime()); 44 | } 45 | 46 | const string& Lifetime::getPrefixText() const { 47 | return prefixText; 48 | } 49 | 50 | void Lifetime::setPrefixText(const string& prefixText) { 51 | this->prefixText = prefixText; 52 | } 53 | 54 | LifetimeCollector::~LifetimeCollector() { 55 | //nothing 56 | } 57 | 58 | GlobalLifetimePrinter* GlobalLifetimePrinter::instance = nullptr; 59 | GlobalLifetimePrinter& GlobalLifetimePrinter::getInstance() { 60 | if(instance == nullptr) { 61 | instance = new GlobalLifetimePrinter(); 62 | } 63 | return *instance; 64 | } 65 | 66 | void GlobalLifetimePrinter::collect(Lifetime& lt) { 67 | cout << lt.getPrefixText() << lt.getLifetimeString() << endl; 68 | } 69 | 70 | GlobalLifetimePrinter::GlobalLifetimePrinter() { 71 | //nothing 72 | } 73 | 74 | PrintLifetime::PrintLifetime(const string& prefixText) : 75 | Lifetime(GlobalLifetimePrinter::getInstance(), prefixText) 76 | { 77 | //nothing 78 | } 79 | 80 | PrintLifetime::~PrintLifetime() { 81 | //work is done by virtual base-class destructor 82 | } 83 | -------------------------------------------------------------------------------- /lib/src/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.cc") 3 | add_library(falcon_util STATIC ${SOURCES}) 4 | target_compile_options(falcon_util PUBLIC $<$:-std=c++11>) 5 | install( 6 | TARGETS falcon_util 7 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 8 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 9 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 10 | -------------------------------------------------------------------------------- /lib/src/util/Interval.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "Interval.h" 22 | 23 | Interval::Interval(uint16_t start_end) : 24 | start(start_end), 25 | end(start_end) 26 | { 27 | 28 | } 29 | 30 | Interval::Interval(uint16_t start, uint16_t end) : 31 | start(start), 32 | end(end) 33 | { 34 | 35 | } 36 | 37 | bool Interval::matches(uint16_t value) const { 38 | return (value >= start && value <= end); 39 | } 40 | -------------------------------------------------------------------------------- /lib/src/util/Interval.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #ifndef INTERVAL_H 22 | #define INTERVAL_H 23 | 24 | #include 25 | 26 | class Interval { 27 | public: 28 | Interval(uint16_t start_end); 29 | Interval(uint16_t start, uint16_t end); 30 | bool matches(uint16_t value) const; 31 | private: 32 | uint16_t start; 33 | uint16_t end; 34 | }; 35 | 36 | #endif // INTERVAL_H 37 | -------------------------------------------------------------------------------- /lib/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_executable(TestAuxModem TestAuxModem.cc) 3 | target_link_libraries(TestAuxModem falcon_meas) 4 | add_test(TestAuxModem TestAuxModem) 5 | 6 | add_executable(TestTrafficGenerator TestTrafficGenerator.cc) 7 | target_link_libraries(TestTrafficGenerator falcon_meas) 8 | add_test(TestTrafficGenerator TestTrafficGenerator) 9 | -------------------------------------------------------------------------------- /lib/test/TestAuxModem.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "falcon/meas/AuxModem.h" 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | using namespace std; 28 | 29 | int main(int argc, char** argv) { 30 | SierraWirelessAuxModem modem; 31 | assert(modem.init()); 32 | assert(modem.configure()); 33 | { 34 | NetworkInfo infoA(modem.getNetworkInfo()); 35 | NetworkInfo infoB(modem.getNetworkInfo()); 36 | assert(infoA == infoB); 37 | } 38 | cout << "OK" << endl; 39 | } 40 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/falkenber9/falcon/6c518d6511da5fa6e8fb309ee311ed515b2201c6/logo.png -------------------------------------------------------------------------------- /misc/CodeStyle_for_qtcreator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CodeStyleData 7 | 8 | false 9 | false 10 | false 11 | true 12 | false 13 | true 14 | true 15 | false 16 | true 17 | false 18 | false 19 | false 20 | true 21 | true 22 | false 23 | true 24 | false 25 | true 26 | false 27 | 2 28 | true 29 | true 30 | 2 31 | true 32 | true 33 | 4 34 | 35 | 36 | 37 | DisplayName 38 | Robert 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(capture_probe) 3 | add_subdirectory(eye) 4 | add_subdirectory(gui) 5 | add_subdirectory(misc) 6 | 7 | # Link libstdc++ and libgcc 8 | #if(BUILD_STATIC) 9 | # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc") 10 | #endif(BUILD_STATIC) 11 | 12 | set(INSTALL_BUNDLE) 13 | 14 | add_executable(FalconCaptureWarden FalconCaptureWarden.cc) 15 | target_link_libraries(FalconCaptureWarden falcon_meas) 16 | target_compile_options(FalconCaptureWarden PUBLIC "-std=c++11") 17 | list(APPEND INSTALL_BUNDLE FalconCaptureWarden) 18 | 19 | if(RF_FOUND) 20 | add_executable(FalconCaptureProbe FalconCaptureProbe.cc) 21 | target_link_libraries(FalconCaptureProbe falcon_capture_probe) 22 | target_compile_options(FalconCaptureProbe PUBLIC "-std=c++11") 23 | list(APPEND INSTALL_BUNDLE FalconCaptureProbe) 24 | endif(RF_FOUND) 25 | 26 | add_executable(FalconEye FalconEye.cc) 27 | target_link_libraries(FalconEye falcon_eye) 28 | target_compile_options(FalconEye PUBLIC "-std=c++11") 29 | list(APPEND INSTALL_BUNDLE FalconEye) 30 | 31 | # nested install targets are not supported by old Cmake on Ubuntu 18 32 | #list (APPEND INSTALL_BUNDLE 33 | # falcon_capture_probe 34 | # falcon_eye) 35 | install( 36 | TARGETS ${INSTALL_BUNDLE} 37 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 38 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 39 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 40 | message(STATUS "Install Bundle: ${INSTALL_BUNDLE}") 41 | 42 | #Copy wrapper scripts into build dir 43 | 44 | file(GLOB SCRIPTS "*.sh" "*.py") 45 | message(STATUS "Copy scripts: ${SCRIPTS}") 46 | foreach(SCRIPTFILE ${SCRIPTS}) 47 | get_filename_component(FILENAME ${SCRIPTFILE} NAME) 48 | message(STATUS "Copy file: ${FILENAME}") 49 | configure_file("${FILENAME}" "${FILENAME}" COPYONLY) 50 | endforeach(SCRIPTFILE) 51 | -------------------------------------------------------------------------------- /src/FalconEye.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "eye/ArgManager.h" 22 | #include "eye/EyeCore.h" 23 | 24 | #include "falcon/common/Version.h" 25 | #include "falcon/common/SignalManager.h" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | using namespace std; 33 | 34 | int main(int argc, char** argv) { 35 | cout << "FalconEye, version " << Version::gitVersion() << endl; 36 | cout << "Copyright (C) 2020 Robert Falkenberg" << endl; 37 | cout << endl; 38 | 39 | Args args; 40 | ArgManager::parseArgs(args, argc, argv); 41 | 42 | //attach signal handlers (for CTRL+C) 43 | SignalGate& signalGate(SignalGate::getInstance()); 44 | signalGate.init(); 45 | 46 | EyeCore eye(args); 47 | signalGate.attach(eye); 48 | 49 | bool success = eye.run(); 50 | 51 | return success ? EXIT_SUCCESS : EXIT_FAILURE; 52 | } 53 | -------------------------------------------------------------------------------- /src/Loop-FalconCaptureProbe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## 3 | ## Copyright (c) 2019 Robert Falkenberg. 4 | ## 5 | ## This file is part of FALCON 6 | ## (see https://github.com/falkenber9/falcon). 7 | ## 8 | ## This program is free software: you can redistribute it and/or modify 9 | ## it under the terms of the GNU Affero General Public License as 10 | ## published by the Free Software Foundation, either version 3 of the 11 | ## License, or (at your option) any later version. 12 | ## 13 | ## This program is distributed in the hope that it will be useful, 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ## GNU Affero General Public License for more details. 17 | ## 18 | ## A copy of the GNU Affero General Public License can be found in 19 | ## the LICENSE file in the top-level directory of this distribution 20 | ## and at http://www.gnu.org/licenses/. 21 | ## 22 | 23 | SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 24 | 25 | #BUILDDIR="$SCRIPTDIR/../build/src/examples" 26 | LOGDIR="." 27 | 28 | INTERVAL_SEC=1 29 | 30 | APPLICATION="FalconCaptureProbe" 31 | THE_DATE=`date +"%Y-%m-%d-%H-%M-%S"` 32 | HOSTNAME=`hostname` 33 | APP_STDOUT="$LOGDIR/$THE_DATE-$HOSTNAME-Loop-FalconCaptureProbe.log" 34 | 35 | BACKOFF=0 36 | if [ "$HOSTNAME" = "cni-lte5" ]; then 37 | BACKOFF=0 38 | elif [ "$HOSTNAME" = "cni-lte6" ]; then 39 | BACKOFF=1 40 | elif [ "$HOSTNAME" = "cni-lte9" ]; then 41 | BACKOFF=2 42 | else 43 | echo "Unknown hostname in lookup for backoff. Backoff set to $BACKOFF" 44 | fi 45 | 46 | APP_PARAMS="-c -b $BACKOFF -N 1" 47 | 48 | echo $SCRIPTDIR 49 | #echo $BUILDDIR 50 | #echo $LOGDIR 51 | echo $APPLICATION 52 | echo $APP_PARAMS 53 | 54 | while true; 55 | do 56 | THE_DATE=`date +"%Y-%m-%d-%H-%M-%S"` 57 | echo "$THE_DATE-$HOSTNAME" | tee -a $APP_STDOUT 58 | ./$APPLICATION $APP_PARAMS 2>&1 | tee -a $APP_STDOUT 59 | echo "Pause for $INTERVAL_SEC s" | tee -a $APP_STDOUT 60 | sleep $INTERVAL_SEC 61 | done; 62 | -------------------------------------------------------------------------------- /src/PullCaptureFiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## 3 | ## Copyright (c) 2019 Robert Falkenberg. 4 | ## 5 | ## This file is part of FALCON 6 | ## (see https://github.com/falkenber9/falcon). 7 | ## 8 | ## This program is free software: you can redistribute it and/or modify 9 | ## it under the terms of the GNU Affero General Public License as 10 | ## published by the Free Software Foundation, either version 3 of the 11 | ## License, or (at your option) any later version. 12 | ## 13 | ## This program is distributed in the hope that it will be useful, 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ## GNU Affero General Public License for more details. 17 | ## 18 | ## A copy of the GNU Affero General Public License can be found in 19 | ## the LICENSE file in the top-level directory of this distribution 20 | ## and at http://www.gnu.org/licenses/. 21 | ## 22 | 23 | 24 | SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 25 | 26 | DST_PATH=. 27 | 28 | REMOTES=( 29 | cni-lte5.local 30 | cni-lte6.local 31 | cni-lte9.local 32 | ) 33 | 34 | REMOTE_SRC_PATH=( 35 | /home/cni-lte/falcon/build/src 36 | /home/cni-lte/falcon/build/src 37 | /home/cni/falcon/build/src 38 | ) 39 | 40 | USERS=( 41 | cni-lte 42 | cni-lte 43 | cni 44 | ) 45 | 46 | 47 | SYNCTOOL=rsync 48 | SYNCTOOL_PARAMS="-aHAXxv --numeric-ids --remove-source-files --progress" 49 | #SYNCTOOL_PARAMS="-aHAXxv --numeric-ids --progress" 50 | 51 | i=0 52 | for REMOTE in ${REMOTES[@]} 53 | do 54 | USER=${USERS[$i]} 55 | SRC_PATH=${REMOTE_SRC_PATH[$i]} 56 | echo "Pulling from remote '$REMOTE'" 57 | echo "User: $USER" 58 | echo "SRC_PATH: $SRC_PATH" 59 | echo "DST_PATH: $DST_PATH" 60 | mkdir -p $DST_PATH/$REMOTE 61 | echo "$SYNCTOOL $SYNCTOOL_PARAMS $USER@$REMOTE:$SRC_PATH/*.{csv,bin,log} $DST_PATH/$REMOTE" 62 | $SYNCTOOL $SYNCTOOL_PARAMS $USER@$REMOTE:$SRC_PATH/*.{csv,bin,log} $DST_PATH/$REMOTE 63 | 64 | i=$((i+1)) 65 | done; 66 | 67 | #rsync -aHAXxv --numeric-ids --delete --progress -e "ssh -T -c arcfour -o Compression=no -x" user@: 68 | -------------------------------------------------------------------------------- /src/Settings-Loop-FalconEye.sh: -------------------------------------------------------------------------------- 1 | 2 | #NOF_SUBFRAMES="1000" 3 | #FREQ="1815e6" 4 | 5 | #OPERATOR="Telekom_" 6 | #OPERATOR="Vodafone" 7 | #OPERATOR="O2-DE___" 8 | 9 | #OPERATOR="PCI165__" #North 10 | OPERATOR="PCI166__" #West 11 | #OPERATOR="PCI167__" #East 12 | 13 | #CELL_PCI="-l 1" # empty for 'best cell' 14 | #CELL_PCI="-l 0" # North 15 | CELL_PCI="-l 1" # West 16 | #CELL_PCI="-l 2" # East 17 | -------------------------------------------------------------------------------- /src/Warden-short-noGPS.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## 3 | ## Copyright (c) 2019 Robert Falkenberg. 4 | ## 5 | ## This file is part of FALCON 6 | ## (see https://github.com/falkenber9/falcon). 7 | ## 8 | ## This program is free software: you can redistribute it and/or modify 9 | ## it under the terms of the GNU Affero General Public License as 10 | ## published by the Free Software Foundation, either version 3 of the 11 | ## License, or (at your option) any later version. 12 | ## 13 | ## This program is distributed in the hope that it will be useful, 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ## GNU Affero General Public License for more details. 17 | ## 18 | ## A copy of the GNU Affero General Public License can be found in 19 | ## the LICENSE file in the top-level directory of this distribution 20 | ## and at http://www.gnu.org/licenses/. 21 | ## 22 | 23 | # ./FalconCaptureWarden -h 24 | #Usage: ./FalconCaptureWarden [aghijnopswW] 25 | # -a Broadcast IP address [default: 169.254.255.255] 26 | # -g NMEA GPS device path [default: use GPS from aux modem] 27 | # -h Show this help message 28 | # -i Poll interval in s [default: 1] 29 | # -j Auto mode interval in s [default: 60] 30 | # -n Number of subframes in ms [default: 20000], 0=unlimited 31 | # -o Probing delay/offset in ms [default: 10000] 32 | # -p Broadcast port [default: 4567] 33 | # -s Payload size in byte [default: 5242880] 34 | # -w Probing URL for upload [default: http://129.217.211.19:6137/index.html] 35 | # -W Probing URL for download [default: http://129.217.211.19:6137/testfiles/100MB.bin] 36 | # -T TX power sampling interval in us [default: 250000], 0=disabled 37 | 38 | 39 | #auto mode interval (-j): ( probing_delay(5s) + probing_timeout(10s) ) * operators(3) = 45 40 | # probin_timeout of 10s cancels file transfer of 5MB with datarate < 4Mbit/s 41 | 42 | APPLICATION="./FalconCaptureWarden" 43 | PARAMS="-j 300 -n 5000 -o 5000 -G" 44 | 45 | echo "Launching $APPLICATION $PARAMS" 46 | $APPLICATION $PARAMS 47 | -------------------------------------------------------------------------------- /src/Warden-short.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## 3 | ## Copyright (c) 2019 Robert Falkenberg. 4 | ## 5 | ## This file is part of FALCON 6 | ## (see https://github.com/falkenber9/falcon). 7 | ## 8 | ## This program is free software: you can redistribute it and/or modify 9 | ## it under the terms of the GNU Affero General Public License as 10 | ## published by the Free Software Foundation, either version 3 of the 11 | ## License, or (at your option) any later version. 12 | ## 13 | ## This program is distributed in the hope that it will be useful, 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ## GNU Affero General Public License for more details. 17 | ## 18 | ## A copy of the GNU Affero General Public License can be found in 19 | ## the LICENSE file in the top-level directory of this distribution 20 | ## and at http://www.gnu.org/licenses/. 21 | ## 22 | 23 | # ./FalconCaptureWarden -h 24 | #Usage: ./FalconCaptureWarden [aghijnopswW] 25 | # -a Broadcast IP address [default: 169.254.255.255] 26 | # -g NMEA GPS device path [default: use GPS from aux modem] 27 | # -h Show this help message 28 | # -i Poll interval in s [default: 1] 29 | # -j Auto mode interval in s [default: 60] 30 | # -n Number of subframes in ms [default: 20000], 0=unlimited 31 | # -o Probing delay/offset in ms [default: 10000] 32 | # -p Broadcast port [default: 4567] 33 | # -s Payload size in byte [default: 5242880] 34 | # -w Probing URL for upload [default: http://129.217.211.19:6137/index.html] 35 | # -W Probing URL for download [default: http://129.217.211.19:6137/testfiles/100MB.bin] 36 | # -T TX power sampling interval in us [default: 250000], 0=disabled 37 | 38 | 39 | #auto mode interval (-j): ( probing_delay(5s) + probing_timeout(10s) ) * operators(3) = 45 40 | # probin_timeout of 10s cancels file transfer of 5MB with datarate < 4Mbit/s 41 | 42 | APPLICATION="./FalconCaptureWarden" 43 | PARAMS="-j 50 -n 5000 -o 5000" 44 | 45 | echo "Launching $APPLICATION $PARAMS" 46 | $APPLICATION $PARAMS 47 | -------------------------------------------------------------------------------- /src/allow-realtime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## 3 | ## Copyright (c) 2019 Robert Falkenberg. 4 | ## 5 | ## This file is part of FALCON 6 | ## (see https://github.com/falkenber9/falcon). 7 | ## 8 | ## This program is free software: you can redistribute it and/or modify 9 | ## it under the terms of the GNU Affero General Public License as 10 | ## published by the Free Software Foundation, either version 3 of the 11 | ## License, or (at your option) any later version. 12 | ## 13 | ## This program is distributed in the hope that it will be useful, 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ## GNU Affero General Public License for more details. 17 | ## 18 | ## A copy of the GNU Affero General Public License can be found in 19 | ## the LICENSE file in the top-level directory of this distribution 20 | ## and at http://www.gnu.org/licenses/. 21 | ## 22 | 23 | PROG="FalconEye" 24 | DIRECTORY=`dirname $0` 25 | 26 | CMD="sudo setcap -v cap_sys_nice=eip $PROG" 27 | 28 | echo "$CMD" 29 | $CMD 30 | -------------------------------------------------------------------------------- /src/archiv/Falcon.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include "Falcon.h" 31 | 32 | Falcon& Falcon::instance() { 33 | static Falcon theFalconMain; 34 | return theFalconMain; 35 | } 36 | 37 | Falcon::Falcon() { 38 | 39 | } 40 | 41 | Falcon::~Falcon() { 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/archiv/Falcon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | 22 | #include "lte/CCSniffer.h" 23 | 24 | class Falcon { 25 | 26 | public: 27 | virtual ~Falcon(); 28 | static Falcon& instance(); 29 | 30 | private: 31 | 32 | CCSniffer* ccSniffer = NULL; 33 | 34 | Falcon(); 35 | Falcon(const Falcon&); 36 | Falcon& operator=(const Falcon&); 37 | 38 | }; 39 | -------------------------------------------------------------------------------- /src/archiv/lte/CCSniffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "falcon/CCSnifferInterfaces.h" 29 | 30 | #include "srsue/hdr/ue_base.h" 31 | #include "srslte/radio/radio_multi.h" 32 | #include "srsue/hdr/phy/phy.h" 33 | 34 | #include "srslte/common/logger.h" 35 | #include "srslte/common/logger_file.h" 36 | #include "srslte/common/log_filter.h" 37 | 38 | 39 | class CCSniffer : 40 | public srsue::ue_base, 41 | public CCSnifferInterface, 42 | public SnifferConfigInterface, 43 | public SnifferVisualizationInterface { 44 | public: 45 | CCSniffer(); 46 | static CCSniffer* get_instance(); 47 | 48 | bool init(srsue::all_args_t *args_); 49 | void stop(); 50 | bool switch_on(); 51 | bool switch_off(); 52 | bool is_attached(); 53 | void start_plot(); 54 | void print_mbms(); 55 | bool mbms_service_start(uint32_t serv, uint32_t port); 56 | 57 | void print_pool(); 58 | 59 | static void rf_msg(srslte_rf_error_t error); 60 | 61 | // UE metrics interface 62 | bool get_metrics(srsue::ue_metrics_t &m); 63 | 64 | void pregenerate_signals(bool enable); 65 | 66 | void radio_overflow(); 67 | private: 68 | virtual ~CCSniffer(); 69 | 70 | static CCSniffer* instance; 71 | pthread_mutex_t ue_instance_mutex = PTHREAD_MUTEX_INITIALIZER; 72 | 73 | srslte::radio_multi radio; 74 | srsue::phy phy; 75 | 76 | srslte::logger_stdout logger_stdout; 77 | srslte::logger_file logger_file; 78 | srslte::logger *logger; 79 | 80 | std::vector phy_log; 81 | 82 | srsue::all_args_t *args; 83 | bool started; 84 | 85 | bool check_srslte_version(); 86 | 87 | }; 88 | -------------------------------------------------------------------------------- /src/archiv/lte/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.cc") 3 | 4 | #add_library(falcon_lte ${SOURCES}) 5 | add_library(falcon_lte STATIC ${SOURCES}) 6 | target_link_libraries(falcon_lte 7 | srsue_mac 8 | srsue_phy 9 | srsue_upper 10 | srslte_common 11 | srslte_phy 12 | srslte_upper 13 | srslte_radio 14 | ${CMAKE_THREAD_LIBS_INIT} 15 | ${Boost_LIBRARIES} 16 | ) 17 | #target_compile_options(falcon_lte PUBLIC "-std=gnu++11") 18 | 19 | -------------------------------------------------------------------------------- /src/capture_probe/ArgManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include 25 | 26 | struct Args { 27 | // receiver params 28 | int cpu_affinity; 29 | bool disable_cfo; 30 | //int force_N_id_2; 31 | //uint32_t nof_prb; 32 | std::string rf_args; 33 | uint32_t rf_nof_rx_ant; 34 | double rf_freq; 35 | double rf_gain; 36 | int decimate; 37 | // probing params 38 | 39 | // local params 40 | int nof_runs; 41 | int repeat_pause; 42 | uint32_t backoff; 43 | // local params for client mode 44 | bool client_mode; 45 | bool no_auxmodem; 46 | uint16_t port; 47 | // local/remote params 48 | std::string output_file_base_name; 49 | uint32_t nof_subframes; 50 | uint32_t probing_delay; 51 | uint32_t direction; 52 | size_t payload_size; 53 | std::string url; 54 | uint32_t tx_power_sample_interval; 55 | }; 56 | 57 | class ArgManager { 58 | public: 59 | static void defaultArgs(Args& args); 60 | static void usage(Args& args, const std::string& prog); 61 | static void parseArgs(Args& args, int argc, char **argv); 62 | private: 63 | ArgManager() = delete; // static only 64 | }; 65 | -------------------------------------------------------------------------------- /src/capture_probe/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.cc" "*.c") 3 | 4 | add_library(falcon_capture_probe STATIC ${SOURCES}) 5 | target_link_libraries(falcon_capture_probe 6 | # srslte_phy 7 | # srslte_common 8 | # srslte_rf 9 | # srslte_rf_utils 10 | falcon_phy 11 | falcon_util 12 | falcon_meas 13 | falcon_common 14 | ${CMNALIB_LIBRARIES} 15 | ${SRSLTE_LIBRARIES} 16 | ${FFT_LIBRARIES} 17 | ) 18 | target_compile_options(falcon_capture_probe PUBLIC $<$:-std=c++11>) 19 | install( 20 | TARGETS falcon_capture_probe 21 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 22 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 23 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 24 | -------------------------------------------------------------------------------- /src/eye/ArgManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include 25 | 26 | struct Args { 27 | // No pointer members! Avoid shallow copies 28 | 29 | uint32_t nof_subframes; 30 | int cpu_affinity; 31 | bool enable_ASCII_PRB_plot; 32 | bool enable_ASCII_power_plot; 33 | bool disable_cfo; 34 | uint32_t time_offset; 35 | int force_N_id_2; 36 | std::string input_file_name = ""; 37 | std::string dci_file_name = ""; 38 | std::string stats_file_name = ""; 39 | int file_offset_time; 40 | double file_offset_freq; 41 | uint32_t file_nof_prb; 42 | uint32_t file_nof_ports; 43 | uint32_t file_cell_id; 44 | bool file_wrap; 45 | std::string rf_args; 46 | uint32_t rf_nof_rx_ant; 47 | double rf_freq; 48 | double rf_gain; 49 | int decimate; 50 | int nof_subframe_workers; 51 | 52 | // other config args 53 | uint32_t dci_format_split_update_interval_ms; 54 | double dci_format_split_ratio; 55 | bool skip_secondary_meta_formats; 56 | bool enable_shortcut_discovery; 57 | uint32_t rnti_histogram_threshold; 58 | }; 59 | 60 | class ArgManager { 61 | public: 62 | static void defaultArgs(Args& args); 63 | static void usage(Args& args, const std::string& prog); 64 | static void parseArgs(Args& args, int argc, char **argv); 65 | private: 66 | ArgManager() = delete; // static only 67 | }; 68 | -------------------------------------------------------------------------------- /src/eye/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(phy) 3 | 4 | file(GLOB SOURCES "*.cc" "*.c") 5 | 6 | add_library(falcon_eye STATIC ${SOURCES}) 7 | target_link_libraries(falcon_eye 8 | # srslte_rf 9 | # srslte_phy 10 | # srslte_common 11 | eye_phy 12 | falcon_phy 13 | falcon_util 14 | falcon_meas 15 | falcon_common 16 | falcon_prof 17 | ${SRSLTE_LIBRARIES} 18 | ${FFT_LIBRARIES} 19 | ) 20 | target_compile_options(falcon_eye PUBLIC $<$:-std=c++11>) 21 | install( 22 | TARGETS falcon_eye 23 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} 24 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 25 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 26 | -------------------------------------------------------------------------------- /src/eye/DataProvider.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | 22 | #include "DataProvider.h" 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/eye/DataProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "falcon/CCSnifferInterfaces.h" 24 | 25 | //class ScanLineProvider : public Provider { 26 | 27 | //}; 28 | -------------------------------------------------------------------------------- /src/eye/phy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.cc" "*.c") 3 | 4 | add_library(eye_phy STATIC ${SOURCES}) 5 | target_link_libraries(eye_phy falcon_phy falcon_prof falcon_common) 6 | 7 | target_compile_options(eye_phy PUBLIC $<$:-std=c++11>) 8 | -------------------------------------------------------------------------------- /src/eye/phy/DCICollection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "falcon/phy/falcon_ue/falcon_ue_dl.h" 4 | #include 5 | #include 6 | #include 7 | 8 | #define EXPECTED_NOF_DL_DCI_PER_SUBFRAME 10 9 | #define EXPECTED_NOF_UL_DCI_PER_SUBFRAME 10 10 | #define MAX_NOF_DL_PRB 100 11 | #define MAX_NOF_UL_PRB 100 12 | 13 | struct DCI_BASE { 14 | DCI_BASE(); 15 | uint16_t rnti; 16 | srslte_dci_format_t format; 17 | uint32_t nof_bits; 18 | std::string hex; 19 | srslte_dci_location_t location; 20 | uint32_t histval; 21 | }; 22 | 23 | struct DCI_DL : public DCI_BASE { 24 | DCI_DL(); 25 | std::unique_ptr dl_dci_unpacked; 26 | std::unique_ptr dl_grant; 27 | }; 28 | 29 | struct DCI_UL : public DCI_BASE { 30 | DCI_UL(); 31 | std::unique_ptr ul_dci_unpacked; 32 | std::unique_ptr ul_grant; 33 | }; 34 | 35 | /** 36 | * @brief The DCICollection class is a container for buffering DCI of a subframe 37 | */ 38 | class DCICollection { 39 | 40 | public: 41 | DCICollection(const srslte_cell_t& cell); 42 | ~DCICollection(); 43 | void setTimestamp(struct timeval timestamp); 44 | timeval getTimestamp() const; 45 | void setSubframe(uint32_t sfn, uint32_t sf_idx, uint32_t cfi); 46 | uint32_t get_sfn() const; 47 | uint32_t get_sf_idx() const; 48 | uint32_t get_cfi() const; 49 | const std::vector& getDCI_DL() const; 50 | const std::vector& getDCI_UL() const; 51 | const std::vector& getRBMapDL() const; 52 | const std::vector& getRBMapUL() const; 53 | bool hasCollisionDL() const; 54 | bool hasCollisionUL() const; 55 | void addCandidate(dci_candidate_t& cand, 56 | const srslte_dci_location_t& location, 57 | uint32_t histval); 58 | static std::vector applyLegacyColorMap(const std::vector& RBMap); 59 | private: 60 | srslte_cell_t cell; 61 | uint32_t sfn; 62 | uint32_t sf_idx; 63 | uint32_t cfi; 64 | struct timeval timestamp; 65 | std::vector dci_dl_collection; 66 | std::vector dci_ul_collection; 67 | std::vector rb_map_dl; 68 | std::vector rb_map_ul; 69 | bool dl_collision; 70 | bool ul_collision; 71 | }; 72 | -------------------------------------------------------------------------------- /src/eye/phy/DCIPrint.cc: -------------------------------------------------------------------------------- 1 | #include "DCIPrint.h" 2 | #include "falcon/phy/common/falcon_phy_common.h" 3 | 4 | #define ANSI_COLOR_RED "\x1b[31m" 5 | #define ANSI_COLOR_GREEN "\x1b[32m" 6 | #define ANSI_COLOR_YELLOW "\x1b[33m" 7 | #define ANSI_COLOR_BLUE "\x1b[34m" 8 | #define ANSI_COLOR_MAGENTA "\x1b[35m" 9 | #define ANSI_COLOR_CYAN "\x1b[36m" 10 | #define ANSI_COLOR_RESET "\x1b[0m" 11 | 12 | const static char* color_rnti[] = { 13 | ANSI_COLOR_RED, 14 | ANSI_COLOR_GREEN, 15 | ANSI_COLOR_YELLOW, 16 | ANSI_COLOR_BLUE, 17 | ANSI_COLOR_MAGENTA, 18 | ANSI_COLOR_CYAN, 19 | ANSI_COLOR_GREEN, 20 | ANSI_COLOR_YELLOW, 21 | ANSI_COLOR_BLUE, 22 | ANSI_COLOR_MAGENTA 23 | }; 24 | 25 | const static char* color_power[] = { 26 | ANSI_COLOR_BLUE, 27 | ANSI_COLOR_CYAN, 28 | ANSI_COLOR_GREEN, 29 | ANSI_COLOR_YELLOW, 30 | ANSI_COLOR_RED, 31 | ANSI_COLOR_MAGENTA, 32 | ANSI_COLOR_RESET, 33 | ANSI_COLOR_RESET 34 | }; 35 | 36 | #define COLOR_RNTI(x) (color_rnti[x%10]) 37 | #define COLOR_POWER(x) (color_power[x%8]) 38 | #define COLOR_RESET ANSI_COLOR_RESET 39 | 40 | void DCIPrint::printRBVectorColored(FILE* file, const std::vector& map) { 41 | for(std::vector::const_iterator it = map.begin(); it != map.end(); ++it) { 42 | if(*it == FALCON_UNSET_RNTI) { 43 | fprintf(file, COLOR_RESET "_"); 44 | } 45 | else { 46 | fprintf(file, "%s", COLOR_RNTI(*it)); 47 | fprintf(file, "%d", *it % 10); 48 | } 49 | } 50 | fprintf(file, COLOR_RESET); 51 | } 52 | 53 | void DCIPrint::printRBVector(FILE* file, const std::vector& map) { 54 | for(std::vector::const_iterator it = map.begin(); it != map.end(); ++it) { 55 | if(*it == FALCON_UNSET_RNTI) { 56 | fprintf(file, "_"); 57 | } 58 | else { 59 | fprintf(file, "%d", *it % 10); 60 | } 61 | } 62 | } 63 | 64 | void DCIPrint::printPowerVectorColored(FILE* file, const std::vector& map) { 65 | for(std::vector::const_iterator it = map.begin(); it != map.end(); ++it) { 66 | if(*it == 0) { 67 | fprintf(file, COLOR_RESET "_"); 68 | } 69 | else { 70 | fprintf(file, "%s", COLOR_POWER(*it)); 71 | fprintf(file, "%d", *it % 8); 72 | } 73 | } 74 | fprintf(file, COLOR_RESET); 75 | } 76 | -------------------------------------------------------------------------------- /src/eye/phy/DCIPrint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | class DCIPrint { 8 | public: 9 | static void printRBVectorColored(FILE* file, const std::vector& map); 10 | static void printRBVector(FILE* file, const std::vector& map); 11 | static void printPowerVectorColored(FILE* file, const std::vector& map); 12 | }; 13 | -------------------------------------------------------------------------------- /src/eye/phy/DCISearch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "falcon/phy/falcon_ue/falcon_ue_dl.h" 4 | #include "SubframeInfo.h" 5 | #include "PhyCommon.h" 6 | #include "MetaFormats.h" 7 | 8 | class DCISearch { 9 | public: 10 | DCISearch(srslte_ue_dl_t& ue_dl, 11 | const DCIMetaFormats& metaFormats, 12 | RNTIManager& rntiManager, 13 | SubframeInfo& subframeInfo, 14 | uint32_t sf_idx, 15 | uint32_t sfn); 16 | 17 | int search(); 18 | DCIBlindSearchStats& getStats(); 19 | 20 | void setShortcutDiscovery(bool enable); 21 | bool getShortcutDiscovery() const; 22 | private: 23 | int inspect_dci_location_recursively(srslte_dci_msg_t *dci_msg, 24 | uint32_t cfi, 25 | falcon_cce_to_dci_location_map_t *cce_map, 26 | falcon_dci_location_t *location_list, 27 | uint32_t ncce, 28 | uint32_t L, 29 | uint32_t max_depth, 30 | falcon_dci_meta_format_t **meta_formats, 31 | uint32_t nof_formats, 32 | uint32_t enable_discovery, 33 | const dci_candidate_t parent_cand[]); 34 | int recursive_blind_dci_search(srslte_dci_msg_t *dci_msg, 35 | uint32_t cfi); 36 | //falcon_ue_dl_t& q; 37 | srslte_ue_dl_t& ue_dl; 38 | const DCIMetaFormats& metaFormats; 39 | RNTIManager& rntiManager; 40 | DCICollection& dciCollection; 41 | SubframePower& subframePower; 42 | uint32_t sf_idx; 43 | uint32_t sfn; 44 | DCIBlindSearchStats stats; 45 | bool enableShortcutDiscovery; 46 | }; 47 | -------------------------------------------------------------------------------- /src/eye/phy/Helper.c: -------------------------------------------------------------------------------- 1 | #include "Helper.h" 2 | 3 | 4 | 5 | float my_cabsf(cf_t c) { 6 | return cabsf(c); 7 | } 8 | -------------------------------------------------------------------------------- /src/eye/phy/Helper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #include 8 | #include 9 | #include "srslte/config.h" 10 | 11 | float my_cabsf(cf_t c); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #undef I // Fix complex.h #define I nastiness when using C++ 16 | #endif 17 | -------------------------------------------------------------------------------- /src/eye/phy/MetaFormats.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "falcon/phy/falcon_phch/falcon_dci.h" 5 | 6 | extern const srslte_dci_format_t falcon_ue_all_formats[]; 7 | extern const uint32_t nof_falcon_ue_all_formats; 8 | 9 | class DCIMetaFormats { 10 | public: 11 | DCIMetaFormats(uint32_t nformats, double split_ratio = 1.0); 12 | ~DCIMetaFormats(); 13 | void setSplitRatio(double split_ratio); 14 | void update_formats(); 15 | falcon_dci_meta_format_t** getPrimaryMetaFormats() const; 16 | falcon_dci_meta_format_t** getSecondaryMetaFormats() const; 17 | uint32_t getNofPrimaryMetaFormats() const; 18 | uint32_t getNofSecondaryMetaFormats() const; 19 | void setSkipSecondaryMetaFormats(bool skip); 20 | bool skipSecondaryMetaFormats() const; 21 | void printPrimaryMetaFormats() const; 22 | void printSecondaryMetaFormats() const; 23 | private: 24 | falcon_dci_meta_format_t* all_meta_formats; 25 | falcon_dci_meta_format_t** primary_meta_formats; 26 | falcon_dci_meta_format_t** secondary_meta_formats; 27 | 28 | uint32_t nof_all_meta_formats; 29 | uint32_t nof_primary_meta_formats; 30 | uint32_t nof_secondary_meta_formats; 31 | bool skip_secondary_meta_formats; 32 | double split_ratio; 33 | void printMetaFormatList(falcon_dci_meta_format_t** formats, uint32_t nof_formats) const; 34 | }; 35 | -------------------------------------------------------------------------------- /src/eye/phy/Phy.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "PhyCommon.h" 8 | #include "MetaFormats.h" 9 | #include "SubframeWorkerThread.h" 10 | #include "SubframeWorker.h" 11 | #include "falcon/common/ThreadSafeQueue.h" 12 | 13 | #include "srslte/common/common.h" 14 | 15 | #define FALCON_MAX_PRB 110 16 | 17 | //Phy main object 18 | class Phy { 19 | public: 20 | Phy(uint32_t nof_rx_antennas, 21 | uint32_t nof_workers, 22 | const std::string& dciFilenName, 23 | const std::string& statsFileName, 24 | bool skipSecondaryMetaFormats, 25 | double metaFormatSplitRatio, 26 | uint32_t histogramThreshold); 27 | ~Phy(); 28 | std::shared_ptr getAvail(); 29 | std::shared_ptr getAvailImmediate(); 30 | void putAvail(std::shared_ptr); 31 | std::shared_ptr getPending(); 32 | void putPending(std::shared_ptr); 33 | void joinPending(); 34 | PhyCommon& getCommon(); 35 | DCIMetaFormats& getMetaFormats(); 36 | std::vector >& getWorkers(); 37 | bool setCell(srslte_cell_t cell); 38 | void setRNTI(uint16_t rnti); 39 | void setChestCFOEstimateEnable(bool enable, uint32_t mask); 40 | void setChestAverageSubframe(bool enable); 41 | 42 | void printStats(); 43 | 44 | uint32_t nof_rx_antennas; 45 | uint32_t nof_workers; 46 | private: 47 | PhyCommon common; 48 | DCIMetaFormats metaFormats; 49 | 50 | std::vector> workers; 51 | ThreadSafeQueue avail; 52 | ThreadSafeQueue pending; 53 | SubframeWorkerThread workerThread; 54 | 55 | }; 56 | -------------------------------------------------------------------------------- /src/eye/phy/PhyCommon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "falcon/util/RNTIManager.h" 5 | #include "falcon/phy/falcon_phch/falcon_dci.h" 6 | #include "SubframeInfoConsumer.h" 7 | 8 | extern const srslte_dci_format_t falcon_ue_all_formats[]; 9 | extern const uint32_t nof_falcon_ue_all_formats; 10 | 11 | class DCIBlindSearchStats { 12 | public: 13 | DCIBlindSearchStats(); 14 | void print(FILE* file); 15 | DCIBlindSearchStats& operator+=(const DCIBlindSearchStats& right); 16 | 17 | uint32_t nof_locations; 18 | uint32_t nof_decoded_locations; 19 | uint32_t nof_cce; 20 | uint32_t nof_missed_cce; 21 | uint32_t nof_subframes; 22 | uint32_t nof_subframe_collisions_dw; 23 | uint32_t nof_subframe_collisions_up; 24 | struct timeval time_blindsearch; 25 | }; 26 | 27 | class PhyStats { 28 | public: 29 | PhyStats(); 30 | ~PhyStats(); 31 | PhyStats& operator+=(const PhyStats& right); 32 | 33 | uint32_t totRBup, totRBdw, totBWup, totBWdw; 34 | uint16_t nof_rnti; 35 | }; 36 | 37 | class PhyCommon { 38 | public: 39 | PhyCommon(uint32_t max_prb, 40 | uint32_t nof_rx_antennas, 41 | const std::string& dciFileName, 42 | const std::string& statsFileName, 43 | uint32_t histogramThreshold); 44 | ~PhyCommon(); 45 | RNTIManager& getRNTIManager(); 46 | FILE* getDCIFile(); 47 | FILE* getStatsFile(); 48 | void addStats(const DCIBlindSearchStats& stats); 49 | DCIBlindSearchStats& getStats(); 50 | void printStats(); 51 | 52 | void setShortcutDiscovery(bool enable); 53 | bool getShortcutDiscovery() const; 54 | 55 | //upper layer interfaces 56 | void setDCIConsumer(std::shared_ptr); 57 | void resetDCIConsumer(); 58 | 59 | //lower layer interface 60 | void consumeDCICollection(const SubframeInfo& subframeInfo); 61 | 62 | uint32_t max_prb; 63 | uint32_t nof_rx_antennas; 64 | private: 65 | FILE* dci_file; 66 | FILE* stats_file; 67 | RNTIManager rntiManager; 68 | 69 | DCIBlindSearchStats stats; 70 | 71 | std::shared_ptr defaultDCIConsumer; 72 | std::shared_ptr dciConsumer; 73 | 74 | bool enableShortcutDiscovery; 75 | }; 76 | -------------------------------------------------------------------------------- /src/eye/phy/SubframeInfo.cc: -------------------------------------------------------------------------------- 1 | #include "SubframeInfo.h" 2 | 3 | SubframeInfo::SubframeInfo(const srslte_cell_t& cell) : 4 | subframePower(cell), 5 | dciCollection(cell) 6 | { 7 | 8 | } 9 | 10 | SubframeInfo::~SubframeInfo() { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/eye/phy/SubframeInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SubframePower.h" 4 | #include "DCICollection.h" 5 | 6 | class SubframeInfo { 7 | public: 8 | SubframeInfo(const srslte_cell_t& cell); 9 | ~SubframeInfo(); 10 | SubframePower& getSubframePower() { return subframePower; } 11 | const SubframePower& getSubframePower() const { return subframePower; } 12 | DCICollection& getDCICollection() { return dciCollection; } 13 | const DCICollection& getDCICollection() const { return dciCollection; } 14 | private: 15 | SubframePower subframePower; 16 | DCICollection dciCollection; 17 | }; 18 | -------------------------------------------------------------------------------- /src/eye/phy/SubframeInfoConsumer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SubframeInfo.h" 4 | 5 | class SubframeInfoConsumer { 6 | 7 | public: 8 | virtual ~SubframeInfoConsumer(); 9 | virtual void consumeDCICollection(const SubframeInfo& collection) = 0; 10 | }; 11 | 12 | class DCIConsumerList : public SubframeInfoConsumer { 13 | public: 14 | virtual ~DCIConsumerList() override; 15 | virtual void consumeDCICollection(const SubframeInfo &collection) override; 16 | void addConsumer(std::shared_ptr consumer); 17 | private: 18 | std::vector> consumers; 19 | }; 20 | 21 | class DCIToFileBase : public SubframeInfoConsumer { 22 | public: 23 | DCIToFileBase(); 24 | DCIToFileBase(FILE* dci_file); 25 | virtual ~DCIToFileBase() override; 26 | void setFile(FILE* dci_file); 27 | FILE* getFile(); 28 | virtual void consumeDCICollection(const SubframeInfo& subframeInfo) override = 0; 29 | protected: 30 | FILE* dci_file; 31 | }; 32 | 33 | class DCIToFile : public DCIToFileBase { 34 | public: 35 | DCIToFile(); 36 | DCIToFile(FILE* dci_file); 37 | virtual ~DCIToFile() override; 38 | virtual void consumeDCICollection(const SubframeInfo& subframeInfo) override; 39 | private: 40 | void printDCICollection(const SubframeInfo& collection) const; 41 | }; 42 | 43 | class DCIDrawASCII : public DCIToFileBase { 44 | public: 45 | DCIDrawASCII(); 46 | DCIDrawASCII(FILE* dci_file); 47 | virtual ~DCIDrawASCII() override; 48 | virtual void consumeDCICollection(const SubframeInfo& subframeInfo) override; 49 | private: 50 | void printRBMaps(const SubframeInfo& subframeInfo) const; 51 | void printRBVector(const std::vector& map) const; 52 | void printRBVectorColored(const std::vector& map) const; 53 | }; 54 | 55 | class PowerDrawASCII : public DCIToFileBase { 56 | public: 57 | PowerDrawASCII(); 58 | PowerDrawASCII(FILE* dci_file); 59 | virtual ~PowerDrawASCII() override; 60 | virtual void consumeDCICollection(const SubframeInfo &subframeInfo) override; 61 | private: 62 | void printPowerVectorColored(const std::vector& map) const; 63 | }; 64 | -------------------------------------------------------------------------------- /src/eye/phy/SubframePower.cc: -------------------------------------------------------------------------------- 1 | #include "SubframePower.h" 2 | #include "srslte/phy/utils/vector.h" 3 | 4 | #include 5 | #include "Helper.h" 6 | 7 | SubframePower::SubframePower(const srslte_cell_t& cell) : 8 | nof_prb(cell.nof_prb), 9 | rb_power_dl(cell.nof_prb, 0) 10 | { 11 | 12 | } 13 | 14 | SubframePower::~SubframePower() { 15 | 16 | } 17 | 18 | void SubframePower::computePower(const cf_t *sf_symbols) { 19 | 20 | 21 | #define SIMD_POWER 22 | #ifdef SIMD_POWER 23 | //reset 24 | std::fill(rb_power_dl.begin(), rb_power_dl.end(), 0); 25 | 26 | //accumulate 27 | for (uint32_t j = 0; j < 14; j++) { 28 | for (uint32_t i = 0; i < nof_prb; i++) { 29 | rb_power_dl[i] += srslte_vec_avg_power_cf(&sf_symbols[i*12+j*(12*nof_prb)], 12); 30 | } 31 | } 32 | 33 | //log domain, division for average, max/min search 34 | max = -std::numeric_limits::max(); 35 | min = std::numeric_limits::max(); 36 | const float logDivBy = 10*(log10f(14)); 37 | for (uint32_t i = 0; i< nof_prb; i++) { 38 | rb_power_dl[i] = 10 * log10f(rb_power_dl[i]) - logDivBy; 39 | max = rb_power_dl[i] > max ? rb_power_dl[i] : max; 40 | min = rb_power_dl[i] < min ? rb_power_dl[i] : min; 41 | } 42 | 43 | #endif 44 | 45 | //#define CLASSIC_POWER 46 | #ifdef CLASSIC_POWER 47 | //reset 48 | std::fill(rb_power_dl.begin(), rb_power_dl.end(), 0); 49 | std::vector tmp_plot_wf(12*nof_prb, 0); 50 | 51 | for (uint32_t j = 0; j < 14; j++) { 52 | for (uint32_t i = 0; i < 12*nof_prb; i++) { 53 | float tmp = my_cabsf(sf_symbols[i+j*(12*nof_prb)]); 54 | tmp_plot_wf[i] += tmp*tmp/14; 55 | } 56 | } 57 | 58 | float tmp_buff = 0; 59 | max = std::numeric_limits::min(); 60 | min = std::numeric_limits::max(); 61 | for(uint32_t i = 0; i < nof_prb; i++) { 62 | tmp_buff = 0; 63 | for(uint32_t ii = 0; ii < 12; ii++) { 64 | tmp_buff += tmp_plot_wf[(i*12)+ii]/12; 65 | } 66 | 67 | rb_power_dl[i] = 10 * log10f(tmp_buff); 68 | max = rb_power_dl[i] > max ? rb_power_dl[i] : max; 69 | min = rb_power_dl[i] < min ? rb_power_dl[i] : min; 70 | } 71 | 72 | #endif 73 | 74 | } 75 | 76 | -------------------------------------------------------------------------------- /src/eye/phy/SubframePower.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "falcon/phy/falcon_ue/falcon_ue_dl.h" 4 | #include 5 | 6 | class SubframePower { 7 | public: 8 | SubframePower(const srslte_cell_t& cell); 9 | ~SubframePower(); 10 | const std::vector& getRBPowerDL() const {return rb_power_dl;} 11 | void computePower(const cf_t* sf_symbols); 12 | uint32_t getNofPRB() const { return nof_prb; } 13 | float getMax() const { return max; } 14 | float getMin() const { return min; } 15 | private: 16 | uint32_t nof_prb; 17 | float max; 18 | float min; 19 | std::vector rb_power_dl; 20 | }; 21 | -------------------------------------------------------------------------------- /src/eye/phy/SubframeWorker.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "PhyCommon.h" 4 | #include "MetaFormats.h" 5 | #include "falcon/common/SubframeBuffer.h" 6 | #include "falcon/phy/falcon_ue/falcon_ue_dl.h" 7 | 8 | // handles a subframe 9 | class SubframeWorker { 10 | public: 11 | SubframeWorker(uint32_t idx, 12 | uint32_t max_prb, 13 | PhyCommon& common, 14 | DCIMetaFormats& metaFormats); 15 | ~SubframeWorker(); 16 | bool setCell(srslte_cell_t cell); 17 | void setRNTI(uint16_t rnti); 18 | void setChestCFOEstimateEnable(bool enable, uint32_t mask); 19 | void setChestAverageSubframe(bool enable); 20 | 21 | void prepare(uint32_t sf_idx, uint32_t sfn, bool updateMetaFormats); 22 | void work(); 23 | void printStats(); 24 | DCIBlindSearchStats& getStats(); 25 | cf_t* getBuffer(uint32_t antenna_idx); 26 | cf_t** getBuffers() {return sfb.sf_buffer;} 27 | uint32_t getSfidx() const {return sf_idx;} 28 | uint32_t getSfn() const {return sfn;} 29 | 30 | private: 31 | SubframeBuffer sfb; 32 | uint8_t *pch_payload_buffers[SRSLTE_MAX_CODEWORDS]; 33 | 34 | uint32_t idx; 35 | uint32_t max_prb; 36 | PhyCommon& common; 37 | DCIMetaFormats& metaFormats; 38 | srslte_ue_dl_t ue_dl; 39 | uint32_t sf_idx; 40 | uint32_t sfn; 41 | bool updateMetaFormats; 42 | bool collision_dw, collision_up; 43 | DCIBlindSearchStats stats; 44 | }; 45 | -------------------------------------------------------------------------------- /src/eye/phy/SubframeWorkerThread.cc: -------------------------------------------------------------------------------- 1 | #include "SubframeWorkerThread.h" 2 | #include "falcon/prof/Lifetime.h" 3 | 4 | #include 5 | 6 | SubframeWorkerThread::SubframeWorkerThread(ThreadSafeQueue& avail, 7 | ThreadSafeQueue& pending) : 8 | avail(avail), 9 | pending(pending), 10 | canceled(false), 11 | joined(false) 12 | { 13 | 14 | } 15 | 16 | SubframeWorkerThread::~SubframeWorkerThread() { 17 | cancel(); 18 | wait_thread_finish(); 19 | } 20 | 21 | void SubframeWorkerThread::cancel() { 22 | // this function must not block! 23 | canceled = true; 24 | } 25 | 26 | void SubframeWorkerThread::wait_thread_finish() { 27 | if(!joined) { 28 | joined = true; 29 | thread::wait_thread_finish(); 30 | } 31 | } 32 | 33 | void SubframeWorkerThread::run_thread() { 34 | std::cout << "SubframeWorkerThread ready" << std::endl; 35 | while(!canceled) { 36 | std::shared_ptr worker = pending.dequeue(); 37 | if(worker != nullptr) { 38 | worker->work(); 39 | // enqueue finished worker 40 | avail.enqueue(std::move(worker)); 41 | } 42 | else { 43 | // nullptr is only returned if phy is canceled 44 | canceled = true; 45 | } 46 | } 47 | std::cout << "SubframeWorkerThread ended" << std::endl; 48 | } 49 | -------------------------------------------------------------------------------- /src/eye/phy/SubframeWorkerThread.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SubframeWorker.h" 4 | #include "falcon/common/ThreadSafeQueue.h" 5 | 6 | #include "srslte/common/threads.h" 7 | 8 | class SubframeWorkerThread : public thread { 9 | public: 10 | SubframeWorkerThread(ThreadSafeQueue& avail, 11 | ThreadSafeQueue& pending); 12 | virtual ~SubframeWorkerThread(); 13 | void cancel(); 14 | void wait_thread_finish(); 15 | protected: 16 | virtual void run_thread() override; 17 | private: 18 | ThreadSafeQueue& avail; 19 | ThreadSafeQueue& pending; 20 | volatile bool canceled; 21 | volatile bool joined; 22 | }; 23 | -------------------------------------------------------------------------------- /src/gui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ##################### 2 | # QT Widget Support # 3 | ##################### 4 | 5 | # Instruct CMake to run moc automatically when needed 6 | set(CMAKE_AUTOMOC ON) 7 | # Create code from a list of Qt designer ui files 8 | set(CMAKE_AUTOUIC ON) 9 | # Find the QtWidgets library 10 | 11 | ################ 12 | # Applications # 13 | ################ 14 | 15 | #include headers 16 | include_directories("${PROJECT_BINARY_DIR}") 17 | 18 | add_subdirectory(model) 19 | add_subdirectory(adapters_qt) 20 | 21 | qt5_add_resources(IMAGES ${PROJECT_SOURCE_DIR}/gfx/images.qrc) #Dir for ResourceFile with Images 22 | set_source_files_properties(${IMAGES} PROPERTIES GENERATED ON) #Use generated Images for App (Compiled) 23 | 24 | set(FalconGUI_SRC 25 | mainwindow.ui 26 | mainwindow.cpp 27 | main.cpp 28 | spectrum.cpp 29 | file_input_output.cpp 30 | settings.cpp 31 | setting_slots.cpp 32 | dynamic_options.cpp 33 | performance_plot.cpp 34 | waterfall.cpp 35 | rnti_table.cpp 36 | colorpicker.cpp 37 | ${IMAGES} 38 | ) 39 | 40 | include_directories("gui") 41 | 42 | add_executable(FalconGUI ${FalconGUI_SRC}) 43 | target_compile_options(FalconGUI PUBLIC $<$:-std=c++11>) 44 | 45 | target_link_libraries(FalconGUI 46 | Qt5::Core 47 | Qt5::Gui 48 | Qt5::Widgets 49 | Qt5::Charts 50 | ${OPENGL_LIBRARIES} 51 | ${Boost_LIBRARIES} 52 | model 53 | adapters_qt 54 | falcon_common 55 | falcon_meas 56 | qcustomplot 57 | rangewidget 58 | ${SRSLTE_LIBRARIES} 59 | ${FFT_LIBRARIES} 60 | ) 61 | 62 | install(TARGETS FalconGUI 63 | DESTINATION ${CMAKE_INSTALL_BINDIR}) 64 | -------------------------------------------------------------------------------- /src/gui/adapters_qt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.cc") 3 | include_directories(${Qt5Widgets_INCLUDE_DIRS}) 4 | add_library(adapters_qt STATIC ${SOURCES}) 5 | target_compile_options(adapters_qt PUBLIC "-std=gnu++11") 6 | -------------------------------------------------------------------------------- /src/gui/adapters_qt/SpectrumAdapter.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "SpectrumAdapter.h" 22 | 23 | 24 | void SpectrumAdapter::update() { 25 | // currently, only push() is implemented 26 | 27 | emit signal_update(); 28 | 29 | // emit signals to gui here 30 | } 31 | 32 | void SpectrumAdapter::push(const ScanLineLegacy* data) { 33 | //ScanLine* scanline = dynamic_cast(data); 34 | 35 | switch (data->type) { 36 | case(ScanLineType_t::SCAN_LINE_UPLINK): 37 | if(emit_uplink) emit update_ul(data); 38 | else delete data; 39 | break; 40 | case(ScanLineType_t::SCAN_LINE_DOWNLINK): 41 | if(emit_downlink) emit update_dl(data); 42 | else delete data; 43 | break; 44 | case(ScanLineType_t::SCAN_LINE_SPECTRUM): 45 | if(emit_spectrum) emit update_spectrum(data); 46 | else delete data; 47 | break; 48 | case(ScanLineType_t::SCAN_LINE_SPECTRUM_DIFF): 49 | if(emit_difference) emit update_spectrum_diff(data); 50 | else delete data; 51 | break; 52 | case(ScanLineType_t::SCAN_LINE_RNTI_HIST): 53 | if(emit_rnti_hist) emit update_rnti_hist(data); 54 | else delete data; 55 | break; 56 | case(ScanLineType_t::SCAN_LINE_PERF_PLOT_A): 57 | if(emit_perf_plot_a) emit update_perf_plot_a(data); 58 | else delete data; 59 | break; 60 | case(ScanLineType_t::SCAN_LINE_PERF_PLOT_B): 61 | if(emit_perf_plot_b) emit update_perf_plot_b(data); 62 | else delete data; 63 | break; 64 | case(ScanLineType_t::TABLE_LINE): 65 | if(emit_table_update) emit update_table(data); 66 | else delete data; 67 | break; 68 | } 69 | } 70 | 71 | void SpectrumAdapter::notifyDetach() { 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/gui/adapters_qt/SpectrumAdapter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "falcon/CCSnifferInterfaces.h" 24 | #include "../model_dummy/ScanThread.h" 25 | #include 26 | 27 | class SpectrumAdapter : public QObject, public Subscriber { 28 | Q_OBJECT 29 | 30 | public: 31 | SpectrumAdapter(QObject *parent = nullptr) : QObject(parent) {} 32 | virtual ~SpectrumAdapter() {} 33 | 34 | // Subscriber interface 35 | void update(); 36 | void push(const ScanLineLegacy*) override; 37 | void notifyDetach(); // Forced detach 38 | 39 | bool emit_spectrum = false; 40 | bool emit_difference = false; 41 | bool emit_downlink = false; 42 | bool emit_uplink = false; 43 | bool emit_rnti_hist = false; 44 | bool emit_perf_plot_a = false; 45 | bool emit_perf_plot_b = false; 46 | bool emit_table_update = false; 47 | 48 | signals: 49 | void update_ul(const ScanLineLegacy* line); 50 | void update_dl(const ScanLineLegacy* line); 51 | void update_spectrum(const ScanLineLegacy* line); 52 | void signal_update(); 53 | void update_spectrum_diff(const ScanLineLegacy* line); 54 | void update_rnti_hist(const ScanLineLegacy* line); 55 | void update_perf_plot_a(const ScanLineLegacy* line); 56 | void update_perf_plot_b(const ScanLineLegacy* line); 57 | void update_table(const ScanLineLegacy* line); 58 | 59 | }; 60 | -------------------------------------------------------------------------------- /src/gui/colorpicker.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORPICKER_H 2 | #define COLORPICKER_H 3 | 4 | #pragma once 5 | 6 | #include "settings.h" 7 | #include "ui_mainwindow.h" // for valid usage of Ui::MainWindow 8 | #include "rangewidget/RangeWidget.h" 9 | #include "spectrum.h" 10 | #include 11 | 12 | 13 | class Colorpicker : public QObject{ 14 | Q_OBJECT 15 | public: 16 | explicit Colorpicker(Settings* p_glob_settings, Ui::MainWindow* p_ui); 17 | ~Colorpicker(); 18 | 19 | RangeWidget* get_color_range_slider(); 20 | 21 | private: 22 | Settings* glob_settings; 23 | Ui::MainWindow *ui; 24 | 25 | bool downlink_color_active; 26 | QColorDialog *color_dialog = nullptr; 27 | RangeWidget *color_range_slider = nullptr; 28 | QPalette downlink_palette; 29 | QPalette uplink_palette; 30 | 31 | QLabel* slider_label = nullptr; 32 | 33 | QColor dl_old; 34 | QColor ul_old; 35 | 36 | Spectrum *spectrum_view = nullptr; 37 | 38 | public slots: 39 | void on_pushButton_downlink_color_clicked(); 40 | void on_pushButton_uplink_color_clicked(); 41 | void set_color(const QColor &color); 42 | 43 | private slots: 44 | void restore_color(); 45 | 46 | signals: 47 | void color_change(); 48 | 49 | 50 | }; 51 | 52 | 53 | 54 | #endif // COLORPICKER_H 55 | -------------------------------------------------------------------------------- /src/gui/file_input_output.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "file_input_output.h" 22 | #include 23 | #include 24 | #include 25 | 26 | QString FileDialog:: openFile(){ 27 | 28 | QString filename = QFileDialog::getOpenFileName( 29 | this, 30 | "Open Document", 31 | QDir::currentPath(), 32 | "All files (*.*) ;; Sample Files (*.bin *.csv)"); 33 | 34 | if( !filename.isNull() ) 35 | { 36 | qDebug() << "selected file path : " << filename.toUtf8(); 37 | return filename; 38 | } 39 | return "Error with File!"; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/gui/file_input_output.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #ifndef INPUTOUTPUT_H 22 | #define INPUTOUTPUT_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | class FileDialog : public QWidget 29 | { 30 | public: 31 | QString openFile(); 32 | }; 33 | 34 | #endif // INPUTOUTPUT_H 35 | -------------------------------------------------------------------------------- /src/gui/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "mainwindow.h" 22 | #include 23 | #include "spectrum.h" 24 | 25 | 26 | int main(int argc, char *argv[]) { 27 | QApplication a(argc, argv); 28 | MainWindow w; 29 | w.show(); 30 | 31 | return a.exec(); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/gui/model/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.cc" "*.c") 3 | add_library(model STATIC ${SOURCES}) 4 | 5 | #if(SRSLTE_LIBRARY_RADIO AND SRSLTE_LIBRARY_RF AND SRSLTE_LIBRARY_RF_UTILS) 6 | # 7 | target_link_libraries(model pthread falcon_eye falcon_phy falcon_util falcon_common ${Boost_LIBRARIES} ${SRSLTE_LIBRARIES} ${FFT_LIBRARIES}) 8 | # 9 | #else() 10 | # 11 | #target_link_libraries(model_dummy pthread falcon_phy falcon_util ${Boost_LIBRARIES} srslte_phy srslte_upper srslte_common ${FFT_LIBRARIES}) 12 | #add_definitions(-DDISABLE_RF) 13 | # 14 | #endif(SRSLTE_LIBRARY_RADIO AND SRSLTE_LIBRARY_RF AND SRSLTE_LIBRARY_RF_UTILS) 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/gui/model/EyeThread.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "eye/ArgManager.h" 4 | #include "falcon/CCSnifferInterfaces.h" 5 | #include "falcon/definitions.h" 6 | #include "eye/phy/SubframeInfoConsumer.h" 7 | 8 | #undef I // Fix complex.h #define I nastiness when using C++ 9 | #include 10 | #include "falcon/util/RNTIManager.h" 11 | 12 | #define SPECTROGRAM_INTERVAL_US 10000 13 | #define SPECTROGRAM_MAX_LINE_WIDTH 100 14 | 15 | // Forward declaration to keep it opaque 16 | class EyeCore; 17 | 18 | class EyeThread : 19 | public Provider { 20 | public: 21 | EyeThread() : 22 | Provider(), 23 | cancel(false), 24 | initialized(false), 25 | scanline_width(SPECTROGRAM_MAX_LINE_WIDTH), 26 | eye(NULL), 27 | theThread(NULL) 28 | {} 29 | virtual ~EyeThread(); 30 | 31 | void init(); 32 | void start(const Args& args); 33 | void stop(); 34 | bool isInitialized(); 35 | void test(); 36 | inline int getScanLineWidth() {return scanline_width;}; 37 | void attachConsumer(std::shared_ptr consumer); 38 | RNTIManager &getRNTIManager(); 39 | void refreshShortcutDiscovery(bool val); 40 | void forwardRNTIHistogramThresholdToEyeCore(int val); 41 | 42 | 43 | private: 44 | void run(); 45 | volatile bool cancel; 46 | bool initialized; 47 | int scanline_width; 48 | EyeCore* eye; 49 | boost::thread* theThread; 50 | std::shared_ptr m_consumer = nullptr; 51 | }; 52 | 53 | class DCIGUIConsumer : public SubframeInfoConsumer { 54 | public: 55 | DCIGUIConsumer(); 56 | DCIGUIConsumer(EyeThread &p_Thread); 57 | void setThread(EyeThread &p_Thread); 58 | virtual void consumeDCICollection(const SubframeInfo& subframeInfo) override; 59 | private: 60 | FILE *dci_file; 61 | EyeThread *m_Thread = nullptr; 62 | uint32_t cfi_tmp[65536]; 63 | }; 64 | -------------------------------------------------------------------------------- /src/gui/model_dummy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB SOURCES "*.cc" "*.c") 3 | add_library(model_dummy STATIC ${SOURCES}) 4 | 5 | #if(SRSLTE_LIBRARY_RADIO AND SRSLTE_LIBRARY_RF AND SRSLTE_LIBRARY_RF_UTILS) 6 | # 7 | target_link_libraries(model_dummy pthread eye_phy falcon_phy falcon_util falcon_common ${Boost_LIBRARIES} ${SRSLTE_LIBRARIES} ${FFT_LIBRARIES}) 8 | # 9 | #else() 10 | # 11 | #target_link_libraries(model_dummy pthread falcon_phy falcon_util ${Boost_LIBRARIES} srslte_phy srslte_upper srslte_common ${FFT_LIBRARIES}) 12 | #add_definitions(-DDISABLE_RF) 13 | # 14 | #endif(SRSLTE_LIBRARY_RADIO AND SRSLTE_LIBRARY_RF AND SRSLTE_LIBRARY_RF_UTILS) 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/gui/model_dummy/ScanThread.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #include "ScanThread.h" 22 | 23 | #include 24 | #include 25 | 26 | 27 | void ScanThread::init() { 28 | // setup dependencies of this instance 29 | initialized = true; 30 | } 31 | 32 | void ScanThread::start() { 33 | if(!isInitialized()) { 34 | std::cerr << "Error in " << __func__ << ": not initialized." << std::endl; 35 | return; 36 | } 37 | if(theThread != NULL) { 38 | std::cerr << "Thread already running!" << std::endl; 39 | } 40 | theThread = new boost::thread(boost::bind(&ScanThread::run, this)); 41 | } 42 | 43 | void ScanThread::run() { 44 | ScanLineLegacy line_ul; 45 | ScanLineLegacy line_dl; 46 | 47 | 48 | line_ul.type = SCAN_LINE_UPLINK; 49 | line_dl.type = SCAN_LINE_DOWNLINK; 50 | 51 | 52 | while(!cancel) { 53 | usleep(SPECTROGRAM_INTERVAL_US); 54 | 55 | for (unsigned int col = 0; col < spectrogram_line_width; ++col) { 56 | line_ul.linebuf[col]= static_cast (rand()) / (static_cast (RAND_MAX/100000)); 57 | line_dl.linebuf[col]= static_cast (rand()) / (static_cast (RAND_MAX/100000)); 58 | } 59 | pushToSubscribers(&line_ul); 60 | pushToSubscribers(&line_dl); 61 | } 62 | } 63 | 64 | void ScanThread::stop() { 65 | cancel = true; 66 | if(theThread != NULL) { 67 | theThread->join(); 68 | delete theThread; 69 | theThread = NULL; 70 | } 71 | } 72 | 73 | bool ScanThread::isInitialized() { 74 | return initialized; 75 | } 76 | 77 | ScanThread::~ScanThread() { 78 | stop(); 79 | } 80 | -------------------------------------------------------------------------------- /src/gui/model_dummy/ScanThread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include "falcon/CCSnifferInterfaces.h" 24 | #include "falcon/definitions.h" 25 | #include 26 | 27 | //#define SPECTROGRAM_LINE_COUNT 100 28 | //#define SPECTROGRAM_LINE_WIDTH 100 29 | #define SPECTROGRAM_INTERVAL_US 10000 30 | 31 | class ScanThread : 32 | public Provider { 33 | public: 34 | ScanThread() : 35 | Provider (), 36 | cancel(false), 37 | initialized(false), 38 | theThread(NULL) 39 | {} 40 | virtual ~ScanThread(); 41 | 42 | int spectrogram_line_width = 50; 43 | 44 | void init(); 45 | void start(); 46 | void stop(); 47 | bool isInitialized(); 48 | private: 49 | void run(); 50 | volatile bool cancel; 51 | bool initialized; 52 | boost::thread* theThread; 53 | }; 54 | -------------------------------------------------------------------------------- /src/gui/model_dummy/cni_cc_decoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #ifndef CNI_DECODER_H 22 | #define CNI_DECODER_H 23 | #pragma once 24 | 25 | 26 | 27 | 28 | #ifdef __cplusplus 29 | extern "C" 30 | { 31 | #endif 32 | 33 | #include 34 | #include 35 | 36 | extern void *decoderthread; // Pointer auf decoderthread Funktionen 37 | extern volatile bool go_exit; 38 | 39 | typedef struct { 40 | int nof_subframes; 41 | int cpu_affinity; 42 | bool disable_plots; 43 | bool disable_cfo; 44 | uint32_t time_offset; 45 | int force_N_id_2; 46 | char *input_file_name; 47 | char *rnti_list_file; 48 | char *rnti_list_file_out; 49 | int file_offset_time; 50 | float file_offset_freq; 51 | uint32_t file_nof_prb; 52 | uint32_t file_nof_ports; 53 | uint32_t file_cell_id; 54 | char *rf_args; 55 | uint32_t rf_nof_rx_ant; 56 | double rf_freq; 57 | float rf_gain; 58 | int net_port; 59 | char *net_address; 60 | int net_port_signal; 61 | char *net_address_signal; 62 | int decimate; 63 | } prog_args_t; 64 | 65 | 66 | void plot_scanLines(void *f_pointer, float *data_ul, float *data_dl, float *data_spectrum, uint32_t *rnti_hist); 67 | 68 | //extern volatile prog_args_t prog_args; 69 | 70 | //extern volatile bool go_exit; 71 | 72 | 73 | int start_cni_decoder(); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/gui/model_dummy/cni_cc_decoderThread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "falcon/CCSnifferInterfaces.h" 25 | #include "falcon/definitions.h" 26 | #include 27 | //#include "cni_cc_decoder.h" 28 | 29 | 30 | //#define SPECTROGRAM_LINE_COUNT 100 31 | //#define SPECTROGRAM_LINE_WIDTH 100 32 | #define SPECTROGRAM_INTERVAL_US 10000 33 | /* 34 | typedef enum { 35 | SCAN_LINE_UPLINK = 0, 36 | SCAN_LINE_DOWNLINK 37 | } ScanLineType_t; 38 | 39 | class ScanLine : public LineData, public PushData { 40 | public: 41 | ScanLineType_t type; 42 | float linebuf[SPECTROGRAM_LINE_WIDTH]; 43 | };*/ 44 | 45 | class DecoderThread : 46 | public Provider { 47 | public: 48 | DecoderThread() : 49 | Provider(), 50 | cancel(false), 51 | initialized(false), 52 | theThread(NULL) 53 | {} 54 | virtual ~DecoderThread(); 55 | 56 | void init(); 57 | void start(int width); 58 | void stop(); 59 | bool isInitialized(); 60 | int scanline_width = 50; 61 | void test(); 62 | 63 | private: 64 | void run(); 65 | volatile bool cancel; 66 | bool initialized; 67 | boost::thread* theThread; 68 | }; 69 | 70 | -------------------------------------------------------------------------------- /src/gui/spectrum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Robert Falkenberg. 3 | * 4 | * This file is part of FALCON 5 | * (see https://github.com/falkenber9/falcon). 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU Affero General Public License as 9 | * published by the Free Software Foundation, either version 3 of the 10 | * License, or (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU Affero General Public License for more details. 16 | * 17 | * A copy of the GNU Affero General Public License can be found in 18 | * the LICENSE file in the top-level directory of this distribution 19 | * and at http://www.gnu.org/licenses/. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | #include "falcon/definitions.h" 25 | #include "QMouseEvent" 26 | #include "QWheelEvent" 27 | #include "QElapsedTimer" 28 | #include 29 | #include "settings.h" 30 | 31 | #define SPECTROGRAM_NOF_TEXTURES 2 32 | 33 | #define PRINT_FPS 0 34 | 35 | #if PRINT_FPS 36 | #include "QTimer" 37 | #endif 38 | 39 | class Spectrum : public QOpenGLWidget { 40 | Q_OBJECT 41 | public: 42 | explicit Spectrum(QWidget *parent = nullptr, Settings *glob_settings = nullptr); 43 | virtual ~Spectrum() override; 44 | void addLine(const uint16_t* data); 45 | void scroll_up(); 46 | void scroll_down(); 47 | 48 | float intensity_factor = 1.0; 49 | float min_intensity = 0.0; 50 | float max_intensity = 500000.0; 51 | static bool paused; 52 | static int scroll_offset; // Position for scrolling 53 | 54 | protected: 55 | void initializeGL() override; 56 | void resizeGL(int width, int height) override; 57 | void paintGL() override; 58 | void mousePressEvent(QMouseEvent *event) override; 59 | 60 | private: 61 | Settings *settings; 62 | GLuint textureHandles[SPECTROGRAM_NOF_TEXTURES]; 63 | GLubyte *textureBuffer; 64 | int nextLine = 0; 65 | volatile bool textureUpdateNeeded; 66 | QElapsedTimer lastUpdate; 67 | #if PRINT_FPS 68 | QTimer fps_timer; 69 | uint32_t dataChangeCount; 70 | uint32_t textureUpdateCount; 71 | uint32_t textureDrawCount; 72 | #endif 73 | 74 | void initializeTextureBuffer(); 75 | void loadTexture(); 76 | void drawSpectrogram(); 77 | void intensityToRGB(float intensity, GLubyte *rgbaOut); 78 | 79 | signals: 80 | void subwindow_click(); 81 | 82 | public slots: 83 | #if PRINT_FPS 84 | void printFrameCount(); 85 | #endif 86 | 87 | }; 88 | -------------------------------------------------------------------------------- /src/gui/waterfall.h: -------------------------------------------------------------------------------- 1 | #ifndef WATERFALL_H 2 | #define WATERFALL_H 3 | 4 | #pragma once 5 | 6 | #include "qcustomplot/qcustomplot.h" 7 | #include "settings.h" 8 | #include "falcon/CCSnifferInterfaces.h" 9 | #include "spectrum.h" 10 | #include "adapters_qt/SpectrumAdapter.h" 11 | #include 12 | 13 | //#include "plots.h" 14 | 15 | class Waterfall : public QObject{ 16 | Q_OBJECT 17 | public: 18 | // Handle pointers on Main windows settings 19 | explicit Waterfall(Settings* p_glob_settings, SpectrumAdapter* p_spectrumAdapter, QMdiArea* p_mdiArea); 20 | ~Waterfall(); 21 | 22 | virtual void activate() = 0; 23 | virtual void deactivate() = 0; 24 | virtual void decorate() = 0; 25 | 26 | void wheelEvent(QWheelEvent *event); 27 | 28 | protected: 29 | bool active = false; 30 | Settings* glob_settings = nullptr; 31 | SpectrumAdapter* spectrumAdapter = nullptr; 32 | QMdiArea* mdiArea = nullptr; 33 | 34 | Spectrum *spectrum_view = nullptr; 35 | QWidget *m_window = nullptr; 36 | QMdiSubWindow *m_subwindow = nullptr; 37 | 38 | protected slots: 39 | void SubWindow_mousePressEvent(); 40 | void draw(const ScanLineLegacy*); 41 | void setFPS(int fps); 42 | }; 43 | 44 | class Waterfall_UL : public Waterfall{ 45 | Q_OBJECT 46 | public: 47 | Waterfall_UL(Settings* p_glob_settings, SpectrumAdapter* p_spectrumAdapter, QMdiArea* p_mdiArea); 48 | ~Waterfall_UL(); 49 | virtual void activate() override; 50 | virtual void deactivate() override; 51 | virtual void decorate() override; 52 | }; 53 | 54 | class Waterfall_DL : public Waterfall{ 55 | Q_OBJECT 56 | public: 57 | Waterfall_DL(Settings* p_glob_settings, SpectrumAdapter* p_spectrumAdapter, QMdiArea* p_mdiArea); 58 | ~Waterfall_DL(); 59 | virtual void activate() override; 60 | virtual void deactivate() override; 61 | virtual void decorate() override; 62 | }; 63 | 64 | class Waterfall_DIFF : public Waterfall{ 65 | Q_OBJECT 66 | public: 67 | Waterfall_DIFF(Settings* p_glob_settings, SpectrumAdapter* p_spectrumAdapter, QMdiArea* p_mdiArea); 68 | ~Waterfall_DIFF(); 69 | virtual void activate() override; 70 | virtual void deactivate() override; 71 | virtual void decorate() override; 72 | }; 73 | 74 | class Waterfall_SPEC : public Waterfall{ 75 | Q_OBJECT 76 | public: 77 | Waterfall_SPEC(Settings* p_glob_settings, SpectrumAdapter* p_spectrumAdapter, QMdiArea* p_mdiArea); 78 | ~Waterfall_SPEC(); 79 | virtual void activate() override; 80 | virtual void deactivate() override; 81 | virtual void decorate() override; 82 | void range_slider_value_changed(int _1st, int _2nd); 83 | }; 84 | 85 | #endif // WATERFALL_H 86 | -------------------------------------------------------------------------------- /src/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | add_executable(SearchSpace SearchSpace.cc) 4 | 5 | target_link_libraries(SearchSpace 6 | falcon_phy 7 | ${SRSLTE_LIBRARIES} 8 | ) 9 | -------------------------------------------------------------------------------- /src/performance-mode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## 3 | ## Copyright (c) 2019 Robert Falkenberg. 4 | ## 5 | ## This file is part of FALCON 6 | ## (see https://github.com/falkenber9/falcon). 7 | ## 8 | ## This program is free software: you can redistribute it and/or modify 9 | ## it under the terms of the GNU Affero General Public License as 10 | ## published by the Free Software Foundation, either version 3 of the 11 | ## License, or (at your option) any later version. 12 | ## 13 | ## This program is distributed in the hope that it will be useful, 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ## GNU Affero General Public License for more details. 17 | ## 18 | ## A copy of the GNU Affero General Public License can be found in 19 | ## the LICENSE file in the top-level directory of this distribution 20 | ## and at http://www.gnu.org/licenses/. 21 | ## 22 | 23 | gov="performance" 24 | echo "Setting CPU governor to '$gov'" 25 | ./set-cpu-governor.sh $gov 26 | -------------------------------------------------------------------------------- /src/powersave-mode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## 3 | ## Copyright (c) 2019 Robert Falkenberg. 4 | ## 5 | ## This file is part of FALCON 6 | ## (see https://github.com/falkenber9/falcon). 7 | ## 8 | ## This program is free software: you can redistribute it and/or modify 9 | ## it under the terms of the GNU Affero General Public License as 10 | ## published by the Free Software Foundation, either version 3 of the 11 | ## License, or (at your option) any later version. 12 | ## 13 | ## This program is distributed in the hope that it will be useful, 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ## GNU Affero General Public License for more details. 17 | ## 18 | ## A copy of the GNU Affero General Public License can be found in 19 | ## the LICENSE file in the top-level directory of this distribution 20 | ## and at http://www.gnu.org/licenses/. 21 | ## 22 | 23 | gov="powersave" 24 | echo "Setting CPU governor to '$gov'" 25 | ./set-cpu-governor.sh $gov 26 | -------------------------------------------------------------------------------- /src/set-cpu-governor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## 3 | ## Copyright (c) 2019 Robert Falkenberg. 4 | ## 5 | ## This file is part of FALCON 6 | ## (see https://github.com/falkenber9/falcon). 7 | ## 8 | ## This program is free software: you can redistribute it and/or modify 9 | ## it under the terms of the GNU Affero General Public License as 10 | ## published by the Free Software Foundation, either version 3 of the 11 | ## License, or (at your option) any later version. 12 | ## 13 | ## This program is distributed in the hope that it will be useful, 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ## GNU Affero General Public License for more details. 17 | ## 18 | ## A copy of the GNU Affero General Public License can be found in 19 | ## the LICENSE file in the top-level directory of this distribution 20 | ## and at http://www.gnu.org/licenses/. 21 | ## 22 | 23 | gov=$1 24 | 25 | for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "$gov" | sudo tee $file; done 26 | --------------------------------------------------------------------------------