mirror of https://github.com/PentHertz/srsLTE.git
Merge branch 'srsran:master' into master
This commit is contained in:
commit
987dda4345
|
@ -23,6 +23,7 @@ Checks: '*,-fuchsia-*,
|
|||
-google-runtime-references,-google-readability-casting,-google-build-using-namespace,
|
||||
google-default-arguments,-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-cert-err58-cpp,
|
||||
-altera-unroll-loops,
|
||||
-readability-function-cognitive-complexity,-readability-isolate-declaration,
|
||||
-misc-non-private-member-variables-in-classes,-altera-struct-pack-align,-readability-uppercase-literal-suffix,
|
||||
-cppcoreguidelines-non-private-member-variables-in-classes,
|
||||
|
|
11
.gdbinit
11
.gdbinit
|
@ -20,7 +20,7 @@ class BoundedVectorPrinter(object):
|
|||
self.value_type = self.val.type.template_argument(0)
|
||||
|
||||
def children(self):
|
||||
start = self.val['buffer'].cast(self.value_type.pointer())
|
||||
start = self.val['buffer']['_M_elems'].cast(self.value_type.pointer())
|
||||
length = int(self.val['size_'])
|
||||
for idx in range(length):
|
||||
yield f'[{idx}]', start[idx]
|
||||
|
@ -33,11 +33,10 @@ class BoundedVectorPrinter(object):
|
|||
def display_hint(self):
|
||||
return 'array'
|
||||
|
||||
@staticmethod
|
||||
def make(val):
|
||||
if str(val.type).startswith('srsran::bounded_vector<'):
|
||||
return BoundedVectorPrinter(val)
|
||||
def make_bounded_vector(val):
|
||||
if 'bounded_vector<' in str(val.type):
|
||||
return BoundedVectorPrinter(val)
|
||||
|
||||
gdb.pretty_printers.append(BoundedVectorPrinter.make)
|
||||
gdb.pretty_printers.append(make_bounded_vector)
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!--
|
||||
Before filing an issue, search for solutions here:
|
||||
- srsRAN users mailing list (http://www.softwareradiosystems.com/mailman/listinfo/srsran-users)
|
||||
- srsRAN users mailing list (https://lists.srsran.com/mailman/listinfo/srsran-users)
|
||||
-->
|
||||
|
||||
## Issue Description ##
|
||||
|
|
|
@ -1,48 +1,44 @@
|
|||
name: C/C++ CI
|
||||
on: push
|
||||
jobs:
|
||||
x86_ubuntu18_build:
|
||||
name: Build and test on x86 Ubuntu 18.04
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [gcc, clang]
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Build srsRAN on x86 Ubuntu 18.04
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev colordiff ninja-build valgrind
|
||||
mkdir build && cd build && cmake -DRF_FOUND=True -GNinja .. && ninja && ctest -T memcheck
|
||||
x86_ubuntu16_build:
|
||||
name: Build and test on x86 Ubuntu 16.04
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [gcc, clang]
|
||||
runs-on: ubuntu-16.04
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Build srsRAN on x86 Ubuntu 16.04
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev colordiff ninja-build valgrind
|
||||
mkdir build && cd build && cmake -DRF_FOUND=True -GNinja .. && ninja && ctest -T memcheck
|
||||
|
||||
aarch64_ubuntu18_build:
|
||||
runs-on: ubuntu-18.04
|
||||
name: Build on aarch64
|
||||
x86_ubuntu_build:
|
||||
name: Build on x86
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04]
|
||||
compiler: [gcc, clang]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Build srsRAN on aarch64
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build srsRAN on x86 ${{ matrix.os }}
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev colordiff ninja-build valgrind
|
||||
mkdir build && cd build && cmake -DRF_FOUND=True -GNinja .. && ninja && ctest
|
||||
|
||||
aarch64_ubuntu_build:
|
||||
name: Build on aarch64
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-20.04, ubuntu-18.04]
|
||||
compiler: [gcc, clang]
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
distro: ubuntu20.04
|
||||
- os: ubuntu-18.04
|
||||
distro: ubuntu18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build srsRAN on aarch64 ${{ matrix.os }}
|
||||
uses: uraimo/run-on-arch-action@master
|
||||
with:
|
||||
architecture: aarch64
|
||||
distribution: ubuntu18.04
|
||||
arch: aarch64
|
||||
distro: ${{ matrix.distro }}
|
||||
run: |
|
||||
export CTEST_PARALLEL_LEVEL=$(nproc --all)
|
||||
apt update
|
||||
apt install -y build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev ninja-build
|
||||
ls -l && pwd && mkdir build && cd build && cmake -DRF_FOUND=True -GNinja .. && ninja
|
||||
ls -l && pwd && mkdir build && cd build && cmake -DRF_FOUND=True -GNinja .. && ninja
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ "master" ]
|
||||
schedule:
|
||||
- cron: '38 10 * * 2'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get install \
|
||||
build-essential \
|
||||
cmake \
|
||||
libfftw3-dev \
|
||||
libmbedtls-dev \
|
||||
libpcsclite-dev \
|
||||
libboost-program-options-dev \
|
||||
libconfig++-dev \
|
||||
libsctp-dev \
|
||||
libuhd-dev \
|
||||
libzmq3-dev
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||
|
||||
# - run: |
|
||||
# echo "Run, Build Application using script"
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
23
.lgtm.yml
23
.lgtm.yml
|
@ -1,23 +0,0 @@
|
|||
extraction:
|
||||
cpp:
|
||||
prepare:
|
||||
packages:
|
||||
- build-essential
|
||||
- cmake
|
||||
- libfftw3-dev
|
||||
- libmbedtls-dev
|
||||
- libpcsclite-dev
|
||||
- libboost-program-options-dev
|
||||
- libconfig++-dev
|
||||
- libsctp-dev
|
||||
- libuhd-dev
|
||||
- libzmq3-dev
|
||||
configure:
|
||||
command:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake ..
|
||||
index:
|
||||
build_command:
|
||||
- cd build
|
||||
- make
|
31
.travis.yml
31
.travis.yml
|
@ -1,31 +0,0 @@
|
|||
dist: bionic
|
||||
sudo: required
|
||||
|
||||
before_script:
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get install -qq build-essential cmake libfftw3-dev libmbedtls-dev libpcsclite-dev libboost-program-options-dev libconfig++-dev libsctp-dev libczmq-dev libpcsclite-dev rapidjson-dev colordiff ninja-build clang-format-8
|
||||
|
||||
language: cpp
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
script:
|
||||
- sudo ln -s /usr/bin/clang-format-diff-8 /usr/bin/clang-format-diff
|
||||
- git remote set-branches --add origin master
|
||||
- git fetch
|
||||
- |
|
||||
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
|
||||
# Run only for PRs because target branch is needed to do the clang-format check
|
||||
echo "Checking clang-format between TRAVIS_BRANCH=$TRAVIS_BRANCH and TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH"
|
||||
./run-clang-format-diff.sh "$TRAVIS_BRANCH" "$TRAVIS_PULL_REQUEST_BRANCH"
|
||||
else
|
||||
echo "Skipping clang-format check"
|
||||
fi
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DENABLE_TTCN3=True -DRF_FOUND=True -G Ninja ..
|
||||
- ninja
|
||||
- ninja test
|
||||
- sudo ninja install
|
34
CHANGELOG
34
CHANGELOG
|
@ -1,6 +1,40 @@
|
|||
Change Log for Releases
|
||||
=======================
|
||||
|
||||
## 22.10
|
||||
* Fix DL NAS integrity checks in srsUE
|
||||
* Remove Travis and LGTM as CI platforms
|
||||
* Remove polarssl as optional dependency (only mbedTLS used and required for security)
|
||||
* Allow to specify multiple PLMNs in SIB1
|
||||
* Allow non-blocking S1AP connect and expose various other SCTP options
|
||||
* Add support to broadcast MAC backoff indicator
|
||||
* Seperate T300/T301 timer in srsENB
|
||||
* Fix in eMBMS payload buffer handling
|
||||
* Fix memleak in NR scheduler
|
||||
|
||||
## 22.04.1
|
||||
* Various bug fixes in RLC AM and PDCP for NR
|
||||
* Fix crash when UE attempted to reestablish in SA
|
||||
* Remove fixed coreset0 index for SSB
|
||||
* Add support for SIB5 and SIB6 transmission in LTE
|
||||
|
||||
## 22.04
|
||||
* Added baseline 5G-SA support to srsUE and srsENB
|
||||
* Added dynamic loading of RF libraries
|
||||
* Added RRC Redirect to srsUE
|
||||
* Added support for A5 measurement events to srsENB
|
||||
* Added Crest Factor Reduction (CFR) for srsENB downlink and srsUE uplink (4G only)
|
||||
* Raise C++ standard to C++14
|
||||
* Other bug-fixes and improved stability and performance in all parts
|
||||
|
||||
## 21.10
|
||||
* Add initial 5G NSA support to srsENB (tested with OnePlus 5G Nord)
|
||||
* Improved interoperability of srsUE in NSA mode
|
||||
* Added enhanced instrumentation to file using JSON format
|
||||
* Fixed stability issues with Ettus N310
|
||||
* Added BLER-adaptive MCS scheduling to srsENB
|
||||
* Other bug-fixes and improved stability and performance in all parts
|
||||
|
||||
## 21.04
|
||||
* Rename project from srsLTE to srsRAN
|
||||
* Add initial 5G NSA support to srsUE (including x86-optimized FEC and PHY layer)
|
||||
|
|
141
CMakeLists.txt
141
CMakeLists.txt
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
@ -30,7 +30,7 @@ endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
|||
########################################################################
|
||||
# Project setup
|
||||
########################################################################
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project( SRSRAN )
|
||||
message( STATUS "CMAKE_SYSTEM: " ${CMAKE_SYSTEM} )
|
||||
message( STATUS "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR} )
|
||||
|
@ -67,42 +67,46 @@ option(ENABLE_SRSENB "Build srsENB application" ON)
|
|||
option(ENABLE_SRSEPC "Build srsEPC application" ON)
|
||||
option(DISABLE_SIMD "Disable SIMD instructions" OFF)
|
||||
option(AUTO_DETECT_ISA "Autodetect supported ISA extensions" ON)
|
||||
|
||||
|
||||
option(ENABLE_GUI "Enable GUI (using srsGUI)" ON)
|
||||
option(ENABLE_RF_PLUGINS "Enable RF plugins" ON)
|
||||
option(ENABLE_UHD "Enable UHD" ON)
|
||||
option(ENABLE_BLADERF "Enable BladeRF" ON)
|
||||
option(ENABLE_SOAPYSDR "Enable SoapySDR" ON)
|
||||
option(ENABLE_SKIQ "Enable Sidekiq SDK" ON)
|
||||
option(ENABLE_ZEROMQ "Enable ZeroMQ" ON)
|
||||
option(ENABLE_HARDSIM "Enable support for SIM cards" ON)
|
||||
|
||||
|
||||
option(ENABLE_TTCN3 "Enable TTCN3 test binaries" OFF)
|
||||
option(ENABLE_ZMQ_TEST "Enable ZMQ based E2E tests" OFF)
|
||||
|
||||
|
||||
option(BUILD_STATIC "Attempt to statically link external deps" OFF)
|
||||
option(RPATH "Enable RPATH" OFF)
|
||||
option(ENABLE_ASAN "Enable gcc/clang address sanitizer" OFF)
|
||||
option(ENABLE_GCOV "Enable gcc/clang address sanitizer" OFF)
|
||||
option(ENABLE_GCOV "Enable gcov" OFF)
|
||||
option(ENABLE_MSAN "Enable clang memory sanitizer" OFF)
|
||||
option(ENABLE_TSAN "Enable clang thread sanitizer" OFF)
|
||||
option(ENABLE_TIDY "Enable clang tidy" OFF)
|
||||
|
||||
|
||||
option(USE_LTE_RATES "Use standard LTE sampling rates" OFF)
|
||||
option(USE_MKL "Use MKL instead of fftw" OFF)
|
||||
|
||||
|
||||
option(ENABLE_TIMEPROF "Enable time profiling" ON)
|
||||
|
||||
|
||||
option(FORCE_32BIT "Add flags to force 32 bit compilation" OFF)
|
||||
|
||||
option(ENABLE_SRSLOG_TRACING "Enable event tracing using srslog" OFF)
|
||||
option(ASSERTS_ENABLED "Enable srsRAN asserts" ON)
|
||||
option(STOP_ON_WARNING "Interrupt application on warning" OFF)
|
||||
|
||||
option(ENABLE_ALL_TEST "Enable all unit/component test" OFF)
|
||||
|
||||
# Users that want to try this feature need to make sure the lto plugin is
|
||||
# loaded by bintools (ar, nm, ...). Older versions of bintools will not do
|
||||
# it automatically so it is necessary to use the gcc wrappers of the compiler
|
||||
# (gcc-ar, gcc-nm, ...).
|
||||
option(BUILD_WITH_LTO "Enable LTO (experimental)" OFF)
|
||||
|
||||
|
||||
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
|
||||
set(GCC_ARCH armv8-a CACHE STRING "GCC compile for specific architecture.")
|
||||
message(STATUS "Detected aarch64 processor")
|
||||
|
@ -176,29 +180,17 @@ else(USE_MKL)
|
|||
endif(USE_MKL)
|
||||
|
||||
# Crypto
|
||||
find_package(Polarssl)
|
||||
if (POLARSSL_FOUND)
|
||||
set(SEC_INCLUDE_DIRS "${POLARSSL_INCLUDE_DIRS}")
|
||||
find_package(MbedTLS REQUIRED)
|
||||
if (MBEDTLS_FOUND)
|
||||
set(SEC_INCLUDE_DIRS "${MBEDTLS_INCLUDE_DIRS}")
|
||||
if(BUILD_STATIC)
|
||||
set(SEC_LIBRARIES "${POLARSSL_STATIC_LIBRARIES}")
|
||||
set(SEC_LIBRARIES "${MBEDTLS_STATIC_LIBRARIES}")
|
||||
else(BUILD_STATIC)
|
||||
set(SEC_LIBRARIES "${POLARSSL_LIBRARIES}")
|
||||
set(SEC_LIBRARIES "${MBEDTLS_LIBRARIES}")
|
||||
endif(BUILD_STATIC)
|
||||
add_definitions(-DHAVE_POLARSSL)
|
||||
else(POLARSSL_FOUND)
|
||||
find_package(MbedTLS REQUIRED)
|
||||
if (MBEDTLS_FOUND)
|
||||
set(SEC_INCLUDE_DIRS "${MBEDTLS_INCLUDE_DIRS}")
|
||||
if(BUILD_STATIC)
|
||||
set(SEC_LIBRARIES "${MBEDTLS_STATIC_LIBRARIES}")
|
||||
else(BUILD_STATIC)
|
||||
set(SEC_LIBRARIES "${MBEDTLS_LIBRARIES}")
|
||||
endif(BUILD_STATIC)
|
||||
add_definitions(-DHAVE_MBEDTLS)
|
||||
else(MBEDTLS_FOUND)
|
||||
message(FATAL_ERROR "Either PolarSSL or mbedTLS are required to build srsRAN")
|
||||
endif (MBEDTLS_FOUND)
|
||||
endif(POLARSSL_FOUND)
|
||||
else(MBEDTLS_FOUND)
|
||||
message(FATAL_ERROR "mbedTLS is required to build srsRAN")
|
||||
endif (MBEDTLS_FOUND)
|
||||
|
||||
# Hard-SIM support
|
||||
if(ENABLE_HARDSIM)
|
||||
|
@ -221,6 +213,15 @@ if(ENABLE_UHD)
|
|||
endif(UHD_FOUND)
|
||||
endif(ENABLE_UHD)
|
||||
|
||||
# SKIQ
|
||||
if (ENABLE_SKIQ)
|
||||
find_package(SKIQ)
|
||||
if(SKIQ_FOUND)
|
||||
include_directories(${SKIQ_INCLUDE_DIRS})
|
||||
link_directories(${SKIQ_LIBRARY_DIRS})
|
||||
endif(SKIQ_FOUND)
|
||||
endif (ENABLE_SKIQ)
|
||||
|
||||
# BladeRF
|
||||
if(ENABLE_BLADERF)
|
||||
find_package(bladeRF)
|
||||
|
@ -253,12 +254,12 @@ if(ENABLE_TIMEPROF)
|
|||
add_definitions(-DENABLE_TIMEPROF)
|
||||
endif(ENABLE_TIMEPROF)
|
||||
|
||||
if(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR ZEROMQ_FOUND)
|
||||
if(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR ZEROMQ_FOUND OR SKIQ_FOUND)
|
||||
set(RF_FOUND TRUE CACHE INTERNAL "RF frontend found")
|
||||
else(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR ZEROMQ_FOUND)
|
||||
else(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR ZEROMQ_FOUND OR SKIQ_FOUND)
|
||||
set(RF_FOUND FALSE CACHE INTERNAL "RF frontend found")
|
||||
add_definitions(-DDISABLE_RF)
|
||||
endif(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR ZEROMQ_FOUND)
|
||||
endif(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR ZEROMQ_FOUND OR SKIQ_FOUND)
|
||||
|
||||
# Boost
|
||||
if(BUILD_STATIC)
|
||||
|
@ -268,6 +269,9 @@ endif(BUILD_STATIC)
|
|||
set(BOOST_REQUIRED_COMPONENTS
|
||||
program_options
|
||||
)
|
||||
if(UHD_FOUND) # Ubuntu 18.04 requires component 'system' to link UHD
|
||||
list(APPEND BOOST_REQUIRED_COMPONENTS "system")
|
||||
endif(UHD_FOUND)
|
||||
if(UNIX AND EXISTS "/usr/lib64")
|
||||
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
|
||||
endif(UNIX AND EXISTS "/usr/lib64")
|
||||
|
@ -367,22 +371,24 @@ macro(ADD_C_COMPILER_FLAG_IF_AVAILABLE flag have)
|
|||
endmacro(ADD_C_COMPILER_FLAG_IF_AVAILABLE)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++11 -fno-strict-aliasing")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-comment -Wno-reorder -Wno-unused-variable -Wtype-limits -std=c++14 -fno-strict-aliasing")
|
||||
|
||||
ADD_C_COMPILER_FLAG_IF_AVAILABLE("-Wno-unused-but-set-variable" HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
|
||||
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-Wno-unused-but-set-variable" HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
|
||||
|
||||
if (AUTO_DETECT_ISA)
|
||||
find_package(SSE)
|
||||
endif (AUTO_DETECT_ISA)
|
||||
|
||||
ADD_C_COMPILER_FLAG_IF_AVAILABLE("-march=${GCC_ARCH}" HAVE_MARCH_${GCC_ARCH})
|
||||
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-march=${GCC_ARCH}" HAVE_MARCH_${GCC_ARCH})
|
||||
|
||||
if (HAVE_AVX2)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE")
|
||||
else (HAVE_AVX2)
|
||||
if(HAVE_AVX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
|
||||
elseif(HAVE_SSE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -msse4.1 -DLV_HAVE_SSE")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -msse4.1 -DLV_HAVE_SSE")
|
||||
endif(HAVE_AVX)
|
||||
endif (HAVE_AVX2)
|
||||
|
||||
|
@ -394,8 +400,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|||
endif(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||
|
||||
if(FORCE_32BIT)
|
||||
ADD_C_COMPILER_FLAG_IF_AVAILABLE("-m32" HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
|
||||
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-m32" HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
|
||||
ADD_C_COMPILER_FLAG_IF_AVAILABLE("-m32" HAVE_M32)
|
||||
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-m32" HAVE_M32)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-m32")
|
||||
endif(FORCE_32BIT)
|
||||
|
||||
|
@ -406,6 +412,7 @@ ADD_C_COMPILER_FLAG_IF_AVAILABLE("-Werror=incompatible-pointer-types" HAVE_ERROR
|
|||
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-comment -Wno-write-strings -Wno-unused-result -Wformat -Wmissing-field-initializers -Wtype-limits -std=c99 -fno-strict-aliasing -D_GNU_SOURCE")
|
||||
|
||||
ADD_C_COMPILER_FLAG_IF_AVAILABLE("-Wno-unused-but-set-variable" HAVE_WNO_UNUSED_BUT_SET_VARIABLE)
|
||||
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -O0 -DDEBUG_MODE -DBUILD_TYPE_DEBUG")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0 -DDEBUG_MODE -DBUILD_TYPE_DEBUG")
|
||||
|
@ -432,12 +439,12 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|||
find_package(SSE)
|
||||
endif (AUTO_DETECT_ISA)
|
||||
if (HAVE_AVX2)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -mavx2 -DLV_HAVE_AVX2 -DLV_HAVE_AVX -DLV_HAVE_SSE")
|
||||
else (HAVE_AVX2)
|
||||
if(HAVE_AVX)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -mavx -DLV_HAVE_AVX -DLV_HAVE_SSE")
|
||||
elseif(HAVE_SSE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=${GCC_ARCH} -mfpmath=sse -msse4.1 -DLV_HAVE_SSE")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -msse4.1 -DLV_HAVE_SSE")
|
||||
endif(HAVE_AVX)
|
||||
endif (HAVE_AVX2)
|
||||
|
||||
|
@ -491,18 +498,22 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|||
endif ()
|
||||
|
||||
if (ENABLE_ASAN)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
# Note: When using ASAN, we need to ensure the use of RPATH instead of RUNPATH via "-Wl,--disable-new-dtags"
|
||||
# While RPATH is default, some systems (e.g. Ubuntu 18.04 and 20.04) use RUNPATH by default, which is non-transitive.
|
||||
# Since ASAN intercepts dlopen(), by which it replaces the dynamic string token "$ORIGIN" to its own location,
|
||||
# the RF plugins won't be found by "libsrsran_rf.so" when using ASAN + RUNPATH in the top-level executable.
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer -Wl,--disable-new-dtags")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -Wl,--disable-new-dtags")
|
||||
endif (ENABLE_ASAN)
|
||||
|
||||
if (ENABLE_TSAN)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread -DHAVE_TSAN")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
|
||||
endif (ENABLE_TSAN)
|
||||
|
||||
if (ENABLE_MSAN AND CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory -fno-omit-frame-pointer -fPIE -pie")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory -fno-omit-frame-pointer -fPIE -pie")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory -fno-omit-frame-pointer -fsanitize-memory-track-origins -fPIE")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory -fno-omit-frame-pointer -fsanitize-memory-track-origins -fPIE")
|
||||
endif (ENABLE_MSAN AND CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
if (ENABLE_GCOV)
|
||||
|
@ -519,8 +530,8 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|||
|
||||
# Add colored output when using the Ninja generator
|
||||
if("Ninja" STREQUAL ${CMAKE_GENERATOR})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
|
||||
ADD_C_COMPILER_FLAG_IF_AVAILABLE("-fdiagnostics-color=always" HAVE_DIAGNOSTIC_COLOR_C)
|
||||
ADD_CXX_COMPILER_FLAG_IF_AVAILABLE("-fdiagnostics-color=always" HAVE_DIAGNOSTIC_COLOR_CXX)
|
||||
endif()
|
||||
|
||||
# Add -Werror to C/C++ flags for newer compilers
|
||||
|
@ -529,11 +540,22 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||
endif()
|
||||
|
||||
# GCC >= 11.2.0: Disable analysis on "maybe-uninitialized" variables because of the high false-positive rate
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.2)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-maybe-uninitialized")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
# Increase inlining limit to allow gcc compilation on e.g. RPi2
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --param large-function-growth=1600")
|
||||
endif(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
|
||||
if (EXTRA_TERM_TIMEOUT_S)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSRSRAN_TERM_TIMEOUT_S=${EXTRA_TERM_TIMEOUT_S}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSRSRAN_TERM_TIMEOUT_S=${EXTRA_TERM_TIMEOUT_S}")
|
||||
endif (EXTRA_TERM_TIMEOUT_S)
|
||||
|
||||
message(STATUS "CMAKE_C_FLAGS is ${CMAKE_C_FLAGS}")
|
||||
message(STATUS "CMAKE_CXX_FLAGS is ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
|
@ -605,6 +627,18 @@ function(add_nr_test)
|
|||
set_tests_properties(${TNAME} PROPERTIES LABELS "nr;${CTEST_LABELS}")
|
||||
endfunction()
|
||||
|
||||
function(add_nr_advanced_test)
|
||||
if (NOT ${ENABLE_ALL_TEST})
|
||||
return()
|
||||
endif()
|
||||
add_test(${ARGN})
|
||||
set(TNAME ${ARGV0})
|
||||
if(${TNAME} STREQUAL NAME)
|
||||
set(TNAME ${ARGV1})
|
||||
endif()
|
||||
set_tests_properties(${TNAME} PROPERTIES LABELS "nr;${CTEST_LABELS}")
|
||||
endfunction()
|
||||
|
||||
########################################################################
|
||||
# Add general includes and dependencies
|
||||
########################################################################
|
||||
|
@ -638,13 +672,14 @@ if(RF_FOUND)
|
|||
endif(ENABLE_SRSUE)
|
||||
|
||||
if(ENABLE_SRSENB)
|
||||
message(STATUS "Building with srsENB")
|
||||
message(STATUS "Building with srsENB/srsGNB")
|
||||
add_subdirectory(srsenb)
|
||||
add_subdirectory(srsgnb)
|
||||
else(ENABLE_SRSENB)
|
||||
message(STATUS "srsENB build disabled")
|
||||
message(STATUS "srsENB/srsGNB build disabled")
|
||||
endif(ENABLE_SRSENB)
|
||||
else(RF_FOUND)
|
||||
message(STATUS "srsUE and srsENB builds disabled due to missing RF driver")
|
||||
message(STATUS "srsUE and srsENB/srsGNB builds disabled due to missing RF driver")
|
||||
endif(RF_FOUND)
|
||||
|
||||
if(ENABLE_SRSEPC)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Files: *
|
||||
Copyright: 2013-2021, Software Radio Systems Limited.
|
||||
Copyright: 2013-2022, Software Radio Systems Limited.
|
||||
License:
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
@ -24,4 +24,4 @@ set(CTEST_DROP_METHOD "http")
|
|||
set(CTEST_DROP_SITE "my.cdash.org")
|
||||
set(CTEST_DROP_LOCATION "/submit.php?project=srsRAN")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||
set(VALGRIND_COMMAND_OPTIONS "--error-exitcode=1 --trace-children=yes --leak-check=full --show-reachable=yes --vex-guest-max-insns=25")
|
||||
set(VALGRIND_COMMAND_OPTIONS "--error-exitcode=1 --trace-children=yes --leak-check=full --show-leak-kinds=all --track-origins=yes --show-reachable=yes --vex-guest-max-insns=25")
|
||||
|
|
12
README.md
12
README.md
|
@ -1,17 +1,17 @@
|
|||
srsRAN
|
||||
======
|
||||
|
||||
[![Build Status](https://travis-ci.com/srsran/srsRAN.svg?branch=master)](https://travis-ci.com/srsran/srsRAN)
|
||||
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/srsran/srsRAN.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/srsran/srsRAN/context:cpp)
|
||||
[![Coverity](https://scan.coverity.com/projects/23048/badge.svg)](https://scan.coverity.com/projects/srsran_agpl)
|
||||
[![Build Status](https://github.com/srsran/srsRAN/actions/workflows/ccpp.yml/badge.svg?branch=master)](https://github.com/srsran/srsRAN/actions/workflows/ccpp.yml)
|
||||
[![CodeQL](https://github.com/srsran/srsRAN/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/srsran/srsRAN/actions/workflows/codeql.yml)
|
||||
[![Coverity](https://scan.coverity.com/projects/23045/badge.svg)](https://scan.coverity.com/projects/srsran)
|
||||
|
||||
srsRAN is a 4G/5G software radio suite developed by [SRS](http://www.srs.io).
|
||||
|
||||
See the [srsRAN project pages](https://www.srsran.com) for information, guides and project news.
|
||||
|
||||
The srsRAN suite includes:
|
||||
* srsUE - a full-stack SDR 4G/5G-NSA UE application (5G-SA coming soon)
|
||||
* srsENB - a full-stack SDR 4G eNodeB application (5G-NSA and 5G-SA coming soon)
|
||||
* srsUE - a full-stack SDR 4G/5G UE application
|
||||
* srsENB - a full-stack SDR 4G/5G e(g)NodeB application
|
||||
* srsEPC - a light-weight 4G core network implementation with MME, HSS and S/P-GW
|
||||
|
||||
For application features, build instructions and user guides see the [srsRAN documentation](https://docs.srsran.com).
|
||||
|
@ -21,4 +21,4 @@ For license details, see LICENSE file.
|
|||
Support
|
||||
=======
|
||||
|
||||
Mailing list: https://lists.softwareradiosystems.com/mailman/listinfo/srslte-users
|
||||
Mailing list: https://lists.srsran.com/mailman/listinfo/srsran-users
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# By using this file, you agree to the terms and conditions set
|
||||
# forth in the LICENSE file which can be found at the top level of
|
||||
# the distribution.
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
# srsRAN is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# srsRAN is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# A copy of the GNU Affero General Public License can be found in
|
||||
# the LICENSE file in the top-level directory of this distribution
|
||||
# and at http://www.gnu.org/licenses/.
|
||||
#
|
||||
|
||||
# Adopted from https://github.com/pothosware/SoapyRTLSDR
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
@ -23,13 +23,16 @@ if(NOT LIMESDR_FOUND)
|
|||
|
||||
find_path(LIMESDR_INCLUDE_DIRS
|
||||
NAMES LimeSuite.h
|
||||
HINTS $ENV{LIMESUITE_DIR}/include
|
||||
PATHS ${LIMESDR_PKG_INCLUDE_DIRS}
|
||||
/usr/include/lime
|
||||
/usr/local/include/lime
|
||||
$ENV{LIMESUITE_DIR}/include/lime
|
||||
)
|
||||
|
||||
find_library(LIMESDR_LIBRARIES
|
||||
NAMES LimeSuite
|
||||
HINTS $ENV{LIMESUITE_DIR}/lib
|
||||
PATHS ${LIMESDR_PKG_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
@ -28,31 +28,45 @@
|
|||
find_path(MKL_INCLUDE_DIR
|
||||
NAMES mkl.h
|
||||
HINTS $ENV{MKL_DIR}/include
|
||||
/opt/intel/oneapi/mkl/latest/include
|
||||
/opt/intel/mkl/include
|
||||
/usr/include/mkl
|
||||
PATHS)
|
||||
|
||||
find_path(MKL_FFTW_INCLUDE_DIR
|
||||
NAMES fftw3.h
|
||||
HINTS $ENV{MKL_DIR}/include/fftw
|
||||
/opt/intel/oneapi/mkl/latest/include/fftw
|
||||
/opt/intel/mkl/include/fftw
|
||||
/usr/include/mkl/fftw
|
||||
PATHS)
|
||||
|
||||
find_library(MKL_LIBRARIES
|
||||
NAMES mkl_rt
|
||||
HINTS $ENV{MKL_DIR}/lib/intel64
|
||||
/opt/intel/oneapi/mkl/latest/lib/intel64
|
||||
/opt/intel/mkl/lib/intel64
|
||||
PATHS)
|
||||
|
||||
find_library(MKL_CORE
|
||||
NAMES libmkl_core.a
|
||||
HINTS $ENV{MKL_DIR}/lib/intel64
|
||||
/opt/intel/oneapi/mkl/latest/lib/intel64/
|
||||
/opt/intel/mkl/lib/intel64
|
||||
PATHS)
|
||||
|
||||
find_library(MKL_ILP
|
||||
NAMES libmkl_intel_ilp64.a
|
||||
HINTS $ENV{MKL_DIR}/lib/intel64
|
||||
/opt/intel/oneapi/mkl/latest/lib/intel64/
|
||||
/opt/intel/mkl/lib/intel64
|
||||
PATHS)
|
||||
|
||||
find_library(MKL_SEQ
|
||||
NAMES libmkl_sequential.a
|
||||
HINTS $ENV{MKL_DIR}/lib/intel64
|
||||
/opt/intel/oneapi/mkl/latest/lib/intel64/
|
||||
/opt/intel/mkl/lib/intel64
|
||||
PATHS)
|
||||
|
||||
set(MKL_STATIC_LIBRARIES -Wl,--start-group ${MKL_CORE} ${MKL_ILP} ${MKL_SEQ} -Wl,--end-group -lpthread -lm -ldl)
|
||||
|
@ -61,7 +75,7 @@ set(MKL_INCLUDE_DIRS ${MKL_INCLUDE_DIR} ${MKL_FFTW_INCLUDE_DIR})
|
|||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set MKL_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(mkl DEFAULT_MSG
|
||||
find_package_handle_standard_args(MKL DEFAULT_MSG
|
||||
MKL_LIBRARIES MKL_CORE MKL_ILP MKL_SEQ MKL_INCLUDE_DIRS)
|
||||
|
||||
if(MKL_FOUND)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
# srsRAN is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# srsRAN is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# A copy of the GNU Affero General Public License can be found in
|
||||
# the LICENSE file in the top-level directory of this distribution
|
||||
# and at http://www.gnu.org/licenses/.
|
||||
#
|
||||
|
||||
# - Try to find polarssl
|
||||
#
|
||||
# Once done this will define
|
||||
# POLARSSL_FOUND - System has polarssl
|
||||
# POLARSSL_INCLUDE_DIRS - The polarssl include directories
|
||||
# POLARSSL_LIBRARIES - The polarssl library
|
||||
|
||||
FIND_PACKAGE(PkgConfig REQUIRED)
|
||||
PKG_CHECK_MODULES(PC_POLARSSL polarssl)
|
||||
|
||||
FIND_PATH(
|
||||
POLARSSL_INCLUDE_DIRS
|
||||
NAMES polarssl/version.h
|
||||
HINTS $ENV{POLARSSL_DIR}/include
|
||||
${PC_POLARSSL_INCLUDEDIR}
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
PATHS /usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(
|
||||
POLARSSL_LIBRARIES
|
||||
NAMES polarssl
|
||||
HINTS $ENV{POLARSSL_DIR}/lib
|
||||
${PC_POLARSSL_LIBDIR}
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib64
|
||||
PATHS /usr/local/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib
|
||||
/usr/lib64
|
||||
)
|
||||
|
||||
FIND_LIBRARY(
|
||||
POLARSSL_STATIC_LIBRARIES
|
||||
NAMES libpolarssl.a
|
||||
HINTS $ENV{POLARSSL_DIR}/lib
|
||||
${PC_POLARSSL_LIBDIR}
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib64
|
||||
PATHS /usr/local/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib
|
||||
/usr/lib64
|
||||
)
|
||||
|
||||
message(STATUS "POLARSSL LIBRARIES: " ${POLARSSL_LIBRARIES})
|
||||
message(STATUS "POLARSSL STATIC LIBRARIES: " ${POLARSSL_STATIC_LIBRARIES})
|
||||
message(STATUS "POLARSSL INCLUDE DIRS: " ${POLARSSL_INCLUDE_DIRS})
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Polarssl DEFAULT_MSG POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)
|
||||
MARK_AS_ADVANCED(POLARSSL_STATIC_LIBRARIES POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
#
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
# srsRAN is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# srsRAN is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# A copy of the GNU Affero General Public License can be found in
|
||||
# the LICENSE file in the top-level directory of this distribution
|
||||
# and at http://www.gnu.org/licenses/.
|
||||
#
|
||||
|
||||
FIND_PACKAGE(PkgConfig REQUIRED)
|
||||
#PKG_CHECK_MODULES(SKIQ SKIQ)
|
||||
IF(NOT SKIQ_FOUND)
|
||||
|
||||
FIND_PATH(
|
||||
SKIQ_INCLUDE_DIRS
|
||||
NAMES sidekiq_api.h
|
||||
HINTS $ENV{SKIQ_DIR}/inc
|
||||
$ENV{SKIQ_DIR}/sidekiq_core/inc
|
||||
PATHS /usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(
|
||||
SKIQ_LIBRARY
|
||||
NAMES sidekiq__x86_64.gcc
|
||||
HINTS $ENV{SKIQ_DIR}/lib
|
||||
PATHS /usr/local/lib
|
||||
/usr/lib
|
||||
/usr/lib/x86_64-linux-gnu
|
||||
/usr/local/lib64
|
||||
/usr/local/lib32
|
||||
)
|
||||
|
||||
FIND_LIBRARY(
|
||||
SKIQ_LIBRARY_GLIB
|
||||
NAMES libglib-2.0.a
|
||||
HINTS $ENV{SKIQ_DIR}/lib/support/x86_64.gcc/usr/lib/epiq
|
||||
PATHS /usr/local/lib
|
||||
/usr/lib
|
||||
/usr/lib/epiq
|
||||
/usr/lib/x86_64-linux-gnu
|
||||
/usr/local/lib64
|
||||
/usr/local/lib32
|
||||
)
|
||||
|
||||
FIND_LIBRARY(
|
||||
SKIQ_LIBRARY_USB
|
||||
NAMES libusb-1.0.a
|
||||
HINTS $ENV{SKIQ_DIR}/lib/support/x86_64.gcc/usr/lib/epiq
|
||||
PATHS /usr/local/lib
|
||||
/usr/lib
|
||||
/usr/lib/epiq
|
||||
/usr/lib/x86_64-linux-gnu
|
||||
/usr/local/lib64
|
||||
/usr/local/lib32
|
||||
)
|
||||
|
||||
FIND_LIBRARY(
|
||||
SKIQ_LIBRARY_TIRPC
|
||||
NAMES libtirpc.so.3
|
||||
PATHS /usr/local/lib
|
||||
/usr/lib64
|
||||
/usr/lib/epiq
|
||||
/usr/lib/x86_64-linux-gnu
|
||||
/usr/local/lib64
|
||||
/usr/local/lib32
|
||||
)
|
||||
|
||||
set(SKIQ_LIBRARIES ${SKIQ_LIBRARY} ${SKIQ_LIBRARY_GLIB} ${SKIQ_LIBRARY_USB} ${SKIQ_LIBRARY_TIRPC})
|
||||
|
||||
message(STATUS "SKIQ LIBRARIES " ${SKIQ_LIBRARIES})
|
||||
message(STATUS "SKIQ INCLUDE DIRS " ${SKIQ_INCLUDE_DIRS})
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SKIQ DEFAULT_MSG SKIQ_LIBRARIES SKIQ_INCLUDE_DIRS)
|
||||
MARK_AS_ADVANCED(SKIQ_LIBRARIES SKIQ_INCLUDE_DIRS)
|
||||
|
||||
ENDIF(NOT SKIQ_FOUND)
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
@ -23,14 +23,16 @@ if(NOT SOAPYSDR_FOUND)
|
|||
pkg_check_modules (SOAPYSDR_PKG SoapySDR)
|
||||
|
||||
find_path(SOAPYSDR_INCLUDE_DIRS
|
||||
NAMES Device.h
|
||||
NAMES SoapySDR/Device.h
|
||||
HINTS $ENV{SOAPY_DIR}/include
|
||||
PATHS ${SOAPYSDR_PKG_INCLUDE_DIRS}
|
||||
/usr/include/SoapySDR
|
||||
/usr/local/include/SoapySDR
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(SOAPYSDR_LIBRARIES
|
||||
NAMES SoapySDR
|
||||
HINTS $ENV{SOAPY_DIR}/lib
|
||||
PATHS ${SOAPYSDR_PKG_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
@ -20,18 +20,21 @@
|
|||
|
||||
if(NOT BLADERF_FOUND)
|
||||
pkg_check_modules (BLADERF_PKG libbladeRF)
|
||||
find_path(BLADERF_INCLUDE_DIRS NAMES libbladeRF.h
|
||||
PATHS
|
||||
${BLADERF_PKG_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
|
||||
find_path(BLADERF_INCLUDE_DIRS
|
||||
NAMES libbladeRF.h
|
||||
HINTS $ENV{BLADERF_DIR}/include
|
||||
PATHS ${BLADERF_PKG_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(BLADERF_LIBRARIES NAMES bladeRF
|
||||
PATHS
|
||||
${BLADERF_PKG_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
find_library(BLADERF_LIBRARIES
|
||||
NAMES bladeRF
|
||||
HINTS $ENV{BLADERF_DIR}/lib
|
||||
PATHS ${BLADERF_PKG_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(BLADERF_INCLUDE_DIRS AND BLADERF_LIBRARIES)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
@ -18,8 +18,8 @@
|
|||
# and at http://www.gnu.org/licenses/.
|
||||
#
|
||||
|
||||
SET(SRSRAN_VERSION_MAJOR 21)
|
||||
SET(SRSRAN_VERSION_MINOR 04)
|
||||
SET(SRSRAN_VERSION_MAJOR 22)
|
||||
SET(SRSRAN_VERSION_MINOR 10)
|
||||
SET(SRSRAN_VERSION_PATCH 0)
|
||||
SET(SRSRAN_VERSION_STRING "${SRSRAN_VERSION_MAJOR}.${SRSRAN_VERSION_MINOR}.${SRSRAN_VERSION_PATCH}")
|
||||
SET(SRSRAN_SOVERSION 0)
|
||||
|
|
|
@ -105,7 +105,7 @@ install_file "ue.conf.example"
|
|||
install_file "enb.conf.example"
|
||||
install_file "sib.conf.example"
|
||||
install_file "rr.conf.example"
|
||||
install_file "drb.conf.example"
|
||||
install_file "rb.conf.example"
|
||||
install_file "epc.conf.example"
|
||||
install_file "mbms.conf.example"
|
||||
install_file "user_db.csv.example"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref HEAD
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
@ -66,7 +66,7 @@ endif(SRSGUI_FOUND)
|
|||
|
||||
if (ZEROMQ_FOUND)
|
||||
add_executable(zmq_remote_rx zmq_remote_rx.c)
|
||||
target_link_libraries(zmq_remote_rx srsran_phy srsran_rf)
|
||||
target_link_libraries(zmq_remote_rx srsran_phy srsran_rf ${ZEROMQ_LIBRARIES})
|
||||
endif (ZEROMQ_FOUND)
|
||||
|
||||
#################################################################
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -106,7 +106,7 @@ void parse_args(int argc, char** argv)
|
|||
rf_gain = strtof(argv[optind], NULL);
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -106,7 +106,7 @@ void parse_args(int argc, char** argv)
|
|||
scan_raster_offset = true;
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -170,7 +170,7 @@ void parse_args(int argc, char** argv)
|
|||
cell.nbiot_prb = (uint32_t)strtol(argv[optind], NULL, 10);
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
|
@ -692,10 +692,9 @@ int main(int argc, char** argv)
|
|||
// find the noise spectral density
|
||||
float snr_lin = srsran_convert_dB_to_power(file_snr);
|
||||
float n0 = abs_avg / snr_lin;
|
||||
float nstd = sqrtf(n0 / 2);
|
||||
|
||||
// add some noise to the signal
|
||||
srsran_ch_awgn_c(output_buffer, output_buffer, nstd, sf_n_samples);
|
||||
srsran_ch_awgn_c(output_buffer, output_buffer, n0, sf_n_samples);
|
||||
}
|
||||
|
||||
/* send to file or usrp */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -228,7 +228,7 @@ void parse_args(prog_args_t* args, int argc, char** argv)
|
|||
args->disable_plots_except_constellation = true;
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
default:
|
||||
usage(args, argv[0]);
|
||||
|
@ -339,7 +339,7 @@ int main(int argc, char** argv)
|
|||
parse_args(&prog_args, argc, argv);
|
||||
|
||||
#if HAVE_PCAP
|
||||
FILE* pcap_file = LTE_PCAP_Open(MAC_LTE_DLT, "/tmp/npdsch.pcap");
|
||||
FILE* pcap_file = DLT_PCAP_Open(MAC_LTE_DLT, "/tmp/npdsch.pcap");
|
||||
#endif
|
||||
|
||||
sigset_t sigset;
|
||||
|
@ -865,7 +865,7 @@ int main(int argc, char** argv)
|
|||
|
||||
#if HAVE_PCAP
|
||||
printf("Saving PCAP file\n");
|
||||
LTE_PCAP_Close(pcap_file);
|
||||
DLT_PCAP_Close(pcap_file);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_RF
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -22,6 +22,7 @@
|
|||
#include "srsran/common/crash_handler.h"
|
||||
#include "srsran/common/gen_mch_tables.h"
|
||||
#include "srsran/srsran.h"
|
||||
#include <getopt.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <signal.h>
|
||||
|
@ -52,6 +53,12 @@ static char* output_file_name = NULL;
|
|||
#define PAGE_UP 53
|
||||
#define PAGE_DOWN 54
|
||||
|
||||
#define CFR_THRES_UP_KEY 't'
|
||||
#define CFR_THRES_DN_KEY 'g'
|
||||
|
||||
#define CFR_THRES_STEP 0.05f
|
||||
#define CFR_PAPR_STEP 0.1f
|
||||
|
||||
static srsran_cell_t cell = {
|
||||
25, // nof_prb
|
||||
1, // nof_ports
|
||||
|
@ -66,7 +73,7 @@ static int net_port = -1; // -1 generates random dataThat means there is so
|
|||
static uint32_t cfi = 2;
|
||||
static uint32_t mcs_idx = 1, last_mcs_idx = 1;
|
||||
static int nof_frames = -1;
|
||||
static srsran_tm_t transmission_mode = SRSRAN_TM1;
|
||||
static srsran_tm_t transmission_mode = SRSRAN_TM1;
|
||||
static uint32_t nof_tb = 1;
|
||||
static uint32_t multiplex_pmi = 0;
|
||||
static uint32_t multiplex_nof_layers = 1;
|
||||
|
@ -79,6 +86,27 @@ static bool enable_256qam = false;
|
|||
static float output_file_snr = +INFINITY;
|
||||
static bool use_standard_lte_rate = false;
|
||||
|
||||
|
||||
// CFR runtime control flags
|
||||
static bool cfr_thr_inc = false;
|
||||
static bool cfr_thr_dec = false;
|
||||
|
||||
typedef struct {
|
||||
int enable;
|
||||
char* mode;
|
||||
float manual_thres;
|
||||
float strength;
|
||||
float auto_target_papr;
|
||||
float ema_alpha;
|
||||
} cfr_args_t;
|
||||
|
||||
static cfr_args_t cfr_args = {.enable = 0,
|
||||
.mode = "manual",
|
||||
.manual_thres = 1.0f,
|
||||
.strength = 1.0f,
|
||||
.auto_target_papr = 8.0f,
|
||||
.ema_alpha = 1.0f / (float)SRSRAN_CP_NORM_NSYMB};
|
||||
|
||||
static bool null_file_sink = false;
|
||||
static srsran_filesink_t fsink;
|
||||
static srsran_ofdm_t ifft[SRSRAN_MAX_PORTS];
|
||||
|
@ -94,6 +122,7 @@ static srsran_softbuffer_tx_t* softbuffers[SRSRAN_MAX_CODEWORDS];
|
|||
static srsran_regs_t regs;
|
||||
static srsran_dci_dl_t dci_dl;
|
||||
static int rvidx[SRSRAN_MAX_CODEWORDS] = {0, 0};
|
||||
static srsran_cfr_cfg_t cfr_config = {};
|
||||
|
||||
static cf_t * sf_buffer[SRSRAN_MAX_PORTS] = {NULL}, *output_buffer[SRSRAN_MAX_PORTS] = {NULL};
|
||||
static uint32_t sf_n_re, sf_n_samples;
|
||||
|
@ -143,14 +172,28 @@ static void usage(char* prog)
|
|||
printf("\t-s output file SNR [Default %f]\n", output_file_snr);
|
||||
printf("\t-q Enable/Disable 256QAM modulation (default %s)\n", enable_256qam ? "enabled" : "disabled");
|
||||
printf("\t-Q Use standard LTE sample rates (default %s)\n", use_standard_lte_rate ? "enabled" : "disabled");
|
||||
printf("CFR Options:\n");
|
||||
printf("\t--enable_cfr Enable the CFR (default %s)\n", cfr_args.enable ? "enabled" : "disabled");
|
||||
printf("\t--cfr_mode CFR mode: manual, auto_cma, auto_ema. (default %s)\n", cfr_args.mode);
|
||||
printf("\t--cfr_manual_thres CFR manual threshold (default %.2f)\n", cfr_args.manual_thres);
|
||||
printf("\t--cfr_strength CFR strength (default %.2f)\n", cfr_args.strength);
|
||||
printf("\t--cfr_auto_papr CFR PAPR target for auto modes (default %.2f)\n", cfr_args.auto_target_papr);
|
||||
printf("\t--cfr_ema_alpha CFR alpha parameter for EMA mode (default %.2f)\n", cfr_args.ema_alpha);
|
||||
printf("\n");
|
||||
printf("\t*: See 3GPP 36.212 Table 5.3.3.1.5-4 for more information\n");
|
||||
}
|
||||
struct option cfr_opts[] = {{"enable_cfr", no_argument, &cfr_args.enable, 1},
|
||||
{"cfr_mode", required_argument, NULL, 'C'},
|
||||
{"cfr_manual_thres", required_argument, NULL, 'T'},
|
||||
{"cfr_strength", required_argument, NULL, 'S'},
|
||||
{"cfr_auto_papr", required_argument, NULL, 'P'},
|
||||
{"cfr_ema_alpha", required_argument, NULL, 'e'},
|
||||
{0, 0, 0, 0}};
|
||||
|
||||
static void parse_args(int argc, char** argv)
|
||||
{
|
||||
int opt;
|
||||
while ((opt = getopt(argc, argv, "IadglfmoncpqvutxbwMsBQ")) != -1) {
|
||||
while ((opt = getopt_long(argc, argv, "IadglfmoncpqvutxbwMsBQ", cfr_opts, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case 'I':
|
||||
rf_dev = argv[optind];
|
||||
|
@ -198,7 +241,7 @@ static void parse_args(int argc, char** argv)
|
|||
mbsfn_area_id = (int)strtol(argv[optind], NULL, 10);
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
case 's':
|
||||
output_file_snr = strtof(argv[optind], NULL);
|
||||
|
@ -212,6 +255,27 @@ static void parse_args(int argc, char** argv)
|
|||
case 'Q':
|
||||
use_standard_lte_rate ^= true;
|
||||
break;
|
||||
case 'E':
|
||||
cell.cp = SRSRAN_CP_EXT;
|
||||
break;
|
||||
case 'C':
|
||||
cfr_args.mode = optarg;
|
||||
break;
|
||||
case 'T':
|
||||
cfr_args.manual_thres = strtof(optarg, NULL);
|
||||
break;
|
||||
case 'S':
|
||||
cfr_args.strength = strtof(optarg, NULL);
|
||||
break;
|
||||
case 'P':
|
||||
cfr_args.auto_target_papr = strtof(optarg, NULL);
|
||||
break;
|
||||
case 'e':
|
||||
cfr_args.ema_alpha = strtof(optarg, NULL);
|
||||
break;
|
||||
case 0:
|
||||
/* getopt_long() set a variable, keep going */
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
exit(-1);
|
||||
|
@ -225,6 +289,27 @@ static void parse_args(int argc, char** argv)
|
|||
#endif
|
||||
}
|
||||
|
||||
static int parse_cfr_args()
|
||||
{
|
||||
cfr_config.cfr_enable = cfr_args.enable;
|
||||
cfr_config.manual_thr = cfr_args.manual_thres;
|
||||
cfr_config.max_papr_db = cfr_args.auto_target_papr;
|
||||
cfr_config.alpha = cfr_args.strength;
|
||||
cfr_config.ema_alpha = cfr_args.ema_alpha;
|
||||
|
||||
cfr_config.cfr_mode = srsran_cfr_str2mode(cfr_args.mode);
|
||||
if (cfr_config.cfr_mode == SRSRAN_CFR_THR_INVALID) {
|
||||
ERROR("CFR mode not recognised");
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
||||
if (!srsran_cfr_params_valid(&cfr_config)) {
|
||||
ERROR("Invalid CFR parameters");
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
static void base_init()
|
||||
{
|
||||
int i;
|
||||
|
@ -316,12 +401,16 @@ static void base_init()
|
|||
|
||||
/* create ifft object */
|
||||
for (i = 0; i < cell.nof_ports; i++) {
|
||||
if (srsran_ofdm_tx_init(&ifft[i], SRSRAN_CP_NORM, sf_buffer[i], output_buffer[i], cell.nof_prb)) {
|
||||
if (srsran_ofdm_tx_init(&ifft[i], cell.cp, sf_buffer[i], output_buffer[i], cell.nof_prb)) {
|
||||
ERROR("Error creating iFFT object");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
srsran_ofdm_set_normalize(&ifft[i], true);
|
||||
if (srsran_ofdm_set_cfr(&ifft[i], &cfr_config)) {
|
||||
ERROR("Error setting CFR object");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (srsran_ofdm_tx_init_mbsfn(&ifft_mbsfn, SRSRAN_CP_EXT, sf_buffer[0], output_buffer[0], cell.nof_prb)) {
|
||||
|
@ -330,6 +419,10 @@ static void base_init()
|
|||
}
|
||||
srsran_ofdm_set_non_mbsfn_region(&ifft_mbsfn, 2);
|
||||
srsran_ofdm_set_normalize(&ifft_mbsfn, true);
|
||||
if (srsran_ofdm_set_cfr(&ifft_mbsfn, &cfr_config)) {
|
||||
ERROR("Error setting CFR object");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (srsran_pbch_init(&pbch)) {
|
||||
ERROR("Error creating PBCH object");
|
||||
|
@ -480,6 +573,8 @@ static int update_radl()
|
|||
{
|
||||
ZERO_OBJECT(dci_dl);
|
||||
|
||||
int ret = SRSRAN_ERROR;
|
||||
|
||||
/* Configure cell and PDSCH in function of the transmission mode */
|
||||
switch (transmission_mode) {
|
||||
case SRSRAN_TM1:
|
||||
|
@ -502,7 +597,7 @@ static int update_radl()
|
|||
break;
|
||||
default:
|
||||
ERROR("Transmission mode not implemented.");
|
||||
exit(-1);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
dci_dl.rnti = UE_CRNTI;
|
||||
|
@ -523,7 +618,80 @@ static int update_radl()
|
|||
SRSRAN_DCI_TB_DISABLE(dci_dl.tb[1]);
|
||||
}
|
||||
|
||||
// Increase the CFR threshold or target PAPR
|
||||
if (cfr_thr_inc) {
|
||||
cfr_thr_inc = false; // Reset the flag
|
||||
if (cfr_config.cfr_enable && cfr_config.cfr_mode == SRSRAN_CFR_THR_MANUAL) {
|
||||
cfr_config.manual_thr += CFR_THRES_STEP;
|
||||
for (int i = 0; i < cell.nof_ports; i++) {
|
||||
if (srsran_cfr_set_threshold(&ifft[i].tx_cfr, cfr_config.manual_thr) < SRSRAN_SUCCESS) {
|
||||
ERROR("Setting the CFR");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
if (srsran_cfr_set_threshold(&ifft_mbsfn.tx_cfr, cfr_config.manual_thr) < SRSRAN_SUCCESS) {
|
||||
ERROR("Setting the CFR");
|
||||
goto exit;
|
||||
}
|
||||
printf("CFR Thres. set to %.3f\n", cfr_config.manual_thr);
|
||||
} else if (cfr_config.cfr_enable && cfr_config.cfr_mode != SRSRAN_CFR_THR_MANUAL) {
|
||||
cfr_config.max_papr_db += CFR_PAPR_STEP;
|
||||
for (int i = 0; i < cell.nof_ports; i++) {
|
||||
if (srsran_cfr_set_papr(&ifft[i].tx_cfr, cfr_config.max_papr_db) < SRSRAN_SUCCESS) {
|
||||
ERROR("Setting the CFR");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
if (srsran_cfr_set_papr(&ifft_mbsfn.tx_cfr, cfr_config.max_papr_db) < SRSRAN_SUCCESS) {
|
||||
ERROR("Setting the CFR");
|
||||
goto exit;
|
||||
}
|
||||
printf("CFR target PAPR set to %.3f\n", cfr_config.max_papr_db);
|
||||
}
|
||||
}
|
||||
|
||||
// Decrease the CFR threshold or target PAPR
|
||||
if (cfr_thr_dec) {
|
||||
cfr_thr_dec = false; // Reset the flag
|
||||
if (cfr_config.cfr_enable && cfr_config.cfr_mode == SRSRAN_CFR_THR_MANUAL) {
|
||||
if (cfr_config.manual_thr - CFR_THRES_STEP >= 0) {
|
||||
cfr_config.manual_thr -= CFR_THRES_STEP;
|
||||
for (int i = 0; i < cell.nof_ports; i++) {
|
||||
if (srsran_cfr_set_threshold(&ifft[i].tx_cfr, cfr_config.manual_thr) < SRSRAN_SUCCESS) {
|
||||
ERROR("Setting the CFR");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
if (srsran_cfr_set_threshold(&ifft_mbsfn.tx_cfr, cfr_config.manual_thr) < SRSRAN_SUCCESS) {
|
||||
ERROR("Setting the CFR");
|
||||
goto exit;
|
||||
}
|
||||
printf("CFR Thres. set to %.3f\n", cfr_config.manual_thr);
|
||||
}
|
||||
} else if (cfr_config.cfr_enable && cfr_config.cfr_mode != SRSRAN_CFR_THR_MANUAL) {
|
||||
if (cfr_config.max_papr_db - CFR_PAPR_STEP >= 0) {
|
||||
cfr_config.max_papr_db -= CFR_PAPR_STEP;
|
||||
for (int i = 0; i < cell.nof_ports; i++) {
|
||||
if (srsran_cfr_set_papr(&ifft[i].tx_cfr, cfr_config.max_papr_db) < SRSRAN_SUCCESS) {
|
||||
ERROR("Setting the CFR");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
if (srsran_cfr_set_papr(&ifft_mbsfn.tx_cfr, cfr_config.max_papr_db) < SRSRAN_SUCCESS) {
|
||||
ERROR("Setting the CFR");
|
||||
goto exit;
|
||||
}
|
||||
printf("CFR target PAPR set to %.3f\n", cfr_config.max_papr_db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
srsran_dci_dl_fprint(stdout, &dci_dl, cell.nof_prb);
|
||||
printf("\nCFR controls:\n");
|
||||
printf(" Param | INC | DEC |\n");
|
||||
printf("------------+-----+-----+\n");
|
||||
printf(" Thres/PAPR | %c | %c |\n", CFR_THRES_UP_KEY, CFR_THRES_DN_KEY);
|
||||
printf("\n");
|
||||
if (transmission_mode != SRSRAN_TM1) {
|
||||
printf("\nTransmission mode key table:\n");
|
||||
printf(" Mode | 1TB | 2TB |\n");
|
||||
|
@ -532,13 +700,15 @@ static int update_radl()
|
|||
printf(" CDD | | z |\n");
|
||||
printf("Multiplex | q,w,e,r | a,s |\n");
|
||||
printf("\n");
|
||||
printf("Type new MCS index (0-28) or mode key and press Enter: ");
|
||||
printf("Type new MCS index (0-28) or cfr/mode key and press Enter: ");
|
||||
} else {
|
||||
printf("Type new MCS index (0-28) and press Enter: ");
|
||||
printf("Type new MCS index (0-28) or cfr key and press Enter: ");
|
||||
}
|
||||
fflush(stdout);
|
||||
ret = SRSRAN_SUCCESS;
|
||||
|
||||
return 0;
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Read new MCS from stdin */
|
||||
|
@ -632,6 +802,12 @@ static int update_control()
|
|||
case 'x':
|
||||
transmission_mode = SRSRAN_TM2;
|
||||
break;
|
||||
case CFR_THRES_UP_KEY:
|
||||
cfr_thr_inc = true;
|
||||
break;
|
||||
case CFR_THRES_DN_KEY:
|
||||
cfr_thr_dec = true;
|
||||
break;
|
||||
default:
|
||||
last_mcs_idx = mcs_idx;
|
||||
mcs_idx = strtol(input, NULL, 10);
|
||||
|
@ -649,9 +825,9 @@ static int update_control()
|
|||
} else if (n < 0) {
|
||||
// error
|
||||
perror("select");
|
||||
return -1;
|
||||
return SRSRAN_ERROR;
|
||||
} else {
|
||||
return 0;
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -725,6 +901,10 @@ int main(int argc, char** argv)
|
|||
#endif
|
||||
|
||||
parse_args(argc, argv);
|
||||
if (parse_cfr_args() < SRSRAN_SUCCESS) {
|
||||
ERROR("Error parsing CFR args");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
srsran_use_standard_symbol_size(use_standard_lte_rate);
|
||||
|
||||
|
@ -734,7 +914,7 @@ int main(int argc, char** argv)
|
|||
generate_mcch_table(mch_table, mbsfn_sf_mask);
|
||||
}
|
||||
N_id_2 = cell.id % 3;
|
||||
sf_n_re = 2 * SRSRAN_CP_NORM_NSYMB * cell.nof_prb * SRSRAN_NRE;
|
||||
sf_n_re = SRSRAN_SF_LEN_RE(cell.nof_prb, cell.cp);
|
||||
sf_n_samples = 2 * SRSRAN_SLOT_LEN(srsran_symbol_sz(cell.nof_prb));
|
||||
|
||||
cell.phich_length = SRSRAN_PHICH_NORM;
|
||||
|
@ -850,8 +1030,8 @@ int main(int argc, char** argv)
|
|||
srsran_vec_cf_zero(sf_symbols[0], sf_n_re);
|
||||
|
||||
if (sf_idx == 0 || sf_idx == 5) {
|
||||
srsran_pss_put_slot(pss_signal, sf_symbols[0], cell.nof_prb, SRSRAN_CP_NORM);
|
||||
srsran_sss_put_slot(sf_idx ? sss_signal5 : sss_signal0, sf_symbols[0], cell.nof_prb, SRSRAN_CP_NORM);
|
||||
srsran_pss_put_slot(pss_signal, sf_symbols[0], cell.nof_prb, cell.cp);
|
||||
srsran_sss_put_slot(sf_idx ? sss_signal5 : sss_signal0, sf_symbols[0], cell.nof_prb, cell.cp);
|
||||
}
|
||||
|
||||
/* Copy zeros, SSS, PSS into the rest of antenna ports */
|
||||
|
@ -879,7 +1059,7 @@ int main(int argc, char** argv)
|
|||
srsran_pcfich_encode(&pcfich, &dl_sf, sf_symbols);
|
||||
|
||||
/* Update DL resource allocation from control port */
|
||||
if (update_control()) {
|
||||
if (update_control() < SRSRAN_SUCCESS) {
|
||||
ERROR("Error updating parameters from control port");
|
||||
}
|
||||
|
||||
|
@ -998,7 +1178,7 @@ int main(int argc, char** argv)
|
|||
if (!null_file_sink) {
|
||||
/* Apply AWGN */
|
||||
if (output_file_snr != +INFINITY) {
|
||||
float var = srsran_convert_dB_to_amplitude(-(output_file_snr + 3.0f));
|
||||
float var = srsran_convert_dB_to_power(-output_file_snr);
|
||||
for (int k = 0; k < cell.nof_ports; k++) {
|
||||
srsran_ch_awgn_c(output_buffer[k], output_buffer[k], var, sf_n_samples);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -286,8 +286,8 @@ void parse_args(prog_args_t* args, int argc, char** argv)
|
|||
args->disable_plots_except_constellation = true;
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
args->verbose = srsran_verbose;
|
||||
increase_srsran_verbose_level();
|
||||
args->verbose = get_srsran_verbose_level();
|
||||
break;
|
||||
case 'Z':
|
||||
args->decimate = (int)strtol(argv[optind], NULL, 10);
|
||||
|
@ -699,16 +699,16 @@ int main(int argc, char** argv)
|
|||
to.tv_usec = 0;
|
||||
|
||||
/* Set default verbose level */
|
||||
srsran_verbose = prog_args.verbose;
|
||||
int n = select(1, &set, NULL, NULL, &to);
|
||||
set_srsran_verbose_level(prog_args.verbose);
|
||||
int n = select(1, &set, NULL, NULL, &to);
|
||||
if (n == 1) {
|
||||
/* If a new line is detected set verbose level to Debug */
|
||||
if (fgets(input, sizeof(input), stdin)) {
|
||||
srsran_verbose = SRSRAN_VERBOSE_DEBUG;
|
||||
pkt_errors = 0;
|
||||
pkt_total = 0;
|
||||
nof_detected = 0;
|
||||
nof_trials = 0;
|
||||
set_srsran_verbose_level(SRSRAN_VERBOSE_DEBUG);
|
||||
pkt_errors = 0;
|
||||
pkt_total = 0;
|
||||
nof_detected = 0;
|
||||
nof_trials = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -188,7 +188,7 @@ void parse_args(prog_args_t* args, int argc, char** argv)
|
|||
args->nof_rx_antennas = (int32_t)strtol(argv[optind], NULL, 10);
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
case 'w':
|
||||
args->disable_plots = true;
|
||||
|
@ -232,7 +232,7 @@ int main(int argc, char** argv)
|
|||
|
||||
parse_args(&prog_args, argc, argv);
|
||||
|
||||
FILE* pcap_file = LTE_PCAP_Open(MAC_LTE_DLT, PCAP_FILENAME);
|
||||
FILE* pcap_file = DLT_PCAP_Open(MAC_LTE_DLT, PCAP_FILENAME);
|
||||
|
||||
srsran_use_standard_symbol_size(prog_args.use_standard_lte_rates);
|
||||
|
||||
|
@ -303,7 +303,7 @@ int main(int argc, char** argv)
|
|||
cf_t* equalized_sf_buffer = srsran_vec_malloc(sizeof(cf_t) * sf_n_re);
|
||||
|
||||
// RX
|
||||
srsran_ofdm_t fft[SRSRAN_MAX_PORTS];
|
||||
srsran_ofdm_t fft[SRSRAN_MAX_PORTS] = {};
|
||||
srsran_ofdm_cfg_t ofdm_cfg = {};
|
||||
ofdm_cfg.nof_prb = cell_sl.nof_prb;
|
||||
ofdm_cfg.cp = SRSRAN_CP_NORM;
|
||||
|
@ -341,7 +341,7 @@ int main(int argc, char** argv)
|
|||
// PSCCH Channel estimation
|
||||
srsran_chest_sl_cfg_t pscch_chest_sl_cfg = {};
|
||||
srsran_chest_sl_t pscch_chest = {};
|
||||
if (srsran_chest_sl_init(&pscch_chest, SRSRAN_SIDELINK_PSCCH, cell_sl, sl_comm_resource_pool) != SRSRAN_SUCCESS) {
|
||||
if (srsran_chest_sl_init(&pscch_chest, SRSRAN_SIDELINK_PSCCH, cell_sl, &sl_comm_resource_pool) != SRSRAN_SUCCESS) {
|
||||
ERROR("Error in chest PSCCH init");
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ int main(int argc, char** argv)
|
|||
|
||||
srsran_chest_sl_cfg_t pssch_chest_sl_cfg = {};
|
||||
srsran_chest_sl_t pssch_chest = {};
|
||||
if (srsran_chest_sl_init(&pssch_chest, SRSRAN_SIDELINK_PSSCH, cell_sl, sl_comm_resource_pool) != SRSRAN_SUCCESS) {
|
||||
if (srsran_chest_sl_init(&pssch_chest, SRSRAN_SIDELINK_PSSCH, cell_sl, &sl_comm_resource_pool) != SRSRAN_SUCCESS) {
|
||||
ERROR("Error in chest PSSCH init");
|
||||
return SRSRAN_ERROR;
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ clean_exit:
|
|||
|
||||
if (pcap_file != NULL) {
|
||||
printf("Saving PCAP file to %s\n", PCAP_FILENAME);
|
||||
LTE_PCAP_Close(pcap_file);
|
||||
DLT_PCAP_Close(pcap_file);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_GUI
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -83,7 +83,7 @@ void parse_args(int argc, char** argv)
|
|||
force_cfo = strtof(argv[optind], NULL);
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -84,7 +84,7 @@ void parse_args(int argc, char** argv)
|
|||
nof_rx_antennas = (int)strtol(argv[optind], NULL, 10);
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -105,7 +105,7 @@ void parse_args(int argc, char** argv)
|
|||
nof_rx_antennas = (uint32_t)strtol(argv[optind], NULL, 10);
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -77,7 +77,7 @@ void parse_args(int argc, char** argv)
|
|||
nof_subframes = (int)strtol(argv[optind], NULL, 10);
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -123,7 +123,7 @@ int main(int argc, char** argv)
|
|||
ERROR("Error receiving samples");
|
||||
exit(-1);
|
||||
}
|
||||
if (srsran_verbose == SRSRAN_VERBOSE_INFO) {
|
||||
if (get_srsran_verbose_level() == SRSRAN_VERBOSE_INFO) {
|
||||
printf("Received %d samples from radio\n", n);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ int main(int argc, char** argv)
|
|||
print_cnt = 0;
|
||||
}
|
||||
} else {
|
||||
if (srsran_verbose == SRSRAN_VERBOSE_INFO) {
|
||||
if (get_srsran_verbose_level() == SRSRAN_VERBOSE_INFO) {
|
||||
printf("Transmitted %d bytes to ZMQ\n", n);
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ static void parse_args(int argc, char** argv)
|
|||
rf_freq = strtof(argv[optind], NULL);
|
||||
break;
|
||||
case 'v':
|
||||
srsran_verbose++;
|
||||
increase_srsran_verbose_level();
|
||||
break;
|
||||
case 'z':
|
||||
zmq_args = argv[optind];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright 2013-2021 Software Radio Systems Limited
|
||||
# Copyright 2013-2022 Software Radio Systems Limited
|
||||
#
|
||||
# This file is part of srsRAN
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -39,6 +39,11 @@ struct rolling_average {
|
|||
}
|
||||
T value() const { return count_ == 0 ? 0 : avg_; }
|
||||
uint32_t count() const { return count_; }
|
||||
void reset()
|
||||
{
|
||||
avg_ = 0;
|
||||
count_ = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
T avg_ = 0;
|
||||
|
@ -47,8 +52,10 @@ private:
|
|||
|
||||
template <typename T>
|
||||
struct exp_average_fast_start {
|
||||
exp_average_fast_start(T alpha_, uint32_t start_size = 100) : alpha(alpha_), start_count_size(start_size)
|
||||
exp_average_fast_start(T alpha_val) : exp_average_fast_start(alpha_val, 1.0 / alpha_val) {}
|
||||
exp_average_fast_start(T alpha_val, uint32_t start_size) : alpha_(alpha_val), start_count_size(start_size)
|
||||
{
|
||||
assert(alpha_ < 1);
|
||||
assert(start_size > 0);
|
||||
}
|
||||
void push(T sample)
|
||||
|
@ -57,16 +64,18 @@ struct exp_average_fast_start {
|
|||
avg_ += (sample - avg_) / (count + 1);
|
||||
count++;
|
||||
} else {
|
||||
avg_ = (1 - alpha) * avg_ + alpha * sample;
|
||||
avg_ = (1 - alpha_) * avg_ + alpha_ * sample;
|
||||
}
|
||||
}
|
||||
T value() const { return count == 0 ? 0 : avg_; }
|
||||
T value() const { return count == 0 ? 0 : avg_; }
|
||||
T alpha() const { return alpha_; }
|
||||
bool is_exp_average_mode() const { return count >= start_count_size; }
|
||||
|
||||
private:
|
||||
T avg_ = 0;
|
||||
uint32_t count = 0;
|
||||
uint32_t start_count_size;
|
||||
T alpha;
|
||||
T alpha_;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
@ -121,7 +130,6 @@ private:
|
|||
|
||||
template <typename T>
|
||||
struct null_sliding_average {
|
||||
|
||||
null_sliding_average(uint32_t N) : window(N, null_value()) {}
|
||||
void push(T sample) { window.push(sample); }
|
||||
void push_hole() { window.push(null_value()); }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -22,8 +22,8 @@
|
|||
#ifndef SRSRAN_DYN_BITSET_H
|
||||
#define SRSRAN_DYN_BITSET_H
|
||||
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/srslog/bundled/fmt/format.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
#include <cstdint>
|
||||
#include <inttypes.h>
|
||||
#include <string>
|
||||
|
@ -372,6 +372,14 @@ public:
|
|||
return get_word_(0);
|
||||
}
|
||||
|
||||
void from_uint64(uint64_t v)
|
||||
{
|
||||
srsran_assert(nof_words_() == 1, "ERROR: cannot convert bitset of size=%zd to uint64_t", size());
|
||||
srsran_assert(
|
||||
v < (1U << size()), "ERROR: Provided mask=0x%" PRIx64 " does not fit in bitset of size=%zd", v, size());
|
||||
buffer[0] = v;
|
||||
}
|
||||
|
||||
template <typename OutputIt>
|
||||
OutputIt to_hex(OutputIt&& mem_buffer) const noexcept
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -23,7 +23,7 @@
|
|||
#define SRSRAN_BOUNDED_VECTOR_H
|
||||
|
||||
#include "srsran/adt/detail/type_storage.h"
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -64,7 +64,7 @@ struct choice_storage_t {
|
|||
}
|
||||
|
||||
template <typename U>
|
||||
void destroy_unsafe()
|
||||
void destroy_unchecked()
|
||||
{
|
||||
get_unchecked<U>().~U();
|
||||
};
|
||||
|
@ -80,7 +80,7 @@ struct CopyCtorVisitor {
|
|||
template <typename T>
|
||||
void operator()(const T& t)
|
||||
{
|
||||
c->construct_unsafe(t);
|
||||
c->construct_unchecked(t);
|
||||
}
|
||||
C* c;
|
||||
};
|
||||
|
@ -91,18 +91,18 @@ struct MoveCtorVisitor {
|
|||
template <typename T>
|
||||
void operator()(T&& t)
|
||||
{
|
||||
c->construct_unsafe(std::move(t));
|
||||
c->construct_unchecked(std::move(t));
|
||||
}
|
||||
C* c;
|
||||
};
|
||||
|
||||
template <typename C>
|
||||
struct DtorUnsafeVisitor {
|
||||
explicit DtorUnsafeVisitor(C* c_) : c(c_) {}
|
||||
struct DtorUncheckVisitor {
|
||||
explicit DtorUncheckVisitor(C* c_) : c(c_) {}
|
||||
template <typename T>
|
||||
void operator()(T& t)
|
||||
{
|
||||
c->template destroy_unsafe<T>();
|
||||
c->template destroy_unchecked<T>();
|
||||
}
|
||||
C* c;
|
||||
};
|
||||
|
@ -119,12 +119,12 @@ struct tagged_union_t
|
|||
|
||||
std::size_t type_id;
|
||||
|
||||
using base_t::destroy_unsafe;
|
||||
using base_t::destroy_unchecked;
|
||||
using base_t::get_buffer;
|
||||
using base_t::get_unchecked;
|
||||
|
||||
template <typename U, typename... Args2>
|
||||
void construct_emplace_unsafe(Args2&&... args)
|
||||
void construct_emplace_unchecked(Args2&&... args)
|
||||
{
|
||||
using U2 = typename std::decay<U>::type;
|
||||
static_assert(type_list_contains<U2, Args...>(),
|
||||
|
@ -134,7 +134,7 @@ struct tagged_union_t
|
|||
}
|
||||
|
||||
template <typename U>
|
||||
void construct_unsafe(U&& u)
|
||||
void construct_unchecked(U&& u)
|
||||
{
|
||||
using U2 = typename std::decay<U>::type;
|
||||
static_assert(type_list_contains<U2, Args...>(),
|
||||
|
@ -143,11 +143,11 @@ struct tagged_union_t
|
|||
new (get_buffer()) U2(std::forward<U>(u));
|
||||
}
|
||||
|
||||
void copy_unsafe(const this_type& other) { visit(CopyCtorVisitor<this_type>{this}, other); }
|
||||
void copy_unchecked(const this_type& other) { visit(CopyCtorVisitor<this_type>{this}, other); }
|
||||
|
||||
void move_unsafe(this_type&& other) { visit(MoveCtorVisitor<this_type>{this}, other); }
|
||||
void move_unchecked(this_type&& other) { visit(MoveCtorVisitor<this_type>{this}, other); }
|
||||
|
||||
void dtor_unsafe() { visit(choice_details::DtorUnsafeVisitor<base_t>{this}, *this); }
|
||||
void dtor_unchecked() { visit(choice_details::DtorUncheckVisitor<base_t>{this}, *this); }
|
||||
|
||||
size_t get_type_idx() const { return type_id; }
|
||||
|
||||
|
@ -189,51 +189,51 @@ public:
|
|||
typename = typename std::enable_if<std::is_constructible<default_type, Args2...>::value>::type>
|
||||
explicit choice_t(Args2&&... args) noexcept
|
||||
{
|
||||
base_t::template construct_emplace_unsafe<default_type>(std::forward<Args2>(args)...);
|
||||
base_t::template construct_emplace_unchecked<default_type>(std::forward<Args2>(args)...);
|
||||
}
|
||||
|
||||
choice_t(const choice_t<Args...>& other) noexcept { base_t::copy_unsafe(other); }
|
||||
choice_t(const choice_t<Args...>& other) noexcept { base_t::copy_unchecked(other); }
|
||||
|
||||
choice_t(choice_t<Args...>&& other) noexcept { base_t::move_unsafe(std::move(other)); }
|
||||
choice_t(choice_t<Args...>&& other) noexcept { base_t::move_unchecked(std::move(other)); }
|
||||
|
||||
template <typename U, typename = enable_if_can_hold<U> >
|
||||
choice_t(U&& u) noexcept
|
||||
{
|
||||
base_t::construct_unsafe(std::forward<U>(u));
|
||||
base_t::construct_unchecked(std::forward<U>(u));
|
||||
}
|
||||
|
||||
~choice_t() { base_t::dtor_unsafe(); }
|
||||
~choice_t() { base_t::dtor_unchecked(); }
|
||||
|
||||
template <typename U, typename = enable_if_can_hold<U> >
|
||||
choice_t& operator=(U&& u) noexcept
|
||||
{
|
||||
if (not base_t::template is<U>()) {
|
||||
base_t::dtor_unsafe();
|
||||
base_t::dtor_unchecked();
|
||||
}
|
||||
base_t::construct_unsafe(std::forward<U>(u));
|
||||
base_t::construct_unchecked(std::forward<U>(u));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename U, typename... Args2>
|
||||
void emplace(Args2&&... args) noexcept
|
||||
{
|
||||
base_t::dtor_unsafe();
|
||||
base_t::template construct_emplace_unsafe<U>(std::forward<Args2>(args)...);
|
||||
base_t::dtor_unchecked();
|
||||
base_t::template construct_emplace_unchecked<U>(std::forward<Args2>(args)...);
|
||||
}
|
||||
|
||||
choice_t& operator=(const choice_t& other) noexcept
|
||||
{
|
||||
if (this != &other) {
|
||||
base_t::dtor_unsafe();
|
||||
base_t::copy_unsafe(other);
|
||||
base_t::dtor_unchecked();
|
||||
base_t::copy_unchecked(other);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
choice_t& operator=(choice_t&& other) noexcept
|
||||
{
|
||||
base_t::dtor_unsafe();
|
||||
base_t::move_unsafe(std::move(other));
|
||||
base_t::dtor_unchecked();
|
||||
base_t::move_unchecked(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -25,7 +25,7 @@
|
|||
#include "srsran/adt/detail/type_storage.h"
|
||||
#include "srsran/adt/expected.h"
|
||||
#include "srsran/adt/pool/pool_utils.h"
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
@ -291,13 +291,16 @@ public:
|
|||
bool push_blocking(const T& t) { return push_(t, true); }
|
||||
srsran::error_type<T> push_blocking(T&& t) { return push_(std::move(t), true); }
|
||||
bool try_pop(T& obj) { return pop_(obj, false); }
|
||||
T pop_blocking()
|
||||
T pop_blocking(bool* success = nullptr)
|
||||
{
|
||||
T obj{};
|
||||
pop_(obj, true);
|
||||
T obj{};
|
||||
bool ret = pop_(obj, true);
|
||||
if (success != nullptr) {
|
||||
*success = ret;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
bool pop_wait_until(T& obj, const std::chrono::system_clock::time_point& until) { return pop_(obj, true, &until); }
|
||||
bool pop_wait_until(T& obj, const std::chrono::steady_clock::time_point& until) { return pop_(obj, true, &until); }
|
||||
void clear()
|
||||
{
|
||||
T obj;
|
||||
|
@ -411,7 +414,7 @@ protected:
|
|||
return {};
|
||||
}
|
||||
|
||||
bool pop_(T& obj, bool block, const std::chrono::system_clock::time_point* until = nullptr)
|
||||
bool pop_(T& obj, bool block, const std::chrono::steady_clock::time_point* until = nullptr)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(mutex);
|
||||
if (not active) {
|
||||
|
@ -599,12 +602,6 @@ public:
|
|||
base_t(push_callback, pop_callback, size)
|
||||
{}
|
||||
void set_size(size_t size) { base_t::circ_buffer.set_size(size); }
|
||||
|
||||
template <typename F>
|
||||
bool apply_first(const F& func)
|
||||
{
|
||||
return base_t::apply_first(func);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace srsran
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "detail/type_storage.h"
|
||||
#include "expected.h"
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
#include <array>
|
||||
|
||||
namespace srsran {
|
||||
|
@ -99,7 +99,12 @@ public:
|
|||
{
|
||||
public:
|
||||
const_iterator() = default;
|
||||
const_iterator(const static_circular_map<K, T, N>* map, size_t idx_) : ptr(map), idx(idx_) {}
|
||||
const_iterator(const static_circular_map<K, T, N>* map, size_t idx_) : ptr(map), idx(idx_)
|
||||
{
|
||||
if (idx < ptr->capacity() and not ptr->present[idx]) {
|
||||
++(*this);
|
||||
}
|
||||
}
|
||||
|
||||
const_iterator& operator++()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -79,11 +79,9 @@ void copy_if_present_helper(type_storage<T, MinSize, AlignSize>& lhs,
|
|||
{
|
||||
if (lhs_present and rhs_present) {
|
||||
lhs.get() = rhs.get();
|
||||
}
|
||||
if (lhs_present) {
|
||||
} else if (lhs_present) {
|
||||
lhs.destroy();
|
||||
}
|
||||
if (rhs_present) {
|
||||
} else if (rhs_present) {
|
||||
lhs.copy_ctor(rhs);
|
||||
}
|
||||
}
|
||||
|
@ -96,11 +94,9 @@ void move_if_present_helper(type_storage<T, MinSize, AlignSize>& lhs,
|
|||
{
|
||||
if (lhs_present and rhs_present) {
|
||||
lhs.move_assign(std::move(rhs));
|
||||
}
|
||||
if (lhs_present) {
|
||||
} else if (lhs_present) {
|
||||
lhs.destroy();
|
||||
}
|
||||
if (rhs_present) {
|
||||
} else if (rhs_present) {
|
||||
lhs.move_ctor(std::move(rhs));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -22,7 +22,7 @@
|
|||
#ifndef SRSRAN_EXPECTED_H
|
||||
#define SRSRAN_EXPECTED_H
|
||||
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
#include <memory>
|
||||
#include <system_error>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -341,6 +341,9 @@ public:
|
|||
constexpr static void (Derived::*react_fn)(SrcState&, const Event&) = ReactFn;
|
||||
constexpr static bool (Derived::*guard_fn)(SrcState&, const Event&) = GuardFn;
|
||||
|
||||
// ignore warning "never nullptr" for template specialization w/wo defaults for ReactFn or GuardFn
|
||||
_Pragma("GCC diagnostic push"); // save current diagnostic config
|
||||
_Pragma("GCC diagnostic ignored \"-Waddress\""); // ignore -Waddress
|
||||
static bool react(derived_view* f, src_state_t& s, const event_t& ev)
|
||||
{
|
||||
if (guard_fn == nullptr or (f->*guard_fn)(s, ev)) {
|
||||
|
@ -351,6 +354,7 @@ public:
|
|||
}
|
||||
return false;
|
||||
}
|
||||
_Pragma("GCC diagnostic pop"); // restore diagnostic config
|
||||
|
||||
template <typename SrcState2, typename Event2>
|
||||
using is_match = std::is_same<type_list<SrcState2, Event2>, type_list<src_state_t, event_t> >;
|
||||
|
@ -372,6 +376,9 @@ public:
|
|||
constexpr static void (Derived::*react_fn)(const Event&) = ReactFn;
|
||||
constexpr static bool (Derived::*guard_fn)(const Event&) = GuardFn;
|
||||
|
||||
// ignore warning "never nullptr" for template specialization w/wo defaults for ReactFn or GuardFn
|
||||
_Pragma("GCC diagnostic push"); // save current diagnostic config
|
||||
_Pragma("GCC diagnostic ignored \"-Waddress\""); // ignore -Waddress
|
||||
template <typename SrcState>
|
||||
static bool react(derived_view* f, SrcState& s, const event_t& ev)
|
||||
{
|
||||
|
@ -383,6 +390,7 @@ public:
|
|||
}
|
||||
return false;
|
||||
}
|
||||
_Pragma("GCC diagnostic pop"); // restore diagnostic config
|
||||
|
||||
template <typename SrcState2, typename Event2>
|
||||
using is_match = std::is_same<Event2, event_t>;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -22,8 +22,8 @@
|
|||
#ifndef SRSRAN_INTERVAL_H
|
||||
#define SRSRAN_INTERVAL_H
|
||||
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/srslog/bundled/fmt/format.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
@ -86,6 +86,17 @@ public:
|
|||
|
||||
bool contains(T point) const { return start_ <= point and point < stop_; }
|
||||
|
||||
interval<T>& intersect(const interval<T>& other)
|
||||
{
|
||||
if (not overlaps(other)) {
|
||||
*this = interval<T>{};
|
||||
} else {
|
||||
start_ = std::max(start(), other.start());
|
||||
stop_ = std::min(stop(), other.stop());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
T start_;
|
||||
T stop_;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -23,7 +23,7 @@
|
|||
#define SRSRAN_MOVE_CALLBACK_H
|
||||
|
||||
#include "detail/type_storage.h"
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
constexpr empty_table_t() = default;
|
||||
R call(void* src, Args... args) const final
|
||||
{
|
||||
srsran_terminate("ERROR: bad function call (cause: function ptr is empty)");
|
||||
srsran_assertion_failure("bad function call (cause: function ptr is empty)");
|
||||
}
|
||||
void move(void* src, void* dest) const final {}
|
||||
void dtor(void* src) const final {}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -29,8 +29,8 @@
|
|||
|
||||
namespace srsran {
|
||||
|
||||
using observer_id = std::size_t;
|
||||
const size_t invalid_observer_id = std::numeric_limits<observer_id>::max();
|
||||
using observer_id = std::size_t;
|
||||
const std::size_t invalid_observer_id = std::numeric_limits<observer_id>::max();
|
||||
|
||||
template <typename... Args>
|
||||
class observer;
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
template <typename... Args2>
|
||||
observer_id subscribe(Args2&&... args)
|
||||
{
|
||||
size_t id = 0;
|
||||
std::size_t id = 0;
|
||||
for (auto& slot : observers) {
|
||||
if (not static_cast<bool>(slot)) {
|
||||
// empty slot found
|
||||
|
@ -117,9 +117,9 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
size_t nof_observers() const
|
||||
std::size_t nof_observers() const
|
||||
{
|
||||
size_t count = 0;
|
||||
std::size_t count = 0;
|
||||
for (auto& slot : observers) {
|
||||
count += static_cast<bool>(slot) ? 1 : 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -23,7 +23,7 @@
|
|||
#define SRSRAN_OPTIONAL_H
|
||||
|
||||
#include "detail/type_storage.h"
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
|
||||
namespace srsran {
|
||||
|
||||
|
@ -31,7 +31,9 @@ template <typename T>
|
|||
class optional
|
||||
{
|
||||
public:
|
||||
optional() : has_val_(false) {}
|
||||
using value_type = T;
|
||||
|
||||
optional() : has_val_(false), empty() {}
|
||||
optional(const T& t) : has_val_(true) { storage.emplace(t); }
|
||||
optional(T&& t) : has_val_(true) { storage.emplace(std::move(t)); }
|
||||
optional(const optional<T>& other) : has_val_(other.has_value())
|
||||
|
@ -105,8 +107,11 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
bool has_val_;
|
||||
detail::type_storage<T> storage;
|
||||
bool has_val_;
|
||||
union {
|
||||
char empty;
|
||||
detail::type_storage<T> storage;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -0,0 +1,429 @@
|
|||
/**
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
* srsRAN is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsRAN is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_OPTIONAL_ARRAY_H
|
||||
#define SRSRAN_OPTIONAL_ARRAY_H
|
||||
|
||||
#include "optional.h"
|
||||
#include "span.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
#include <array>
|
||||
|
||||
namespace srsran {
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename Vec>
|
||||
class base_optional_span
|
||||
{
|
||||
using base_t = base_optional_span<Vec>;
|
||||
using T = typename Vec::value_type::value_type;
|
||||
|
||||
protected:
|
||||
template <typename Obj>
|
||||
class iterator_impl
|
||||
{
|
||||
using It = iterator_impl<Obj>;
|
||||
using parent_t = typename std::conditional<std::is_const<Obj>::value, const base_t, base_t>::type;
|
||||
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = Obj;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using pointer = Obj*;
|
||||
using reference = Obj&;
|
||||
|
||||
iterator_impl() = default;
|
||||
iterator_impl(parent_t* parent_, size_t idx_) : parent(parent_), idx(idx_)
|
||||
{
|
||||
if (idx < parent->vec.size() and not parent->contains(idx)) {
|
||||
++(*this);
|
||||
}
|
||||
}
|
||||
|
||||
It& operator++()
|
||||
{
|
||||
while (++idx < parent->vec.size() and not parent->contains(idx)) {
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
It& operator--()
|
||||
{
|
||||
while (--idx < parent->vec.size() and not parent->contains(idx)) {
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
reference operator*() { return parent->operator[](idx); }
|
||||
pointer operator->() { return &parent->operator[](idx); }
|
||||
|
||||
bool operator==(const It& other) const { return idx == other.idx and parent == other.parent; }
|
||||
bool operator!=(const It& other) const { return not(*this == other); }
|
||||
|
||||
private:
|
||||
friend base_t;
|
||||
|
||||
parent_t* parent = nullptr;
|
||||
size_t idx = std::numeric_limits<size_t>::max();
|
||||
};
|
||||
|
||||
size_t nof_elems = 0;
|
||||
Vec vec;
|
||||
|
||||
public:
|
||||
using value_type = T;
|
||||
using iterator = iterator_impl<T>;
|
||||
using const_iterator = iterator_impl<const T>;
|
||||
|
||||
base_optional_span() = default;
|
||||
base_optional_span(Vec&& v, size_t nof_elems_) : vec(std::move(v)), nof_elems(nof_elems_) {}
|
||||
base_optional_span(const Vec& v, size_t nof_elems_) : vec(v), nof_elems(nof_elems_) {}
|
||||
|
||||
// Find first position that is empty
|
||||
size_t find_first_empty(size_t start_guess = 0)
|
||||
{
|
||||
if (nof_elems == vec.size()) {
|
||||
return vec.size();
|
||||
}
|
||||
for (size_t i = start_guess; i < vec.size(); ++i) {
|
||||
if (not vec[i].has_value()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return vec.size();
|
||||
}
|
||||
|
||||
bool contains(size_t idx) const { return idx < vec.size() and vec[idx].has_value(); }
|
||||
|
||||
T& operator[](size_t idx) { return *vec[idx]; }
|
||||
const T& operator[](size_t idx) const { return *vec[idx]; }
|
||||
|
||||
bool empty() const { return nof_elems == 0; }
|
||||
size_t size() const { return nof_elems; }
|
||||
|
||||
iterator begin() { return iterator{this, 0}; }
|
||||
iterator end() { return iterator{this, vec.size()}; }
|
||||
const_iterator begin() const { return const_iterator{this, 0}; }
|
||||
const_iterator end() const { return const_iterator{this, vec.size()}; }
|
||||
|
||||
void clear()
|
||||
{
|
||||
this->nof_elems = 0;
|
||||
for (auto& e : *this) {
|
||||
e.reset();
|
||||
}
|
||||
}
|
||||
void erase(size_t idx)
|
||||
{
|
||||
srsran_assert(idx < this->vec.size(), "Out-of-bounds access to array: %zd>=%zd", idx, this->vec.size());
|
||||
if (this->contains(idx)) {
|
||||
this->nof_elems--;
|
||||
this->vec[idx].reset();
|
||||
}
|
||||
}
|
||||
void erase(iterator it) { erase(it.idx); }
|
||||
|
||||
template <typename U>
|
||||
void insert(size_t idx, U&& u)
|
||||
{
|
||||
srsran_assert(idx < this->vec.size(), "Out-of-bounds access to array: %zd>=%zd", idx, this->vec.size());
|
||||
this->nof_elems += this->contains(idx) ? 0 : 1;
|
||||
this->vec[idx] = std::forward<U>(u);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void emplace(size_t idx, Args&&... args)
|
||||
{
|
||||
srsran_assert(idx < this->vec.size(), "Out-of-bounds access to array: %zd>=%zd", idx, this->vec.size());
|
||||
if (not this->contains(idx)) {
|
||||
this->nof_elems++;
|
||||
}
|
||||
this->vec[idx].emplace(std::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Vec>
|
||||
class base_optional_vector : public base_optional_span<Vec>
|
||||
{
|
||||
using base_t = base_optional_span<Vec>;
|
||||
|
||||
public:
|
||||
using value_type = typename base_optional_span<Vec>::value_type;
|
||||
using iterator = typename base_optional_span<Vec>::iterator;
|
||||
using const_iterator = typename base_optional_span<Vec>::const_iterator;
|
||||
|
||||
base_optional_vector() = default;
|
||||
base_optional_vector(const base_optional_vector&) = default;
|
||||
base_optional_vector(base_optional_vector&& other) noexcept : base_t(std::move(other.vec), other.size())
|
||||
{
|
||||
other.nof_elems = 0;
|
||||
}
|
||||
base_optional_vector& operator=(const base_optional_vector&) = default;
|
||||
base_optional_vector& operator =(base_optional_vector&& other) noexcept
|
||||
{
|
||||
this->vec = std::move(other.vec);
|
||||
this->nof_elems = other.nof_elems;
|
||||
other.nof_elems = 0;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* Array of optional items. The iteration is in order of indexes and correctly skips non-present items
|
||||
* Pointer/References/Iterators remain valid throughout the object lifetime
|
||||
* NOTE: The sorted iteration and pointer validation guarantees add some overhead if the array is very fragmented
|
||||
* @tparam T type of objects
|
||||
* @tparam N static size of max nof items
|
||||
*/
|
||||
template <typename T, size_t N>
|
||||
class optional_array : public detail::base_optional_vector<std::array<optional<T>, N> >
|
||||
{};
|
||||
|
||||
/**
|
||||
* Contrarily to optional_array, this class may allocate and cause pointer/reference/iterator invalidation.
|
||||
* However, the indexes will remain valid.
|
||||
* @tparam T
|
||||
*/
|
||||
template <typename T>
|
||||
class optional_vector : public detail::base_optional_vector<std::vector<optional<T> > >
|
||||
{
|
||||
using base_t = detail::base_optional_vector<std::vector<optional<T> > >;
|
||||
|
||||
public:
|
||||
/// May allocate and cause pointer invalidation
|
||||
template <typename U>
|
||||
void insert(size_t idx, U&& u)
|
||||
{
|
||||
if (idx >= this->vec.size()) {
|
||||
this->vec.resize(idx + 1);
|
||||
}
|
||||
base_t::insert(idx, std::forward<U>(u));
|
||||
}
|
||||
|
||||
/// May allocate and cause pointer invalidation
|
||||
template <typename... Args>
|
||||
void emplace(size_t idx, Args&&... args)
|
||||
{
|
||||
if (idx >= this->vec.size()) {
|
||||
this->vec.resize(idx + 1);
|
||||
}
|
||||
base_t::emplace(idx, std::forward<Args>(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class optional_span : public detail::base_optional_span<srsran::span<optional<T> > >
|
||||
{
|
||||
using base_t = detail::base_optional_span<srsran::span<optional<T> > >;
|
||||
|
||||
public:
|
||||
template <size_t N>
|
||||
optional_span(const optional_array<T, N>& ar) : base_t::vec(ar)
|
||||
{}
|
||||
optional_span(const optional_vector<T>& ar) : base_t::vec(ar) {}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
class base_split_optional_span
|
||||
{
|
||||
protected:
|
||||
using presence_type = typename std::conditional<std::is_const<T>::value, const bool, bool>::type;
|
||||
|
||||
T* ptr = nullptr;
|
||||
presence_type* present_ptr = nullptr;
|
||||
size_t len = 0;
|
||||
|
||||
template <typename Obj>
|
||||
class iterator_impl
|
||||
{
|
||||
using It = iterator_impl<Obj>;
|
||||
using Parent = typename std::
|
||||
conditional<std::is_const<Obj>::value, const base_split_optional_span<T>, base_split_optional_span<T> >::type;
|
||||
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = Obj;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using pointer = Obj*;
|
||||
using reference = Obj&;
|
||||
|
||||
iterator_impl() = default;
|
||||
iterator_impl(Parent* parent_, size_t idx_) : parent(parent_), idx(idx_)
|
||||
{
|
||||
if (idx < parent->len and not parent->contains(idx)) {
|
||||
++(*this);
|
||||
}
|
||||
}
|
||||
|
||||
It& operator++()
|
||||
{
|
||||
while (++idx < parent->len and not parent->contains(idx)) {
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
It& operator--()
|
||||
{
|
||||
while (--idx < parent->len and not parent->contains(idx)) {
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
reference operator*() { return parent->operator[](idx); }
|
||||
pointer operator->() { return &parent->operator[](idx); }
|
||||
|
||||
bool operator==(const It& other) const { return idx == other.idx and parent == other.parent; }
|
||||
bool operator!=(const It& other) const { return not(*this == other); }
|
||||
|
||||
size_t get_idx() const { return idx; }
|
||||
|
||||
private:
|
||||
Parent* parent = nullptr;
|
||||
size_t idx = std::numeric_limits<size_t>::max();
|
||||
};
|
||||
|
||||
public:
|
||||
using value_type = T;
|
||||
using iterator = iterator_impl<T>;
|
||||
using const_iterator = iterator_impl<const T>;
|
||||
|
||||
constexpr base_split_optional_span() = default;
|
||||
template <std::size_t N>
|
||||
constexpr base_split_optional_span(value_type (&arr)[N], presence_type (&present)[N]) noexcept : ptr(arr),
|
||||
present_ptr(present),
|
||||
len(N)
|
||||
{}
|
||||
constexpr base_split_optional_span(value_type* arr, presence_type* present, size_t N) :
|
||||
ptr(arr), present_ptr(present), len(N)
|
||||
{}
|
||||
|
||||
bool contains(size_t idx) const { return idx < len and present_ptr[idx]; }
|
||||
bool empty() const
|
||||
{
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
if (present_ptr[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
size_t size() const
|
||||
{
|
||||
size_t c = 0;
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
c += present_ptr[i] ? 1 : 0;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
size_t capacity() const { return len; }
|
||||
|
||||
const T& operator[](size_t idx) const { return ptr[idx]; }
|
||||
T& operator[](size_t idx) { return ptr[idx]; }
|
||||
const T& at(size_t idx) const
|
||||
{
|
||||
srsran_assert(contains(idx), "Access to inexistent element of index=%zd", idx);
|
||||
return ptr[idx];
|
||||
}
|
||||
T& at(size_t idx)
|
||||
{
|
||||
srsran_assert(this->contains(idx), "Access to inexistent element of index=%zd", idx);
|
||||
return this->ptr[idx];
|
||||
}
|
||||
|
||||
const_iterator begin() const { return const_iterator(this, 0); }
|
||||
const_iterator end() const { return const_iterator(this, len); }
|
||||
iterator begin() { return iterator(this, 0); }
|
||||
iterator end() { return iterator(this, this->len); }
|
||||
|
||||
// Find first position that is empty
|
||||
size_t find_first_empty(size_t start_guess = 0) { return begin().get_idx(); }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename T>
|
||||
class split_optional_span : public detail::base_split_optional_span<T>
|
||||
{
|
||||
using base_t = detail::base_split_optional_span<T>;
|
||||
|
||||
public:
|
||||
using value_type = T;
|
||||
using const_iterator = typename base_t::const_iterator;
|
||||
using iterator = typename base_t::iterator;
|
||||
|
||||
using base_t::base_t;
|
||||
|
||||
template <typename U>
|
||||
void insert(size_t idx, U&& u)
|
||||
{
|
||||
srsran_assert(idx < this->len, "Out-of-bounds access to array: %zd>=%zd", idx, this->len);
|
||||
this->present_ptr[idx] = true;
|
||||
this->ptr[idx] = std::forward<U>(u);
|
||||
}
|
||||
void erase(size_t idx)
|
||||
{
|
||||
srsran_assert(idx < this->len, "Out-of-bounds access to array: %zd>=%zd", idx, this->len);
|
||||
this->present_ptr[idx] = false;
|
||||
}
|
||||
void erase(iterator it) { erase(it.get_idx()); }
|
||||
void clear()
|
||||
{
|
||||
for (size_t i = 0; i < this->len; ++i) {
|
||||
this->present_ptr[i] = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename U>
|
||||
class split_optional_span<const U> : public detail::base_split_optional_span<const U>
|
||||
{
|
||||
using base_t = detail::base_split_optional_span<const U>;
|
||||
using presence_type = typename base_t::presence_type;
|
||||
|
||||
public:
|
||||
using value_type = const U;
|
||||
using const_iterator = typename base_t::const_iterator;
|
||||
|
||||
using base_t::base_t;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
split_optional_span<T>
|
||||
make_optional_span(T* array,
|
||||
typename std::conditional<std::is_const<T>::value, const bool, bool>::type* present,
|
||||
size_t N)
|
||||
{
|
||||
return split_optional_span<T>(array, present, N);
|
||||
}
|
||||
template <typename T, size_t N>
|
||||
split_optional_span<T>
|
||||
make_optional_span(T (&array)[N],
|
||||
typename std::conditional<std::is_const<T>::value, const bool, bool>::type (&present)[N])
|
||||
{
|
||||
return split_optional_span<T>(array, present);
|
||||
}
|
||||
|
||||
} // namespace srsran
|
||||
|
||||
#endif // SRSRAN_OPTIONAL_ARRAY_H
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -24,8 +24,8 @@
|
|||
|
||||
#include "memblock_cache.h"
|
||||
#include "pool_utils.h"
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/common/thread_pool.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
|
@ -130,7 +130,7 @@ public:
|
|||
void* node = grow_pool.allocate_node();
|
||||
|
||||
if (grow_pool.size() < batch_threshold) {
|
||||
allocate_batch_in_background_unlocked();
|
||||
allocate_batch_in_background_nolock();
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void allocate_batch_in_background_unlocked()
|
||||
void allocate_batch_in_background_nolock()
|
||||
{
|
||||
if (state->dispatched) {
|
||||
// new batch allocation already ongoing
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
/**
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
* srsRAN is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsRAN is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_CACHED_ALLOC_H
|
||||
#define SRSRAN_CACHED_ALLOC_H
|
||||
|
||||
#include "../intrusive_list.h"
|
||||
#include "memblock_cache.h"
|
||||
#include <deque>
|
||||
#include <queue>
|
||||
|
||||
namespace srsran {
|
||||
|
||||
/**
|
||||
* Custom Allocator that caches deallocated memory blocks in a stack to be reused in future allocations.
|
||||
* This minimizes the number of new/delete calls, when the rate of insertions/removals match (e.g. a queue)
|
||||
* This allocator is not thread-safe. It assumes the container is being used in a single-threaded environment,
|
||||
* or being mutexed when altered, which is a reasonable assumption
|
||||
* @tparam T object type
|
||||
*/
|
||||
template <typename T>
|
||||
class cached_alloc : public std::allocator<T>
|
||||
{
|
||||
struct memblock_t : public intrusive_double_linked_list_element<> {
|
||||
explicit memblock_t(size_t sz) : block_size(sz) {}
|
||||
size_t block_size;
|
||||
};
|
||||
const size_t min_n = (sizeof(memblock_t) + sizeof(T) - 1) / sizeof(T);
|
||||
|
||||
public:
|
||||
using value_type = T;
|
||||
|
||||
~cached_alloc()
|
||||
{
|
||||
while (not free_list.empty()) {
|
||||
memblock_t& b = free_list.front();
|
||||
free_list.pop_front();
|
||||
size_t n = b.block_size;
|
||||
b.~memblock_t();
|
||||
std::allocator<T>::deallocate(reinterpret_cast<T*>(&b), n);
|
||||
}
|
||||
}
|
||||
cached_alloc() = default;
|
||||
cached_alloc(cached_alloc<T>&& other) noexcept = default;
|
||||
cached_alloc(const cached_alloc<T>& other) noexcept : cached_alloc() {}
|
||||
template <typename U>
|
||||
explicit cached_alloc(const cached_alloc<U>& other) noexcept : cached_alloc()
|
||||
{
|
||||
// start empty, as cached blocks cannot be copied
|
||||
}
|
||||
cached_alloc& operator=(const cached_alloc<T>& other) noexcept { return *this; }
|
||||
cached_alloc& operator=(cached_alloc&& other) noexcept = default;
|
||||
|
||||
T* allocate(size_t n, const void* ptr = nullptr)
|
||||
{
|
||||
size_t req_n = std::max(n, min_n);
|
||||
for (memblock_t& b : free_list) {
|
||||
if (b.block_size == req_n) {
|
||||
free_list.pop(&b);
|
||||
b.~memblock_t();
|
||||
return reinterpret_cast<T*>(&b);
|
||||
}
|
||||
}
|
||||
return std::allocator<T>::allocate(req_n, ptr);
|
||||
}
|
||||
void deallocate(T* p, size_t n) noexcept
|
||||
{
|
||||
size_t req_n = std::max(n, min_n);
|
||||
auto* block = reinterpret_cast<memblock_t*>(p);
|
||||
new (block) memblock_t(req_n);
|
||||
free_list.push_front(block);
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
struct rebind {
|
||||
using other = cached_alloc<U>;
|
||||
};
|
||||
|
||||
private:
|
||||
intrusive_double_linked_list<memblock_t> free_list;
|
||||
};
|
||||
|
||||
} // namespace srsran
|
||||
|
||||
template <typename T1, typename T2>
|
||||
bool operator==(const srsran::cached_alloc<T1>& lhs, const srsran::cached_alloc<T2>& rhs) noexcept
|
||||
{
|
||||
return &lhs == &rhs;
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
bool operator!=(const srsran::cached_alloc<T1>& lhs, const srsran::cached_alloc<T2>& rhs) noexcept
|
||||
{
|
||||
return not(lhs == rhs);
|
||||
}
|
||||
|
||||
namespace srsran {
|
||||
|
||||
template <typename T>
|
||||
using deque = std::deque<T, cached_alloc<T> >;
|
||||
|
||||
template <typename T>
|
||||
using queue = std::queue<T, srsran::deque<T> >;
|
||||
|
||||
} // namespace srsran
|
||||
|
||||
#endif // SRSRAN_CACHED_ALLOC_H
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -116,6 +116,22 @@ private:
|
|||
srslog::basic_logger& logger;
|
||||
};
|
||||
|
||||
template <typename T, size_t N, typename... Args>
|
||||
unique_pool_ptr<T> make_pool_obj_with_fallback(circular_stack_pool<N>& pool, size_t key, Args&&... args)
|
||||
{
|
||||
void* block = pool.allocate(key, sizeof(T), alignof(T));
|
||||
if (block == nullptr) {
|
||||
// allocated with "new" as a fallback
|
||||
return unique_pool_ptr<T>(new T(std::forward<Args>(args)...), std::default_delete<T>());
|
||||
}
|
||||
// allocation using memory pool was successful
|
||||
new (block) T(std::forward<Args>(args)...);
|
||||
return unique_pool_ptr<T>(static_cast<T*>(block), [key, &pool](T* ptr) {
|
||||
ptr->~T();
|
||||
pool.deallocate(key, ptr);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace srsran
|
||||
|
||||
#endif // SRSRAN_CIRCULAR_MAP_STACK_POOL_H
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -23,7 +23,7 @@
|
|||
#define SRSRAN_LINEAR_ALLOCATOR_H
|
||||
|
||||
#include "pool_utils.h"
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
|
||||
namespace srsran {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -69,7 +69,7 @@ detail::scope_exit<typename std::decay<Callable>::type> make_scope_exit(Callable
|
|||
return detail::scope_exit<typename std::decay<Callable>::type>{std::forward<Callable>(callable)};
|
||||
}
|
||||
|
||||
#define DEFER(FUNC) auto on_exit_call = make_scope_exit([&]() { FUNC })
|
||||
#define DEFER(FUNC) auto on_exit_call##__LINE__ = srsran::make_scope_exit([&]() { FUNC })
|
||||
|
||||
} // namespace srsran
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -22,17 +22,14 @@
|
|||
#ifndef SRSASN_COMMON_UTILS_H
|
||||
#define SRSASN_COMMON_UTILS_H
|
||||
|
||||
#include "srsran/common/srsran_assert.h"
|
||||
#include "srsran/common/buffer_pool.h"
|
||||
#include "srsran/srslog/srslog.h"
|
||||
#include <algorithm>
|
||||
#include "srsran/support/srsran_assert.h"
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace asn1 {
|
||||
|
||||
|
@ -151,6 +148,7 @@ public:
|
|||
int distance() const;
|
||||
int distance_bytes(uint8_t* ref_ptr) const;
|
||||
int distance_bytes() const;
|
||||
int distance_bytes_end() const;
|
||||
|
||||
template <class T>
|
||||
SRSASN_CODE unpack(T& val, uint32_t n_bits)
|
||||
|
@ -204,8 +202,12 @@ public:
|
|||
{
|
||||
size_ = nof_items;
|
||||
cap_ = nof_items;
|
||||
data_ = new T[cap_];
|
||||
std::copy(ptr, ptr + size_, data_);
|
||||
if (ptr != NULL) {
|
||||
data_ = new T[cap_];
|
||||
std::copy(ptr, ptr + size_, data_);
|
||||
} else {
|
||||
data_ = NULL;
|
||||
}
|
||||
}
|
||||
~dyn_array()
|
||||
{
|
||||
|
@ -235,11 +237,13 @@ public:
|
|||
size_ = new_size;
|
||||
return;
|
||||
}
|
||||
|
||||
T* old_data = data_;
|
||||
cap_ = new_size > new_cap ? new_size : new_cap;
|
||||
if (cap_ > 0) {
|
||||
data_ = new T[cap_];
|
||||
if (old_data != NULL) {
|
||||
srsran_assert(cap_ > size_, "Old size larger than new capacity in dyn_array\n");
|
||||
std::copy(&old_data[0], &old_data[size_], data_);
|
||||
}
|
||||
} else {
|
||||
|
@ -260,7 +264,7 @@ public:
|
|||
std::copy(it + 1, end(), it);
|
||||
size_--;
|
||||
|
||||
return it + 1;
|
||||
return it;
|
||||
}
|
||||
bool operator==(const dyn_array<T>& other) const
|
||||
{
|
||||
|
@ -295,7 +299,8 @@ public:
|
|||
using iterator = T*;
|
||||
using const_iterator = const T*;
|
||||
|
||||
explicit bounded_array(uint32_t size_ = 0) : data_(), current_size(size_) {}
|
||||
bounded_array() : data_(), current_size(0) {}
|
||||
explicit bounded_array(uint32_t size_) : data_(), current_size(size_) {}
|
||||
static uint32_t capacity() { return MAX_N; }
|
||||
uint32_t size() const { return current_size; }
|
||||
T& operator[](uint32_t idx) { return data_[idx]; }
|
||||
|
@ -305,6 +310,7 @@ public:
|
|||
return size() == other.size() and std::equal(data_, data_ + size(), other.data_);
|
||||
}
|
||||
void resize(uint32_t new_size) { current_size = new_size; }
|
||||
void clear() { resize(0); }
|
||||
void push_back(const T& elem)
|
||||
{
|
||||
if (current_size >= MAX_N) {
|
||||
|
@ -605,7 +611,7 @@ public:
|
|||
IntType value;
|
||||
integer() = default;
|
||||
integer(IntType value_) : value(value_) {}
|
||||
operator IntType() { return value; }
|
||||
operator IntType() const { return value; }
|
||||
SRSASN_CODE pack(bit_ref& bref) const { return pack_integer(bref, value, lb, ub, has_ext, is_aligned); }
|
||||
SRSASN_CODE unpack(cbit_ref& bref) { return unpack_integer(value, bref, lb, ub, has_ext, is_aligned); }
|
||||
};
|
||||
|
@ -866,7 +872,8 @@ public:
|
|||
static const uint32_t lb = LB, ub = UB;
|
||||
static const bool has_ext = ext, is_aligned = aligned;
|
||||
|
||||
explicit bitstring(uint32_t siz_ = lb) { resize(siz_); }
|
||||
bitstring() { resize(lb); }
|
||||
explicit bitstring(uint32_t siz_) { resize(siz_); }
|
||||
explicit bitstring(const std::string& s)
|
||||
{
|
||||
resize(s.size());
|
||||
|
@ -929,6 +936,17 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
this_type& from_number(uint64_t val, uint32_t nof_bits)
|
||||
{
|
||||
if (nof_bits > UB) {
|
||||
log_error("The provided bitstring value %ld does not fit the bounds [%d, %d]", val, uint32_t(lb), uint32_t(ub));
|
||||
return *this;
|
||||
}
|
||||
resize(nof_bits);
|
||||
bitstring_utils::from_number(data(), val, length());
|
||||
return *this;
|
||||
}
|
||||
|
||||
// packers / unpackers
|
||||
SRSASN_CODE pack(bit_ref& bref) const
|
||||
{
|
||||
|
@ -1314,11 +1332,13 @@ public:
|
|||
~varlength_field_pack_guard();
|
||||
|
||||
private:
|
||||
bit_ref brefstart;
|
||||
// bit_ref bref0;
|
||||
bit_ref* bref_tracker;
|
||||
uint8_t buffer[2048];
|
||||
bool align;
|
||||
using byte_array_t = std::array<uint8_t, srsran::byte_buffer_pool::BLOCK_SIZE>;
|
||||
using byte_array_ptr = srsran::any_pool_ptr<byte_array_t>;
|
||||
|
||||
bit_ref brefstart;
|
||||
bit_ref* bref_tracker;
|
||||
byte_array_ptr buffer_ptr;
|
||||
bool align;
|
||||
};
|
||||
|
||||
class varlength_field_unpack_guard
|
||||
|
@ -1365,6 +1385,33 @@ private:
|
|||
separator_t sep;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
inline auto to_json(json_writer& j, const T& obj) -> decltype(obj.to_json(j))
|
||||
{
|
||||
obj.to_json(j);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline auto to_json(json_writer& j, const T& obj) -> decltype(j.write_str(obj.to_string()))
|
||||
{
|
||||
j.write_str(obj.to_string());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void to_json(json_writer& j, const asn1::dyn_array<T>& lst)
|
||||
{
|
||||
j.start_array();
|
||||
for (const auto& o : lst) {
|
||||
to_json(j, o);
|
||||
}
|
||||
j.end_array();
|
||||
}
|
||||
|
||||
inline void to_json(json_writer& j, int64_t number)
|
||||
{
|
||||
j.write_int(number);
|
||||
}
|
||||
|
||||
/*******************
|
||||
Test pack/unpack
|
||||
*******************/
|
||||
|
@ -1410,6 +1457,423 @@ int test_pack_unpack_consistency(const Msg& msg)
|
|||
return SRSASN_SUCCESS;
|
||||
}
|
||||
|
||||
/************************
|
||||
General Layer Types
|
||||
************************/
|
||||
|
||||
/// Enumerated used in RRC and RRC NR that distinguishes Release and Setup modes
|
||||
struct setup_release_opts {
|
||||
enum options { release, setup, nulltype } value;
|
||||
|
||||
const char* to_string() const
|
||||
{
|
||||
static const char* options[] = {"release", "setup"};
|
||||
return convert_enum_idx(options, 2, value, "setup_release_c::types");
|
||||
}
|
||||
};
|
||||
using setup_release_e = enumerated<setup_release_opts>;
|
||||
|
||||
// SetupRelease{ElementTypeParam} ::= CHOICE
|
||||
template <class T>
|
||||
struct setup_release_c {
|
||||
using types_opts = setup_release_opts;
|
||||
using types = setup_release_e;
|
||||
|
||||
// choice methods
|
||||
setup_release_c() = default;
|
||||
void set(typename types::options e = types::nulltype) { type_ = e; }
|
||||
types type() const { return type_; }
|
||||
SRSASN_CODE pack(bit_ref& bref) const
|
||||
{
|
||||
type_.pack(bref);
|
||||
switch (type_.value) {
|
||||
case types::release:
|
||||
break;
|
||||
case types::setup:
|
||||
HANDLE_CODE(c.pack(bref));
|
||||
break;
|
||||
default:
|
||||
log_invalid_choice_id(type_, "setup_release_c");
|
||||
return SRSASN_ERROR_ENCODE_FAIL;
|
||||
}
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
SRSASN_CODE unpack(cbit_ref& bref)
|
||||
{
|
||||
types e;
|
||||
e.unpack(bref);
|
||||
set(e);
|
||||
switch (type_.value) {
|
||||
case types::release:
|
||||
break;
|
||||
case types::setup:
|
||||
HANDLE_CODE(c.unpack(bref));
|
||||
break;
|
||||
default:
|
||||
log_invalid_choice_id(type_, "setup_release_c");
|
||||
return SRSASN_ERROR_DECODE_FAIL;
|
||||
}
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
void to_json(json_writer& j) const
|
||||
{
|
||||
j.start_obj();
|
||||
switch (type_.value) {
|
||||
case types::release:
|
||||
break;
|
||||
case types::setup:
|
||||
asn1::to_json(j, setup());
|
||||
break;
|
||||
default:
|
||||
log_invalid_choice_id(type_, "setup_release_c");
|
||||
}
|
||||
j.end_obj();
|
||||
}
|
||||
// getters
|
||||
bool is_setup() const { return type_.value == setup_release_opts::setup; }
|
||||
T& setup()
|
||||
{
|
||||
assert_choice_type(types::setup, type_, "SetupRelease");
|
||||
return c;
|
||||
}
|
||||
const T& setup() const
|
||||
{
|
||||
assert_choice_type(types::setup, type_, "SetupRelease");
|
||||
return c;
|
||||
}
|
||||
void set_release() { set(types::release); }
|
||||
T& set_setup()
|
||||
{
|
||||
set(types::setup);
|
||||
return c;
|
||||
}
|
||||
|
||||
private:
|
||||
types type_;
|
||||
T c;
|
||||
};
|
||||
|
||||
// Criticality ::= ENUMERATED
|
||||
struct crit_opts {
|
||||
enum options { reject, ignore, notify, nulltype } value;
|
||||
const char* to_string() const
|
||||
{
|
||||
static const char* options[] = {"reject", "ignore", "notify"};
|
||||
return convert_enum_idx(options, 3, value, "crit_e");
|
||||
}
|
||||
};
|
||||
typedef enumerated<crit_opts> crit_e;
|
||||
|
||||
// Presence ::= ENUMERATED
|
||||
struct presence_opts {
|
||||
enum options { optional, conditional, mandatory, nulltype } value;
|
||||
|
||||
const char* to_string() const
|
||||
{
|
||||
static const char* options[] = {"optional", "conditional", "mandatory"};
|
||||
return convert_enum_idx(options, 3, value, "presence_e");
|
||||
}
|
||||
};
|
||||
typedef enumerated<presence_opts> presence_e;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename IEsSetParam>
|
||||
struct ie_field_value_item {
|
||||
using obj_set_type = IEsSetParam;
|
||||
using value_type = typename IEsSetParam::value_c;
|
||||
const char* item_name() const { return "value"; }
|
||||
void set_item(uint32_t id) { item = IEsSetParam::get_value(id); }
|
||||
|
||||
protected:
|
||||
value_type item;
|
||||
};
|
||||
|
||||
template <typename ExtensionSetParam>
|
||||
struct ie_field_ext_item {
|
||||
using obj_set_type = ExtensionSetParam;
|
||||
using value_type = typename ExtensionSetParam::ext_c;
|
||||
const char* item_name() const { return "extension"; }
|
||||
void set_item(uint32_t id) { item = ExtensionSetParam::get_ext(id); }
|
||||
|
||||
protected:
|
||||
value_type item;
|
||||
};
|
||||
|
||||
template <class IEItem>
|
||||
struct base_ie_field : public IEItem {
|
||||
using obj_set_type = typename IEItem::obj_set_type;
|
||||
using value_type = typename IEItem::value_type;
|
||||
|
||||
uint32_t id() const { return obj_set_type::idx_to_id(value().type().value); }
|
||||
crit_e crit() const { return obj_set_type::get_crit(id()); }
|
||||
value_type& value() { return this->item; }
|
||||
const value_type& value() const { return this->item; }
|
||||
|
||||
value_type* operator->() { return &value(); }
|
||||
const value_type* operator->() const { return &value(); }
|
||||
value_type& operator*() { return value(); }
|
||||
const value_type& operator*() const { return value(); }
|
||||
|
||||
SRSASN_CODE pack(bit_ref& bref) const
|
||||
{
|
||||
HANDLE_CODE(pack_integer(bref, id(), (uint32_t)0u, (uint32_t)65535u, false, true));
|
||||
HANDLE_CODE(crit().pack(bref));
|
||||
HANDLE_CODE(value().pack(bref));
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
SRSASN_CODE unpack(cbit_ref& bref)
|
||||
{
|
||||
uint32_t id_val;
|
||||
HANDLE_CODE(unpack_integer(id_val, bref, (uint32_t)0u, (uint32_t)65535u, false, true));
|
||||
this->set_item(id_val);
|
||||
HANDLE_CODE(crit().unpack(bref));
|
||||
HANDLE_CODE(value().unpack(bref));
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
void to_json(json_writer& j) const
|
||||
{
|
||||
j.start_obj();
|
||||
j.write_int("id", id());
|
||||
j.write_str("criticality", crit().to_string());
|
||||
j.write_fieldname(this->item_name());
|
||||
asn1::to_json(j, value());
|
||||
j.end_obj();
|
||||
}
|
||||
bool load_info_obj(const uint32_t& id_)
|
||||
{
|
||||
if (not obj_set_type::is_id_valid(id_)) {
|
||||
return false;
|
||||
}
|
||||
this->set_item(id_);
|
||||
return value().type().value != obj_set_type::value_c::types_opts::nulltype;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// ProtocolIE-Field{LAYER-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE{{IEsSetParam}}
|
||||
template <class IEsSetParam>
|
||||
struct protocol_ie_field_s : public detail::base_ie_field<detail::ie_field_value_item<IEsSetParam> > {};
|
||||
|
||||
// ProtocolIE-SingleContainer{LAYER-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE{{IEsSetParam}}
|
||||
template <class ies_set_paramT_>
|
||||
struct protocol_ie_single_container_s : public protocol_ie_field_s<ies_set_paramT_> {};
|
||||
|
||||
// ProtocolExtensionField{LAYER-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE{{LAYER-PROTOCOL-EXTENSION}}
|
||||
template <class ExtensionSetParam>
|
||||
struct protocol_ext_field_s : public detail::base_ie_field<detail::ie_field_ext_item<ExtensionSetParam> > {};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
struct ie_value_item {
|
||||
using value_type = T;
|
||||
value_type value;
|
||||
|
||||
value_type* operator->() { return &value; }
|
||||
const value_type* operator->() const { return &value; }
|
||||
value_type& operator*() { return value; }
|
||||
const value_type& operator*() const { return value; }
|
||||
const char* item_name() const { return "value"; }
|
||||
|
||||
protected:
|
||||
value_type& item() { return value; }
|
||||
const value_type& item() const { return value; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ie_ext_item {
|
||||
using value_type = T;
|
||||
value_type ext;
|
||||
|
||||
value_type* operator->() { return &ext; }
|
||||
const value_type* operator->() const { return &ext; }
|
||||
value_type& operator*() { return ext; }
|
||||
const value_type& operator*() const { return ext; }
|
||||
const char* item_name() const { return "extension"; }
|
||||
|
||||
protected:
|
||||
value_type& item() { return ext; }
|
||||
const value_type& item() const { return ext; }
|
||||
};
|
||||
|
||||
template <class IEItem>
|
||||
struct base_ie_container_item : public IEItem {
|
||||
using value_type = typename IEItem::value_type;
|
||||
|
||||
base_ie_container_item(uint32_t id_, crit_e crit_) : id(id_), crit(crit_) {}
|
||||
|
||||
uint32_t id = 0;
|
||||
crit_e crit;
|
||||
|
||||
value_type* operator->() { return &this->item(); }
|
||||
const value_type* operator->() const { return &this->item(); }
|
||||
value_type& operator*() { return this->item(); }
|
||||
const value_type& operator*() const { return this->item(); }
|
||||
|
||||
SRSASN_CODE pack(bit_ref& bref) const
|
||||
{
|
||||
HANDLE_CODE(pack_integer(bref, id, (uint32_t)0u, (uint32_t)65535u, false, true));
|
||||
HANDLE_CODE(crit.pack(bref));
|
||||
{
|
||||
varlength_field_pack_guard varlen_scope(bref, true);
|
||||
HANDLE_CODE(this->item().pack(bref));
|
||||
}
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
SRSASN_CODE unpack(cbit_ref& bref)
|
||||
{
|
||||
HANDLE_CODE(unpack_integer(id, bref, (uint32_t)0u, (uint32_t)65535u, false, true));
|
||||
HANDLE_CODE(crit.unpack(bref));
|
||||
{
|
||||
varlength_field_unpack_guard varlen_scope(bref, true);
|
||||
HANDLE_CODE(this->item().unpack(bref));
|
||||
}
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
void to_json(json_writer& j) const
|
||||
{
|
||||
j.start_obj();
|
||||
j.write_int("id", id);
|
||||
j.write_str("criticality", crit.to_string());
|
||||
j.write_fieldname(this->item_name());
|
||||
asn1::to_json(j, this->item());
|
||||
j.end_obj();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename T>
|
||||
struct protocol_ie_container_item_s : public detail::base_ie_container_item<detail::ie_value_item<T> > {
|
||||
using base_type = detail::base_ie_container_item<detail::ie_value_item<T> >;
|
||||
using base_type::base_type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct protocol_ext_container_item_s : public detail::base_ie_container_item<detail::ie_ext_item<T> > {
|
||||
using base_type = detail::base_ie_container_item<detail::ie_ext_item<T> >;
|
||||
using base_type::base_type;
|
||||
};
|
||||
|
||||
// ProtocolIE-Container{LAYER-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE (SIZE (0..65535)) OF ProtocolIE-Field
|
||||
template <class IEsSetParam>
|
||||
using protocol_ie_container_l = dyn_seq_of<protocol_ie_field_s<IEsSetParam>, 0, 65535, true>;
|
||||
|
||||
// ProtocolExtensionContainer{LAYER-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE (SIZE (1..65535)) OF
|
||||
// ProtocolExtensionField
|
||||
template <class ExtensionSetParam>
|
||||
using protocol_ext_container_l = dyn_seq_of<protocol_ext_field_s<ExtensionSetParam>, 1, 65535, true>;
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct empty_obj_set_item_c {
|
||||
struct types_opts {
|
||||
enum options { nulltype } value;
|
||||
const char* to_string() const;
|
||||
};
|
||||
typedef enumerated<types_opts> types;
|
||||
|
||||
// choice methods
|
||||
types type() const { return types::nulltype; }
|
||||
SRSASN_CODE pack(bit_ref& bref) const;
|
||||
SRSASN_CODE unpack(cbit_ref& bref);
|
||||
void to_json(json_writer& j) const;
|
||||
};
|
||||
|
||||
struct base_empty_obj_set {
|
||||
// members lookup methods
|
||||
static uint32_t idx_to_id(uint32_t idx);
|
||||
static bool is_id_valid(const uint32_t& id);
|
||||
static crit_e get_crit(const uint32_t& id);
|
||||
static presence_e get_presence(const uint32_t& id);
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// Empty Protocol IE Object Set
|
||||
struct protocol_ies_empty_o : public detail::base_empty_obj_set {
|
||||
using value_c = detail::empty_obj_set_item_c;
|
||||
|
||||
// members lookup methods
|
||||
static value_c get_value(uint32_t id) { return {}; }
|
||||
};
|
||||
|
||||
/// Empty Protocol Extension Object Set
|
||||
struct protocol_ext_empty_o : public detail::base_empty_obj_set {
|
||||
using ext_c = detail::empty_obj_set_item_c;
|
||||
|
||||
// members lookup methods
|
||||
static ext_c get_ext(uint32_t id) { return {}; }
|
||||
};
|
||||
|
||||
/// Empty ProtocolExtensionContainer
|
||||
struct protocol_ie_container_empty_l {
|
||||
template <class extT_>
|
||||
using ie_field_s = protocol_ext_container_item_s<extT_>;
|
||||
|
||||
// sequence methods
|
||||
SRSASN_CODE pack(bit_ref& bref) const
|
||||
{
|
||||
uint32_t nof_ies = 0;
|
||||
pack_length(bref, nof_ies, 1u, 65535u, true);
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
SRSASN_CODE unpack(cbit_ref& bref)
|
||||
{
|
||||
uint32_t nof_ies = 0;
|
||||
unpack_length(nof_ies, bref, 1u, 65535u, true);
|
||||
if (nof_ies > 0) {
|
||||
return SRSASN_ERROR_DECODE_FAIL;
|
||||
}
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
void to_json(json_writer& j) const
|
||||
{
|
||||
j.start_obj();
|
||||
j.end_obj();
|
||||
}
|
||||
};
|
||||
|
||||
using protocol_ext_container_empty_l = protocol_ie_container_empty_l;
|
||||
|
||||
template <typename ProtocolIEs>
|
||||
class elementary_procedure_option
|
||||
{
|
||||
ProtocolIEs protocol_ies;
|
||||
|
||||
public:
|
||||
bool ext;
|
||||
// ...
|
||||
|
||||
ProtocolIEs* operator->() { return &protocol_ies; }
|
||||
const ProtocolIEs* operator->() const { return &protocol_ies; }
|
||||
ProtocolIEs& operator*() { return protocol_ies; }
|
||||
const ProtocolIEs& operator*() const { return protocol_ies; }
|
||||
|
||||
// sequence methods
|
||||
SRSASN_CODE pack(bit_ref& bref) const
|
||||
{
|
||||
bref.pack(ext, 1);
|
||||
HANDLE_CODE(protocol_ies.pack(bref));
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
SRSASN_CODE unpack(cbit_ref& bref)
|
||||
{
|
||||
bref.unpack(ext, 1);
|
||||
HANDLE_CODE(protocol_ies.unpack(bref));
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
void to_json(json_writer& j) const
|
||||
{
|
||||
j.start_obj();
|
||||
j.write_fieldname("protocolIEs");
|
||||
asn1::to_json(j, protocol_ies);
|
||||
j.end_obj();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace asn1
|
||||
|
||||
#endif // SRSASN_COMMON_UTILS_H
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -2430,6 +2430,7 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_security_protected_nas_msg(LIBLTE_BYTE_MSG_STR
|
|||
#define LIBLTE_MME_EPS_NETWORK_FEATURE_SUPPORT_IEI 0x64
|
||||
#define LIBLTE_MME_ADDITIONAL_UPDATE_RESULT_IEI 0xF
|
||||
#define LIBLTE_MME_T3412_EXTENDED_VALUE_IEI 0x5E
|
||||
#define LIBLTE_MME_ADDITIONAL_INFORMATION_IEI 0x65
|
||||
// Enums
|
||||
// Structs
|
||||
typedef struct {
|
||||
|
@ -3649,6 +3650,8 @@ typedef struct {
|
|||
// Functions
|
||||
LIBLTE_ERROR_ENUM liblte_mme_pack_deactivate_eps_bearer_context_request_msg(
|
||||
LIBLTE_MME_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT* deact_eps_bearer_context_req,
|
||||
uint8 sec_hdr_type,
|
||||
uint32 count,
|
||||
LIBLTE_BYTE_MSG_STRUCT* msg);
|
||||
LIBLTE_ERROR_ENUM liblte_mme_unpack_deactivate_eps_bearer_context_request_msg(
|
||||
LIBLTE_BYTE_MSG_STRUCT* msg,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,96 @@
|
|||
/**
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
* srsRAN is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsRAN is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_NAS_5G_UTILS_H
|
||||
#define SRSRAN_NAS_5G_UTILS_H
|
||||
|
||||
#include "srsran/asn1/asn1_utils.h"
|
||||
#include "srsran/common/byte_buffer.h"
|
||||
#include "srsran/config.h"
|
||||
|
||||
using namespace asn1;
|
||||
namespace srsran {
|
||||
namespace nas_5g {
|
||||
|
||||
struct ecies_scheme_profile_a_out {
|
||||
uint8_t ecc_ephemeral_key[33];
|
||||
std::vector<uint8_t> ciphertext;
|
||||
uint8_t mac_tag[8];
|
||||
};
|
||||
|
||||
struct ecies_scheme_profile_b_out {
|
||||
uint8_t ecc_ephemeral_key[32];
|
||||
std::vector<uint8_t> ciphertext;
|
||||
uint8_t mac_tag[8];
|
||||
};
|
||||
|
||||
template <typename Enum, int bl>
|
||||
SRSASN_CODE unpack_enum(asn1::cbit_ref& bref, Enum* e)
|
||||
{
|
||||
uint32_t tmp = {};
|
||||
HANDLE_CODE(bref.unpack(tmp, bl));
|
||||
*e = static_cast<Enum>(tmp);
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
|
||||
template <typename Enum, int bl>
|
||||
SRSASN_CODE pack_enum(asn1::bit_ref& bref, Enum e)
|
||||
{
|
||||
uint32_t tmp = static_cast<uint32_t>(e);
|
||||
HANDLE_CODE(bref.pack(tmp, bl));
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
|
||||
template <class EnumType, uint32_t bit_length_>
|
||||
class nas_enumerated : public EnumType
|
||||
{
|
||||
public:
|
||||
static const uint32_t bit_length = bit_length_;
|
||||
|
||||
nas_enumerated() {}
|
||||
nas_enumerated(typename EnumType::options o) { EnumType::value = o; }
|
||||
SRSASN_CODE pack(asn1::bit_ref& bref) const
|
||||
{
|
||||
uint32_t tmp = static_cast<uint32_t>(EnumType::value);
|
||||
HANDLE_CODE(bref.pack(tmp, bit_length));
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
SRSASN_CODE unpack(asn1::cbit_ref& bref)
|
||||
{
|
||||
uint32_t tmp = {};
|
||||
HANDLE_CODE(bref.unpack(tmp, bit_length));
|
||||
*this = static_cast<typename EnumType::options>(tmp);
|
||||
return SRSASN_SUCCESS;
|
||||
}
|
||||
EnumType& operator=(EnumType v)
|
||||
{
|
||||
EnumType::value = v;
|
||||
return *this;
|
||||
}
|
||||
operator typename EnumType::options() const { return EnumType::value; }
|
||||
};
|
||||
|
||||
SRSASN_CODE unpack_mcc_mnc(uint8_t* mcc_bytes, uint8_t* mnc_bytes, asn1::cbit_ref& bref);
|
||||
SRSASN_CODE pack_mcc_mnc(uint8_t* mcc_bytes, uint8_t* mnc_bytes, asn1::bit_ref& bref);
|
||||
|
||||
} // namespace nas_5g
|
||||
} // namespace srsran
|
||||
#endif // MANUAL_H
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
* srsRAN is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsRAN is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_NGAP_UTILS_H
|
||||
#define SRSRAN_NGAP_UTILS_H
|
||||
|
||||
#include "asn1_utils.h"
|
||||
#include "ngap.h"
|
||||
/************************
|
||||
* Forward declarations
|
||||
***********************/
|
||||
|
||||
namespace asn1 {
|
||||
namespace ngap {
|
||||
struct rrcestablishment_cause_opts;
|
||||
struct cause_radio_network_opts;
|
||||
using rrcestablishment_cause_e = enumerated<rrcestablishment_cause_opts, true, 1>;
|
||||
using cause_radio_network_e = enumerated<cause_radio_network_opts, true, 2>;
|
||||
} // namespace ngap
|
||||
} // namespace asn1
|
||||
|
||||
#endif // SRSRAN_NGAP_UTILS_H
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -19,18 +19,37 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSRAN_RRC_CFG_UTILS_H
|
||||
#define SRSRAN_RRC_CFG_UTILS_H
|
||||
#ifndef SRSRAN_OBJ_ID_CMP_UTILS_H
|
||||
#define SRSRAN_OBJ_ID_CMP_UTILS_H
|
||||
|
||||
#include "srsran/asn1/rrc_utils.h"
|
||||
#include "srsran/common/common.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
namespace srsran {
|
||||
|
||||
template <typename rrcObj>
|
||||
using rrc_obj_id_t = decltype(asn1::rrc::get_rrc_obj_id(std::declval<rrcObj>()));
|
||||
using asn1_obj_id_t = uint8_t;
|
||||
|
||||
/// Template function to generically obtain id of asn1 object (e.g. srb_id of srbs, drb_id of drbs, etc.)
|
||||
template <typename Asn1Obj>
|
||||
uint8_t get_asn1_obj_id(const Asn1Obj& obj);
|
||||
|
||||
/// Template function to generically set id of asn1 object (e.g. srb_id of srbs, drb_id of drbs, etc.)
|
||||
template <typename Asn1Obj>
|
||||
void set_asn1_obj_id(Asn1Obj& obj, uint8_t id);
|
||||
|
||||
/// helper macro to help define get_asn1_obj_id and set_asn1_obj_id for specific asn1 objects
|
||||
#define ASN1_OBJ_ID_DEFINE(Asn1ObjType, member) \
|
||||
template <> \
|
||||
uint8_t get_asn1_obj_id<Asn1ObjType>(const Asn1ObjType& obj) \
|
||||
{ \
|
||||
return obj.member; \
|
||||
} \
|
||||
template <> \
|
||||
void set_asn1_obj_id<Asn1ObjType>(Asn1ObjType & obj, uint8_t id) \
|
||||
{ \
|
||||
obj.member = id; \
|
||||
}
|
||||
|
||||
//! Functor to compare RRC config elements (e.g. SRB/measObj/Rep) based on ID
|
||||
struct rrc_obj_id_cmp {
|
||||
|
@ -38,27 +57,27 @@ struct rrc_obj_id_cmp {
|
|||
typename std::enable_if<not std::is_integral<T>::value and not std::is_integral<U>::value, bool>::type
|
||||
operator()(const T& lhs, const U& rhs) const
|
||||
{
|
||||
return asn1::rrc::get_rrc_obj_id(lhs) < asn1::rrc::get_rrc_obj_id(rhs);
|
||||
return get_asn1_obj_id(lhs) < get_asn1_obj_id(rhs);
|
||||
}
|
||||
template <typename T>
|
||||
bool operator()(const T& lhs, rrc_obj_id_t<T> id) const
|
||||
bool operator()(const T& lhs, asn1_obj_id_t id) const
|
||||
{
|
||||
return asn1::rrc::get_rrc_obj_id(lhs) < id;
|
||||
return get_asn1_obj_id(lhs) < id;
|
||||
}
|
||||
template <typename T>
|
||||
bool operator()(rrc_obj_id_t<T> id, const T& rhs) const
|
||||
bool operator()(asn1_obj_id_t id, const T& rhs) const
|
||||
{
|
||||
return id < asn1::rrc::get_rrc_obj_id(rhs);
|
||||
return id < get_asn1_obj_id(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Container>
|
||||
struct unary_rrc_obj_id {
|
||||
rrc_obj_id_t<typename Container::value_type> id;
|
||||
asn1_obj_id_t id;
|
||||
template <typename T>
|
||||
explicit unary_rrc_obj_id(T id_) : id(id_)
|
||||
{}
|
||||
bool operator()(const typename Container::value_type& e) const { return asn1::rrc::get_rrc_obj_id(e) == id; }
|
||||
bool operator()(const typename Container::value_type& e) const { return get_asn1_obj_id(e) == id; }
|
||||
};
|
||||
|
||||
/// Find rrc object in list based on ID
|
||||
|
@ -78,13 +97,13 @@ template <typename Container, typename IdType>
|
|||
typename Container::iterator sorted_find_rrc_obj_id(Container& c, IdType id)
|
||||
{
|
||||
auto it = std::lower_bound(c.begin(), c.end(), id, rrc_obj_id_cmp{});
|
||||
return (it == c.end() or asn1::rrc::get_rrc_obj_id(*it) != id) ? c.end() : it;
|
||||
return (it == c.end() or get_asn1_obj_id(*it) != id) ? c.end() : it;
|
||||
}
|
||||
template <typename Container, typename IdType>
|
||||
typename Container::const_iterator sorted_find_rrc_obj_id(const Container& c, IdType id)
|
||||
{
|
||||
auto it = std::lower_bound(c.begin(), c.end(), id, rrc_obj_id_cmp{});
|
||||
return (it == c.end() or asn1::rrc::get_rrc_obj_id(*it) != id) ? c.end() : it;
|
||||
return (it == c.end() or get_asn1_obj_id(*it) != id) ? c.end() : it;
|
||||
}
|
||||
|
||||
template <typename Container, typename Container2>
|
||||
|
@ -95,7 +114,7 @@ bool equal_rrc_obj_ids(const Container& c, const Container2& c2)
|
|||
c2.begin(),
|
||||
c2.end(),
|
||||
[](const typename Container::value_type& e, const typename Container2::value_type& e2) {
|
||||
return asn1::rrc::get_rrc_obj_id(e) == asn1::rrc::get_rrc_obj_id(e2);
|
||||
return get_asn1_obj_id(e) == get_asn1_obj_id(e2);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -107,7 +126,7 @@ typename Container::iterator add_rrc_obj_id(Container& c, IdType id)
|
|||
if (it == c.end()) {
|
||||
c.push_back({});
|
||||
it = c.end() - 1;
|
||||
asn1::rrc::set_rrc_obj_id(*it, id);
|
||||
set_asn1_obj_id(*it, id);
|
||||
std::sort(c.begin(), c.end(), rrc_obj_id_cmp{});
|
||||
it = sorted_find_rrc_obj_id(c, id);
|
||||
}
|
||||
|
@ -117,11 +136,11 @@ typename Container::iterator add_rrc_obj_id(Container& c, IdType id)
|
|||
template <typename Container>
|
||||
typename Container::iterator add_rrc_obj(Container& c, const typename Container::value_type& v)
|
||||
{
|
||||
auto it = sorted_find_rrc_obj_id(c, asn1::rrc::get_rrc_obj_id(v));
|
||||
auto it = sorted_find_rrc_obj_id(c, get_asn1_obj_id(v));
|
||||
if (it == c.end()) {
|
||||
c.push_back(v);
|
||||
std::sort(c.begin(), c.end(), rrc_obj_id_cmp{});
|
||||
it = sorted_find_rrc_obj_id(c, asn1::rrc::get_rrc_obj_id(v));
|
||||
it = sorted_find_rrc_obj_id(c, get_asn1_obj_id(v));
|
||||
} else {
|
||||
*it = v;
|
||||
}
|
||||
|
@ -145,21 +164,21 @@ bool rem_rrc_obj_id(Container& c, IdType id)
|
|||
* @return id value
|
||||
*/
|
||||
template <typename Container>
|
||||
auto find_rrc_obj_id_gap(const Container& c) -> decltype(asn1::rrc::get_rrc_obj_id(c[0]))
|
||||
auto find_rrc_obj_id_gap(const Container& c) -> decltype(get_asn1_obj_id(c[0]))
|
||||
{
|
||||
auto id_cmp_op = rrc_obj_id_cmp{};
|
||||
assert(std::is_sorted(c.begin(), c.end(), id_cmp_op));
|
||||
|
||||
auto prev_it = c.begin();
|
||||
if (prev_it != c.end() and asn1::rrc::get_rrc_obj_id(*prev_it) == 1) {
|
||||
if (prev_it != c.end() and get_asn1_obj_id(*prev_it) == 1) {
|
||||
auto it = prev_it;
|
||||
for (++it; it != c.end(); prev_it = it, ++it) {
|
||||
if (asn1::rrc::get_rrc_obj_id(*it) > asn1::rrc::get_rrc_obj_id(*prev_it) + 1) {
|
||||
if (get_asn1_obj_id(*it) > get_asn1_obj_id(*prev_it) + 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (prev_it == c.end()) ? 1 : asn1::rrc::get_rrc_obj_id(*prev_it) + 1; // starts at 1.
|
||||
return (prev_it == c.end()) ? 1 : get_asn1_obj_id(*prev_it) + 1; // starts at 1.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -316,7 +335,7 @@ void compute_cfg_diff(const toAddModList& src_list,
|
|||
}
|
||||
|
||||
using it_t = typename toAddModList::const_iterator;
|
||||
auto rem_func = [&rem_diff_list](it_t rem_it) { rem_diff_list.push_back(asn1::rrc::get_rrc_obj_id(*rem_it)); };
|
||||
auto rem_func = [&rem_diff_list](it_t rem_it) { rem_diff_list.push_back(get_asn1_obj_id(*rem_it)); };
|
||||
auto add_func = [&add_diff_list](it_t add_it) { add_diff_list.push_back(*add_it); };
|
||||
auto mod_func = [&add_diff_list](it_t src_it, it_t target_it) {
|
||||
if (not(*src_it == *target_it)) {
|
||||
|
@ -328,4 +347,4 @@ void compute_cfg_diff(const toAddModList& src_list,
|
|||
|
||||
} // namespace srsran
|
||||
|
||||
#endif // SRSRAN_RRC_CFG_UTILS_H
|
||||
#endif // SRSRAN_OBJ_ID_CMP_UTILS_H
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
@ -178,7 +178,7 @@ struct bcch_dl_sch_msg_mbms_s {
|
|||
};
|
||||
|
||||
// ThresholdEUTRA-v1250 ::= INTEGER (0..97)
|
||||
using thres_eutra_v1250 = uint8_t;
|
||||
using thres_eutra_v1250 = integer<uint8_t, 0, 97>;
|
||||
|
||||
// MBMS-SessionInfo-r9 ::= SEQUENCE
|
||||
struct mbms_session_info_r9_s {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
* Copyright 2013-2022 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsRAN.
|
||||
*
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue