mirror of https://github.com/pvnis/srsRAN_4G.git
Merge branch 'next' into agpl_next
# Conflicts: # lib/include/srslte/common/mac_nr_pcap.h # lib/include/srslte/phy/ue/ue_ul_nr_data.h # lib/src/common/mac_nr_pcap.cc # lib/src/phy/ue/ue_ul_nr_data.c # srsenb/hdr/phy/lte/worker_pool.h # srsenb/hdr/phy/nr/cc_worker.h # srsenb/hdr/phy/nr/sf_worker.h # srsenb/hdr/phy/nr/worker_pool.h # srsenb/src/phy/lte/worker_pool.cc # srsenb/src/phy/nr/cc_worker.cc # srsenb/src/phy/nr/sf_worker.cc # srsenb/src/phy/nr/worker_pool.cc # srsue/hdr/phy/lte/worker_pool.h # srsue/hdr/phy/nr/cc_worker.h # srsue/hdr/phy/nr/sf_worker.h # srsue/hdr/phy/nr/worker_pool.h # srsue/hdr/stack/mac/mac_nr.h # srsue/src/phy/lte/worker_pool.cc # srsue/src/phy/nr/cc_worker.cc # srsue/src/phy/nr/sf_worker.cc # srsue/src/phy/nr/worker_pool.cc # srsue/src/stack/mac/mac_nr.ccmaster
commit
3daa9f3fc3
@ -0,0 +1,243 @@
|
||||
#
|
||||
# BackwardMacros.cmake
|
||||
# Copyright 2013 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
###############################################################################
|
||||
# OPTIONS
|
||||
###############################################################################
|
||||
|
||||
if(POLICY CMP0011)
|
||||
cmake_policy(SET CMP0011 NEW)
|
||||
cmake_policy(SET CMP0012 NEW)
|
||||
endif()
|
||||
|
||||
set(STACK_WALKING_UNWIND TRUE CACHE BOOL
|
||||
"Use compiler's unwind API")
|
||||
set(STACK_WALKING_BACKTRACE FALSE CACHE BOOL
|
||||
"Use backtrace from (e)glibc for stack walking")
|
||||
set(STACK_WALKING_LIBUNWIND FALSE CACHE BOOL
|
||||
"Use libunwind for stack walking")
|
||||
|
||||
set(STACK_DETAILS_AUTO_DETECT TRUE CACHE BOOL
|
||||
"Auto detect backward's stack details dependencies")
|
||||
|
||||
set(STACK_DETAILS_BACKTRACE_SYMBOL FALSE CACHE BOOL
|
||||
"Use backtrace from (e)glibc for symbols resolution")
|
||||
set(STACK_DETAILS_DW FALSE CACHE BOOL
|
||||
"Use libdw to read debug info")
|
||||
set(STACK_DETAILS_BFD FALSE CACHE BOOL
|
||||
"Use libbfd to read debug info")
|
||||
set(STACK_DETAILS_DWARF FALSE CACHE BOOL
|
||||
"Use libdwarf/libelf to read debug info")
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND NOT DEFINED BACKWARD_TESTS)
|
||||
# If this is a top level CMake project, we most lixely want the tests
|
||||
set(BACKWARD_TESTS ON CACHE BOOL "Enable tests")
|
||||
else()
|
||||
set(BACKWARD_TESTS OFF CACHE BOOL "Enable tests")
|
||||
endif()
|
||||
###############################################################################
|
||||
# CONFIGS
|
||||
###############################################################################
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if (STACK_WALKING_LIBUNWIND)
|
||||
# libunwind works on the macOS without having to add special include
|
||||
# paths or libraries
|
||||
if (NOT APPLE)
|
||||
find_path(LIBUNWIND_INCLUDE_DIR NAMES "libunwind.h")
|
||||
find_library(LIBUNWIND_LIBRARY unwind)
|
||||
|
||||
if (LIBUNWIND_LIBRARY)
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(UNW_INIT_SIGNAL_FRAME libunwind.h HAVE_UNW_INIT_SIGNAL_FRAME)
|
||||
if (NOT HAVE_UNW_INIT_SIGNAL_FRAME)
|
||||
message(STATUS "libunwind does not support unwinding from signal handler frames")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(LIBUNWIND_INCLUDE_DIRS ${LIBUNWIND_INCLUDE_DIR})
|
||||
set(LIBDWARF_LIBRARIES ${LIBUNWIND_LIBRARY})
|
||||
find_package_handle_standard_args(libunwind DEFAULT_MSG
|
||||
LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR)
|
||||
mark_as_advanced(LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARY)
|
||||
list(APPEND _BACKWARD_LIBRARIES ${LIBUNWIND_LIBRARY})
|
||||
endif()
|
||||
|
||||
# Disable other unwinders if libunwind is found
|
||||
set(STACK_WALKING_UNWIND FALSE)
|
||||
set(STACK_WALKING_BACKTRACE FALSE)
|
||||
endif()
|
||||
|
||||
if (${STACK_DETAILS_AUTO_DETECT})
|
||||
# find libdw
|
||||
find_path(LIBDW_INCLUDE_DIR NAMES "elfutils/libdw.h" "elfutils/libdwfl.h")
|
||||
find_library(LIBDW_LIBRARY dw)
|
||||
set(LIBDW_INCLUDE_DIRS ${LIBDW_INCLUDE_DIR} )
|
||||
set(LIBDW_LIBRARIES ${LIBDW_LIBRARY} )
|
||||
find_package_handle_standard_args(libdw DEFAULT_MSG
|
||||
LIBDW_LIBRARY LIBDW_INCLUDE_DIR)
|
||||
mark_as_advanced(LIBDW_INCLUDE_DIR LIBDW_LIBRARY)
|
||||
|
||||
# find libbfd
|
||||
find_path(LIBBFD_INCLUDE_DIR NAMES "bfd.h")
|
||||
find_path(LIBDL_INCLUDE_DIR NAMES "dlfcn.h")
|
||||
find_library(LIBBFD_LIBRARY bfd)
|
||||
find_library(LIBDL_LIBRARY dl)
|
||||
set(LIBBFD_INCLUDE_DIRS ${LIBBFD_INCLUDE_DIR} ${LIBDL_INCLUDE_DIR})
|
||||
set(LIBBFD_LIBRARIES ${LIBBFD_LIBRARY} ${LIBDL_LIBRARY})
|
||||
find_package_handle_standard_args(libbfd DEFAULT_MSG
|
||||
LIBBFD_LIBRARY LIBBFD_INCLUDE_DIR
|
||||
LIBDL_LIBRARY LIBDL_INCLUDE_DIR)
|
||||
mark_as_advanced(LIBBFD_INCLUDE_DIR LIBBFD_LIBRARY
|
||||
LIBDL_INCLUDE_DIR LIBDL_LIBRARY)
|
||||
|
||||
# find libdwarf
|
||||
find_path(LIBDWARF_INCLUDE_DIR NAMES "libdwarf.h" PATH_SUFFIXES libdwarf)
|
||||
find_path(LIBELF_INCLUDE_DIR NAMES "libelf.h")
|
||||
find_path(LIBDL_INCLUDE_DIR NAMES "dlfcn.h")
|
||||
find_library(LIBDWARF_LIBRARY dwarf)
|
||||
find_library(LIBELF_LIBRARY elf)
|
||||
find_library(LIBDL_LIBRARY dl)
|
||||
set(LIBDWARF_INCLUDE_DIRS ${LIBDWARF_INCLUDE_DIR} ${LIBELF_INCLUDE_DIR} ${LIBDL_INCLUDE_DIR})
|
||||
set(LIBDWARF_LIBRARIES ${LIBDWARF_LIBRARY} ${LIBELF_LIBRARY} ${LIBDL_LIBRARY})
|
||||
find_package_handle_standard_args(libdwarf DEFAULT_MSG
|
||||
LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR
|
||||
LIBELF_LIBRARY LIBELF_INCLUDE_DIR
|
||||
LIBDL_LIBRARY LIBDL_INCLUDE_DIR)
|
||||
mark_as_advanced(LIBDWARF_INCLUDE_DIR LIBDWARF_LIBRARY
|
||||
LIBELF_INCLUDE_DIR LIBELF_LIBRARY
|
||||
LIBDL_INCLUDE_DIR LIBDL_LIBRARY)
|
||||
|
||||
if (LIBDW_FOUND)
|
||||
LIST(APPEND _BACKWARD_INCLUDE_DIRS ${LIBDW_INCLUDE_DIRS})
|
||||
LIST(APPEND _BACKWARD_LIBRARIES ${LIBDW_LIBRARIES})
|
||||
set(STACK_DETAILS_DW TRUE)
|
||||
set(STACK_DETAILS_BFD FALSE)
|
||||
set(STACK_DETAILS_DWARF FALSE)
|
||||
set(STACK_DETAILS_BACKTRACE_SYMBOL FALSE)
|
||||
elseif(LIBBFD_FOUND)
|
||||
LIST(APPEND _BACKWARD_INCLUDE_DIRS ${LIBBFD_INCLUDE_DIRS})
|
||||
LIST(APPEND _BACKWARD_LIBRARIES ${LIBBFD_LIBRARIES})
|
||||
|
||||
# If we attempt to link against static bfd, make sure to link its dependencies, too
|
||||
get_filename_component(bfd_lib_ext "${LIBBFD_LIBRARY}" EXT)
|
||||
if (bfd_lib_ext STREQUAL "${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
list(APPEND _BACKWARD_LIBRARIES iberty z)
|
||||
endif()
|
||||
|
||||
set(STACK_DETAILS_DW FALSE)
|
||||
set(STACK_DETAILS_BFD TRUE)
|
||||
set(STACK_DETAILS_DWARF FALSE)
|
||||
set(STACK_DETAILS_BACKTRACE_SYMBOL FALSE)
|
||||
elseif(LIBDWARF_FOUND)
|
||||
LIST(APPEND _BACKWARD_INCLUDE_DIRS ${LIBDWARF_INCLUDE_DIRS})
|
||||
LIST(APPEND _BACKWARD_LIBRARIES ${LIBDWARF_LIBRARIES})
|
||||
|
||||
set(STACK_DETAILS_DW FALSE)
|
||||
set(STACK_DETAILS_BFD FALSE)
|
||||
set(STACK_DETAILS_DWARF TRUE)
|
||||
set(STACK_DETAILS_BACKTRACE_SYMBOL FALSE)
|
||||
else()
|
||||
set(STACK_DETAILS_DW FALSE)
|
||||
set(STACK_DETAILS_BFD FALSE)
|
||||
set(STACK_DETAILS_DWARF FALSE)
|
||||
set(STACK_DETAILS_BACKTRACE_SYMBOL TRUE)
|
||||
endif()
|
||||
else()
|
||||
if (STACK_DETAILS_DW)
|
||||
LIST(APPEND _BACKWARD_LIBRARIES dw)
|
||||
endif()
|
||||
|
||||
if (STACK_DETAILS_BFD)
|
||||
LIST(APPEND _BACKWARD_LIBRARIES bfd dl)
|
||||
endif()
|
||||
|
||||
if (STACK_DETAILS_DWARF)
|
||||
LIST(APPEND _BACKWARD_LIBRARIES dwarf elf)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(map_definitions var_prefix define_prefix)
|
||||
foreach(def ${ARGN})
|
||||
if (${${var_prefix}${def}})
|
||||
LIST(APPEND _BACKWARD_DEFINITIONS "${define_prefix}${def}=1")
|
||||
else()
|
||||
LIST(APPEND _BACKWARD_DEFINITIONS "${define_prefix}${def}=0")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
if (NOT _BACKWARD_DEFINITIONS)
|
||||
map_definitions("STACK_WALKING_" "BACKWARD_HAS_" UNWIND LIBUNWIND BACKTRACE)
|
||||
map_definitions("STACK_DETAILS_" "BACKWARD_HAS_" BACKTRACE_SYMBOL DW BFD DWARF)
|
||||
endif()
|
||||
|
||||
set(BACKWARD_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
set(BACKWARD_HAS_EXTERNAL_LIBRARIES FALSE)
|
||||
set(FIND_PACKAGE_REQUIRED_VARS BACKWARD_INCLUDE_DIR)
|
||||
if(DEFINED _BACKWARD_LIBRARIES)
|
||||
set(BACKWARD_HAS_EXTERNAL_LIBRARIES TRUE)
|
||||
list(APPEND FIND_PACKAGE_REQUIRED_VARS _BACKWARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Backward
|
||||
REQUIRED_VARS ${FIND_PACKAGE_REQUIRED_VARS}
|
||||
)
|
||||
list(APPEND _BACKWARD_INCLUDE_DIRS ${BACKWARD_INCLUDE_DIR})
|
||||
|
||||
macro(add_backward target)
|
||||
target_include_directories(${target} PRIVATE ${BACKWARD_INCLUDE_DIRS})
|
||||
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${BACKWARD_DEFINITIONS})
|
||||
set_property(TARGET ${target} APPEND PROPERTY LINK_LIBRARIES ${BACKWARD_LIBRARIES})
|
||||
endmacro()
|
||||
|
||||
set(BACKWARD_INCLUDE_DIRS ${_BACKWARD_INCLUDE_DIRS} CACHE INTERNAL "_BACKWARD_INCLUDE_DIRS")
|
||||
set(BACKWARD_DEFINITIONS ${_BACKWARD_DEFINITIONS} CACHE INTERNAL "BACKWARD_DEFINITIONS")
|
||||
set(BACKWARD_LIBRARIES ${_BACKWARD_LIBRARIES} CACHE INTERNAL "BACKWARD_LIBRARIES")
|
||||
mark_as_advanced(BACKWARD_INCLUDE_DIRS BACKWARD_DEFINITIONS BACKWARD_LIBRARIES)
|
||||
|
||||
# Expand each definition in BACKWARD_DEFINITIONS to its own cmake var and export
|
||||
# to outer scope
|
||||
foreach(var ${BACKWARD_DEFINITIONS})
|
||||
string(REPLACE "=" ";" var_as_list ${var})
|
||||
list(GET var_as_list 0 var_name)
|
||||
list(GET var_as_list 1 var_value)
|
||||
set(${var_name} ${var_value})
|
||||
mark_as_advanced(${var_name})
|
||||
#message(STATUS "${var_name}=${var_value}")
|
||||
endforeach()
|
||||
|
||||
# Disabled for older CMake version (CentOS)
|
||||
#if (NOT TARGET Backward::Backward)
|
||||
# add_library(Backward::Backward INTERFACE IMPORTED)
|
||||
# set_target_properties(Backward::Backward PROPERTIES
|
||||
# INTERFACE_INCLUDE_DIRECTORIES "${BACKWARD_INCLUDE_DIRS}"
|
||||
# INTERFACE_COMPILE_DEFINITIONS "${BACKWARD_DEFINITIONS}"
|
||||
# )
|
||||
# if(BACKWARD_HAS_EXTERNAL_LIBRARIES)
|
||||
# set_target_properties(Backward::Backward PROPERTIES
|
||||
# INTERFACE_LINK_LIBRARIES "${BACKWARD_LIBRARIES}"
|
||||
# )
|
||||
# endif()
|
||||
#endif()
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,106 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSLTE_BAND_HELPER_H
|
||||
#define SRSLTE_BAND_HELPER_H
|
||||
|
||||
#include <array>
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
namespace srslte {
|
||||
|
||||
// Helper class to handle frequency bands and ARFCNs
|
||||
// For NR: NR-ARFCN and channel raster as per TS 38.104
|
||||
class srslte_band_helper
|
||||
{
|
||||
public:
|
||||
srslte_band_helper() = default;
|
||||
~srslte_band_helper() = default;
|
||||
|
||||
// Return frequency of given NR-ARFCN in Hz
|
||||
double nr_arfcn_to_freq(uint32_t nr_arfcn);
|
||||
|
||||
// Possible values of delta f_raster in Table 5.4.2.3-1 and Table 5.4.2.3-2
|
||||
enum delta_f_raster_t {
|
||||
DEFAULT = 0, // for bands with 2 possible values for delta_f_raster (e.g. 15 and 30 kHz), the lower is chosen
|
||||
KHZ_15,
|
||||
KHZ_30,
|
||||
KHZ_60,
|
||||
KHZ_100,
|
||||
KHZ_120
|
||||
};
|
||||
|
||||
// Return vector of bands that ARFCN is valid for
|
||||
// For bands with 2 possible raster offsets, delta_f_raster needs to be specified
|
||||
std::vector<uint32_t> get_bands_nr(uint32_t nr_arfcn, delta_f_raster_t delta_f_raster = DEFAULT);
|
||||
|
||||
private:
|
||||
// Table 5.4.2.1-1
|
||||
struct nr_raster_params {
|
||||
double delta_F_global_kHz;
|
||||
double F_REF_Offs_MHz;
|
||||
uint32_t N_REF_Offs;
|
||||
uint32_t N_REF_min;
|
||||
uint32_t N_REF_max;
|
||||
};
|
||||
|
||||
// Helper to calculate F_REF according to Table 5.4.2.1-1
|
||||
nr_raster_params get_raster_params(uint32_t nr_arfcn);
|
||||
|
||||
static const uint32_t max_nr_arfcn = 3279165;
|
||||
static constexpr std::array<nr_raster_params, 3> nr_fr_params = {{
|
||||
// clang-format off
|
||||
// Frequency range 0 - 3000 MHz
|
||||
{5, 0.0, 0, 0, 599999},
|
||||
// Frequency range 3000 - 24250 MHz
|
||||
{15, 3000.0, 600000, 600000, 2016666},
|
||||
// Frequency range 24250 - 100000 MHz
|
||||
{60, 24250.08, 2016667, 2016667, max_nr_arfcn}
|
||||
// clang-format on
|
||||
}};
|
||||
|
||||
// Elements of Table 5.4.2.3-1 in TS 38.104
|
||||
struct nr_band {
|
||||
uint8_t band;
|
||||
delta_f_raster_t delta_f_raster;
|
||||
uint32_t ul_nref_first;
|
||||
uint32_t ul_nref_step;
|
||||
uint32_t ul_nref_last;
|
||||
uint32_t dl_nref_first;
|
||||
uint32_t dl_nref_step;
|
||||
uint32_t dl_nref_last;
|
||||
};
|
||||
|
||||
// List of NR bands for FR1 (Table 5.4.2.3-1)
|
||||
// bands with more than one raster offset have multiple entries
|
||||
// TODO: add remaining bands
|
||||
static const uint32_t nof_nr_bands_fr1 = 7;
|
||||
static constexpr std::array<nr_band, nof_nr_bands_fr1> nr_band_table_fr1 = {{
|
||||
// clang-format off
|
||||
{74, KHZ_100, 285400, 20, 294000, 295000, 20, 303600},
|
||||
// n75+n76 missing
|
||||
{77, KHZ_15, 620000, 1, 680000, 620000, 1, 680000},
|
||||
{77, KHZ_30, 620000, 2, 680000, 620000, 2, 680000},
|
||||
|
||||
{78, KHZ_15, 620000, 1, 653333, 620000, 1, 653333},
|
||||
{78, KHZ_30, 620000, 2, 653332, 620000, 2, 653332},
|
||||
|
||||
{79, KHZ_15, 693334, 2, 733333, 693334, 2, 733333},
|
||||
{79, KHZ_30, 693334, 2, 733332, 693334, 2, 733332}
|
||||
// clang-format on
|
||||
}};
|
||||
};
|
||||
|
||||
} // namespace srslte
|
||||
|
||||
#endif // SRSLTE_BAND_HELPER_H
|
@ -0,0 +1,231 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSLTE_BYTE_BUFFER_H
|
||||
#define SRSLTE_BYTE_BUFFER_H
|
||||
|
||||
#include "common.h"
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
|
||||
//#define SRSLTE_BUFFER_POOL_LOG_ENABLED
|
||||
|
||||
namespace srslte {
|
||||
|
||||
#define ENABLE_TIMESTAMP
|
||||
|
||||
struct buffer_latency_calc {
|
||||
void clear()
|
||||
{
|
||||
#ifdef ENABLE_TIMESTAMP
|
||||
timestamp_is_set = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::chrono::microseconds get_latency_us() const
|
||||
{
|
||||
#ifdef ENABLE_TIMESTAMP
|
||||
if (!timestamp_is_set) {
|
||||
return std::chrono::microseconds{0};
|
||||
}
|
||||
return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - tp);
|
||||
#else
|
||||
return std::chrono::microseconds{0};
|
||||
#endif
|
||||
}
|
||||
|
||||
std::chrono::high_resolution_clock::time_point get_timestamp() const { return tp; }
|
||||
|
||||
void set_timestamp()
|
||||
{
|
||||
#ifdef ENABLE_TIMESTAMP
|
||||
tp = std::chrono::high_resolution_clock::now();
|
||||
timestamp_is_set = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_timestamp(std::chrono::high_resolution_clock::time_point tp_)
|
||||
{
|
||||
#ifdef ENABLE_TIMESTAMP
|
||||
tp = tp_;
|
||||
timestamp_is_set = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef ENABLE_TIMESTAMP
|
||||
std::chrono::high_resolution_clock::time_point tp;
|
||||
bool timestamp_is_set = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Byte buffer
|
||||
*
|
||||
* Generic byte buffer with headroom to accommodate packet headers and custom
|
||||
* copy constructors & assignment operators for quick copying. Byte buffer
|
||||
* holds a next pointer to support linked lists.
|
||||
*****************************************************************************/
|
||||
class byte_buffer_t
|
||||
{
|
||||
public:
|
||||
using iterator = uint8_t*;
|
||||
using const_iterator = const uint8_t*;
|
||||
|
||||
uint32_t N_bytes = 0;
|
||||
uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BYTES];
|
||||
uint8_t* msg = nullptr;
|
||||
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
|
||||
char debug_name[SRSLTE_BUFFER_POOL_LOG_NAME_LEN];
|
||||
#endif
|
||||
|
||||
struct buffer_metadata_t {
|
||||
uint32_t pdcp_sn = 0;
|
||||
buffer_latency_calc tp;
|
||||
} md;
|
||||
|
||||
byte_buffer_t() : msg(&buffer[SRSLTE_BUFFER_HEADER_OFFSET])
|
||||
{
|
||||
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
|
||||
bzero(debug_name, SRSLTE_BUFFER_POOL_LOG_NAME_LEN);
|
||||
#endif
|
||||
}
|
||||
explicit byte_buffer_t(uint32_t size) : msg(&buffer[SRSLTE_BUFFER_HEADER_OFFSET]), N_bytes(size)
|
||||
{
|
||||
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
|
||||
bzero(debug_name, SRSLTE_BUFFER_POOL_LOG_NAME_LEN);
|
||||
#endif
|
||||
}
|
||||
byte_buffer_t(uint32_t size, uint8_t val) : byte_buffer_t(size) { std::fill(msg, msg + N_bytes, val); }
|
||||
byte_buffer_t(const byte_buffer_t& buf) : msg(&buffer[SRSLTE_BUFFER_HEADER_OFFSET]), md(buf.md), N_bytes(buf.N_bytes)
|
||||
{
|
||||
// copy actual contents
|
||||
memcpy(msg, buf.msg, N_bytes);
|
||||
}
|
||||
|
||||
byte_buffer_t& operator=(const byte_buffer_t& buf)
|
||||
{
|
||||
// avoid self assignment
|
||||
if (&buf == this)
|
||||
return *this;
|
||||
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
|
||||
N_bytes = buf.N_bytes;
|
||||
md = buf.md;
|
||||
memcpy(msg, buf.msg, N_bytes);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
|
||||
N_bytes = 0;
|
||||
md = {};
|
||||
}
|
||||
uint32_t get_headroom() { return msg - buffer; }
|
||||
// Returns the remaining space from what is reported to be the length of msg
|
||||
uint32_t get_tailroom() { return (sizeof(buffer) - (msg - buffer) - N_bytes); }
|
||||
std::chrono::microseconds get_latency_us() const { return md.tp.get_latency_us(); }
|
||||
|
||||
std::chrono::high_resolution_clock::time_point get_timestamp() const { return md.tp.get_timestamp(); }
|
||||
|
||||
void set_timestamp() { md.tp.set_timestamp(); }
|
||||
|
||||
void set_timestamp(std::chrono::high_resolution_clock::time_point tp_) { md.tp.set_timestamp(tp_); }
|
||||
|
||||
void append_bytes(uint8_t* buf, uint32_t size)
|
||||
{
|
||||
memcpy(&msg[N_bytes], buf, size);
|
||||
N_bytes += size;
|
||||
}
|
||||
|
||||
uint8_t* data() { return msg; }
|
||||
const uint8_t* data() const { return msg; }
|
||||
uint32_t size() const { return N_bytes; }
|
||||
iterator begin() { return msg; }
|
||||
const iterator begin() const { return msg; }
|
||||
iterator end() { return msg + N_bytes; }
|
||||
const_iterator end() const { return msg + N_bytes; }
|
||||
|
||||
void* operator new(size_t sz);
|
||||
void* operator new(size_t sz, const std::nothrow_t& nothrow_value) noexcept;
|
||||
void* operator new[](size_t sz) = delete;
|
||||
void operator delete(void* ptr);
|
||||
void operator delete[](void* ptr) = delete;
|
||||
};
|
||||
|
||||
struct bit_buffer_t {
|
||||
uint32_t N_bits = 0;
|
||||
uint8_t buffer[SRSLTE_MAX_BUFFER_SIZE_BITS];
|
||||
uint8_t* msg = nullptr;
|
||||
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
|
||||
char debug_name[128];
|
||||
#endif
|
||||
|
||||
bit_buffer_t() : msg(&buffer[SRSLTE_BUFFER_HEADER_OFFSET]) {}
|
||||
bit_buffer_t(const bit_buffer_t& buf) : msg(&buffer[SRSLTE_BUFFER_HEADER_OFFSET]), N_bits(buf.N_bits)
|
||||
{
|
||||
memcpy(msg, buf.msg, N_bits);
|
||||
}
|
||||
bit_buffer_t& operator=(const bit_buffer_t& buf)
|
||||
{
|
||||
// avoid self assignment
|
||||
if (&buf == this) {
|
||||
return *this;
|
||||
}
|
||||
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
|
||||
N_bits = buf.N_bits;
|
||||
memcpy(msg, buf.msg, N_bits);
|
||||
return *this;
|
||||
}
|
||||
void clear()
|
||||
{
|
||||
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
|
||||
N_bits = 0;
|
||||
}
|
||||
uint32_t get_headroom() { return msg - buffer; }
|
||||
};
|
||||
|
||||
// Create a Managed Life-Time Byte Buffer
|
||||
class byte_buffer_pool;
|
||||
|
||||
using unique_byte_buffer_t = std::unique_ptr<byte_buffer_t>;
|
||||
|
||||
///
|
||||
/// Utilities to create a span out of a byte_buffer.
|
||||
///
|
||||
|
||||
using byte_span = span<uint8_t>;
|
||||
using const_byte_span = span<const uint8_t>;
|
||||
|
||||
inline byte_span make_span(byte_buffer_t& b)
|
||||
{
|
||||
return byte_span{b.msg, b.N_bytes};
|
||||
}
|
||||
|
||||
inline const_byte_span make_span(const byte_buffer_t& b)
|
||||
{
|
||||
return const_byte_span{b.msg, b.N_bytes};
|
||||
}
|
||||
|
||||
inline byte_span make_span(unique_byte_buffer_t& b)
|
||||
{
|
||||
return byte_span{b->msg, b->N_bytes};
|
||||
}
|
||||
|
||||
inline const_byte_span make_span(const unique_byte_buffer_t& b)
|
||||
{
|
||||
return const_byte_span{b->msg, b->N_bytes};
|
||||
}
|
||||
|
||||
} // namespace srslte
|
||||
|
||||
#endif // SRSLTE_BYTE_BUFFER_H
|
@ -1,63 +0,0 @@
|
||||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsLTE.
|
||||
*
|
||||
* srsLTE 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.
|
||||
*
|
||||
* srsLTE 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 SRSLTE_MAC_NR_PCAP_H
|
||||
#define SRSLTE_MAC_NR_PCAP_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace srslte {
|
||||
|
||||
class mac_nr_pcap
|
||||
{
|
||||
public:
|
||||
mac_nr_pcap();
|
||||
~mac_nr_pcap();
|
||||
void enable(const bool& enable_);
|
||||
void open(const std::string& filename, const uint16_t& ue_id = 0);
|
||||
void close();
|
||||
|
||||
void set_ue_id(const uint16_t& ue_id);
|
||||
|
||||
void write_dl_crnti(uint8_t* pdu, uint32_t pdu_len_bytes, uint16_t crnti, uint8_t harqid, uint32_t tti);
|
||||
void write_ul_crnti(uint8_t* pdu, uint32_t pdu_len_bytes, uint16_t rnti, uint8_t harqid, uint32_t tti);
|
||||
void write_dl_ra_rnti(uint8_t* pdu, uint32_t pdu_len_bytes, uint16_t rnti, uint8_t harqid, uint32_t tti);
|
||||
void write_dl_bch(uint8_t* pdu, uint32_t pdu_len_bytes, uint16_t rnti, uint8_t harqid, uint32_t tti);
|
||||
void write_dl_pch(uint8_t* pdu, uint32_t pdu_len_bytes, uint16_t rnti, uint8_t harqid, uint32_t tti);
|
||||
void write_dl_si_rnti(uint8_t* pdu, uint32_t pdu_len_bytes, uint16_t rnti, uint8_t harqid, uint32_t tti);
|
||||
|
||||
private:
|
||||
bool enable_write = false;
|
||||
std::string filename;
|
||||
FILE* pcap_file = nullptr;
|
||||
uint32_t ue_id = 0;
|
||||
void pack_and_write(uint8_t* pdu,
|
||||
uint32_t pdu_len_bytes,
|
||||
uint32_t tti,
|
||||
uint16_t crnti_,
|
||||
uint8_t harqid,
|
||||
uint8_t direction,
|
||||
uint8_t rnti_type);
|
||||
};
|
||||
|
||||
} // namespace srslte
|
||||
|
||||
#endif // SRSLTE_MAC_NR_PCAP_H
|
@ -0,0 +1,46 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSLTE_ENB_GTPU_INTERFACES_H
|
||||
#define SRSLTE_ENB_GTPU_INTERFACES_H
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
// GTPU interface for PDCP
|
||||
class gtpu_interface_pdcp
|
||||
{
|
||||
public:
|
||||
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t pdu) = 0;
|
||||
};
|
||||
|
||||
// GTPU interface for RRC
|
||||
class gtpu_interface_rrc
|
||||
{
|
||||
public:
|
||||
struct bearer_props {
|
||||
bool forward_from_teidin_present = false;
|
||||
bool flush_before_teidin_present = false;
|
||||
uint32_t forward_from_teidin = 0;
|
||||
uint32_t flush_before_teidin = 0;
|
||||
};
|
||||
|
||||
virtual uint32_t
|
||||
add_bearer(uint16_t rnti, uint32_t lcid, uint32_t addr, uint32_t teid_out, const bearer_props* props = nullptr) = 0;
|
||||
virtual void set_tunnel_status(uint32_t teidin, bool dl_active) = 0;
|
||||
virtual void rem_bearer(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual void mod_bearer_rnti(uint16_t old_rnti, uint16_t new_rnti) = 0;
|
||||
virtual void rem_user(uint16_t rnti) = 0;
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSLTE_ENB_GTPU_INTERFACES_H
|
@ -0,0 +1,247 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "srslte/interfaces/rrc_interface_types.h"
|
||||
#include "srslte/interfaces/sched_interface.h"
|
||||
|
||||
#ifndef SRSLTE_ENB_MAC_INTERFACES_H
|
||||
#define SRSLTE_ENB_MAC_INTERFACES_H
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
struct mac_args_t {
|
||||
uint32_t nof_prb; ///< Needed to dimension MAC softbuffers for all cells
|
||||
sched_interface::sched_args_t sched;
|
||||
int nr_tb_size = -1;
|
||||
uint32_t max_nof_ues;
|
||||
};
|
||||
|
||||
/* Interface PHY -> MAC */
|
||||
class mac_interface_phy_lte
|
||||
{
|
||||
public:
|
||||
const static int MAX_GRANTS = 64;
|
||||
|
||||
/**
|
||||
* DL grant structure per UE
|
||||
*/
|
||||
struct dl_sched_grant_t {
|
||||
srslte_dci_dl_t dci = {};
|
||||
uint8_t* data[SRSLTE_MAX_TB] = {};
|
||||
srslte_softbuffer_tx_t* softbuffer_tx[SRSLTE_MAX_TB] = {};
|
||||
};
|
||||
|
||||
/**
|
||||
* DL Scheduling result per cell/carrier
|
||||
*/
|
||||
typedef struct {
|
||||
dl_sched_grant_t pdsch[MAX_GRANTS]; //< DL Grants
|
||||
uint32_t nof_grants; //< Number of DL grants
|
||||
uint32_t cfi; //< Current CFI of the cell, it can vary across cells
|
||||
} dl_sched_t;
|
||||
|
||||
/**
|
||||
* List of DL scheduling results, one entry per cell/carrier
|
||||
*/
|
||||
typedef std::vector<dl_sched_t> dl_sched_list_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t rnti;
|
||||
bool ack;
|
||||
} ul_sched_ack_t;
|
||||
|
||||
/**
|
||||
* UL grant information per UE
|
||||
*/
|
||||
typedef struct {
|
||||
srslte_dci_ul_t dci;
|
||||
uint32_t pid;
|
||||
uint32_t current_tx_nb;
|
||||
uint8_t* data;
|
||||
bool needs_pdcch;
|
||||
srslte_softbuffer_rx_t* softbuffer_rx;
|
||||
} ul_sched_grant_t;
|
||||
|
||||
/**
|
||||
* UL Scheduling result per cell/carrier
|
||||
*/
|
||||
typedef struct {
|
||||
ul_sched_grant_t pusch[MAX_GRANTS];
|
||||
ul_sched_ack_t phich[MAX_GRANTS];
|
||||
uint32_t nof_grants;
|
||||
uint32_t nof_phich;
|
||||
} ul_sched_t;
|
||||
|
||||
/**
|
||||
* List of UL scheduling results, one entry per cell/carrier
|
||||
*/
|
||||
typedef std::vector<ul_sched_t> ul_sched_list_t;
|
||||
|
||||
virtual int sr_detected(uint32_t tti, uint16_t rnti) = 0;
|
||||
virtual void rach_detected(uint32_t tti, uint32_t primary_cc_idx, uint32_t preamble_idx, uint32_t time_adv) = 0;
|
||||
|
||||
/**
|
||||
* PHY callback for giving MAC the Rank Indicator information of a given RNTI for an eNb cell/carrier.
|
||||
*
|
||||
* @param tti the given TTI
|
||||
* @param rnti the UE identifier in the eNb
|
||||
* @param cc_idx The eNb Cell/Carrier where the measurement corresponds
|
||||
* @param ri_value the actual Rank Indicator value, 0 for 1 layer, 1 for two layers and so on.
|
||||
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
|
||||
*/
|
||||
virtual int ri_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t ri_value) = 0;
|
||||
|
||||
/**
|
||||
* PHY callback for giving MAC the Pre-coding Matrix Indicator information of a given RNTI for an eNb cell/carrier.
|
||||
*
|
||||
* @param tti the given TTI
|
||||
* @param rnti the UE identifier in the eNb
|
||||
* @param cc_idx The eNb Cell/Carrier where the measurement corresponds
|
||||
* @param pmi_value the actual PMI value
|
||||
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
|
||||
*/
|
||||
virtual int pmi_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t pmi_value) = 0;
|
||||
|
||||
/**
|
||||
* PHY callback for for giving MAC the Channel Quality information of a given RNTI, TTI and eNb cell/carrier
|
||||
* @param tti the given TTI
|
||||
* @param rnti the UE identifier in the eNb
|
||||
* @param cc_idx The eNb Cell/Carrier where the measurement corresponds
|
||||
* @param cqi_value the corresponding Channel Quality Information
|
||||
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
|
||||
*/
|
||||
virtual int cqi_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t cqi_value) = 0;
|
||||
|
||||
typedef enum { PUSCH = 0, PUCCH, SRS } ul_channel_t;
|
||||
|
||||
/**
|
||||
* PHY callback for giving MAC the SNR in dB of an UL transmission for a given RNTI at a given carrier
|
||||
*
|
||||
* @param tti The measurement was made
|
||||
* @param rnti The UE identifier in the eNb
|
||||
* @param cc_idx The eNb Cell/Carrier where the UL transmission was received
|
||||
* @param snr_db The actual SNR of the received signal
|
||||
* @param ch Indicates uplink channel (PUSCH, PUCCH or SRS)
|
||||
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
|
||||
*/
|
||||
virtual int snr_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, float snr_db, ul_channel_t ch) = 0;
|
||||
|
||||
/**
|
||||
* PHY callback for giving MAC the Time Aligment information in microseconds of a given RNTI during a TTI processing
|
||||
*
|
||||
* @param tti The measurement was made
|
||||
* @param rnti The UE identifier in the eNb
|
||||
* @param ta_us The actual time alignment in microseconds
|
||||
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
|
||||
*/
|
||||
virtual int ta_info(uint32_t tti, uint16_t rnti, float ta_us) = 0;
|
||||
|
||||
/**
|
||||
* PHY callback for giving MAC the HARQ DL ACK/NACK feedback information for a given RNTI, TTI, eNb cell/carrier and
|
||||
* Transport block.
|
||||
*
|
||||
* @param tti the given TTI
|
||||
* @param rnti the UE identifier in the eNb
|
||||
* @param cc_idx the eNb Cell/Carrier identifier
|
||||
* @param tb_idx the transport block index
|
||||
* @param ack true for ACK, false for NACK, do not call for DTX
|
||||
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
|
||||
*/
|
||||
virtual int ack_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t tb_idx, bool ack) = 0;
|
||||
|
||||
/**
|
||||
* Informs MAC about a received PUSCH transmission for given RNTI, TTI and eNb Cell/carrier.
|
||||
*
|
||||
* This function does not deallocate the uplink buffer. The function push_pdu() must be called after this
|
||||
* to inform the MAC that the uplink buffer can be discarded or pushed to the stack
|
||||
*
|
||||
* @param tti the given TTI
|
||||
* @param rnti the UE identifier in the eNb
|
||||
* @param cc_idx the eNb Cell/Carrier identifier
|
||||
* @param nof_bytes the number of grants carrierd by the PUSCH message
|
||||
* @param crc_res the CRC check, set to true if the message was decoded succesfully
|
||||
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
|
||||
*/
|
||||
virtual int crc_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t nof_bytes, bool crc_res) = 0;
|
||||
|
||||
/**
|
||||
* Pushes an uplink PDU through the stack if crc_res==true or discards it if crc_res==false
|
||||
*
|
||||
* @param tti the given TTI
|
||||
* @param rnti the UE identifier in the eNb
|
||||
* @param enb_cc_idx the eNb Cell/Carrier identifier
|
||||
* @param nof_bytes the number of grants carrierd by the PUSCH message
|
||||
* @param crc_res the CRC check, set to true if the message was decoded succesfully
|
||||
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
|
||||
*/
|
||||
virtual int push_pdu(uint32_t tti_rx, uint16_t rnti, uint32_t enb_cc_idx, uint32_t nof_bytes, bool crc_res) = 0;
|
||||
|
||||
virtual int get_dl_sched(uint32_t tti, dl_sched_list_t& dl_sched_res) = 0;
|
||||
virtual int get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_list_t& dl_sched_res) = 0;
|
||||
virtual int get_ul_sched(uint32_t tti, ul_sched_list_t& ul_sched_res) = 0;
|
||||
virtual void set_sched_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) = 0;
|
||||
};
|
||||
|
||||
class mac_interface_rlc
|
||||
{
|
||||
public:
|
||||
virtual int rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue) = 0;
|
||||
};
|
||||
|
||||
class mac_interface_rrc
|
||||
{
|
||||
public:
|
||||
/* Provides cell configuration including SIB periodicity, etc. */
|
||||
virtual int cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg) = 0;
|
||||
virtual void reset() = 0;
|
||||
|
||||
/* Manages UE configuration context */
|
||||
virtual int ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg) = 0;
|
||||
virtual int ue_rem(uint16_t rnti) = 0;
|
||||
|
||||
/**
|
||||
* Called after Msg3 reception to set the UE C-RNTI, resolve contention, and alter the UE's configuration in the
|
||||
* scheduler and phy.
|
||||
*
|
||||
* @param temp_crnti temporary C-RNTI of the UE
|
||||
* @param crnti chosen C-RNTI for the UE
|
||||
* @param cfg new UE scheduler configuration
|
||||
*/
|
||||
virtual int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_cfg_t* cfg) = 0;
|
||||
|
||||
/* Manages UE bearers and associated configuration */
|
||||
virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) = 0;
|
||||
virtual int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) = 0;
|
||||
virtual void phy_config_enabled(uint16_t rnti, bool enabled) = 0;
|
||||
virtual void write_mcch(const srslte::sib2_mbms_t* sib2_,
|
||||
const srslte::sib13_t* sib13_,
|
||||
const srslte::mcch_msg_t* mcch_,
|
||||
const uint8_t* mcch_payload,
|
||||
const uint8_t mcch_payload_length) = 0;
|
||||
|
||||
/**
|
||||
* Allocate a C-RNTI for a new user, without adding it to the phy layer and scheduler yet
|
||||
* @return value of the allocated C-RNTI
|
||||
*/
|
||||
virtual uint16_t reserve_new_crnti(const sched_interface::ue_cfg_t& ue_cfg) = 0;
|
||||
};
|
||||
|
||||
// Combined interface for PHY to access stack (MAC and RRC)
|
||||
class stack_interface_phy_lte : public mac_interface_phy_lte
|
||||
{
|
||||
public:
|
||||
virtual void tti_clock() = 0;
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSLTE_ENB_MAC_INTERFACES_H
|
@ -0,0 +1,62 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "srslte/common/byte_buffer.h"
|
||||
#include "srslte/interfaces/pdcp_interface_types.h"
|
||||
#include <map>
|
||||
|
||||
#ifndef SRSLTE_ENB_PDCP_INTERFACES_H
|
||||
#define SRSLTE_ENB_PDCP_INTERFACES_H
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
// PDCP interface for GTPU
|
||||
class pdcp_interface_gtpu
|
||||
{
|
||||
public:
|
||||
virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu, int pdcp_sn = -1) = 0;
|
||||
virtual std::map<uint32_t, srslte::unique_byte_buffer_t> get_buffered_pdus(uint16_t rnti, uint32_t lcid) = 0;
|
||||
};
|
||||
|
||||
// PDCP interface for RRC
|
||||
class pdcp_interface_rrc
|
||||
{
|
||||
public:
|
||||
virtual void reset(uint16_t rnti) = 0;
|
||||
virtual void add_user(uint16_t rnti) = 0;
|
||||
virtual void rem_user(uint16_t rnti) = 0;
|
||||
virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu, int pdcp_sn = -1) = 0;
|
||||
virtual void add_bearer(uint16_t rnti, uint32_t lcid, srslte::pdcp_config_t cnfg) = 0;
|
||||
virtual void del_bearer(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual void config_security(uint16_t rnti, uint32_t lcid, srslte::as_security_config_t sec_cfg) = 0;
|
||||
virtual void enable_integrity(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual void enable_encryption(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual void send_status_report(uint16_t rnti) = 0;
|
||||
virtual void send_status_report(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual bool get_bearer_state(uint16_t rnti, uint32_t lcid, srslte::pdcp_lte_state_t* state) = 0;
|
||||
virtual bool set_bearer_state(uint16_t rnti, uint32_t lcid, const srslte::pdcp_lte_state_t& state) = 0;
|
||||
virtual void reestablish(uint16_t rnti) = 0;
|
||||
};
|
||||
|
||||
// PDCP interface for RLC
|
||||
class pdcp_interface_rlc
|
||||
{
|
||||
public:
|
||||
/* RLC calls PDCP to push a PDCP PDU. */
|
||||
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t pdu) = 0;
|
||||
virtual void notify_delivery(uint16_t rnti, uint32_t lcid, const std::vector<uint32_t>& pdcp_sns) = 0;
|
||||
virtual void notify_failure(uint16_t rnti, uint32_t lcid, const std::vector<uint32_t>& pdcp_sns) = 0;
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSLTE_ENB_PDCP_INTERFACES_H
|
@ -0,0 +1,102 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "srslte/interfaces/rrc_interface_types.h"
|
||||
#include "srslte/phy/common/phy_common.h"
|
||||
|
||||
#ifndef SRSLTE_ENB_PHY_INTERFACES_H
|
||||
#define SRSLTE_ENB_PHY_INTERFACES_H
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
/* Interface MAC -> PHY */
|
||||
class phy_interface_mac_lte
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Removes an RNTI context from all the physical layer components, including secondary cells
|
||||
* @param rnti identifier of the user
|
||||
*/
|
||||
virtual void rem_rnti(uint16_t rnti) = 0;
|
||||
|
||||
/**
|
||||
* Pregenerates the scrambling sequences for a given RNTI.
|
||||
* WARNING: This function make take several ms to complete.
|
||||
*
|
||||
* @param rnti identifier of the user
|
||||
*/
|
||||
virtual int pregen_sequences(uint16_t rnti) = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param stop
|
||||
*/
|
||||
virtual void set_mch_period_stop(uint32_t stop) = 0;
|
||||
|
||||
/**
|
||||
* Activates and/or deactivates Secondary Cells in the PHY for a given RNTI. Requires the RNTI of the given UE and a
|
||||
* vector with the activation/deactivation values. Use true for activation and false for deactivation. The index 0 is
|
||||
* reserved for PCell and will not be used.
|
||||
*
|
||||
* @param rnti identifier of the user
|
||||
* @param activation vector with the activate/deactivate.
|
||||
*/
|
||||
virtual void set_activation_deactivation_scell(uint16_t rnti,
|
||||
const std::array<bool, SRSLTE_MAX_CARRIERS>& activation) = 0;
|
||||
};
|
||||
|
||||
/* Interface RRC -> PHY */
|
||||
class phy_interface_rrc_lte
|
||||
{
|
||||
public:
|
||||
srslte::phy_cfg_mbsfn_t mbsfn_cfg;
|
||||
|
||||
virtual void configure_mbsfn(srslte::sib2_mbms_t* sib2, srslte::sib13_t* sib13, const srslte::mcch_msg_t& mcch) = 0;
|
||||
|
||||
struct phy_rrc_cfg_t {
|
||||
bool configured = false; ///< Indicates whether PHY shall consider configuring this cell/carrier
|
||||
uint32_t enb_cc_idx = 0; ///< eNb Cell index
|
||||
srslte::phy_cfg_t phy_cfg = {}; ///< Dedicated physical layer configuration
|
||||
};
|
||||
|
||||
typedef std::vector<phy_rrc_cfg_t> phy_rrc_cfg_list_t;
|
||||
|
||||
/**
|
||||
* Sets the physical layer dedicated configuration for a given RNTI. The dedicated configuration list shall provide
|
||||
* all the required information configuration for the following cases:
|
||||
* - Add an RNTI straight from RRC
|
||||
* - Moving primary to another serving cell
|
||||
* - Add/Remove secondary serving cells
|
||||
*
|
||||
* Remind this call will partially reconfigure the primary serving cell, `complete_config``shall be called
|
||||
* in order to complete the configuration.
|
||||
*
|
||||
* @param rnti the given RNTI
|
||||
* @param phy_cfg_list Physical layer configuration for the indicated eNb cell
|
||||
*/
|
||||
virtual void set_config(uint16_t rnti, const phy_rrc_cfg_list_t& phy_cfg_list) = 0;
|
||||
|
||||
/**
|
||||
* Instructs the physical layer the configuration has been complete from upper layers for a given RNTI
|
||||
*
|
||||
* @param rnti the given UE identifier (RNTI)
|
||||
*/
|
||||
virtual void complete_config(uint16_t rnti) = 0;
|
||||
};
|
||||
|
||||
// Combined interface for stack (MAC and RRC) to access PHY
|
||||
class phy_interface_stack_lte : public phy_interface_mac_lte, public phy_interface_rrc_lte
|
||||
{};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSLTE_ENB_PHY_INTERFACES_H
|
@ -0,0 +1,67 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSLTE_ENB_RLC_INTERFACES_H
|
||||
#define SRSLTE_ENB_RLC_INTERFACES_H
|
||||
|
||||
#include "srslte/common/byte_buffer.h"
|
||||
#include "srslte/interfaces/rlc_interface_types.h"
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
// RLC interface for MAC
|
||||
class rlc_interface_mac
|
||||
{
|
||||
public:
|
||||
/* MAC calls RLC to get RLC segment of nof_bytes length.
|
||||
* Segmentation happens in this function. RLC PDU is stored in payload. */
|
||||
virtual int read_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0;
|
||||
|
||||
virtual void read_pdu_pcch(uint8_t* payload, uint32_t buffer_size) = 0;
|
||||
|
||||
/* MAC calls RLC to push an RLC PDU. This function is called from an independent MAC thread.
|
||||
* PDU gets placed into the buffer and higher layer thread gets notified. */
|
||||
virtual void write_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_bytes) = 0;
|
||||
};
|
||||
|
||||
// RLC interface for PDCP
|
||||
class rlc_interface_pdcp
|
||||
{
|
||||
public:
|
||||
/* PDCP calls RLC to push an RLC SDU. SDU gets placed into the RLC buffer and MAC pulls
|
||||
* RLC PDUs according to TB size. */
|
||||
virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0;
|
||||
virtual void discard_sdu(uint16_t rnti, uint32_t lcid, uint32_t sn) = 0;
|
||||
virtual bool rb_is_um(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual bool sdu_queue_is_full(uint16_t rnti, uint32_t lcid) = 0;
|
||||
};
|
||||
|
||||
// RLC interface for RRC
|
||||
class rlc_interface_rrc
|
||||
{
|
||||
public:
|
||||
virtual void clear_buffer(uint16_t rnti) = 0;
|
||||
virtual void add_user(uint16_t rnti) = 0;
|
||||
virtual void rem_user(uint16_t rnti) = 0;
|
||||
virtual void add_bearer(uint16_t rnti, uint32_t lcid, srslte::rlc_config_t cnfg) = 0;
|
||||
virtual void add_bearer_mrb(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual void del_bearer(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0;
|
||||
virtual bool has_bearer(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual bool suspend_bearer(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual bool resume_bearer(uint16_t rnti, uint32_t lcid) = 0;
|
||||
virtual void reestablish(uint16_t rnti) = 0;
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSLTE_ENB_RLC_INTERFACES_H
|
@ -0,0 +1,92 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "srslte/asn1/s1ap_utils.h"
|
||||
#include "srslte/interfaces/enb_rrc_interface_types.h"
|
||||
#include "srslte/interfaces/sched_interface.h"
|
||||
|
||||
#ifndef SRSLTE_ENB_RRC_INTERFACES_H
|
||||
#define SRSLTE_ENB_RRC_INTERFACES_H
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
// RRC interface for S1AP
|
||||
class rrc_interface_s1ap
|
||||
{
|
||||
public:
|
||||
virtual void write_dl_info(uint16_t rnti, srslte::unique_byte_buffer_t sdu) = 0;
|
||||
virtual void release_complete(uint16_t rnti) = 0;
|
||||
virtual bool setup_ue_ctxt(uint16_t rnti, const asn1::s1ap::init_context_setup_request_s& msg) = 0;
|
||||
virtual bool modify_ue_ctxt(uint16_t rnti, const asn1::s1ap::ue_context_mod_request_s& msg) = 0;
|
||||
virtual bool setup_ue_erabs(uint16_t rnti, const asn1::s1ap::erab_setup_request_s& msg) = 0;
|
||||
virtual void modify_erabs(uint16_t rnti,
|
||||
const asn1::s1ap::erab_modify_request_s& msg,
|
||||
std::vector<uint16_t>* erabs_modified,
|
||||
std::vector<uint16_t>* erabs_failed_to_modify) = 0;
|
||||
virtual bool release_erabs(uint32_t rnti) = 0;
|
||||
virtual void release_erabs(uint32_t rnti,
|
||||
const asn1::s1ap::erab_release_cmd_s& msg,
|
||||
std::vector<uint16_t>* erabs_released,
|
||||
std::vector<uint16_t>* erabs_failed_to_release) = 0;
|
||||
virtual void add_paging_id(uint32_t ueid, const asn1::s1ap::ue_paging_id_c& ue_paging_id) = 0;
|
||||
|
||||
/**
|
||||
* Reports the reception of S1 HandoverCommand / HandoverPreparationFailure or abnormal conditions during
|
||||
* S1 Handover preparation back to RRC.
|
||||
*
|
||||
* @param rnti user
|
||||
* @param is_success true if ho cmd was received
|
||||
* @param container TargeteNB RRCConnectionReconfiguration message with MobilityControlInfo
|
||||
*/
|
||||
virtual void ho_preparation_complete(uint16_t rnti,
|
||||
bool is_success,
|
||||
const asn1::s1ap::ho_cmd_s& msg,
|
||||
srslte::unique_byte_buffer_t container) = 0;
|
||||
virtual uint16_t
|
||||
start_ho_ue_resource_alloc(const asn1::s1ap::ho_request_s& msg,
|
||||
const asn1::s1ap::sourceenb_to_targetenb_transparent_container_s& container) = 0;
|
||||
virtual void set_erab_status(uint16_t rnti, const asn1::s1ap::bearers_subject_to_status_transfer_list_l& erabs) = 0;
|
||||
};
|
||||
|
||||
/// RRC interface for RLC
|
||||
class rrc_interface_rlc
|
||||
{
|
||||
public:
|
||||
virtual void read_pdu_pcch(uint8_t* payload, uint32_t payload_size) = 0;
|
||||
virtual void max_retx_attempted(uint16_t rnti) = 0;
|
||||
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0;
|
||||
};
|
||||
|
||||
/// RRC interface for MAC
|
||||
class rrc_interface_mac
|
||||
{
|
||||
public:
|
||||
/* Radio Link failure */
|
||||
virtual int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0;
|
||||
virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0;
|
||||
virtual void set_activity_user(uint16_t rnti) = 0;
|
||||
virtual bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) = 0;
|
||||
|
||||
///< Provide packed SIB to MAC (buffer is managed by RRC)
|
||||
virtual uint8_t* read_pdu_bcch_dlsch(const uint8_t enb_cc_idx, const uint32_t sib_index) = 0;
|
||||
};
|
||||
|
||||
/// RRC interface for PDCP
|
||||
class rrc_interface_pdcp
|
||||
{
|
||||
public:
|
||||
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t pdu) = 0;
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSLTE_ENB_RRC_INTERFACES_H
|
@ -0,0 +1,119 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "srslte/asn1/s1ap_utils.h"
|
||||
#include "srslte/interfaces/rrc_interface_types.h"
|
||||
|
||||
#ifndef SRSLTE_ENB_S1AP_INTERFACES_H
|
||||
#define SRSLTE_ENB_S1AP_INTERFACES_H
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
struct s1ap_args_t {
|
||||
uint32_t enb_id; // 20-bit id (lsb bits)
|
||||
uint8_t cell_id; // 8-bit cell id
|
||||
uint16_t tac; // 16-bit tac
|
||||
uint16_t mcc; // BCD-coded with 0xF filler
|
||||
uint16_t mnc; // BCD-coded with 0xF filler
|
||||
std::string mme_addr;
|
||||
std::string gtp_bind_addr;
|
||||
std::string s1c_bind_addr;
|
||||
std::string enb_name;
|
||||
};
|
||||
|
||||
// S1AP interface for RRC
|
||||
class s1ap_interface_rrc
|
||||
{
|
||||
public:
|
||||
struct bearer_status_info {
|
||||
uint8_t erab_id;
|
||||
uint16_t pdcp_dl_sn, pdcp_ul_sn;
|
||||
uint16_t dl_hfn, ul_hfn;
|
||||
};
|
||||
|
||||
virtual void initial_ue(uint16_t rnti,
|
||||
uint32_t enb_cc_idx,
|
||||
asn1::s1ap::rrc_establishment_cause_e cause,
|
||||
srslte::unique_byte_buffer_t pdu) = 0;
|
||||
virtual void initial_ue(uint16_t rnti,
|
||||
uint32_t enb_cc_idx,
|
||||
asn1::s1ap::rrc_establishment_cause_e cause,
|
||||
srslte::unique_byte_buffer_t pdu,
|
||||
uint32_t m_tmsi,
|
||||
uint8_t mmec) = 0;
|
||||
|
||||
virtual void write_pdu(uint16_t rnti, srslte::unique_byte_buffer_t pdu) = 0;
|
||||
virtual bool user_exists(uint16_t rnti) = 0;
|
||||
virtual void user_mod(uint16_t old_rnti, uint16_t new_rnti) = 0;
|
||||
virtual bool user_release(uint16_t rnti, asn1::s1ap::cause_radio_network_e cause_radio) = 0;
|
||||
virtual void ue_ctxt_setup_complete(uint16_t rnti, const asn1::s1ap::init_context_setup_resp_s& res) = 0;
|
||||
virtual void ue_erab_setup_complete(uint16_t rnti, const asn1::s1ap::erab_setup_resp_s& res) = 0;
|
||||
virtual bool is_mme_connected() = 0;
|
||||
|
||||
/**
|
||||
* Command the s1ap to transmit a HandoverRequired message to MME.
|
||||
* This message initiates the S1 handover preparation procedure at the Source eNB
|
||||
*
|
||||
* @param rnti user to perform S1 handover
|
||||
* @param target_eci eNB Id + Cell Id of the target eNB
|
||||
* @param target_plmn PLMN of the target eNB
|
||||
* @param fwd_erabs E-RABs that are candidates to DL forwarding
|
||||
* @param rrc_container RRC container with SourceENBToTargetENBTransparentContainer message.
|
||||
* @return true if successful
|
||||
*/
|
||||
virtual bool send_ho_required(uint16_t rnti,
|
||||
uint32_t target_eci,
|
||||
srslte::plmn_id_t target_plmn,
|
||||
srslte::span<uint32_t> fwd_erabs,
|
||||
srslte::unique_byte_buffer_t rrc_container) = 0;
|
||||
|
||||
/**
|
||||
* Command the s1ap to transmit eNBStatusTransfer message to MME. This message passes the PDCP context of the UE
|
||||
* performing S1 handover from source eNB to target eNB.
|
||||
*
|
||||
* @param rnti user to perform S1 handover
|
||||
* @param bearer_status_list PDCP SN and HFN status of the bearers to be preserved at target eNB
|
||||
* @return true if successful
|
||||
*/
|
||||
virtual bool send_enb_status_transfer_proc(uint16_t rnti, std::vector<bearer_status_info>& bearer_status_list) = 0;
|
||||
|
||||
/* Acknowledge Handover Request message back to MME.
|
||||
* This message signals the completion of the HandoverPreparation from the TeNB point of view. */
|
||||
virtual bool send_ho_req_ack(const asn1::s1ap::ho_request_s& msg,
|
||||
uint16_t rnti,
|
||||
uint32_t enb_cc_idx,
|
||||
srslte::unique_byte_buffer_t ho_cmd,
|
||||
srslte::span<asn1::s1ap::erab_admitted_item_s> admitted_bearers) = 0;
|
||||
|
||||
/**
|
||||
* Notify MME that Handover is complete
|
||||
*/
|
||||
virtual void send_ho_notify(uint16_t rnti, uint64_t target_eci) = 0;
|
||||
|
||||
/**
|
||||
* Cancel on-going S1 Handover. MME should release UE context in target eNB
|
||||
* SeNB --> MME
|
||||
*/
|
||||
virtual void send_ho_cancel(uint16_t rnti) = 0;
|
||||
|
||||
/**
|
||||
* Called during release of a subset of eNB E-RABs. Send E-RAB RELEASE INDICATION to MME.
|
||||
* SeNB --> MME
|
||||
*/
|
||||
virtual bool release_erabs(uint16_t rnti, const std::vector<uint16_t>& erabs_successfully_released) = 0;
|
||||
|
||||
virtual bool send_ue_cap_info_indication(uint16_t rnti, srslte::unique_byte_buffer_t ue_radio_cap) = 0;
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSLTE_ENB_S1AP_INTERFACES_H
|
@ -0,0 +1,560 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSLTE_RRC_NR_INTERFACE_TYPES_H
|
||||
#define SRSLTE_RRC_NR_INTERFACE_TYPES_H
|
||||
|
||||
#include "srslte/config.h"
|
||||
#include "srslte/srslte.h"
|
||||
#include <string>
|
||||
|
||||
namespace srslte {
|
||||
|
||||
/***************************
|
||||
* PHY Config
|
||||
**************************/
|
||||
|
||||
struct phy_cfg_nr_t {
|
||||
srslte_sch_hl_cfg_nr_t pdsch = {};
|
||||
srslte_sch_hl_cfg_nr_t pusch = {};
|
||||
srslte_pucch_nr_hl_cfg_t pucch = {};
|
||||
srslte_prach_cfg_t prach = {};
|
||||
srslte_ue_dl_nr_pdcch_cfg_t pdcch = {};
|
||||
srslte_ue_dl_nr_harq_ack_cfg_t harq_ack = {};
|
||||
|
||||
phy_cfg_nr_t()
|
||||
{
|
||||
// Default PDSCH configuration
|
||||
pdsch.sch_cfg.mcs_table = srslte_mcs_table_256qam;
|
||||
|
||||
// Default PRACH configuration
|
||||
prach.is_nr = true;
|
||||
prach.config_idx = 16;
|
||||
prach.root_seq_idx = 1;
|
||||
prach.freq_offset = 0;
|
||||
prach.zero_corr_zone = 0;
|
||||
prach.num_ra_preambles = 64;
|
||||
prach.hs_flag = false;
|
||||
|
||||
// physicalCellGroupConfig
|
||||
// pdsch-HARQ-ACK-Codebook: dynamic (1)
|
||||
harq_ack.pdsch_harq_ack_codebook = srslte_pdsch_harq_ack_codebook_dynamic;
|
||||
|
||||
// commonControlResourceSet
|
||||
// controlResourceSetId: 1
|
||||
// frequencyDomainResources: ff0000000000
|
||||
// duration: 1
|
||||
// cce-REG-MappingType: nonInterleaved (1)
|
||||
// nonInterleaved: NULL
|
||||
// precoderGranularity: sameAsREG-bundle (0)
|
||||
pdcch.coreset[1].coreset_id = 1;
|
||||
pdcch.coreset[1].precoder_granularity = srslte_coreset_precoder_granularity_reg_bundle;
|
||||
pdcch.coreset[1].duration = 1;
|
||||
pdcch.coreset[1].mapping_type = srslte_coreset_mapping_type_non_interleaved;
|
||||
for (uint32_t i = 0; i < SRSLTE_CORESET_FREQ_DOMAIN_RES_SIZE; i++) {
|
||||
pdcch.coreset[1].freq_resources[i] = (i < 8);
|
||||
}
|
||||
pdcch.coreset_present[1] = true;
|
||||
|
||||
// SearchSpace
|
||||
// searchSpaceId: 1
|
||||
// controlResourceSetId: 1
|
||||
// monitoringSlotPeriodicityAndOffset: sl1 (0)
|
||||
// sl1: NULL
|
||||
// monitoringSymbolsWithinSlot: 8000 [bit length 14, 2 LSB pad bits, 1000 0000 0000 00.. decimal value 8192]
|
||||
// nrofCandidates
|
||||
// aggregationLevel1: n0 (0)
|
||||
// aggregationLevel2: n0 (0)
|
||||
// aggregationLevel4: n1 (1)
|
||||
// aggregationLevel8: n0 (0)
|
||||
// aggregationLevel16: n0 (0)
|
||||
// searchSpaceType: common (0)
|
||||
// common
|
||||
// dci-Format0-0-AndFormat1-0
|
||||
srslte_search_space_t search_space1 = {};
|
||||
search_space1.id = 1;
|
||||
search_space1.coreset_id = 1;
|
||||
search_space1.nof_candidates[0] = 0;
|
||||
search_space1.nof_candidates[1] = 0;
|
||||
search_space1.nof_candidates[2] = 1;
|
||||
search_space1.nof_candidates[3] = 0;
|
||||
search_space1.nof_candidates[4] = 0;
|
||||
search_space1.type = srslte_search_space_type_common_3;
|
||||
pdcch.search_space[1] = search_space1;
|
||||
pdcch.search_space_present[1] = true;
|
||||
|
||||
// ra-SearchSpace: 1
|
||||
pdcch.ra_rnti = 0x16; //< Supposed to be deduced from PRACH configuration
|
||||
pdcch.ra_search_space = search_space1;
|
||||
pdcch.ra_search_space.type = srslte_search_space_type_common_1;
|
||||
pdcch.ra_search_space_present = true;
|
||||
|
||||
// pdsch-ConfigCommon: setup (1)
|
||||
// setup
|
||||
// pdsch-TimeDomainAllocationList: 2 items
|
||||
// Item 0
|
||||
// PDSCH-TimeDomainResourceAllocation
|
||||
// mappingType: typeA (0)
|
||||
// startSymbolAndLength: 40
|
||||
// Item 1
|
||||
// PDSCH-TimeDomainResourceAllocation
|
||||
// mappingType: typeA (0)
|
||||
// startSymbolAndLength: 57
|
||||
pdsch.common_time_ra[0].mapping_type = srslte_sch_mapping_type_A;
|
||||
pdsch.common_time_ra[0].sliv = 40;
|
||||
pdsch.common_time_ra[0].k = 0;
|
||||
pdsch.common_time_ra[1].mapping_type = srslte_sch_mapping_type_A;
|
||||
pdsch.common_time_ra[1].sliv = 57;
|
||||
pdsch.common_time_ra[1].k = 0;
|
||||
pdsch.nof_common_time_ra = 2;
|
||||
|
||||
// pusch-ConfigCommon: setup (1)
|
||||
// setup
|
||||
// pusch-TimeDomainAllocationList: 2 items
|
||||
// Item 0
|
||||
// PUSCH-TimeDomainResourceAllocation
|
||||
// k2: 4
|
||||
// mappingType: typeA (0)
|
||||
// startSymbolAndLength: 27
|
||||
// Item 1
|
||||
// PUSCH-TimeDomainResourceAllocation
|
||||
// k2: 5
|
||||
// mappingType: typeA (0)
|
||||
// startSymbolAndLength: 27
|
||||
// p0-NominalWithGrant: -90dBm
|
||||
pusch.common_time_ra[0].mapping_type = srslte_sch_mapping_type_A;
|
||||
pusch.common_time_ra[0].sliv = 27;
|
||||
pusch.common_time_ra[0].k = 4;
|
||||
pusch.common_time_ra[1].mapping_type = srslte_sch_mapping_type_A;
|
||||
pusch.common_time_ra[1].sliv = 27;
|
||||
pusch.common_time_ra[1].k = 5;
|
||||
pusch.nof_common_time_ra = 2;
|
||||
|
||||
// pusch-Config: setup (1)
|
||||
// setup
|
||||
// dmrs-UplinkForPUSCH-MappingTypeA: setup (1)
|
||||
// setup
|
||||
// dmrs-AdditionalPosition: pos1 (1)
|
||||
// transformPrecodingDisabled
|
||||
pusch.dmrs_typeA.additional_pos = srslte_dmrs_sch_add_pos_1;
|
||||
pusch.dmrs_typeA.present = true;
|
||||
// pusch-PowerControl
|
||||
// msg3-Alpha: alpha1 (7)
|
||||
// p0-NominalWithoutGrant: -90dBm
|
||||
// p0-AlphaSets: 1 item
|
||||
// Item 0
|
||||
// P0-PUSCH-AlphaSet
|
||||
// p0-PUSCH-AlphaSetId: 0
|
||||
// p0: 0dB
|
||||
// alpha: alpha1 (7)
|
||||
// pathlossReferenceRSToAddModList: 1 item
|
||||
// Item 0
|
||||
// PUSCH-PathlossReferenceRS
|
||||
// pusch-PathlossReferenceRS-Id: 0
|
||||
// referenceSignal: ssb-Index (0)
|
||||
// ssb-Index: 0
|
||||
// sri-PUSCH-MappingToAddModList: 1 item
|
||||
// Item 0
|
||||
// SRI-PUSCH-PowerControl
|
||||
// sri-PUSCH-PowerControlId: 0
|
||||
// sri-PUSCH-PathlossReferenceRS-Id: 0
|
||||
// sri-P0-PUSCH-AlphaSetId: 0
|
||||
// sri-PUSCH-ClosedLoopIndex: i0 (0)
|
||||
// resourceAllocation: resourceAllocationType1 (1)
|
||||
// uci-OnPUSCH: setup (1)
|
||||
// setup
|
||||
// betaOffsets: semiStatic (1)
|
||||
// semiStatic
|
||||
// betaOffsetACK-Index1: 9
|
||||
// betaOffsetACK-Index2: 9
|
||||
// betaOffsetACK-Index3: 9
|
||||
// betaOffsetCSI-Part1-Index1: 6
|
||||
// betaOffsetCSI-Part1-Index2: 6
|
||||
// betaOffsetCSI-Part2-Index1: 6
|
||||
// betaOffsetCSI-Part2-Index2: 6
|
||||
// scaling: f1 (3)
|
||||
|
||||
// pucch-Config: setup (1)
|
||||
// setup
|
||||
// resourceSetToAddModList: 2 items
|
||||
pucch.enabled = true;
|
||||
// Item 0
|
||||
// PUCCH-ResourceSet
|
||||
// pucch-ResourceSetId: 0
|
||||
// resourceList: 8 items
|
||||
// Item 0
|
||||
// PUCCH-ResourceId: 0
|
||||
// Item 1
|
||||
// PUCCH-ResourceId: 1
|
||||
// Item 2
|
||||
// PUCCH-ResourceId: 2
|
||||
// Item 3
|
||||
// PUCCH-ResourceId: 3
|
||||
// Item 4
|
||||
// PUCCH-ResourceId: 4
|
||||
// Item 5
|
||||
// PUCCH-ResourceId: 5
|
||||
// Item 6
|
||||
// PUCCH-ResourceId: 6
|
||||
// Item 7
|
||||
// PUCCH-ResourceId: 7
|
||||
pucch.sets[0].nof_resources = 8;
|
||||
|
||||
// Item 1
|
||||
// PUCCH-ResourceSet
|
||||
// pucch-ResourceSetId: 1
|
||||
// resourceList: 8 items
|
||||
// Item 0
|
||||
// PUCCH-ResourceId: 8
|
||||
// Item 1
|
||||
// PUCCH-ResourceId: 9
|
||||
// Item 2
|
||||
// PUCCH-ResourceId: 10
|
||||
// Item 3
|
||||
// PUCCH-ResourceId: 11
|
||||
// Item 4
|
||||
// PUCCH-ResourceId: 12
|
||||
// Item 5
|
||||
// PUCCH-ResourceId: 13
|
||||
// Item 6
|
||||
// PUCCH-ResourceId: 14
|
||||
// Item 7
|
||||
// PUCCH-ResourceId: 15
|
||||
pucch.sets[1].nof_resources = 8;
|
||||
|
||||
// resourceToAddModList: 18 items
|
||||
// Item 0
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 0
|
||||
// startingPRB: 0
|
||||
// format: format1 (1)
|
||||
// format1
|
||||
// initialCyclicShift: 0
|
||||
// nrofSymbols: 14
|
||||
// startingSymbolIndex: 0
|
||||
// timeDomainOCC: 0
|
||||
pucch.sets[0].resources[0].format = SRSLTE_PUCCH_NR_FORMAT_1;
|
||||
pucch.sets[0].resources[0].starting_prb = 0;
|
||||
pucch.sets[0].resources[0].initial_cyclic_shift = 0;
|
||||
pucch.sets[0].resources[0].nof_symbols = 14;
|
||||
pucch.sets[0].resources[0].start_symbol_idx = 0;
|
||||
pucch.sets[0].resources[0].time_domain_occ = 0;
|
||||
|
||||
// Item 1
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 1
|
||||
// startingPRB: 0
|
||||
// format: format1 (1)
|
||||
// format1
|
||||
// initialCyclicShift: 4
|
||||
// nrofSymbols: 14
|
||||
// startingSymbolIndex: 0
|
||||
// timeDomainOCC: 0
|
||||
pucch.sets[0].resources[1].format = SRSLTE_PUCCH_NR_FORMAT_1;
|
||||
pucch.sets[0].resources[1].starting_prb = 0;
|
||||
pucch.sets[0].resources[1].initial_cyclic_shift = 4;
|
||||
pucch.sets[0].resources[1].nof_symbols = 14;
|
||||
pucch.sets[0].resources[1].start_symbol_idx = 0;
|
||||
pucch.sets[0].resources[1].time_domain_occ = 0;
|
||||
|
||||
// Item 2
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 2
|
||||
// startingPRB: 0
|
||||
// format: format1 (1)
|
||||
// format1
|
||||
// initialCyclicShift: 8
|
||||
// nrofSymbols: 14
|
||||
// startingSymbolIndex: 0
|
||||
// timeDomainOCC: 0
|
||||
pucch.sets[0].resources[2].format = SRSLTE_PUCCH_NR_FORMAT_1;
|
||||
pucch.sets[0].resources[2].starting_prb = 0;
|
||||
pucch.sets[0].resources[2].initial_cyclic_shift = 8;
|
||||
pucch.sets[0].resources[2].nof_symbols = 14;
|
||||
pucch.sets[0].resources[2].start_symbol_idx = 0;
|
||||
pucch.sets[0].resources[2].time_domain_occ = 0;
|
||||
|
||||
// Item 3
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 3
|
||||
// startingPRB: 0
|
||||
// format: format1 (1)
|
||||
// format1
|
||||
// initialCyclicShift: 0
|
||||
// nrofSymbols: 14
|
||||
// startingSymbolIndex: 0
|
||||
// timeDomainOCC: 1
|
||||
pucch.sets[0].resources[3].format = SRSLTE_PUCCH_NR_FORMAT_1;
|
||||
pucch.sets[0].resources[3].starting_prb = 0;
|
||||
pucch.sets[0].resources[3].initial_cyclic_shift = 0;
|
||||
pucch.sets[0].resources[3].nof_symbols = 14;
|
||||
pucch.sets[0].resources[3].start_symbol_idx = 0;
|
||||
pucch.sets[0].resources[3].time_domain_occ = 1;
|
||||
|
||||
// Item 4
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 4
|
||||
// startingPRB: 0
|
||||
// format: format1 (1)
|
||||
// format1
|
||||
// initialCyclicShift: 4
|
||||
// nrofSymbols: 14
|
||||
// startingSymbolIndex: 0
|
||||
// timeDomainOCC: 1
|
||||
pucch.sets[0].resources[4].format = SRSLTE_PUCCH_NR_FORMAT_1;
|
||||
pucch.sets[0].resources[4].starting_prb = 0;
|
||||
pucch.sets[0].resources[4].initial_cyclic_shift = 4;
|
||||
pucch.sets[0].resources[4].nof_symbols = 14;
|
||||
pucch.sets[0].resources[4].start_symbol_idx = 0;
|
||||
pucch.sets[0].resources[4].time_domain_occ = 1;
|
||||
|
||||
// Item 5
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 5
|
||||
// startingPRB: 0
|
||||
// format: format1 (1)
|
||||
// format1
|
||||
// initialCyclicShift: 8
|
||||
// nrofSymbols: 14
|
||||
// startingSymbolIndex: 0
|
||||
// timeDomainOCC: 1
|
||||
pucch.sets[0].resources[5].format = SRSLTE_PUCCH_NR_FORMAT_1;
|
||||
pucch.sets[0].resources[5].starting_prb = 0;
|
||||
pucch.sets[0].resources[5].initial_cyclic_shift = 8;
|
||||
pucch.sets[0].resources[5].nof_symbols = 14;
|
||||
pucch.sets[0].resources[5].start_symbol_idx = 0;
|
||||
pucch.sets[0].resources[5].time_domain_occ = 1;
|
||||
|
||||
// Item 6
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 6
|
||||
// startingPRB: 0
|
||||
// format: format1 (1)
|
||||
// format1
|
||||
// initialCyclicShift: 0
|
||||
// nrofSymbols: 14
|
||||
// startingSymbolIndex: 0
|
||||
// timeDomainOCC: 2
|
||||
pucch.sets[0].resources[6].format = SRSLTE_PUCCH_NR_FORMAT_1;
|
||||
pucch.sets[0].resources[6].starting_prb = 0;
|
||||
pucch.sets[0].resources[6].initial_cyclic_shift = 0;
|
||||
pucch.sets[0].resources[6].nof_symbols = 14;
|
||||
pucch.sets[0].resources[6].start_symbol_idx = 0;
|
||||
pucch.sets[0].resources[6].time_domain_occ = 2;
|
||||
|
||||
// Item 7
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 7
|
||||
// startingPRB: 0
|
||||
// format: format1 (1)
|
||||
// format1
|
||||
// initialCyclicShift: 4
|
||||
// nrofSymbols: 14
|
||||
// startingSymbolIndex: 0
|
||||
// timeDomainOCC: 2
|
||||
pucch.sets[0].resources[7].format = SRSLTE_PUCCH_NR_FORMAT_1;
|
||||
pucch.sets[0].resources[7].starting_prb = 0;
|
||||
pucch.sets[0].resources[7].initial_cyclic_shift = 0;
|
||||
pucch.sets[0].resources[7].nof_symbols = 14;
|
||||
pucch.sets[0].resources[7].start_symbol_idx = 0;
|
||||
pucch.sets[0].resources[7].time_domain_occ = 2;
|
||||
|
||||
// Item 8
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 8
|
||||
// startingPRB: 51
|
||||
// format: format2 (2)
|
||||
// format2
|
||||
// nrofPRBs: 1
|
||||
// nrofSymbols: 2
|
||||
// startingSymbolIndex: 0
|
||||
pucch.sets[1].resources[0].format = SRSLTE_PUCCH_NR_FORMAT_2;
|
||||
pucch.sets[1].resources[0].starting_prb = 51;
|
||||
pucch.sets[1].resources[0].nof_prb = 1;
|
||||
pucch.sets[1].resources[0].nof_symbols = 2;
|
||||
pucch.sets[1].resources[0].start_symbol_idx = 0;
|
||||
|
||||
// Item 9
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 9
|
||||
// startingPRB: 51
|
||||
// format: format2 (2)
|
||||
// format2
|
||||
// nrofPRBs: 1
|
||||
// nrofSymbols: 2
|
||||
// startingSymbolIndex: 2
|
||||
pucch.sets[1].resources[1].format = SRSLTE_PUCCH_NR_FORMAT_2;
|
||||
pucch.sets[1].resources[1].starting_prb = 51;
|
||||
pucch.sets[1].resources[1].nof_prb = 1;
|
||||
pucch.sets[1].resources[1].nof_symbols = 2;
|
||||
pucch.sets[1].resources[1].start_symbol_idx = 2;
|
||||
|
||||
// Item 10
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 10
|
||||
// startingPRB: 51
|
||||
// format: format2 (2)
|
||||
// format2
|
||||
// nrofPRBs: 1
|
||||
// nrofSymbols: 2
|
||||
// startingSymbolIndex: 4
|
||||
pucch.sets[1].resources[2].format = SRSLTE_PUCCH_NR_FORMAT_2;
|
||||
pucch.sets[1].resources[2].starting_prb = 51;
|
||||
pucch.sets[1].resources[2].nof_prb = 1;
|
||||
pucch.sets[1].resources[2].nof_symbols = 2;
|
||||
pucch.sets[1].resources[2].start_symbol_idx = 4;
|
||||
|
||||
// Item 11
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 11
|
||||
// startingPRB: 51
|
||||
// format: format2 (2)
|
||||
// format2
|
||||
// nrofPRBs: 1
|
||||
// nrofSymbols: 2
|
||||
// startingSymbolIndex: 6
|
||||
pucch.sets[1].resources[3].format = SRSLTE_PUCCH_NR_FORMAT_2;
|
||||
pucch.sets[1].resources[3].starting_prb = 51;
|
||||
pucch.sets[1].resources[3].nof_prb = 1;
|
||||
pucch.sets[1].resources[3].nof_symbols = 2;
|
||||
pucch.sets[1].resources[3].start_symbol_idx = 6;
|
||||
|
||||
// Item 12
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 12
|
||||
// startingPRB: 51
|
||||
// format: format2 (2)
|
||||
// format2
|
||||
// nrofPRBs: 1
|
||||
// nrofSymbols: 2
|
||||
// startingSymbolIndex: 8
|
||||
pucch.sets[1].resources[4].format = SRSLTE_PUCCH_NR_FORMAT_2;
|
||||
pucch.sets[1].resources[4].starting_prb = 51;
|
||||
pucch.sets[1].resources[4].nof_prb = 1;
|
||||
pucch.sets[1].resources[4].nof_symbols = 2;
|
||||
pucch.sets[1].resources[4].start_symbol_idx = 8;
|
||||
|
||||
// Item 13
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 13
|
||||
// startingPRB: 51
|
||||
// format: format2 (2)
|
||||
// format2
|
||||
// nrofPRBs: 1
|
||||
// nrofSymbols: 2
|
||||
// startingSymbolIndex: 10
|
||||
pucch.sets[1].resources[5].format = SRSLTE_PUCCH_NR_FORMAT_2;
|
||||
pucch.sets[1].resources[5].starting_prb = 51;
|
||||
pucch.sets[1].resources[5].nof_prb = 1;
|
||||
pucch.sets[1].resources[5].nof_symbols = 2;
|
||||
pucch.sets[1].resources[5].start_symbol_idx = 10;
|
||||
|
||||
// Item 14
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 14
|
||||
// startingPRB: 51
|
||||
// format: format2 (2)
|
||||
// format2
|
||||
// nrofPRBs: 1
|
||||
// nrofSymbols: 2
|
||||
// startingSymbolIndex: 12
|
||||
pucch.sets[1].resources[6].format = SRSLTE_PUCCH_NR_FORMAT_2;
|
||||
pucch.sets[1].resources[6].starting_prb = 51;
|
||||
pucch.sets[1].resources[6].nof_prb = 1;
|
||||
pucch.sets[1].resources[6].nof_symbols = 2;
|
||||
pucch.sets[1].resources[6].start_symbol_idx = 12;
|
||||
|
||||
// Item 15
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 15
|
||||
// startingPRB: 1
|
||||
// format: format2 (2)
|
||||
// format2
|
||||
// nrofPRBs: 1
|
||||
// nrofSymbols: 2
|
||||
// startingSymbolIndex: 0
|
||||
pucch.sets[1].resources[7].format = SRSLTE_PUCCH_NR_FORMAT_2;
|
||||
pucch.sets[1].resources[7].starting_prb = 51;
|
||||
pucch.sets[1].resources[7].nof_prb = 1;
|
||||
pucch.sets[1].resources[7].nof_symbols = 2;
|
||||
pucch.sets[1].resources[7].start_symbol_idx = 2;
|
||||
|
||||
// Item 16
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 16
|
||||
// startingPRB: 0
|
||||
// format: format1 (1)
|
||||
// format1
|
||||
// initialCyclicShift: 8
|
||||
// nrofSymbols: 14
|
||||
// startingSymbolIndex: 0
|
||||
// timeDomainOCC: 2
|
||||
// Item 17
|
||||
// PUCCH-Resource
|
||||
// pucch-ResourceId: 17
|
||||
// startingPRB: 1
|
||||
// format: format2 (2)
|
||||
// format2
|
||||
// nrofPRBs: 1
|
||||
// nrofSymbols: 2
|
||||
// startingSymbolIndex: 2
|
||||
// format1: setup (1)
|
||||
// setup
|
||||
// format2: setup (1)
|
||||
// setup
|
||||
// maxCodeRate: zeroDot25 (2)
|
||||
for (uint32_t i = 0; i < SRSLTE_PUCCH_NR_MAX_NOF_SETS; i++) {
|
||||
srslte_pucch_nr_resource_set_t* set = &pucch.sets[i];
|
||||
for (uint32_t j = 0; j < set->nof_resources; j++) {
|
||||
if (set->resources[j].format == SRSLTE_PUCCH_NR_FORMAT_2) {
|
||||
set->resources[j].max_code_rate = 2; // 0.25
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// schedulingRequestResourceToAddModList: 1 item
|
||||
// Item 0
|
||||
// SchedulingRequestResourceConfig
|
||||
// schedulingRequestResourceId: 1
|
||||
// schedulingRequestID: 0
|
||||
// periodicityAndOffset: sl40 (10)
|
||||
// sl40: 8
|
||||
// resource: 16
|
||||
|
||||
// dl-DataToUL-ACK: 7 items
|
||||
// Item 0
|
||||
// dl-DataToUL-ACK item: 8
|
||||
// Item 1
|
||||
// dl-DataToUL-ACK item: 7
|
||||
// Item 2
|
||||
// dl-DataToUL-ACK item: 6
|
||||
// Item 3
|
||||
// dl-DataToUL-ACK item: 5
|
||||
// Item 4
|
||||
// dl-DataToUL-ACK item: 4
|
||||
// Item 5
|
||||
// dl-DataToUL-ACK item: 12
|
||||
// Item 6
|
||||
// dl-DataToUL-ACK item: 11
|
||||
harq_ack.dl_data_to_ul_ack[0] = 8;
|
||||
harq_ack.dl_data_to_ul_ack[1] = 7;
|
||||
harq_ack.dl_data_to_ul_ack[2] = 6;
|
||||
harq_ack.dl_data_to_ul_ack[3] = 5;
|
||||
harq_ack.dl_data_to_ul_ack[4] = 4;
|
||||
harq_ack.dl_data_to_ul_ack[5] = 12;
|
||||
harq_ack.dl_data_to_ul_ack[6] = 11;
|
||||
harq_ack.nof_dl_data_to_ul_ack = 7;
|
||||
}
|
||||
};
|
||||
} // namespace srslte
|
||||
|
||||
#endif // SRSLTE_RRC_NR_INTERFACE_TYPES_H
|
@ -0,0 +1,107 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSLTE_MAC_RAR_PDU_NR_H
|
||||
#define SRSLTE_MAC_RAR_PDU_NR_H
|
||||
|
||||
#include "srslte/common/common.h"
|
||||
#include "srslte/config.h"
|
||||
#include "srslte/phy/common/phy_common_nr.h"
|
||||
#include "srslte/srslog/srslog.h"
|
||||
#include <memory>
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
namespace srslte {
|
||||
|
||||
class mac_rar_pdu_nr;
|
||||
|
||||
// 3GPP 38.321 v15.3.0 Sec 6.1.5
|
||||
class mac_rar_subpdu_nr
|
||||
{
|
||||
public:
|
||||
// Possible types of RAR subpdus (same like EUTRA)
|
||||
typedef enum { BACKOFF = 0, RAPID } rar_subh_type_t;
|
||||
|
||||
mac_rar_subpdu_nr(mac_rar_pdu_nr* parent_);
|
||||
|
||||
// RAR content length in bits (38.321 Sec 6.2.3)
|
||||
static const uint32_t UL_GRANT_NBITS = SRSLTE_RAR_UL_GRANT_NBITS;
|
||||
static const uint32_t TA_COMMAND_NBITS = 12;
|
||||
|
||||
// getter
|
||||
bool read_subpdu(const uint8_t* ptr);
|
||||
bool has_more_subpdus();
|
||||
uint32_t get_total_length();
|
||||
bool has_rapid() const;
|
||||
uint8_t get_rapid() const;
|
||||
uint16_t get_temp_crnti() const;
|
||||
uint32_t get_ta() const;
|
||||
std::array<uint8_t, UL_GRANT_NBITS> get_ul_grant() const;
|
||||
bool has_backoff() const;
|
||||
uint8_t get_backoff() const;
|
||||
|
||||
// setter
|
||||
uint32_t write_subpdu(const uint8_t* start_);
|
||||
void set_backoff(const uint8_t backoff_indicator_);
|
||||
|
||||
std::string to_string();
|
||||
|
||||
private:
|
||||
int header_length = 1; // RAR PDU subheader is always 1 B
|
||||
int payload_length = 0; // only used if MAC RAR is included
|
||||
|
||||
std::array<uint8_t, UL_GRANT_NBITS> ul_grant = {};
|
||||
uint16_t ta = 0; // 12bit TA
|
||||
uint16_t temp_crnti = 0;
|
||||
uint16_t rapid = 0;
|
||||
uint8_t backoff_indicator = 0;
|
||||
rar_subh_type_t type = BACKOFF;
|
||||
bool E_bit = 0;
|
||||
|
||||
srslog::basic_logger& logger;
|
||||
|
||||
mac_rar_pdu_nr* parent = nullptr;
|
||||
};
|
||||
|
||||
class mac_rar_pdu_nr
|
||||
{
|
||||
public:
|
||||
mac_rar_pdu_nr();
|
||||
~mac_rar_pdu_nr() = default;
|
||||
|
||||
bool pack();
|
||||
bool unpack(const uint8_t* payload, const uint32_t& len);
|
||||
uint32_t get_num_subpdus();
|
||||
// Returns reference to a single subPDU
|
||||
const mac_rar_subpdu_nr& get_subpdu(const uint32_t& index);
|
||||
// Returns reference to all subPDUs
|
||||
const std::vector<mac_rar_subpdu_nr>& get_subpdus();
|
||||
|
||||
uint32_t get_remaining_len();
|
||||
|
||||
void set_si_rapid(uint16_t si_rapid_); // configured through SIB1 for on-demand SI request (See 38.331 Sec 5.2.1)
|
||||
bool has_si_rapid();
|
||||
|
||||
std::string to_string();
|
||||
|
||||
private:
|
||||
std::vector<mac_rar_subpdu_nr> subpdus;
|
||||
uint32_t remaining_len = 0;
|
||||
uint16_t si_rapid = 0;
|
||||
bool si_rapid_set = false;
|
||||
srslog::basic_logger& logger;
|
||||
};
|
||||
|
||||
} // namespace srslte
|
||||
|
||||
#endif // SRSLTE_MAC_RAR_PDU_NR_H
|
@ -0,0 +1,78 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2020 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* @file ue_dl_nr.h
|
||||
*
|
||||
* Description: NR UE uplink physical layer procedures for data
|
||||
*
|
||||
* This module is a frontend to all the uplink data channel processing modules.
|
||||
*
|
||||
* Reference:
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SRSLTE_UE_UL_DATA_H
|
||||
#define SRSLTE_UE_UL_DATA_H
|
||||
|
||||
#include "srslte/phy/ch_estimation/dmrs_sch.h"
|
||||
#include "srslte/phy/common/phy_common_nr.h"
|
||||
#include "srslte/phy/dft/ofdm.h"
|
||||
#include "srslte/phy/phch/phch_cfg_nr.h"
|
||||
#include "srslte/phy/phch/pucch_cfg_nr.h"
|
||||
#include "srslte/phy/phch/pucch_nr.h"
|
||||
#include "srslte/phy/phch/pusch_nr.h"
|
||||
|
||||
typedef struct SRSLTE_API {
|
||||
srslte_pusch_nr_args_t pusch;
|
||||
srslte_pucch_nr_args_t pucch;
|
||||
uint32_t nof_max_prb;
|
||||
} srslte_ue_ul_nr_args_t;
|
||||
|
||||
typedef struct SRSLTE_API {
|
||||
uint32_t max_prb;
|
||||
|
||||
srslte_carrier_nr_t carrier;
|
||||
|
||||
srslte_ofdm_t ifft;
|
||||
|
||||
cf_t* sf_symbols[SRSLTE_MAX_PORTS];
|
||||
srslte_pusch_nr_t pusch;
|
||||
srslte_pucch_nr_t pucch;
|
||||
srslte_dmrs_sch_t dmrs;
|
||||
} srslte_ue_ul_nr_t;
|
||||
|
||||
SRSLTE_API int srslte_ue_ul_nr_init(srslte_ue_ul_nr_t* q, cf_t* output, const srslte_ue_ul_nr_args_t* args);
|
||||
|
||||
SRSLTE_API int srslte_ue_ul_nr_set_carrier(srslte_ue_ul_nr_t* q, const srslte_carrier_nr_t* carrier);
|
||||
|
||||
SRSLTE_API int srslte_ue_ul_nr_encode_pusch(srslte_ue_ul_nr_t* q,
|
||||
const srslte_slot_cfg_t* slot_cfg,
|
||||
const srslte_sch_cfg_nr_t* pusch_cfg,
|
||||
uint8_t* data_);
|
||||
|
||||
SRSLTE_API int srslte_ue_ul_nr_encode_pucch(srslte_ue_ul_nr_t* q,
|
||||
const srslte_slot_cfg_t* slot_cfg,
|
||||
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||
const srslte_pucch_nr_resource_t* resource,
|
||||
const srslte_uci_data_nr_t* uci_data);
|
||||
|
||||
SRSLTE_API void srslte_ue_ul_nr_free(srslte_ue_ul_nr_t* q);
|
||||
|
||||
SRSLTE_API int
|
||||
srslte_ue_ul_nr_pusch_info(const srslte_ue_ul_nr_t* q, const srslte_sch_cfg_nr_t* cfg, char* str, uint32_t str_len);
|
||||
|
||||
SRSLTE_API int srslte_ue_ul_nr_pucch_info(const srslte_pucch_nr_resource_t* resource,
|
||||
const srslte_uci_data_nr_t* uci_data,
|
||||
char* str,
|
||||
uint32_t str_len);
|
||||
|
||||
#endif // SRSLTE_UE_UL_DATA_H
|
@ -1,63 +0,0 @@
|
||||
/**
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsLTE.
|
||||
*
|
||||
* srsLTE 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.
|
||||
*
|
||||
* srsLTE 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/.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* @file ue_dl_nr.h
|
||||
*
|
||||
* Description: NR UE uplink physical layer procedures for data
|
||||
*
|
||||
* This module is a frontend to all the uplink data channel processing modules.
|
||||
*
|
||||
* Reference:
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SRSLTE_UE_UL_DATA_H
|
||||
#define SRSLTE_UE_UL_DATA_H
|
||||
|
||||
#include "srslte/phy/common/phy_common_nr.h"
|
||||
#include "srslte/phy/phch/phch_cfg_nr.h"
|
||||
|
||||
/**
|
||||
* @brief Calculates the PUSCH time resource default A and stores it in the provided PUSCH NR grant.
|
||||
*
|
||||
* @remark Defined by TS 38.214 V15.10.0 Table 6.1.2.1.1-2: Default PUSCH time domain resource allocation A for normal
|
||||
* CP
|
||||
*
|
||||
* @param m Time domain resource assignment field value m of the DCI
|
||||
* @param[out] grant PUSCH grant
|
||||
* @return Returns SRSLTE_SUCCESS if the provided allocation is valid, otherwise it returns SRSLTE_ERROR code
|
||||
*/
|
||||
SRSLTE_API int srslte_ue_ul_nr_pdsch_time_resource_default_A(uint32_t m, srslte_sch_grant_nr_t* grant);
|
||||
|
||||
/**
|
||||
* @brief Calculates the number of PUSCH-DMRS CDM groups without data for DCI format 0_0
|
||||
*
|
||||
* @remark Defined by TS 38.214 V15.10.0 6.2.2 UE DM-RS transmission procedure
|
||||
*
|
||||
* @param cfg PUSCH NR configuration by upper layers
|
||||
* @param[out] grant Provides grant pointer to fill
|
||||
* @return Returns SRSLTE_SUCCESS if the provided data is valid, otherwise it returns SRSLTE_ERROR code
|
||||
*/
|
||||
SRSLTE_API int srslte_ue_ul_nr_nof_dmrs_cdm_groups_without_data_format_0_0(const srslte_sch_cfg_nr_t* cfg,
|
||||
srslte_sch_grant_nr_t* grant);
|
||||
|
||||
|
||||
#endif // SRSLTE_UE_UL_DATA_H
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue