├── assets
└── lte.png
├── liblte
├── hdr
│ ├── liblte_mcc_mnc_list.h
│ └── liblte_common.h
├── manual_tests
│ └── Makefile
├── CMakeLists.txt
├── src
│ └── liblte_common.cc
└── tests
│ └── liblte_common_tests.cc
├── Test captures
└── LTE_test_file_int8.bin
├── libtools
├── CMakeLists.txt
├── hdr
│ ├── libtools_scoped_lock.h
│ └── libtools_helpers.h
└── src
│ └── libtools_scoped_lock.cc
├── AUTHORS.md
├── LTE_fdd_dl_file_gen
├── src
│ ├── LTE_fdd_dl_fg.i
│ └── __init__.py
├── CMakeLists.txt
├── python
│ └── LTE_fdd_dl_file_gen.py
└── hdr
│ └── LTE_fdd_dl_fg_api.h
├── LTE_fdd_dl_file_scan
├── src
│ ├── LTE_fdd_dl_fs.i
│ └── __init__.py
├── CMakeLists.txt
├── python
│ └── LTE_fdd_dl_file_scan.py
└── hdr
│ └── LTE_fdd_dl_fs_api.h
├── LTE_file_recorder
├── CMakeLists.txt
├── src
│ └── LTE_file_recorder_main.cc
└── hdr
│ ├── LTE_file_recorder_flowgraph.h
│ └── LTE_file_recorder_interface.h
├── LTE_fdd_dl_scan
├── CMakeLists.txt
├── hdr
│ └── LTE_fdd_dl_scan_state_machine_api.h
└── src
│ └── LTE_fdd_dl_scan_main.cc
├── cmake
├── Modules
│ ├── FindUhd.cmake
│ ├── FindLibbladeRF.cmake
│ ├── FindGnuradioOsmosdr.cmake
│ ├── FindPolarssl.cmake
│ ├── FindFFTW3F.cmake
│ └── GrPlatform.cmake
└── cmake_uninstall.cmake.in
├── LTE_fdd_enodeb
├── CMakeLists.txt
├── src
│ ├── LTE_fdd_enb_main.cc
│ └── LTE_fdd_enb_timer.cc
└── hdr
│ ├── LTE_fdd_enb_gw.h
│ ├── LTE_fdd_enb_timer.h
│ ├── LTE_fdd_enb_timer_mgr.h
│ └── LTE_fdd_enb_pdcp.h
├── enodeb_nat_script.sh
├── octave
├── lte_bcch_dlsch_msg_pack.m
├── cmn_dec2bin.m
├── cmn_bin2dec.m
├── lte_layer_mapper_ul.m
├── lte_pre_coder_ul.m
├── lte_code_block_concatenation.m
├── lte_layer_demapper_ul.m
├── lte_pre_decoder_and_matched_filter_ul.m
├── lte_bcch_dlsch_msg_unpack.m
├── lte_cfi_channel_encode.m
├── lte_generate_prs_c.m
├── lte_ulsch_control_data_multiplexing.m
├── cmn_oct2bin.m
├── lte_generate_pss.m
├── lte_ulsch_control_data_demultiplexing.m
├── lte_generate_crs.m
├── lte_calc_crc.m
├── lte_bch_channel_encode.m
├── lte_dlsch_channel_encode.m
├── lte_dci_channel_encode.m
├── lte_bch_channel_decode.m
├── lte_cfi_channel_decode.m
├── lte_dci_channel_decode.m
├── lte_dlsch_channel_decode.m
├── cmn_conv_encode.m
├── lte_ulsch_channel_encode.m
├── lte_bcch_bch_msg_unpack.m
├── lte_bcch_bch_msg_pack.m
├── lte_ulsch_channel_decode.m
├── lte_prach_bb_gen.m
├── lte_rate_match_conv.m
├── lte_code_block_deconcatenation.m
├── lte_pre_decoder_and_matched_filter_dl.m
├── lte_dci_1a_pack.m
├── lte_modulation_demapper.m
├── lte_pre_coder_dl.m
├── lte_ulsch_channel_interleaver.m
├── lte_ulsch_channel_deinterleaver.m
├── lte_generate_sss.m
├── lte_code_block_desegmentation.m
├── lte_sib1_pack.m
└── lte_code_block_segmentation.m
└── cmn_hdr
└── typedefs.h
/assets/lte.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mgp25/OpenLTE/HEAD/assets/lte.png
--------------------------------------------------------------------------------
/liblte/hdr/liblte_mcc_mnc_list.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mgp25/OpenLTE/HEAD/liblte/hdr/liblte_mcc_mnc_list.h
--------------------------------------------------------------------------------
/Test captures/LTE_test_file_int8.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mgp25/OpenLTE/HEAD/Test captures/LTE_test_file_int8.bin
--------------------------------------------------------------------------------
/liblte/manual_tests/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | g++ -I../hdr/ -I../../cmn_hdr ../src/liblte_phy.cc ../src/liblte_mac.cc ../src/liblte_rrc.cc ../src/liblte_common.cc ratematch_test.cc -o ratematch_test -lfftw3f -litpp
3 |
--------------------------------------------------------------------------------
/libtools/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(GrPlatform)
2 | add_library(tools
3 | src/libtools_socket_wrap.cc
4 | src/libtools_scoped_lock.cc
5 | src/libtools_ipc_msgq.cc
6 | src/libtools_helpers.cc
7 | )
8 | include_directories(hdr ${CMAKE_SOURCE_DIR}/cmn_hdr ${CMAKE_SOURCE_DIR}/liblte/hdr)
9 |
--------------------------------------------------------------------------------
/AUTHORS.md:
--------------------------------------------------------------------------------
1 | - Ben Wojtowicz, [bwojtowi@gmail.com](bwojtowi@gmail.com)
2 | - Andrew Murphy, [andrew.murphy@rd.bbc.co.uk](andrew.murphy@rd.bbc.co.uk)
3 | - Ziming He, [ziminghe83@gmail.com](ziminghe83@gmail.com)
4 | - Przemek Bereski, [przemobe@users.sourceforge.net](przemobe@users.sourceforge.net)
5 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_file_gen/src/LTE_fdd_dl_fg.i:
--------------------------------------------------------------------------------
1 | /* -*- c++ -*- */
2 |
3 | #define LTE_FDD_DL_FG_API
4 |
5 | %include "gnuradio.i" // the common stuff
6 |
7 | %{
8 | #include "LTE_fdd_dl_fg_samp_buf.h"
9 | %}
10 |
11 | GR_SWIG_BLOCK_MAGIC(LTE_fdd_dl_fg,samp_buf);
12 | %include "LTE_fdd_dl_fg_samp_buf.h"
13 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_file_scan/src/LTE_fdd_dl_fs.i:
--------------------------------------------------------------------------------
1 | /* -*- c++ -*- */
2 |
3 | #define LTE_FDD_DL_FS_API
4 |
5 | %include "gnuradio.i" // the common stuff
6 |
7 | %{
8 | #include "LTE_fdd_dl_fs_samp_buf.h"
9 | %}
10 |
11 | GR_SWIG_BLOCK_MAGIC(LTE_fdd_dl_fs,samp_buf);
12 | %include "LTE_fdd_dl_fs_samp_buf.h"
13 |
--------------------------------------------------------------------------------
/liblte/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(GrPlatform)
2 | add_library(lte
3 | src/liblte_common.cc
4 | src/liblte_interface.cc
5 | src/liblte_phy.cc
6 | src/liblte_mac.cc
7 | src/liblte_rlc.cc
8 | src/liblte_pdcp.cc
9 | src/liblte_rrc.cc
10 | src/liblte_mme.cc
11 | src/liblte_security.cc
12 | )
13 | include_directories(hdr ${CMAKE_SOURCE_DIR}/cmn_hdr)
14 |
15 | add_executable(liblte_common_test
16 | tests/liblte_common_tests.cc
17 | src/liblte_common.cc
18 | )
19 | add_test(liblte_common_test liblte_common_test)
20 |
--------------------------------------------------------------------------------
/LTE_file_recorder/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(GrPlatform)
2 | include_directories(hdr
3 | ${CMAKE_SOURCE_DIR}/liblte/hdr
4 | ${CMAKE_SOURCE_DIR}/libtools/hdr
5 | ${CMAKE_SOURCE_DIR}/cmn_hdr
6 | )
7 | add_executable(LTE_file_recorder
8 | src/LTE_file_recorder_main.cc
9 | src/LTE_file_recorder_interface.cc
10 | src/LTE_file_recorder_flowgraph.cc
11 | )
12 | target_link_libraries(LTE_file_recorder lte fftw3f tools pthread ${UHD_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_OSMOSDR_LIBRARIES})
13 | install(TARGETS LTE_file_recorder DESTINATION bin)
14 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_scan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(GrPlatform)
2 | include_directories(hdr
3 | ${CMAKE_SOURCE_DIR}/liblte/hdr
4 | ${CMAKE_SOURCE_DIR}/libtools/hdr
5 | ${CMAKE_SOURCE_DIR}/cmn_hdr
6 | )
7 | add_executable(LTE_fdd_dl_scan
8 | src/LTE_fdd_dl_scan_main.cc
9 | src/LTE_fdd_dl_scan_interface.cc
10 | src/LTE_fdd_dl_scan_flowgraph.cc
11 | src/LTE_fdd_dl_scan_state_machine.cc
12 | )
13 | target_link_libraries(LTE_fdd_dl_scan lte fftw3f tools pthread ${UHD_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_OSMOSDR_LIBRARIES})
14 | set_target_properties(LTE_fdd_dl_scan PROPERTIES DEFINE_SYMBOL "LTE_fdd_dl_scan_state_machine_EXPORTS")
15 | install(TARGETS LTE_fdd_dl_scan DESTINATION bin)
16 |
--------------------------------------------------------------------------------
/cmake/Modules/FindUhd.cmake:
--------------------------------------------------------------------------------
1 | INCLUDE(FindPkgConfig)
2 | PKG_CHECK_MODULES(PC_UHD uhd)
3 |
4 | FIND_PATH(
5 | UHD_INCLUDE_DIRS
6 | NAMES uhd/version.hpp
7 | HINTS $ENV{UHD_DIR}/include
8 | ${PC_UHD_INCLUDEDIR}
9 | ${CMAKE_INSTALL_PREFIX}/include
10 | PATHS /usr/local/include
11 | /usr/include
12 | )
13 |
14 | FIND_LIBRARY(
15 | UHD_LIBRARIES
16 | NAMES uhd
17 | HINTS $ENV{UHD_DIR}/lib
18 | ${PC_UHD_LIBDIR}
19 | ${CMAKE_INSTALL_PREFIX}/lib
20 | ${CMAKE_INSTALL_PREFIX}/lib64
21 | PATHS /usr/local/lib
22 | /usr/local/lib64
23 | /usr/lib
24 | /usr/lib64
25 | )
26 |
27 | message(STATUS "UHD LIBRARIES " ${UHD_LIBRARIES})
28 | message(STATUS "UHD INCLUDE DIRS " ${UHD_INCLUDE_DIRS})
29 |
30 | INCLUDE(FindPackageHandleStandardArgs)
31 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS)
32 | MARK_AS_ADVANCED(UHD_LIBRARIES UHD_INCLUDE_DIRS)
33 |
--------------------------------------------------------------------------------
/cmake/Modules/FindLibbladeRF.cmake:
--------------------------------------------------------------------------------
1 | if(NOT LIBBLADERF_FOUND)
2 | pkg_check_modules (LIBBLADERF_PKG libbladeRF)
3 | find_path(LIBBLADERF_INCLUDE_DIRS NAMES libbladeRF.h
4 | PATHS
5 | ${LIBBLADERF_PKG_INCLUDE_DIRS}
6 | /usr/include
7 | /usr/local/include
8 | )
9 |
10 | find_library(LIBBLADERF_LIBRARIES NAMES bladeRF
11 | PATHS
12 | ${LIBBLADERF_PKG_LIBRARY_DIRS}
13 | /usr/lib
14 | /usr/local/lib
15 | )
16 |
17 | if(LIBBLADERF_INCLUDE_DIRS AND LIBBLADERF_LIBRARIES)
18 | set(LIBBLADERF_FOUND TRUE CACHE INTERNAL "libbladeRF found")
19 | message(STATUS "Found libbladeRF: ${LIBBLADERF_INCLUDE_DIRS}, ${LIBBLADERF_LIBRARIES}")
20 | else(LIBBLADERF_INCLUDE_DIRS AND LIBBLADERF_LIBRARIES)
21 | set(LIBBLADERF_FOUND FALSE CACHE INTERNAL "libbladeRF found")
22 | message(STATUS "libbladeRF not found.")
23 | endif(LIBBLADERF_INCLUDE_DIRS AND LIBBLADERF_LIBRARIES)
24 |
25 | mark_as_advanced(LIBBLADERF_LIBRARIES LIBBLADERF_INCLUDE_DIRS)
26 |
27 | endif(NOT LIBBLADERF_FOUND)
28 |
--------------------------------------------------------------------------------
/cmake/Modules/FindGnuradioOsmosdr.cmake:
--------------------------------------------------------------------------------
1 | INCLUDE(FindPkgConfig)
2 | PKG_CHECK_MODULES(PC_GNURADIO_OSMOSDR gnuradio-osmosdr)
3 |
4 | FIND_PATH(
5 | GNURADIO_OSMOSDR_INCLUDE_DIRS
6 | NAMES source.h
7 | HINTS $ENV{GNURADIO_OSMOSDR_DIR}/include/osmosdr
8 | ${PC_GNURADIO_OSMOSDR_INCLUDEDIR}
9 | ${CMAKE_INSTALL_PREFIX}/include/osmosdr
10 | PATHS /usr/local/include/osmosdr
11 | /usr/include/osmosdr
12 | )
13 |
14 | FIND_LIBRARY(
15 | GNURADIO_OSMOSDR_LIBRARIES
16 | NAMES gnuradio-osmosdr
17 | HINTS $ENV{GNURADIO_OSMOSDR_DIR}/lib
18 | ${PC_GNURADIO_OSMOSDR_LIBDIR}
19 | ${CMAKE_INSTALL_PREFIX}/lib
20 | ${CMAKE_INSTALL_PREFIX}/lib64
21 | PATHS /usr/local/lib
22 | /usr/local/lib64
23 | /usr/lib
24 | /usr/lib64
25 | )
26 |
27 | INCLUDE(FindPackageHandleStandardArgs)
28 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_OSMOSDR DEFAULT_MSG GNURADIO_OSMOSDR_LIBRARIES GNURADIO_OSMOSDR_INCLUDE_DIRS)
29 | MARK_AS_ADVANCED(GNURADIO_OSMOSDR_LIBRARIES GNURADIO_OSMOSDR_INCLUDE_DIRS)
30 |
--------------------------------------------------------------------------------
/cmake/Modules/FindPolarssl.cmake:
--------------------------------------------------------------------------------
1 | INCLUDE(FindPkgConfig)
2 | PKG_CHECK_MODULES(PC_POLARSSL polarssl)
3 |
4 | FIND_PATH(
5 | POLARSSL_INCLUDE_DIRS
6 | NAMES polarssl/version.h
7 | HINTS $ENV{POLARSSL_DIR}/include
8 | ${PC_POLARSSL_INCLUDEDIR}
9 | ${CMAKE_INSTALL_PREFIX}/include
10 | PATHS /usr/local/include
11 | /usr/include
12 | )
13 |
14 | FIND_LIBRARY(
15 | POLARSSL_LIBRARIES
16 | NAMES polarssl
17 | HINTS $ENV{POLARSSL_DIR}/lib
18 | ${PC_POLARSSL_LIBDIR}
19 | ${CMAKE_INSTALL_PREFIX}/lib
20 | ${CMAKE_INSTALL_PREFIX}/lib64
21 | PATHS /usr/local/lib
22 | /usr/local/lib64
23 | /usr/lib
24 | /usr/lib64
25 | )
26 |
27 | message(STATUS "POLARSSL LIBRARIES " ${POLARSSL_LIBRARIES})
28 | message(STATUS "POLARSSL INCLUDE DIRS " ${POLARSSL_INCLUDE_DIRS})
29 |
30 | INCLUDE(FindPackageHandleStandardArgs)
31 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(POLARSSL DEFAULT_MSG POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)
32 | MARK_AS_ADVANCED(POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)
33 |
--------------------------------------------------------------------------------
/LTE_fdd_enodeb/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(GrPlatform)
2 | include_directories(hdr
3 | ${CMAKE_SOURCE_DIR}/liblte/hdr
4 | ${CMAKE_SOURCE_DIR}/libtools/hdr
5 | ${CMAKE_SOURCE_DIR}/cmn_hdr
6 | )
7 | add_executable(LTE_fdd_enodeb
8 | src/LTE_fdd_enb_main.cc
9 | src/LTE_fdd_enb_interface.cc
10 | src/LTE_fdd_enb_cnfg_db.cc
11 | src/LTE_fdd_enb_msgq.cc
12 | src/LTE_fdd_enb_hss.cc
13 | src/LTE_fdd_enb_user.cc
14 | src/LTE_fdd_enb_user_mgr.cc
15 | src/LTE_fdd_enb_rb.cc
16 | src/LTE_fdd_enb_timer.cc
17 | src/LTE_fdd_enb_timer_mgr.cc
18 | src/LTE_fdd_enb_radio.cc
19 | src/LTE_fdd_enb_phy.cc
20 | src/LTE_fdd_enb_mac.cc
21 | src/LTE_fdd_enb_rlc.cc
22 | src/LTE_fdd_enb_pdcp.cc
23 | src/LTE_fdd_enb_rrc.cc
24 | src/LTE_fdd_enb_mme.cc
25 | src/LTE_fdd_enb_gw.cc
26 | )
27 | target_link_libraries(LTE_fdd_enodeb lte fftw3f tools pthread rt ${POLARSSL_LIBRARIES} ${UHD_LIBRARIES} ${LIBBLADERF_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_PMT_LIBRARIES})
28 | install(TARGETS LTE_fdd_enodeb DESTINATION bin)
29 | install(CODE "execute_process(COMMAND chmod +x \"${CMAKE_SOURCE_DIR}/enodeb_nat_script.sh\")")
30 | install(CODE "execute_process(COMMAND \"${CMAKE_SOURCE_DIR}/enodeb_nat_script.sh\")")
31 |
--------------------------------------------------------------------------------
/cmake/Modules/FindFFTW3F.cmake:
--------------------------------------------------------------------------------
1 | # http://tim.klingt.org/code/projects/supernova/repository/revisions/d336dd6f400e381bcfd720e96139656de0c53b6a/entry/cmake_modules/FindFFTW3f.cmake
2 | # Modified to use pkg config and use standard var names
3 |
4 | # Find single-precision (float) version of FFTW3
5 |
6 | INCLUDE(FindPkgConfig)
7 | PKG_CHECK_MODULES(PC_FFTW3F "fftw3f >= 3.0")
8 |
9 | FIND_PATH(
10 | FFTW3F_INCLUDE_DIRS
11 | NAMES fftw3.h
12 | HINTS $ENV{FFTW3_DIR}/include
13 | ${PC_FFTW3F_INCLUDE_DIR}
14 | PATHS /usr/local/include
15 | /usr/include
16 | )
17 |
18 | FIND_LIBRARY(
19 | FFTW3F_LIBRARIES
20 | NAMES fftw3f libfftw3f
21 | HINTS $ENV{FFTW3_DIR}/lib
22 | ${PC_FFTW3F_LIBDIR}
23 | PATHS /usr/local/lib
24 | /usr/lib
25 | /usr/lib64
26 | )
27 |
28 | FIND_LIBRARY(
29 | FFTW3F_THREADS_LIBRARIES
30 | NAMES fftw3f_threads libfftw3f_threads
31 | HINTS $ENV{FFTW3_DIR}/lib
32 | ${PC_FFTW3F_LIBDIR}
33 | PATHS /usr/local/lib
34 | /usr/lib
35 | /usr/lib64
36 | )
37 |
38 |
39 | INCLUDE(FindPackageHandleStandardArgs)
40 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3F DEFAULT_MSG FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS)
41 | MARK_AS_ADVANCED(FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS FFTW3F_THREADS_LIBRARIES)
42 |
--------------------------------------------------------------------------------
/cmake/cmake_uninstall.cmake.in:
--------------------------------------------------------------------------------
1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
2 |
3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
6 |
7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
8 | STRING(REGEX REPLACE "\n" ";" files "${files}")
9 | FOREACH(file ${files})
10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
11 | IF(EXISTS "$ENV{DESTDIR}${file}")
12 | EXEC_PROGRAM(
13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
14 | OUTPUT_VARIABLE rm_out
15 | RETURN_VALUE rm_retval
16 | )
17 | IF(NOT "${rm_retval}" STREQUAL 0)
18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
19 | ENDIF(NOT "${rm_retval}" STREQUAL 0)
20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}")
21 | EXEC_PROGRAM(
22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
23 | OUTPUT_VARIABLE rm_out
24 | RETURN_VALUE rm_retval
25 | )
26 | IF(NOT "${rm_retval}" STREQUAL 0)
27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
28 | ENDIF(NOT "${rm_retval}" STREQUAL 0)
29 | ELSE(EXISTS "$ENV{DESTDIR}${file}")
30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}")
32 | ENDFOREACH(file)
33 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_file_gen/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Source
2 | include(GrPlatform)
3 | add_library(LTE_fdd_dl_fg SHARED src/LTE_fdd_dl_fg_samp_buf.cc)
4 | include_directories(hdr ${CMAKE_SOURCE_DIR}/liblte/hdr ${CMAKE_SOURCE_DIR}/cmn_hdr)
5 | target_link_libraries(LTE_fdd_dl_fg lte fftw3f ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_PMT_LIBRARIES})
6 | set_target_properties(LTE_fdd_dl_fg PROPERTIES DEFINE_SYMBOL "LTE_fdd_dl_fg_EXPORTS")
7 | install(TARGETS LTE_fdd_dl_fg LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin)
8 |
9 | # Swig
10 | find_package(SWIG)
11 | find_package(PythonLibs)
12 | if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND)
13 | return()
14 | endif()
15 | include(GrSwig)
16 | include(GrPython)
17 | foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
18 | list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig)
19 | endforeach(incdir)
20 | foreach(incdir ${GNURADIO_OSMOSDR_INCLUDE_DIRS})
21 | list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/osmosdr/swig)
22 | endforeach(incdir)
23 | set(GR_SWIG_LIBRARIES LTE_fdd_dl_fg)
24 | GR_SWIG_MAKE(LTE_fdd_dl_fg src/LTE_fdd_dl_fg.i)
25 | GR_SWIG_INSTALL(TARGETS LTE_fdd_dl_fg DESTINATION ${GR_PYTHON_DIR}/LTE_fdd_dl_fg)
26 | install(FILES src/LTE_fdd_dl_fg.i DESTINATION ${GR_INCLUDE_DIR}/LTE_fdd_dl_fg/swig)
27 |
28 | # Python
29 | if(NOT PYTHONINTERP_FOUND)
30 | return()
31 | endif()
32 | GR_PYTHON_INSTALL(FILES src/__init__.py DESTINATION ${GR_PYTHON_DIR}/LTE_fdd_dl_fg)
33 | GR_PYTHON_INSTALL(PROGRAMS python/LTE_fdd_dl_file_gen.py DESTINATION bin)
34 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_file_scan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Source
2 | include(GrPlatform)
3 | add_library(LTE_fdd_dl_fs SHARED src/LTE_fdd_dl_fs_samp_buf.cc)
4 | include_directories(hdr ${CMAKE_SOURCE_DIR}/liblte/hdr ${CMAKE_SOURCE_DIR}/cmn_hdr)
5 | target_link_libraries(LTE_fdd_dl_fs lte fftw3f ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_PMT_LIBRARIES})
6 | set_target_properties(LTE_fdd_dl_fs PROPERTIES DEFINE_SYMBOL "LTE_fdd_dl_fs_EXPORTS")
7 | install(TARGETS LTE_fdd_dl_fs LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} RUNTIME DESTINATION bin)
8 |
9 | # Swig
10 | find_package(SWIG)
11 | find_package(PythonLibs)
12 | if(NOT SWIG_FOUND OR NOT PYTHONLIBS_FOUND)
13 | return()
14 | endif()
15 | include(GrSwig)
16 | include(GrPython)
17 | foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
18 | list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig)
19 | endforeach(incdir)
20 | foreach(incdir ${GNURADIO_OSMOSDR_INCLUDE_DIRS})
21 | list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/osmosdr/swig)
22 | endforeach(incdir)
23 | set(GR_SWIG_LIBRARIES LTE_fdd_dl_fs)
24 | GR_SWIG_MAKE(LTE_fdd_dl_fs src/LTE_fdd_dl_fs.i)
25 | GR_SWIG_INSTALL(TARGETS LTE_fdd_dl_fs DESTINATION ${GR_PYTHON_DIR}/LTE_fdd_dl_fs)
26 | install(FILES src/LTE_fdd_dl_fs.i DESTINATION ${GR_INCLUDE_DIR}/LTE_fdd_dl_fs/swig)
27 |
28 | # Python
29 | if(NOT PYTHONINTERP_FOUND)
30 | return()
31 | endif()
32 | GR_PYTHON_INSTALL(FILES src/__init__.py DESTINATION ${GR_PYTHON_DIR}/LTE_fdd_dl_fs)
33 | GR_PYTHON_INSTALL(PROGRAMS python/LTE_fdd_dl_file_scan.py DESTINATION bin)
34 |
--------------------------------------------------------------------------------
/enodeb_nat_script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Determine which interface to use
4 | iface=$(ifconfig | grep Ethernet | head -n1 | awk '{print $1}')
5 | echo Using interface : $iface
6 |
7 | # Enable IPTABLES
8 | tmp_ipt_en=$(cat /etc/sysctl.conf | grep -c -x net.ipv4.ip_forward=1)
9 | if [ $tmp_ipt_en -eq 0 ]; then
10 | printf "net.ipv4.ip_forward=1\n" >> /etc/sysctl.conf
11 | sysctl -p /etc/sysctl.conf
12 | fi
13 | modprobe ip_tables
14 | modprobe ip_conntrack
15 |
16 | # Setup IPTABLES
17 | iptables -C FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
18 | if [ $? -eq 1 ]; then
19 | iptables -I FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
20 | fi
21 | iptables -C FORWARD -i tun_openlte -o $iface -m conntrack --ctstate NEW -j ACCEPT
22 | if [ $? -eq 1 ]; then
23 | iptables -I FORWARD -i tun_openlte -o $iface -m conntrack --ctstate NEW -j ACCEPT
24 | fi
25 | iptables -t nat -C POSTROUTING -o $iface -j MASQUERADE
26 | if [ $? -eq 1 ]; then
27 | iptables -t nat -I POSTROUTING -o $iface -j MASQUERADE
28 | fi
29 | iptables-save > /etc/iptables_openlte.rules
30 | printf "#!/bin/sh\niptables-restore < /etc/iptables_openlte.rules\nexit 0\n" > /etc/network/if-up.d/iptablesload
31 | chmod +x /etc/network/if-up.d/iptablesload
32 |
33 | # Give cap_net_admin capabilities to LTE_fdd_enodeb
34 | tmp_loc=$(which LTE_fdd_enodeb)
35 | setcap cap_net_admin=eip $tmp_loc
36 |
37 | # Give global read/write permissions to /dev/net/tun
38 | chmod 666 /dev/net/tun
39 |
40 | # Remove all shared memories for message queues
41 | rm -f /dev/shm/*_olmq
42 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_file_gen/python/LTE_fdd_dl_file_gen.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | from gnuradio import gr
4 | from gnuradio import blocks
5 | from gnuradio.eng_option import eng_option
6 | from optparse import OptionParser
7 | import LTE_fdd_dl_fg
8 | import sys
9 |
10 | class LTE_fdd_dl_file_gen(gr.top_block):
11 |
12 | def __init__(self):
13 | gr.top_block.__init__(self)
14 |
15 | usage = "usage: %prog [options] file"
16 | parser=OptionParser(option_class=eng_option, usage=usage)
17 | # Add options here
18 | parser.add_option("-d", "--data-type", type="string", default="int8",
19 | help="Output file data type, default=%default, options=[int8, gr_complex]")
20 | (options, args) = parser.parse_args()
21 | if len(args) != 1:
22 | parser.print_help()
23 | sys.exit(1)
24 |
25 | if options.data_type == "gr_complex":
26 | size = gr.sizeof_gr_complex
27 | elif options.data_type == "int8":
28 | size = gr.sizeof_char
29 | else:
30 | print("Invalid data type using int8")
31 | size = gr.sizeof_char
32 |
33 | output_filename = args[0]
34 |
35 | # Build flow graph
36 | self.samp_buf = LTE_fdd_dl_fg.samp_buf(size)
37 | self.fsink = blocks.file_sink(size, output_filename)
38 | self.connect(self.samp_buf, self.fsink)
39 |
40 | if __name__ == '__main__':
41 | tb = LTE_fdd_dl_file_gen()
42 | try:
43 | tb.run()
44 | except KeyboardInterrupt:
45 | pass
46 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_file_scan/python/LTE_fdd_dl_file_scan.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | from gnuradio import gr
4 | from gnuradio import blocks
5 | from gnuradio.eng_option import eng_option
6 | from optparse import OptionParser
7 | import LTE_fdd_dl_fs
8 | import sys
9 |
10 | class LTE_fdd_dl_file_scan(gr.top_block):
11 |
12 | def __init__(self):
13 | gr.top_block.__init__(self)
14 |
15 | usage = "usage: %prog [options] file"
16 | parser=OptionParser(option_class=eng_option, usage=usage)
17 | # Add options here
18 | parser.add_option("-d", "--data-type", type="string", default="int8",
19 | help="Input file data type, default=%default, options=[int8, gr_complex]")
20 | (options, args) = parser.parse_args()
21 | if len(args) != 1:
22 | parser.print_help()
23 | sys.exit(1)
24 |
25 | if options.data_type == "gr_complex":
26 | size = gr.sizeof_gr_complex
27 | elif options.data_type == "int8":
28 | size = gr.sizeof_char
29 | else:
30 | print("Invalid data type using int8")
31 | size = gr.sizeof_char
32 |
33 | input_filename = args[0]
34 |
35 | # Build flow graph
36 | self.fsrc = blocks.file_source(size, input_filename, False)
37 | self.samp_buf = LTE_fdd_dl_fs.samp_buf(size)
38 | self.connect(self.fsrc, self.samp_buf)
39 |
40 | if __name__ == '__main__':
41 | tb = LTE_fdd_dl_file_scan()
42 | try:
43 | tb.run()
44 | except KeyboardInterrupt:
45 | pass
46 |
--------------------------------------------------------------------------------
/octave/lte_bcch_dlsch_msg_pack.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_bcch_dlsch_msg_pack
18 | % Description: Packs all of the fields into the BCCH DLSCH message
19 | % Inputs: sib_num - SIB number
20 | % sib - SIB message
21 | % Outputs: bcch_dlsch_msg - Packed BCCH DLSCH message
22 | % Spec: 3GPP TS 36.331 section 6.2.1 and 6.2.2 v10.0.0
23 | % Notes: Currently only supports SIB1
24 | % Rev History: Ben Wojtowicz 1/22/2012 Created
25 | %
26 | function [bcch_dlsch_msg] = lte_bcch_dlsch_msg_pack(sib_num, sib)
27 | % Check sib_num
28 | if(sib_num == 1)
29 | ext_bit = 0;
30 | sib_choice_bit = 1;
31 | bcch_dlsch_msg = [ext_bit, sib_choice_bit, sib];
32 | else
33 | printf("ERROR: Invalid sib_num %u\n", sib_num);
34 | bcch_dlsch_msg = 0;
35 | return;
36 | endif
37 | endfunction
38 |
--------------------------------------------------------------------------------
/octave/cmn_dec2bin.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: cmn_dec2bin
18 | % Description: Converts an array of decimal numbers
19 | % to an array of binary arrays
20 | % Inputs: dec - Array of decimal numbers
21 | % num_bits - Number of bits per decimal
22 | % number
23 | % Outputs: array - Array of binary arrays
24 | % Spec: N/A
25 | % Notes: None
26 | % Rev History: Ben Wojtowicz 11/22/2011 Created
27 | % Ben Wojtowicz 01/29/2012 Fixed license statement
28 | %
29 | function [array] = cmn_dec2bin(dec, num_bits)
30 | [junk, num_dec] = size(dec);
31 |
32 | for(n=1:num_dec)
33 | tmp = dec(n);
34 | for(m=num_bits-1:-1:0)
35 | array(n,num_bits-m) = floor(tmp/2^m);
36 | tmp = tmp - floor(tmp/2^m)*2^m;
37 | endfor
38 | endfor
39 | endfunction
40 |
--------------------------------------------------------------------------------
/octave/cmn_bin2dec.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: cmn_bin2dec
18 | % Description: Converts an array of binary arrays
19 | % to an array of decimal numbers
20 | % Inputs: array - Array of binary arrays
21 | % num_bits - Number of bits per decimal
22 | % number
23 | % Outputs: dec - Array of decimal numbers
24 | % Spec: N/A
25 | % Notes: None
26 | % Rev History: Ben Wojtowicz 11/22/2011 Created
27 | % Ben Wojtowicz 01/29/2012 Fixed license statement
28 | % Ben Wojtowicz 02/19/2012 Added newline to EOF
29 | %
30 | function [dec] = cmn_bin2dec(array, num_bits)
31 | [num_array, junk] = size(array);
32 |
33 | for(n=1:num_array)
34 | dec(n) = 0;
35 | for(m=num_bits-1:-1:0)
36 | dec(n) = dec(n) + array(n,num_bits-m)*2^m;
37 | endfor
38 | endfor
39 | endfunction
40 |
--------------------------------------------------------------------------------
/octave/lte_layer_mapper_ul.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_layer_mapper_ul
18 | % Description: Maps complex-valued modulation symbols onto one
19 | % or several uplink layers
20 | % Inputs: d - Complex valued modulation symbols
21 | % N_ant - Number of antennas
22 | % Outputs: x - Mapped complex valued modulation symbols
23 | % Spec: 3GPP TS 36.211 section 5.3.2A v10.1.0
24 | % Notes: Only supports single antenna.
25 | % Rev History: Ben Wojtowicz 03/26/2014 Created
26 | %
27 | function [x] = lte_layer_mapper_ul(d, N_ant)
28 |
29 | [N_cw, M_symb] = size(d);
30 |
31 | if(N_ant == 1 && N_cw == 1)
32 | % 36.211 Section 5.3.2A.1 and 5.3.2A.2 v10.1.0
33 | M_layer_symb = M_symb;
34 | for(n=0:M_layer_symb-1)
35 | x(0+1, n+1) = d(0+1, n+1);
36 | endfor
37 | else
38 | % FIXME
39 | endif
40 | endfunction
41 |
--------------------------------------------------------------------------------
/octave/lte_pre_coder_ul.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_pre_coder_ul
18 | % Description: Generates a block of vectors to be mapped onto
19 | % resources on each uplink antenna port
20 | % Inputs: x - Block of input vectors
21 | % N_ant - Number of antennas
22 | % Outputs: y - Block of output vectors
23 | % Spec: 3GPP TS 36.211 section 5.3.3A v10.1.0
24 | % Notes: Only supports single antenna.
25 | % Rev History: Ben Wojtowicz 03/26/2014 Created
26 | %
27 | function [y] = lte_pre_coder_ul(x, N_ant)
28 |
29 | [v, M_layer_symb] = size(x);
30 |
31 | if(N_ant == 1 && v == 1)
32 | % 36.211 Section 5.3.3A.1 v10.1.0
33 | M_ap_symb = M_layer_symb;
34 | for(n=0:M_ap_symb-1)
35 | y(n+1) = x(n+1);
36 | endfor
37 | else
38 | printf("ERROR: Number of antenna ports %u not supported\n", N_ant);
39 | y = 0;
40 | endif
41 | endfunction
42 |
--------------------------------------------------------------------------------
/octave/lte_code_block_concatenation.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_code_block_concatenation
18 | % Description: Performs code block concatenation for turbo coded channels
19 | % Inputs: in_bits - Code block bits to be concatenated
20 | % Outputs: out_bits - Code block concatenated bits
21 | % Spec: 3GPP TS 36.212 section 5.1.5 v10.1.0
22 | % Notes: None
23 | % Rev History: Ben Wojtowicz 01/09/2012 Created
24 | %
25 | function [out_bits] = lte_code_block_concatenation(in_bits)
26 | [C, in_bits_len] = size(in_bits);
27 |
28 | % Concatenate code blocks
29 | k_idx = 0;
30 | r_idx = 0;
31 | while(r_idx < C)
32 | j_idx = 0;
33 | while(j_idx < in_bits_len)
34 | out_bits(k_idx+1) = in_bits(r_idx+1,j_idx+1);
35 | k_idx = k_idx + 1;
36 | j_idx = j_idx + 1;
37 | endwhile
38 | r_idx = r_idx + 1;
39 | endwhile
40 | endfunction
41 |
--------------------------------------------------------------------------------
/octave/lte_layer_demapper_ul.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_layer_demapper_ul
18 | % Description: De-maps one or several uplink layers into complex-valued
19 | % modulation symbols
20 | % Inputs: x - Mapped complex valued modulation symbols
21 | % N_ant - Number of antennas
22 | % N_cw - Number of codewords
23 | % Outputs: d - Complex valued modulation symbols
24 | % Spec: 3GPP TS 36.211 section 5.3.2A v10.1.0
25 | % Notes: Only supports single antenna.
26 | % Rev History: Ben Wojtowicz 03/26/2014 Created
27 | %
28 | function [d] = lte_layer_demapper_ul(x, N_ant, N_cw)
29 |
30 | [v, M_layer_symb] = size(x);
31 |
32 | if(N_ant == 1 && N_cw == 1)
33 | % 36.211 Section 5.3.2A.1 and 5.3.2A.2 v10.1.0
34 | M_symb = M_layer_symb;
35 | for(n=0:M_layer_symb-1)
36 | d(0+1, n+1) = x(0+1, n+1);
37 | endfor
38 | else
39 | % FIXME
40 | endif
41 | endfunction
42 |
--------------------------------------------------------------------------------
/octave/lte_pre_decoder_and_matched_filter_ul.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_pre_decoder_and_matched_filter_ul
18 | % Description: Matched filters and unmaps a block of uplink vectors
19 | % from resources on each antenna port
20 | % Inputs: y - Block of input vectors
21 | % h - Channel estimate
22 | % v - Number of layers
23 | % Outputs: x - Block of output vectors
24 | % Spec: 3GPP TS 36.211 section 5.3.3A v10.1.0
25 | % Notes: Only supports single antenna.
26 | % Rev History: Ben Wojtowicz 03/26/2014 Created
27 | %
28 | function [x] = lte_pre_decoder_and_matched_filter_ul(y, h, v)
29 |
30 | [N_ant, M_ap_symb] = size(h);
31 |
32 | if(N_ant == 1 && v == 1)
33 | % 36.211 Section 5.3.3A.1 v10.1.0
34 | M_layer_symb = M_ap_symb;
35 | for(n=0:M_ap_symb-1)
36 | x(n+1) = y(n+1)/h(n+1);
37 | endfor
38 | else
39 | printf("ERROR: Number of antenna ports %u not supported\n", N_ant);
40 | x = 0;
41 | endif
42 | endfunction
43 |
--------------------------------------------------------------------------------
/octave/lte_bcch_dlsch_msg_unpack.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_bcch_dlsch_msg_unpack
18 | % Description: Unpacks all of the fields from the BCCH DLSCH message
19 | % Inputs: bcch_dlsch_msg - Packed BCCH DLSCH message
20 | % Outputs: sib_num - SIB number
21 | % sib - SIB message
22 | % Spec: 3GPP TS 36.331 section 6.2.1 and 6.2.2 v10.0.0
23 | % Notes: Currently only supports SIB1
24 | % Rev History: Ben Wojtowicz 1/22/2012 Created
25 | %
26 | function [sib_num, sib] = lte_bcch_dlsch_msg_unpack(bcch_dlsch_msg)
27 | % Initialize the message index
28 | idx = 0;
29 |
30 | % Skip the extension bit
31 | idx = idx + 1;
32 |
33 | % Extract the sib1_choice_bit
34 | sib1_choice_bit = bcch_dlsch_msg(idx+1);
35 | idx = idx + 1;
36 |
37 | % Determine if SIB1 or another SIB was received
38 | if(sib1_choice_bit == 1)
39 | % SIB 1 was received
40 | sib_num = 1;
41 | sib = bcch_dlsch_msg(idx+1:end);
42 | else
43 | printf("ERROR: Invalid BCCH DLSCH message\n");
44 | sib_num = 0;
45 | sib = 0;
46 | endif
47 | endfunction
48 |
--------------------------------------------------------------------------------
/octave/lte_cfi_channel_encode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_cfi_channel_encode
18 | % Description: Channel encodes the control format
19 | % indicator channel
20 | % Inputs: cfi - Control format indicator
21 | % Outputs: cfi_bits - Control format indicator
22 | % channel encoded bits
23 | % Spec: 3GPP TS 36.212 section 5.3.4 v10.1.0
24 | % Notes: None
25 | % Rev History: Ben Wojtowicz 12/26/2011 Created
26 | % Ben Wojtowicz 01/29/2012 Fixed license statement
27 | %
28 | function [cfi_bits] = lte_cfi_channel_encode(cfi)
29 | % Check cfi
30 | if(cfi == 1)
31 | cfi_bits = [0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1];
32 | elseif(cfi == 2)
33 | cfi_bits = [1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0];
34 | elseif(cfi == 3)
35 | cfi_bits = [1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1];
36 | elseif(cfi == 4)
37 | cfi_bits = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
38 | else
39 | printf("ERROR: Invalid cfi %u\n", cfi);
40 | cfi_bits = 0;
41 | endif
42 | endfunction
43 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_file_gen/src/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2008,2009 Free Software Foundation, Inc.
3 | #
4 | # This application is free software; you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation; either version 3, or (at your option)
7 | # any later version.
8 | #
9 | # This application is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License along
15 | # with this program; if not, write to the Free Software Foundation, Inc.,
16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 | #
18 |
19 | # The presence of this file turns this directory into a Python package
20 |
21 | '''
22 | This is the GNU Radio LTE_fdd_dl_fg module.
23 | '''
24 |
25 | # ----------------------------------------------------------------
26 | # Temporary workaround for ticket:181 (swig+python problem)
27 | import sys
28 | _RTLD_GLOBAL = 0
29 | try:
30 | from dl import RTLD_GLOBAL as _RTLD_GLOBAL
31 | except ImportError:
32 | try:
33 | from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL
34 | except ImportError:
35 | pass
36 |
37 | if _RTLD_GLOBAL != 0:
38 | _dlopenflags = sys.getdlopenflags()
39 | sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL)
40 | # ----------------------------------------------------------------
41 |
42 |
43 | # import swig generated symbols into the LTE_fdd_dl_fg namespace
44 | from LTE_fdd_dl_fg import *
45 |
46 | # import any pure python here
47 | #
48 |
49 | # ----------------------------------------------------------------
50 | # Tail of workaround
51 | if _RTLD_GLOBAL != 0:
52 | sys.setdlopenflags(_dlopenflags) # Restore original flags
53 | # ----------------------------------------------------------------
54 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_file_scan/src/__init__.py:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2008,2009 Free Software Foundation, Inc.
3 | #
4 | # This application is free software; you can redistribute it and/or modify
5 | # it under the terms of the GNU General Public License as published by
6 | # the Free Software Foundation; either version 3, or (at your option)
7 | # any later version.
8 | #
9 | # This application is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU General Public License along
15 | # with this program; if not, write to the Free Software Foundation, Inc.,
16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 | #
18 |
19 | # The presence of this file turns this directory into a Python package
20 |
21 | '''
22 | This is the GNU Radio LTE_fdd_dl_fs module.
23 | '''
24 |
25 | # ----------------------------------------------------------------
26 | # Temporary workaround for ticket:181 (swig+python problem)
27 | import sys
28 | _RTLD_GLOBAL = 0
29 | try:
30 | from dl import RTLD_GLOBAL as _RTLD_GLOBAL
31 | except ImportError:
32 | try:
33 | from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL
34 | except ImportError:
35 | pass
36 |
37 | if _RTLD_GLOBAL != 0:
38 | _dlopenflags = sys.getdlopenflags()
39 | sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL)
40 | # ----------------------------------------------------------------
41 |
42 |
43 | # import swig generated symbols into the LTE_fdd_dl_fs namespace
44 | from LTE_fdd_dl_fs import *
45 |
46 | # import any pure python here
47 | #
48 |
49 | # ----------------------------------------------------------------
50 | # Tail of workaround
51 | if _RTLD_GLOBAL != 0:
52 | sys.setdlopenflags(_dlopenflags) # Restore original flags
53 | # ----------------------------------------------------------------
54 |
--------------------------------------------------------------------------------
/octave/lte_generate_prs_c.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_generate_prs_c
18 | % Description: Generates the psuedo random sequence c
19 | % Inputs: c_init - Initialization value for the
20 | % sequence
21 | % seq_len - Length of the output sequence
22 | % Outputs: c - Psuedo random sequence
23 | % Spec: 3GPP TS 36.211 section 7.2 v10.1.0
24 | % Notes: None
25 | % Rev History: Ben Wojtowicz 10/28/2011 Created
26 | % Ben Wojtowicz 01/29/2012 Fixed license statement
27 | %
28 | function [c] = lte_generate_prs_c(c_init, seq_len)
29 | % Initialize the m-sequences
30 | x1 = zeros(1,1600+seq_len);
31 | x2 = zeros(1,1600+seq_len);
32 | tmp = c_init;
33 | for(n=0:30)
34 | x2(30-n+1) = floor(tmp/(2^(30-n)));
35 | tmp = tmp - (floor(tmp/(2^(30-n)))*2^(30-n));
36 | endfor
37 | x1(0+1) = 1;
38 |
39 | % Advance m-sequences
40 | for(n=0:1600+seq_len)
41 | x1(n+31+1) = mod(x1(n+3+1) + x1(n+1), 2);
42 | x2(n+31+1) = mod(x2(n+3+1) + x2(n+2+1) + x2(n+1+1) + x2(n+1), 2);
43 | endfor
44 |
45 | % Generate c
46 | for(n=0:seq_len-1)
47 | c(n+1) = mod(x1(n+1600+1) + x2(n+1600+1), 2);
48 | endfor
49 | endfunction
50 |
--------------------------------------------------------------------------------
/octave/lte_ulsch_control_data_multiplexing.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_ulsch_control_data_multiplexing
18 | % Description: Multiplexes the control and data bits for ULSCH.
19 | % Inputs: data_bits - Data bits to multiplex
20 | % control_bits - Control bits to multiplex
21 | % N_control_bits - Number of control bits to multiplex
22 | % N_l - Number of layers
23 | % Q_m - Number of bits per modulation symbol
24 | % Outputs: out_bits - Multiplexed bits
25 | % Spec: 3GPP TS 36.212 section 5.2.2.7 v10.1.0
26 | % Notes: N/A
27 | % Rev History: Ben Wojtowicz 03/26/2014 Created
28 | %
29 | function [out_bits] = lte_ulsch_control_data_multiplexing(data_bits, control_bits, N_control_bits, N_l, Q_m)
30 |
31 | % Set i, j, k to 0 (using n for i and m for j)
32 | n = 0;
33 | m = 0;
34 | k = 0;
35 | while(m < N_control_bits)
36 | out_bits(k+1,:) = control_bits(m+1:m+N_l*Q_m-1+1);
37 | m = m + N_l*Q_m;
38 | k = k + 1;
39 | endwhile
40 | while(n < length(data_bits))
41 | out_bits(k+1,:) = data_bits(n+1:n+N_l*Q_m-1+1);
42 | n = n + N_l*Q_m;
43 | k = k + 1;
44 | endwhile
45 | endfunction
46 |
--------------------------------------------------------------------------------
/cmake/Modules/GrPlatform.cmake:
--------------------------------------------------------------------------------
1 | # Copyright 2011 Free Software Foundation, Inc.
2 | #
3 | # This file is part of GNU Radio
4 | #
5 | # GNU Radio is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation; either version 3, or (at your option)
8 | # any later version.
9 | #
10 | # GNU Radio is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with GNU Radio; see the file COPYING. If not, write to
17 | # the Free Software Foundation, Inc., 51 Franklin Street,
18 | # Boston, MA 02110-1301, USA.
19 |
20 | if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE)
21 | return()
22 | endif()
23 | set(__INCLUDED_GR_PLATFORM_CMAKE TRUE)
24 |
25 | ########################################################################
26 | # Setup additional defines for OS types
27 | ########################################################################
28 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
29 | set(LINUX TRUE)
30 | endif()
31 |
32 | if(LINUX AND EXISTS "/etc/debian_version")
33 | set(DEBIAN TRUE)
34 | endif()
35 |
36 | if(LINUX AND EXISTS "/etc/redhat-release")
37 | set(REDHAT TRUE)
38 | endif()
39 |
40 | if(LINUX AND EXISTS "/etc/slackware-version")
41 | set(SLACKWARE TRUE)
42 | endif()
43 |
44 | ########################################################################
45 | # when the library suffix should be 64 (applies to redhat linux family)
46 | ########################################################################
47 | if (REDHAT OR SLACKWARE)
48 | set(LIB64_CONVENTION TRUE)
49 | endif()
50 |
51 | if(NOT DEFINED LIB_SUFFIX AND LIB64_CONVENTION AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
52 | set(LIB_SUFFIX 64)
53 | endif()
54 | set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")
55 |
--------------------------------------------------------------------------------
/octave/cmn_oct2bin.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: cmn_oct2bin
18 | % Description: Converts an array of octal numbers
19 | % to an array of binary arrays
20 | % Inputs: oct - Array of octal numbers
21 | % num_bits - Number of bits per octal
22 | % number
23 | % Outputs: array - Array of binary arrays
24 | % Spec: N/A
25 | % Notes: None
26 | % Rev History: Ben Wojtowicz 11/22/2011 Created
27 | % Ben Wojtowicz 01/29/2012 Fixed license statement
28 | % Ben Wojtowicz 02/19/2012 Fixed mod(num_bits,3)==0 bug
29 | %
30 | function [array] = cmn_oct2bin(oct, num_bits)
31 | [junk, num_oct] = size(oct);
32 |
33 | for(n=1:num_oct)
34 | % Convert whole digits
35 | tmp = oct(n);
36 | idx = num_bits;
37 | for(m=1:floor(num_bits/3))
38 | dig = mod(tmp, 10);
39 | array(n,idx-2:idx) = cmn_dec2bin(dig, 3);
40 | tmp = floor(tmp/10);
41 | idx = idx - 3;
42 | endfor
43 |
44 | if(mod(num_bits, 3) != 0)
45 | % Convert non-whole digits
46 | dig = mod(tmp, 10);
47 | array(n, 1:idx) = cmn_dec2bin(dig, mod(num_bits, 3));
48 | endif
49 | endfor
50 | endfunction
51 |
--------------------------------------------------------------------------------
/octave/lte_generate_pss.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_generate_pss
18 | % Description: Generates an LTE primary synchronization signal
19 | % Inputs: N_id_2 - Physical layer identity
20 | % Outputs: pss_d_u - The sequence d(n) used for the primary
21 | % synchronization signal, generated from
22 | % a frequency domain Zadoff-Chu sequence.
23 | % Spec: 3GPP TS 36.211 section 6.11.1.1 v10.1.0
24 | % Notes: None
25 | % Rev History: Ben Wojtowicz 10/28/2011 Created
26 | % Ben Wojtowicz 01/29/2012 Fixed license statement
27 | % Ben Wojtowicz 02/19/2012 Removed newline at EOF
28 | %
29 | function [pss_d_u] = lte_generate_pss(N_id_2)
30 | % Validate N_id_2 and get the root index
31 | if(N_id_2 == 0)
32 | root_idx = 25;
33 | elseif(N_id_2 == 1)
34 | root_idx = 29;
35 | elseif(N_id_2 == 2)
36 | root_idx = 34;
37 | else
38 | printf("ERROR: Invalid N_id_2 (%u)\n", N_id_2);
39 | pss_d_u = 0;
40 | return;
41 | endif
42 |
43 | % Generate PSS for n=0,1,...,30
44 | for(n=0:30)
45 | pss_d_u(n+1) = cos(-pi*root_idx*n*(n+1)/63) + j*sin(-pi*root_idx*n*(n+1)/63);
46 | endfor
47 |
48 | % Generate PSS for n=31,32,...,61
49 | for(n=31:61)
50 | pss_d_u(n+1) = cos(-pi*root_idx*(n+1)*(n+2)/63) + j*sin(-pi*root_idx*(n+1)*(n+2)/63);
51 | endfor
52 | endfunction
53 |
--------------------------------------------------------------------------------
/octave/lte_ulsch_control_data_demultiplexing.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_ulsch_control_data_demultiplexing
18 | % Description: Demultiplexes the control and data bits for ULSCH.
19 | % Inputs: in_bits - Bits to demultiplex
20 | % N_control_bits - Number of control bits to demultiplex
21 | % N_l - Number of layers
22 | % Q_m - Number of bits per modulation symbol
23 | % Outputs: data_bits - Demultiplexed data bits
24 | % control_bits - Demultiplexed control bits
25 | % Spec: 3GPP TS 36.212 section 5.2.2.7 v10.1.0
26 | % Notes: N/A
27 | % Rev History: Ben Wojtowicz 03/26/2014 Created
28 | %
29 | function [data_bits, control_bits] = lte_ulsch_control_data_demultiplexing(in_bits, N_control_bits, N_l, Q_m)
30 |
31 | % Set i, j, k to 0 (using n for i and m for j)
32 | n = 0;
33 | m = 0;
34 | k = 0;
35 | if(N_control_bits == 0)
36 | control_bits = 0;
37 | endif
38 | while(m < N_control_bits)
39 | control_bits(m+1:m+N_l*Q_m-1+1) = in_bits(k+1,:);
40 | m = m + N_l*Q_m;
41 | k = k + 1;
42 | endwhile
43 | N_data_bits = length(in_bits)*Q_m*N_l - N_control_bits;
44 | while(n < N_data_bits)
45 | data_bits(n+1:n+N_l*Q_m-1+1) = in_bits(k+1,:);
46 | n = n + N_l*Q_m;
47 | k = k + 1;
48 | endwhile
49 | endfunction
50 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_file_gen/hdr/LTE_fdd_dl_fg_api.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | This program is free software: you can redistribute it and/or modify
4 | it under the terms of the GNU Affero General Public License as published by
5 | the Free Software Foundation, either version 3 of the License, or
6 | (at your option) any later version.
7 |
8 | This program is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU Affero General Public License for more details.
12 |
13 | You should have received a copy of the GNU Affero General Public License
14 | along with this program. If not, see .
15 |
16 | *******************************************************************************/
17 |
18 | #ifndef __LTE_FDD_DL_FG_API_H__
19 | #define __LTE_FDD_DL_FG_API_H__
20 |
21 | /*******************************************************************************
22 | INCLUDES
23 | *******************************************************************************/
24 |
25 | #include
26 |
27 | /*******************************************************************************
28 | DEFINES
29 | *******************************************************************************/
30 |
31 | #ifdef LTE_fdd_dl_fg_EXPORTS
32 | #define LTE_FDD_DL_FG_API __GR_ATTR_EXPORT
33 | #else
34 | #define LTE_FDD_DL_FG_API __GR_ATTR_IMPORT
35 | #endif
36 |
37 | /*******************************************************************************
38 | FORWARD DECLARATIONS
39 | *******************************************************************************/
40 |
41 |
42 | /*******************************************************************************
43 | TYPEDEFS
44 | *******************************************************************************/
45 |
46 |
47 | /*******************************************************************************
48 | CLASS DECLARATIONS
49 | *******************************************************************************/
50 |
51 | #endif // __LTE_FDD_DL_FG_API_H__
52 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_file_scan/hdr/LTE_fdd_dl_fs_api.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | This program is free software: you can redistribute it and/or modify
4 | it under the terms of the GNU Affero General Public License as published by
5 | the Free Software Foundation, either version 3 of the License, or
6 | (at your option) any later version.
7 |
8 | This program is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU Affero General Public License for more details.
12 |
13 | You should have received a copy of the GNU Affero General Public License
14 | along with this program. If not, see .
15 |
16 | *******************************************************************************/
17 |
18 | #ifndef __LTE_FDD_DL_FS_API_H__
19 | #define __LTE_FDD_DL_FS_API_H__
20 |
21 | /*******************************************************************************
22 | INCLUDES
23 | *******************************************************************************/
24 |
25 | #include
26 |
27 | /*******************************************************************************
28 | DEFINES
29 | *******************************************************************************/
30 |
31 | #ifdef LTE_fdd_dl_fs_EXPORTS
32 | #define LTE_FDD_DL_FS_API __GR_ATTR_EXPORT
33 | #else
34 | #define LTE_FDD_DL_FS_API __GR_ATTR_IMPORT
35 | #endif
36 |
37 | /*******************************************************************************
38 | FORWARD DECLARATIONS
39 | *******************************************************************************/
40 |
41 |
42 | /*******************************************************************************
43 | TYPEDEFS
44 | *******************************************************************************/
45 |
46 |
47 | /*******************************************************************************
48 | CLASS DECLARATIONS
49 | *******************************************************************************/
50 |
51 | #endif // __LTE_FDD_DL_FS_API_H__
52 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_scan/hdr/LTE_fdd_dl_scan_state_machine_api.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | This program is free software: you can redistribute it and/or modify
4 | it under the terms of the GNU Affero General Public License as published by
5 | the Free Software Foundation, either version 3 of the License, or
6 | (at your option) any later version.
7 |
8 | This program is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU Affero General Public License for more details.
12 |
13 | You should have received a copy of the GNU Affero General Public License
14 | along with this program. If not, see .
15 |
16 | *******************************************************************************/
17 |
18 | #ifndef __LTE_FDD_DL_SCAN_STATE_MACHINE_API_H__
19 | #define __LTE_FDD_DL_SCAN_STATE_MACHINE_API_H__
20 |
21 | /*******************************************************************************
22 | INCLUDES
23 | *******************************************************************************/
24 |
25 | #include
26 |
27 | /*******************************************************************************
28 | DEFINES
29 | *******************************************************************************/
30 |
31 | #ifdef LTE_fdd_dl_scan_state_machine_EXPORTS
32 | #define LTE_FDD_DL_SCAN_STATE_MACHINE_API __GR_ATTR_EXPORT
33 | #else
34 | #define LTE_FDD_DL_SCAN_STATE_MACHINE_API __GR_ATTR_IMPORT
35 | #endif
36 |
37 | /*******************************************************************************
38 | FORWARD DECLARATIONS
39 | *******************************************************************************/
40 |
41 |
42 | /*******************************************************************************
43 | TYPEDEFS
44 | *******************************************************************************/
45 |
46 |
47 | /*******************************************************************************
48 | CLASS DECLARATIONS
49 | *******************************************************************************/
50 |
51 | #endif /* __LTE_FDD_DL_SCAN_STATE_MACHINE_API_H__ */
52 |
--------------------------------------------------------------------------------
/octave/lte_generate_crs.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_generate_crs
18 | % Description: Generates LTE cell specific reference signals
19 | % Inputs: N_s - Slot number withing a radio frame
20 | % L - OFDM symbol number within the slot
21 | % N_id_cell - Physical layer cell identity
22 | % Outputs: r - Reference signal for this cell
23 | % Spec: 3GPP TS 36.211 section 6.10.1.1 v10.1.0
24 | % Notes: Currently only handles normal CP
25 | % Rev History: Ben Wojtowicz 10/28/2011 Created
26 | % Ben Wojtowicz 01/29/2012 Fixed license statement
27 | %
28 | function [r] = lte_generate_crs(N_s, L, N_id_cell)
29 |
30 | % Validate N_s
31 | if(~(N_s >= 0 && N_s <= 19))
32 | printf("ERROR: Invalid N_s (%u)\n", N_s);
33 | r = 0;
34 | return;
35 | endif
36 |
37 | % Validate L
38 | if(~(L >= 0 && L <= 6))
39 | printf("ERROR: Invalid L (%u)\n", L);
40 | r = 0;
41 | return;
42 | endif
43 |
44 | % Validate N_id_cell
45 | if(~(N_id_cell >= 0 && N_id_cell <= 503))
46 | printf("ERROR: Invalid N_id_cell (%u)\n", N_id_cell);
47 | r = 0;
48 | return;
49 | endif
50 |
51 | % Calculate c_init and sequence length
52 | N_cp = 1;
53 | N_rb_dl_max = 110;
54 | c_init = 1024 * (7 * (N_s+1) + L + 1) * (2 * N_id_cell + 1) + 2*N_id_cell + N_cp;
55 | len = 2*N_rb_dl_max;
56 |
57 | % Generate the psuedo random sequence c
58 | c = lte_generate_prs_c(c_init, 2*(len-1)+1+1);
59 |
60 | % Construct r
61 | r = zeros(1,len);
62 | for(m=0:len-1)
63 | r(m+1) = (1/sqrt(2))*(1 - 2*c(2*m+1)) + j*(1/sqrt(2))*(1 - 2*c(2*m+1+1));
64 | endfor
65 | endfunction
66 |
--------------------------------------------------------------------------------
/octave/lte_calc_crc.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_calc_crc
18 | % Description: Calculates one of the LTE CRCs.
19 | % Inputs: in_bits - Input bits
20 | % crc_type - Which CRC to compute (8, 16,
21 | % 24A, or 24B)
22 | % Outputs: crc_bits - CRC bits
23 | % Spec: 3GPP TS 36.212 section 5.1.1 v10.1.0
24 | % Notes: None
25 | % Rev History: Ben Wojtowicz 11/18/2011 Created
26 | % Ben Wojtowicz 01/29/2012 Fixed license statement
27 | %
28 | function [crc_bits] = lte_calc_crc(in_bits, crc_type)
29 | % Check crc_type
30 | if(crc_type == 8)
31 | crc_poly = [1,1,0,0,1,1,0,1,1];
32 | crc_len = 8;
33 | elseif(crc_type == 16)
34 | crc_poly = [1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1];
35 | crc_len = 16;
36 | elseif(crc_type == "24A")
37 | crc_poly = [1,1,0,0,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,1,1,1,0,1,1];
38 | crc_len = 24;
39 | elseif(crc_type == "24B")
40 | crc_poly = [1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1];
41 | crc_len = 24;
42 | else
43 | printf("ERROR: Invalid crc_type (%s)\n", crc_type);
44 | crc_bits = 0;
45 | return;
46 | endif
47 |
48 | % Define local variables
49 | crc_rem = zeros(1,crc_len+1);
50 | tmp_array = [in_bits, zeros(1,crc_len)];
51 |
52 | % Loop to calculate CRC bits
53 | for(n=1:length(in_bits)+crc_len)
54 | for(m=1:crc_len)
55 | crc_rem(m) = crc_rem(m+1);
56 | endfor
57 | crc_rem(crc_len+1) = tmp_array(n);
58 |
59 | if(crc_rem(1) ~= 0)
60 | for(m=1:crc_len+1)
61 | crc_rem(m) = mod(crc_rem(m)+crc_poly(m), 2);
62 | endfor
63 | endif
64 | endfor
65 |
66 | for(n=1:crc_len)
67 | crc_bits(n) = crc_rem(n+1);
68 | endfor
69 | endfunction
70 |
--------------------------------------------------------------------------------
/octave/lte_bch_channel_encode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_bch_channel_encode
18 | % Description: Channel encodes the broadcast channel
19 | % Inputs: mib - Master information block bits
20 | % N_ant - Number of antenna ports to use
21 | % Outputs: bch_bits - Broadcast channel encoded
22 | % bits
23 | % Spec: 3GPP TS 36.212 section 5.3.1 v10.1.0
24 | % Notes: None
25 | % Rev History: Ben Wojtowicz 10/30/2011 Created
26 | % Ben Wojtowicz 01/29/2012 Fixed license statement
27 | % Ben Wojtowicz 02/19/2012 Commonized rate matcher
28 | %
29 | function [bch_bits] = lte_bch_channel_encode(mib, N_ant)
30 | % Check mib
31 | if(length(mib) ~= 24)
32 | printf("ERROR: Invalid mib (length is %u, should be 24)\n", length(mib));
33 | bch_bits = 0;
34 | return;
35 | endif
36 |
37 | % Check N_ant
38 | if(N_ant == 1)
39 | ant_mask = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
40 | elseif(N_ant == 2)
41 | ant_mask = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
42 | elseif(N_ant == 4)
43 | ant_mask = [0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1];
44 | else
45 | printf("ERROR: Invalid N_ant (%u)\n", N_ant);
46 | bch_bits = 0;
47 | return;
48 | endif
49 |
50 | % Define a_bits
51 | a_bits = mib;
52 |
53 | % Calculate p_bits
54 | p_bits = lte_calc_crc(a_bits, 16);
55 |
56 | % Mask p_bits
57 | for(n=0:length(p_bits)-1)
58 | p_bits(n+1) = mod(p_bits(n+1) + ant_mask(n+1), 2);
59 | endfor
60 |
61 | % Construct c_bits
62 | c_bits = [a_bits, p_bits];
63 |
64 | % Determine d_bits
65 | d_bits = cmn_conv_encode(c_bits, 7, 3, [133, 171, 165], 1);
66 | d_bits = reshape(d_bits, 3, []);
67 |
68 | % Determine e_bits
69 | e_bits = lte_rate_match_conv(d_bits, 1920);
70 |
71 | % Return the e_bits
72 | bch_bits = e_bits;
73 | endfunction
74 |
--------------------------------------------------------------------------------
/cmn_hdr/typedefs.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2012 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: typedefs.h
21 |
22 | Description: Contains all the common typedefs for all source code.
23 |
24 | Revision History
25 | ---------- ------------- --------------------------------------------
26 | 02/02/2012 Ben Wojtowicz Created file.
27 | 08/12/2012 Ben Wojtowicz Added 64 bit typedefs.
28 |
29 | *******************************************************************************/
30 |
31 | #ifndef __TYPEDEFS_H__
32 | #define __TYPEDEFS_H__
33 |
34 | /*******************************************************************************
35 | INCLUDES
36 | *******************************************************************************/
37 |
38 | #include
39 | #include
40 |
41 | /*******************************************************************************
42 | DEFINES
43 | *******************************************************************************/
44 |
45 |
46 | /*******************************************************************************
47 | TYPEDEFS
48 | *******************************************************************************/
49 |
50 | typedef char int8;
51 | typedef unsigned char uint8;
52 | typedef short int16;
53 | typedef unsigned short uint16;
54 | typedef int int32;
55 | typedef unsigned int uint32;
56 | typedef long long int64;
57 | typedef unsigned long long uint64;
58 |
59 | /*******************************************************************************
60 | DECLARATIONS
61 | *******************************************************************************/
62 |
63 | #endif /* __TYPEDEFS_H__ */
64 |
--------------------------------------------------------------------------------
/octave/lte_dlsch_channel_encode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_dlsch_channel_encode
18 | % Description: Channel encodes the downlink shared channel
19 | % Inputs: dlsch_msg - Downlink shared channel bits
20 | % tx_mode - Transmission mode used
21 | % rv_idx - Redundancy version number
22 | % G - Number of bits available for transmission
23 | % N_l - Number of layers (for tx_diversity N_l = 2)
24 | % Q_m - Number of bits per modulation symbol
25 | % N_soft - Number of soft bits
26 | % M_dl_harq - Maximum number of DL HARQ processes
27 | % Outputs: dlsch_bits - Downlink shared channel encoded bits
28 | % Spec: 3GPP TS 36.212 section 5.3.2 v10.1.0
29 | % Notes: None
30 | % Rev History: Ben Wojtowicz 02/19/2012 Created
31 | %
32 | function [dlsch_bits] = lte_dlsch_channel_encode(dlsch_msg, tx_mode, rv_idx, G, N_l, Q_m, N_soft, M_dl_harq)
33 | % Define a_bits
34 | a_bits = dlsch_msg;
35 |
36 | % Calculate p_bits
37 | p_bits = lte_calc_crc(a_bits, "24A");
38 |
39 | % Construct b_bits
40 | b_bits = [a_bits, p_bits];
41 |
42 | % Determine c_bits
43 | c_bits_s = lte_code_block_segmentation(b_bits);
44 |
45 | for(cb=0:c_bits_s.num_cb-1)
46 | % Determine d_bits
47 | d_bits = lte_turbo_encode(c_bits_s.cb(cb+1).bits, c_bits_s.F);
48 |
49 | % Determine e_bits and number of e_bits, E
50 | G_prime = G/(N_l*Q_m);
51 | lambda = mod(G_prime, c_bits_s.num_cb);
52 | if(cb <= c_bits_s.num_cb - lambda - 1)
53 | E = N_l*Q_m*floor(G_prime/c_bits_s.num_cb);
54 | else
55 | E = N_l*Q_m*ceil(G_prime/c_bits_s.num_cb);
56 | endif
57 | e_bits = lte_rate_match_turbo(d_bits, E, c_bits_s.num_cb, tx_mode, N_soft, M_dl_harq, "dlsch", rv_idx);
58 | endfor
59 |
60 | % Determine f_bits
61 | f_bits = lte_code_block_concatenation(e_bits);
62 |
63 | % Return f_bits
64 | dlsch_bits = f_bits;
65 | endfunction
66 |
--------------------------------------------------------------------------------
/octave/lte_dci_channel_encode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_dci_channel_encode
18 | % Description: Channel encodes the Downlink Control Information
19 | % Inputs: dci - Downlink Control Information bits
20 | % rnti - Radio Network Temporary Identifier
21 | % ue_ant - UE transmit antenna
22 | % Outputs: dci_bits - Downlink Control Information channel encoded
23 | % bits
24 | % Spec: 3GPP TS 36.212 section 5.3.3 v10.1.0
25 | % Notes: None
26 | % Rev History: Ben Wojtowicz 01/02/2012 Created
27 | %
28 | function [dci_bits] = lte_dci_channel_encode(dci, rnti, ue_ant)
29 | % Check rnti
30 | x_rnti_bits = cmn_dec2bin(rnti, 16);
31 | if(length(x_rnti_bits) > 16)
32 | printf("ERROR: Invalid RNTI (length is %u)\n", length(x_rnti_bits));
33 | dci_bits = 0;
34 | return;
35 | elseif(length(x_rnti_bits) < 16)
36 | x_rnti_bits = [zeros(1,16-length(x_rnti_bits)), x_rnti_bits];
37 | endif
38 |
39 | % Check ue_ant
40 | if(ue_ant == 0)
41 | x_as_bits = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
42 | elseif(ue_ant == 1)
43 | x_as_bits = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];
44 | else
45 | printf("ERROR: Invalid ue_ant %u\n", ue_ant);
46 | dci_bits = 0;
47 | return;
48 | endif
49 |
50 | % Define a_bits
51 | a_bits = dci;
52 |
53 | % Calculate p_bits
54 | p_bits = lte_calc_crc(a_bits, 16);
55 |
56 | % Mask p_bits
57 | for(n=0:length(p_bits)-1)
58 | p_bits(n+1) = mod(p_bits(n+1) + x_rnti_bits(n+1) + x_as_bits(n+1), 2);
59 | endfor
60 |
61 | % Construct c_bits
62 | c_bits = [a_bits, p_bits];
63 |
64 | % Determine d_bits
65 | d_bits = cmn_conv_encode(c_bits, 7, 3, [133, 171, 165], 1);
66 | d_bits = reshape(d_bits, 3, []);
67 |
68 | % Determine e_bits
69 | % Always use 576 as the number of bits can be reduced later
70 | e_bits = lte_rate_match_conv(d_bits, 576);
71 |
72 | % Return the e_bits
73 | dci_bits = e_bits;
74 | endfunction
75 |
--------------------------------------------------------------------------------
/libtools/hdr/libtools_scoped_lock.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2015 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: libtools_scoped_lock.h
21 |
22 | Description: Contains all the definitions for the RAII class for sem_t and
23 | pthread_mutex_t.
24 |
25 | Revision History
26 | ---------- ------------- --------------------------------------------
27 | 12/05/2015 Ben Wojtowicz Created file
28 |
29 | *******************************************************************************/
30 |
31 | #ifndef __LIBTOOLS_SCOPED_LOCK_H__
32 | #define __LIBTOOLS_SCOPED_LOCK_H__
33 |
34 | /*******************************************************************************
35 | INCLUDES
36 | *******************************************************************************/
37 |
38 | #include
39 | #include
40 |
41 | /*******************************************************************************
42 | DEFINES
43 | *******************************************************************************/
44 |
45 |
46 | /*******************************************************************************
47 | FORWARD DECLARATIONS
48 | *******************************************************************************/
49 |
50 |
51 | /*******************************************************************************
52 | TYPEDEFS
53 | *******************************************************************************/
54 |
55 |
56 | /*******************************************************************************
57 | CLASS DECLARATIONS
58 | *******************************************************************************/
59 |
60 | class libtools_scoped_lock
61 | {
62 | public:
63 | libtools_scoped_lock(sem_t &sem);
64 | libtools_scoped_lock(pthread_mutex_t &mutex);
65 | ~libtools_scoped_lock();
66 |
67 | private:
68 | sem_t *sem_;
69 | pthread_mutex_t *mutex_;
70 | bool use_sem;
71 | };
72 |
73 | #endif /* __LIBTOOLS_SCOPED_LOCK_H__ */
74 |
--------------------------------------------------------------------------------
/octave/lte_bch_channel_decode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_bch_channel_decode
18 | % Description: Channel decodes the broadcast channel
19 | % Inputs: bch_bits - Broadcast channel encoded
20 | % bits
21 | % Outputs: mib - Master information block bits
22 | % N_ant - Number of antenna ports used
23 | % Spec: 3GPP TS 36.212 section 5.3.1 v10.1.0
24 | % Notes: None
25 | % Rev History: Ben Wojtowicz 11/12/2011 Created
26 | % Ben Wojtowicz 01/29/2012 Fixed license statement
27 | % Ben Wojtowicz 02/19/2012 Commonized rate unmatcher and
28 | % removed conversion to hard bits
29 | %
30 | function [mib, N_ant] = lte_bch_channel_decode(bch_bits)
31 | % Rate unmatch to get the d_bits
32 | d_bits = lte_rate_unmatch_conv(bch_bits, 40);
33 | d_bits = reshape(d_bits, 1, []);
34 |
35 | % Viterbi decode the d_bits to get the c_bits
36 | c_bits = cmn_viterbi_decode(d_bits, 7, 3, [133, 171, 165]);
37 |
38 | % Recover a_bits and p_bits
39 | a_bits = c_bits(1:24);
40 | p_bits = c_bits(25:40);
41 |
42 | % Calculate p_bits
43 | calc_p_bits = lte_calc_crc(a_bits, 16);
44 |
45 | % Try all p_bit masks
46 | ant_mask_1 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
47 | ant_mask_2 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
48 | ant_mask_4 = [0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1];
49 | check_1 = 0;
50 | check_2 = 0;
51 | check_4 = 0;
52 | for(n=0:length(calc_p_bits)-1)
53 | bit = mod(calc_p_bits(n+1) + ant_mask_1(n+1), 2);
54 | check_1 = check_1 + abs(bit-p_bits(n+1));
55 | bit = mod(calc_p_bits(n+1) + ant_mask_2(n+1), 2);
56 | check_2 = check_2 + abs(bit-p_bits(n+1));
57 | bit = mod(calc_p_bits(n+1) + ant_mask_4(n+1), 2);
58 | check_4 = check_4 + abs(bit-p_bits(n+1));
59 | endfor
60 | if(check_1 == 0)
61 | N_ant = 1;
62 | mib = a_bits;
63 | elseif(check_2 == 0)
64 | N_ant = 2;
65 | mib = a_bits;
66 | elseif(check_4 == 0)
67 | N_ant = 4;
68 | mib = a_bits;
69 | else
70 | N_ant = 0;
71 | mib = 0;
72 | endif
73 | endfunction
74 |
--------------------------------------------------------------------------------
/octave/lte_cfi_channel_decode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_cfi_channel_decode
18 | % Description: Channel decodes the control format
19 | % indicator channel
20 | % Inputs: cfi_bits - Control format indicator
21 | % channel encoded bits
22 | % Outputs: cfi - Control format indicator
23 | % Spec: 3GPP TS 36.212 section 5.3.4 v10.1.0
24 | % Notes: None
25 | % Rev History: Ben Wojtowicz 12/26/2011 Created
26 | % Ben Wojtowicz 01/29/2012 Fixed license statement
27 | % Ben Wojtowicz 02/19/2012 Added conversion to hard bits
28 | %
29 | function [cfi] = lte_cfi_channel_decode(cfi_bits)
30 | % Convert from soft NRZ to hard bits
31 | for(n=1:length(cfi_bits))
32 | if(cfi_bits(n) >= 0)
33 | cfi_bits(n) = 0;
34 | else
35 | cfi_bits(n) = 1;
36 | endif
37 | endfor
38 |
39 | % Calculate the number of bit errors for each CFI
40 | cfi_bits_1 = [0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1];
41 | cfi_bits_2 = [1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0];
42 | cfi_bits_3 = [1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1];
43 | cfi_bits_4 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
44 | bit_errs = zeros(1,4);
45 | for(n=1:32)
46 | if(cfi_bits_1(n) != cfi_bits(n))
47 | bit_errs(1) = bit_errs(1) + 1;
48 | endif
49 | if(cfi_bits_2(n) != cfi_bits(n))
50 | bit_errs(2) = bit_errs(2) + 1;
51 | endif
52 | if(cfi_bits_3(n) != cfi_bits(n))
53 | bit_errs(3) = bit_errs(3) + 1;
54 | endif
55 | if(cfi_bits_4(n) != cfi_bits(n))
56 | bit_errs(4) = bit_errs(4) + 1;
57 | endif
58 | endfor
59 |
60 | % Find the CFI with the least bit errors
61 | min_val = 32;
62 | min_idx = 0;
63 | for(n=1:4)
64 | if(bit_errs(n) < min_val)
65 | min_val = bit_errs(n);
66 | min_idx = n;
67 | endif
68 | endfor
69 |
70 | % Threshold is set at 25% BER (8 errors)
71 | if(min_val < 8)
72 | cfi = min_idx;
73 | else
74 | cfi = 0;
75 | endif
76 | endfunction
77 |
--------------------------------------------------------------------------------
/octave/lte_dci_channel_decode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_dci_channel_decode
18 | % Description: Channel decodes the Downlink Control Information
19 | % Inputs: dci_bits - Downlink Control Information channel encoded
20 | % bits
21 | % rnti - Radio Network Temporary Identifier
22 | % ue_ant - UE transmit antenna
23 | % dci_size - Size of the expected DCI in bits
24 | % Outputs: dci - Downlink Control Information bits
25 | % Spec: 3GPP TS 36.212 section 5.3.3 v10.1.0
26 | % Notes: None
27 | % Rev History: Ben Wojtowicz 01/02/2012 Created
28 | %
29 | function [dci] = lte_dci_channel_decode(dci_bits, rnti, ue_ant, dci_size)
30 | % Check rnti
31 | x_rnti_bits = cmn_dec2bin(rnti, 16);
32 |
33 | % Check ue_ant
34 | if(ue_ant == 0)
35 | x_as_bits = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
36 | elseif(ue_ant == 1)
37 | x_as_bits = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];
38 | else
39 | printf("ERROR: Invalid ue_ant %u\n", ue_ant);
40 | dci = 0;
41 | return;
42 | endif
43 |
44 | % Check dci_size
45 | if(dci_size > length(dci_bits))
46 | printf("ERROR: Not enough bits (%u) for dci_size (%u)\n", length(dci_bits), dci_size);
47 | dci = 0;
48 | return;
49 | endif
50 |
51 | % Rate unmatch to get the d_bits
52 | d_bits = lte_rate_unmatch_conv(dci_bits, dci_size+16);
53 | d_bits = reshape(d_bits, 1, []);
54 |
55 | % Viterbi decode the d_bits to get the c_bits
56 | c_bits = cmn_viterbi_decode(d_bits, 7, 3, [133, 171, 165]);
57 |
58 | % Recover a_bits and p_bits
59 | a_bits = c_bits(1:dci_size);
60 | p_bits = c_bits(dci_size+1:end);
61 |
62 | % Calculate p_bits
63 | calc_p_bits = lte_calc_crc(a_bits, 16);
64 |
65 | % Mask p_bits
66 | for(n=0:length(calc_p_bits)-1)
67 | calc_p_bits(n+1) = mod(calc_p_bits(n+1) + x_rnti_bits(n+1) + x_as_bits(n+1), 2);
68 | endfor
69 |
70 | % Check CRC
71 | ber = 0;
72 | for(n=0:length(p_bits)-1)
73 | if(p_bits(n+1) ~= calc_p_bits(n+1))
74 | ber = ber + 1;
75 | endif
76 | endfor
77 | if(ber == 0)
78 | dci = a_bits;
79 | else
80 | dci = 0;
81 | endif
82 | endfunction
83 |
--------------------------------------------------------------------------------
/octave/lte_dlsch_channel_decode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_dlsch_channel_decode
18 | % Description: Channel decodes the downlink shared channel.
19 | % Inputs: dlsch_bits - Downlink shared channel encoded bits
20 | % tbs - Transport block size
21 | % tx_mode - Tranmission mode used
22 | % rv_idx - Redundancy version number
23 | % M_dl_harq - Maximum number of DL HARQ prcesses
24 | % N_soft - Number of soft bits
25 | % Outputs: dlsch_msg - Downlink shared channel bits
26 | % Spec: 3GPP TS 36.212 section 5.3.2 v10.1.0
27 | % Notes: None
28 | % Rev History: Ben Wojtowicz 02/19/2012 Created
29 | %
30 | function [dlsch_msg] = lte_dlsch_channel_decode(dlsch_bits, tbs, tx_mode, rv_idx, M_dl_harq, N_soft)
31 | % In order to decode a DLSCH message, the NULL bit pattern must be
32 | % determined by encoding a sequence of zeros.
33 | dummy_b_bits = zeros(1,tbs+24);
34 | dummy_c_bits_s = lte_code_block_segmentation(dummy_b_bits);
35 |
36 | % Decode the DLSCH message
37 | % Define f_bits
38 | f_bits = dlsch_bits;
39 |
40 | % Determine e_bits
41 | e_bits = lte_code_block_deconcatenation(f_bits, tbs);
42 | [C, e_bits_len] = size(e_bits);
43 |
44 | for(cb=0:C-1)
45 | % Construct dummy_d_bits
46 | dummy_d_bits = lte_turbo_encode(dummy_c_bits_s.cb(cb+1).bits, dummy_c_bits_s.F);
47 |
48 | % Determine d_bits
49 | d_bits = lte_rate_unmatch_turbo(e_bits, C, dummy_d_bits, tx_mode, N_soft, M_dl_harq, "dlsch", rv_idx);
50 |
51 | % Determine c_bits
52 | c_bits = lte_turbo_decode(d_bits, dummy_c_bits_s.F);
53 | endfor
54 |
55 | % Determine b_bits
56 | b_bits = lte_code_block_desegmentation(c_bits, tbs);
57 |
58 | % Recover a_bits and p_bits
59 | a_bits = b_bits(1:tbs);
60 | p_bits = b_bits(tbs+1:tbs+24);
61 |
62 | % Calculate p_bits
63 | calc_p_bits = lte_calc_crc(a_bits, "24A");
64 |
65 | % Check CRC
66 | ber = 0;
67 | for(n=0:length(p_bits)-1)
68 | if(p_bits(n+1) ~= calc_p_bits(n+1))
69 | ber = ber + 1;
70 | endif
71 | endfor
72 | if(ber == 0)
73 | dlsch_msg = a_bits;
74 | else
75 | dlsch_msg = 0;
76 | endif
77 | endfunction
78 |
--------------------------------------------------------------------------------
/libtools/src/libtools_scoped_lock.cc:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2015 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: libtools_scoped_lock.cc
21 |
22 | Description: Contains all the implementations for the RAII class for sem_t
23 | and pthread_mutex_t.
24 |
25 | Revision History
26 | ---------- ------------- --------------------------------------------
27 | 12/05/2015 Ben Wojtowicz Created file
28 |
29 | *******************************************************************************/
30 |
31 | /*******************************************************************************
32 | INCLUDES
33 | *******************************************************************************/
34 |
35 | #include "libtools_scoped_lock.h"
36 |
37 | /*******************************************************************************
38 | DEFINES
39 | *******************************************************************************/
40 |
41 |
42 | /*******************************************************************************
43 | TYPEDEFS
44 | *******************************************************************************/
45 |
46 |
47 | /*******************************************************************************
48 | GLOBAL VARIABLES
49 | *******************************************************************************/
50 |
51 |
52 | /*******************************************************************************
53 | CLASS IMPLEMENTATIONS
54 | *******************************************************************************/
55 |
56 | // Constructor/Destructor
57 | libtools_scoped_lock::libtools_scoped_lock(sem_t &sem)
58 | {
59 | sem_ = &sem;
60 | use_sem = true;
61 | sem_wait(sem_);
62 | }
63 | libtools_scoped_lock::libtools_scoped_lock(pthread_mutex_t &mutex)
64 | {
65 | mutex_ = &mutex;
66 | use_sem = false;
67 | pthread_mutex_lock(mutex_);
68 | }
69 | libtools_scoped_lock::~libtools_scoped_lock()
70 | {
71 | if(use_sem)
72 | {
73 | sem_post(sem_);
74 | }else{
75 | pthread_mutex_unlock(mutex_);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/octave/cmn_conv_encode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: cmn_conv_encode
18 | % Description: Convolutionally encodes the input
19 | % bit array according to the parameters
20 | % Inputs: in - Input bit array
21 | % k - Constraint length
22 | % r - Rate
23 | % g - Polynomial definition
24 | % array in octal
25 | % tail_bit - Whether to use tail
26 | % biting convolutional
27 | % coding or not (0 = no,
28 | % 1 = yes)
29 | % Outputs: out - Ouput bit array
30 | % Spec: N/A
31 | % Notes: None
32 | % Rev History: Ben Wojtowicz 11/22/2011 Created
33 | % Ben Wojtowicz 01/29/2012 Fixed license statement
34 | %
35 | function [out] = cmn_conv_encode(in, k, r, g, tail_bit)
36 |
37 | % Check constraint length
38 | if(k > 9)
39 | printf("ERROR: Maximum supported constraint length = 9\n");
40 | out = 0;
41 | return;
42 | endif
43 |
44 | % Check r and g
45 | if(length(g) != r)
46 | printf("ERROR: Invalid rate (%u) or polynomial definition (%u)\n", r, length(g));
47 | out = 0;
48 | return;
49 | endif
50 |
51 | % Check for tail biting
52 | if(tail_bit == 1)
53 | % Initialize shift register with tail bits of input
54 | for(n=0:k-1)
55 | s_reg(n+1) = in(length(in)-n-1+1);
56 | endfor
57 | else
58 | % Initialize shift register with zeros
59 | for(n=0:k-1)
60 | s_reg(n+1) = 0;
61 | endfor
62 | endif
63 |
64 | % Convert g from octal to binary array
65 | g_array = cmn_oct2bin(g, k);
66 |
67 | % Convolutionally encode input
68 | idx = 1;
69 | for(n=0:length(in)-1)
70 | % Add next bit to shift register
71 | for(m=k:-1:2)
72 | s_reg(m) = s_reg(m-1);
73 | endfor
74 | s_reg(1) = in(n+1);
75 |
76 | % Determine the output bits
77 | for(m=0:r-1)
78 | out(idx) = 0;
79 |
80 | for(o=0:k-1)
81 | out(idx) = out(idx) + s_reg(o+1)*g_array(m+1,o+1);
82 | endfor
83 | out(idx) = mod(out(idx), 2);
84 | idx = idx + 1;
85 | endfor
86 | endfor
87 | endfunction
88 |
--------------------------------------------------------------------------------
/octave/lte_ulsch_channel_encode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_ulsch_channel_encode
18 | % Description: Channel encodes the uplink shared channel
19 | % Inputs: ulsch_msg - Uplink shared channel bits
20 | % tx_mode - Transmission mode used
21 | % N_prb - Number of PRBs assigned to the UE
22 | % N_l - Number of layers
23 | % Q_m - Number of bits per modulation symbol
24 | % Outputs: ulsch_bits - Uplink shared channel encoded bits
25 | % Spec: 3GPP TS 36.212 section 5.2.2 v10.1.0
26 | % Rev History: Ben Wojtowicz 03/26/2014 Created
27 | %
28 | function [ulsch_bits] = lte_ulsch_channel_encode(ulsch_msg, tx_mode, N_prb, N_l, Q_m)
29 | % Definitions
30 | N_rb_sc = 12;
31 | N_ul_symb = 7;
32 |
33 | % Define a_bits
34 | a_bits = ulsch_msg;
35 |
36 | % Calculate p_bits
37 | p_bits = lte_calc_crc(a_bits, "24A");
38 |
39 | % Construct b_bits
40 | b_bits = [a_bits, p_bits];
41 |
42 | % Determine c_bits
43 | c_bits_s = lte_code_block_segmentation(b_bits);
44 |
45 | for(cb=0:c_bits_s.num_cb-1)
46 | % Determine d_bits
47 | d_bits = lte_turbo_encode(c_bits_s.cb(cb+1).bits, c_bits_s.F);
48 |
49 | % Determine e_bits and number of e_bits, E
50 | G = N_prb*N_rb_sc*(N_ul_symb-1)*2*Q_m*N_l;
51 | G_prime = G/(N_l*Q_m);
52 | lambda = mod(G_prime, c_bits_s.num_cb);
53 | if(cb <= c_bits_s.num_cb - lambda - 1)
54 | E = N_l*Q_m*floor(G_prime/c_bits_s.num_cb);
55 | else
56 | E = N_l*Q_m*ceil(G_prime/c_bits_s.num_cb);
57 | endif
58 | e_bits = lte_rate_match_turbo(d_bits, E, c_bits_s.num_cb, tx_mode, 1, 1, "ulsch", 0);
59 | endfor
60 |
61 | % Determine f_bits
62 | f_bits = lte_code_block_concatenation(e_bits);
63 |
64 | % FIXME: Not handling control information
65 | q_cqi_bits = 0;
66 | q_ri_bits = 0;
67 | q_ack_bits = 0;
68 | Q_CQI = 0;
69 | Q_prime_RI = 0;
70 | Q_prime_ACK = 0;
71 |
72 | % Data and control multiplexing
73 | g_bits = lte_ulsch_control_data_multiplexing(f_bits, q_cqi_bits, Q_CQI, N_l, Q_m);
74 |
75 | % Channel interleaver
76 | h_bits = lte_ulsch_channel_interleaver(g_bits, q_ri_bits, q_ack_bits, N_l, Q_m);
77 |
78 | % Return h_bits
79 | ulsch_bits = h_bits;
80 | endfunction
81 |
--------------------------------------------------------------------------------
/octave/lte_bcch_bch_msg_unpack.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_bcch_bch_msg_unpack
18 | % Description: Unpacks all of the fields from the BCCH BCH message
19 | % Inputs: bcch_bch_msg - Packed BCCH BCH message
20 | % Outputs: bw - System bandwidth (in number of RBs)
21 | % phich_dur - PHICH Duration (normal or extended)
22 | % phich_res - Number of PHICH groups (1/6, 1/2, 1, 2)
23 | % sfn - System frame number
24 | % Spec: 3GPP TS 36.331 section 6.2.1 and 6.2.2 v10.0.0
25 | % Notes: None
26 | % Rev History: Ben Wojtowicz 10/30/2011 Created
27 | % Ben Wojtowicz 01/29/2012 Fixed license statement
28 | % Ben Wojtowicz 02/19/2012 Changed function name to match spec
29 | %
30 | function [bw, phich_dur, phich_res, sfn] = lte_bcch_bch_msg_unpack(bcch_bch_msg)
31 | % Check bcch_bch_msg
32 | if(length(bcch_bch_msg) ~= 24)
33 | printf("ERROR: Invalid bcch_bch_msg (length is %u, should be 24)\n", length(bcch_bch_msg));
34 | bw = 0;
35 | phich_dur = 0;
36 | phich_res = 0;
37 | sfn = 0;
38 | return;
39 | endif
40 |
41 | % Unpack the BCCH BCH message
42 | act_bw = bcch_bch_msg(1:3);
43 | act_phich_dur = bcch_bch_msg(4);
44 | act_phich_res = bcch_bch_msg(5:6);
45 | act_sfn = bcch_bch_msg(7:14);
46 |
47 | % Construct bandwidth
48 | act_bw = 4*act_bw(1) + 2*act_bw(2) + act_bw(3);
49 | if(act_bw == 0)
50 | bw = 6;
51 | elseif(act_bw == 1)
52 | bw = 15;
53 | elseif(act_bw == 2)
54 | bw = 25;
55 | elseif(act_bw == 3)
56 | bw = 50;
57 | elseif(act_bw == 4)
58 | bw = 75;
59 | elseif(act_bw == 5)
60 | bw = 100;
61 | else
62 | printf("ERROR: Invalid act_bw (%u)\n", act_bw);
63 | bw = 0;
64 | endif
65 |
66 | % Construct phich_dur
67 | if(act_phich_dur == 0)
68 | phich_dur = "normal";
69 | else
70 | phich_dur = "extended";
71 | endif
72 |
73 | % Construct phich_res
74 | act_phich_res = 2*act_phich_res(1) + act_phich_res(2);
75 | if(act_phich_res == 0)
76 | phich_res = 1/6;
77 | elseif(act_phich_res == 1)
78 | phich_res = 1/2;
79 | elseif(act_phich_res == 2)
80 | phich_res = 1;
81 | else
82 | phich_res = 2;
83 | endif
84 |
85 | % Construct SFN
86 | sfn = 0;
87 | for(n=0:7)
88 | sfn = sfn + act_sfn(n+1)*2^(9-n);
89 | endfor
90 | endfunction
91 |
--------------------------------------------------------------------------------
/LTE_fdd_dl_scan/src/LTE_fdd_dl_scan_main.cc:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2013 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: LTE_fdd_dl_scan_main.cc
21 |
22 | Description: Contains all the implementations for the LTE FDD DL Scanner
23 | main loop.
24 |
25 | Revision History
26 | ---------- ------------- --------------------------------------------
27 | 02/26/2013 Ben Wojtowicz Created file
28 |
29 | *******************************************************************************/
30 |
31 | /*******************************************************************************
32 | INCLUDES
33 | *******************************************************************************/
34 |
35 | #include "LTE_fdd_dl_scan_interface.h"
36 | #include "LTE_fdd_dl_scan_flowgraph.h"
37 | #include
38 |
39 | /*******************************************************************************
40 | DEFINES
41 | *******************************************************************************/
42 |
43 |
44 | /*******************************************************************************
45 | TYPEDEFS
46 | *******************************************************************************/
47 |
48 |
49 | /*******************************************************************************
50 | GLOBAL VARIABLES
51 | *******************************************************************************/
52 |
53 |
54 | /*******************************************************************************
55 | CLASS IMPLEMENTATIONS
56 | *******************************************************************************/
57 |
58 | int main(int argc, char *argv[])
59 | {
60 | LTE_fdd_dl_scan_interface *interface = LTE_fdd_dl_scan_interface::get_instance();
61 | LTE_fdd_dl_scan_flowgraph *flowgraph = LTE_fdd_dl_scan_flowgraph::get_instance();
62 |
63 | interface->set_ctrl_port(LTE_FDD_DL_SCAN_DEFAULT_CTRL_PORT);
64 | interface->start_ctrl_port();
65 |
66 | printf("*** LTE FDD DL SCAN ***\n");
67 | printf("Please connect to control port %u\n", LTE_FDD_DL_SCAN_DEFAULT_CTRL_PORT);
68 |
69 | while(!interface->get_shutdown())
70 | {
71 | sleep(1);
72 | }
73 |
74 | if(flowgraph->is_started())
75 | {
76 | flowgraph->stop();
77 | }
78 | flowgraph->cleanup();
79 | interface->cleanup();
80 | }
81 |
--------------------------------------------------------------------------------
/LTE_file_recorder/src/LTE_file_recorder_main.cc:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2013 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: LTE_file_recorder_main.cc
21 |
22 | Description: Contains all the implementations for the LTE file recorder
23 | main loop.
24 |
25 | Revision History
26 | ---------- ------------- --------------------------------------------
27 | 08/26/2013 Ben Wojtowicz Created file
28 |
29 | *******************************************************************************/
30 |
31 | /*******************************************************************************
32 | INCLUDES
33 | *******************************************************************************/
34 |
35 | #include "LTE_file_recorder_interface.h"
36 | #include "LTE_file_recorder_flowgraph.h"
37 | #include
38 |
39 | /*******************************************************************************
40 | DEFINES
41 | *******************************************************************************/
42 |
43 |
44 | /*******************************************************************************
45 | TYPEDEFS
46 | *******************************************************************************/
47 |
48 |
49 | /*******************************************************************************
50 | GLOBAL VARIABLES
51 | *******************************************************************************/
52 |
53 |
54 | /*******************************************************************************
55 | CLASS IMPLEMENTATIONS
56 | *******************************************************************************/
57 |
58 | int main(int argc, char *argv[])
59 | {
60 | LTE_file_recorder_interface *interface = LTE_file_recorder_interface::get_instance();
61 | LTE_file_recorder_flowgraph *flowgraph = LTE_file_recorder_flowgraph::get_instance();
62 |
63 | interface->set_ctrl_port(LTE_FILE_RECORDER_DEFAULT_CTRL_PORT);
64 | interface->start_ctrl_port();
65 |
66 | printf("*** LTE File Recorder ***\n");
67 | printf("Please connect to control port %u\n", LTE_FILE_RECORDER_DEFAULT_CTRL_PORT);
68 |
69 | while(!interface->get_shutdown())
70 | {
71 | sleep(1);
72 | }
73 |
74 | if(flowgraph->is_started())
75 | {
76 | flowgraph->stop();
77 | }
78 | flowgraph->cleanup();
79 | interface->cleanup();
80 | }
81 |
--------------------------------------------------------------------------------
/octave/lte_bcch_bch_msg_pack.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_bcch_bch_msg_pack
18 | % Description: Packs all of the fields into the BCCH BCH message
19 | % Inputs: bw - System bandwidth (in number of RBs)
20 | % phich_dur - PHICH Duration (normal or extended)
21 | % phich_res - Number of PHICH groups (1/6, 1/2, 1, 2)
22 | % sfn - System frame number
23 | % Outputs: bcch_bch_msg - Packed BCCH BCH message
24 | % Spec: 3GPP TS 36.331 section 6.2.1 and 6.2.2 v10.0.0
25 | % Notes: None
26 | % Rev History: Ben Wojtowicz 10/30/2011 Created
27 | % Ben Wojtowicz 01/29/2012 Fixed license statement
28 | % Ben Wojtowicz 02/19/2012 Changed function name to match spec
29 | %
30 | function [bcch_bch_msg] = lte_bcch_bch_msg_pack(bw, phich_dur, phich_res, sfn)
31 | % Check bandwidth
32 | if(bw == 6)
33 | act_bw = [0,0,0];
34 | elseif(bw == 15)
35 | act_bw = [0,0,1];
36 | elseif(bw == 25)
37 | act_bw = [0,1,0];
38 | elseif(bw == 50)
39 | act_bw = [0,1,1];
40 | elseif(bw == 75)
41 | act_bw = [1,0,0];
42 | elseif(bw == 100)
43 | act_bw = [1,0,1];
44 | else
45 | printf("ERROR: Invalid bw (%u)\n", bw);
46 | bcch_bch_msg = 0;
47 | return;
48 | endif
49 |
50 | % Check phich_dur
51 | if(phich_dur == "normal")
52 | act_phich_dur = 0;
53 | elseif(phich_dur == "extended")
54 | act_phich_dur = 1;
55 | else
56 | printf("ERROR: Invalid phich_dur (%s)\n", phich_dur);
57 | bcch_bch_msg = 0;
58 | return;
59 | endif
60 |
61 | % Check phich_res
62 | if(phich_res == 1/6)
63 | act_phich_res = [0,0];
64 | elseif(phich_res == 1/2)
65 | act_phich_res = [0,1];
66 | elseif(phich_res == 1)
67 | act_phich_res = [1,0];
68 | elseif(phich_res == 2)
69 | act_phich_res = [1,1];
70 | else
71 | printf("ERROR: Invalid phich_res (%f)\n", phich_res);
72 | bcch_bch_msg = 0;
73 | return;
74 | endif
75 |
76 | % Check SFN
77 | if(sfn >= 0 && sfn <= 1023)
78 | tmp = sfn;
79 | for(n=0:7)
80 | act_sfn(n+1) = floor(tmp/2^(9-n));
81 | tmp = tmp - floor(tmp/2^(9-n))*2^(9-n);
82 | endfor
83 | else
84 | printf("ERROR: Invalid sfn (%u)\n", sfn);
85 | bcch_bch_msg = 0;
86 | return;
87 | endif
88 |
89 | % Pack the BCCH BCH message
90 | bcch_bch_msg = [act_bw, act_phich_dur, act_phich_res, act_sfn, zeros(1,10)];
91 | endfunction
92 |
--------------------------------------------------------------------------------
/octave/lte_ulsch_channel_decode.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_ulsch_channel_decode
18 | % Description: Channel decodes the uplink shared channel
19 | % Inputs: ulsch_bits - Uplink shared channel encoded bits
20 | % tbs - Transport block size
21 | % N_l - Number of layers used
22 | % Q_m - Modulation order used
23 | % tx_mode - Transmission mode used
24 | % Outputs: ulsch_msg - Uplink shared channel message bits
25 | % Spec: 3GPP TS 36.212 section 5.2.2 v10.1.0
26 | % Rev History: Ben Wojtowicz 03/26/2014 Created
27 | %
28 | function [ulsch_msg] = lte_ulsch_channel_decode(ulsch_bits, tbs, N_l, Q_m, tx_mode)
29 | % In order to decode an ULSCH message, the NULL bit pattern must be
30 | % determined by encoding a sequence of zeros.
31 | dummy_b_bits = zeros(1,tbs+24);
32 | dummy_c_bits_s = lte_code_block_segmentation(dummy_b_bits);
33 |
34 | % Decode the ULSCH message
35 | % Define h_bits
36 | h_bits = ulsch_bits;
37 |
38 | % FIXME: Not handling control information at this point
39 | Q_prime_RI = 0;
40 | Q_prime_ACK = 0;
41 | Q_CQI = 0;
42 |
43 | % Channel de-interleaver
44 | [g_bits, q_ri_bits, q_ack_bits] = lte_ulsch_channel_deinterleaver(h_bits, Q_prime_RI, Q_prime_ACK, N_l, Q_m);
45 |
46 | % De-multiplexing of data and control
47 | [f_bits, q_cqi_bits] = lte_ulsch_control_data_demultiplexing(g_bits, Q_CQI, N_l, Q_m);
48 |
49 | % Determine e_bits
50 | e_bits = lte_code_block_deconcatenation(f_bits, tbs);
51 | [C, e_bits_len] = size(e_bits);
52 |
53 | for(cb=0:C-1)
54 | % Construct dummy_d_bits
55 | dummy_d_bits = lte_turbo_encode(dummy_c_bits_s.cb(cb+1).bits, dummy_c_bits_s.F);
56 |
57 | % Determine d_bits
58 | d_bits = lte_rate_unmatch_turbo(e_bits, C, dummy_d_bits, tx_mode, 1, 1, "ulsch", 0);
59 |
60 | % Determine c_bits
61 | c_bits = lte_turbo_decode(d_bits, dummy_c_bits_s.F);
62 | endfor
63 |
64 | % Determine b_bits
65 | b_bits = lte_code_block_desegmentation(c_bits, tbs);
66 |
67 | % Recover a_bits and p_bits
68 | a_bits = b_bits(1:tbs);
69 | p_bits = b_bits(tbs+1:tbs+24);
70 |
71 | % Calculate p_bits
72 | calc_p_bits = lte_calc_crc(a_bits, "24A");
73 |
74 | % Check CRC
75 | ber = 0;
76 | for(n=0:length(p_bits)-1)
77 | if(p_bits(n+1) ~= calc_p_bits(n+1))
78 | ber = ber + 1;
79 | endif
80 | endfor
81 | if(ber == 0)
82 | ulsch_msg = a_bits;
83 | else
84 | ulsch_msg = 0;
85 | endif
86 | endfunction
87 |
--------------------------------------------------------------------------------
/octave/lte_prach_bb_gen.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2013 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_prach_bb_gen
18 | % Description: Generates the baseband signal for a PRACH
19 | % Inputs: x_u_v - The PRACH preamble signal to be transmitted
20 | % prach_freq_offset - Offset in the frequency domain of the PRACH
21 | % pre_format - Preamble format of the PRACH
22 | % N_ul_rb - Number of uplink resource blocks available
23 | % Outputs: prach_bb - PRACH baseband signal
24 | % Spec: 3GPP TS 36.211 section 5.7.3 v10.1.0
25 | % Rev History: Ben Wojtowicz 07/21/2013 Created
26 | % Ben Wojtowicz 08/26/2013 Fixed a bug in the frequency domain conversion
27 | %
28 | function [prach_bb] = lte_prach_bb_gen(x_u_v, prach_freq_offset, pre_format, N_ul_rb)
29 |
30 | % Determine the frequency delta between PRACH and PUSCH/PUCCH and the preamble length
31 | if(pre_format >= 0 && pre_format <= 3)
32 | delta_f_RA = 1250;
33 | N_zc = 839;
34 | phi = 7;
35 | else
36 | delta_f_RA = 7500;
37 | N_zc = 139;
38 | phi = 2;
39 | endif
40 |
41 | % Determine the FFT, sequence, and cyclic prefix lengths
42 | if(pre_format == 0)
43 | T_fft = 24576;
44 | T_seq = 24576;
45 | T_cp = 3168;
46 | elseif(pre_format == 1)
47 | T_fft = 24576;
48 | T_seq = 24576;
49 | T_cp = 21024;
50 | elseif(pre_format == 2)
51 | T_fft = 24576;
52 | T_seq = 2*24576;
53 | T_cp = 6240;
54 | elseif(pre_format == 3)
55 | T_fft = 24576;
56 | T_seq = 2*24576;
57 | T_cp = 21024;
58 | else
59 | T_fft = 4096;
60 | T_seq = 4096;
61 | T_cp = 448;
62 | endif
63 |
64 | % Parameters
65 | % FIXME: Only supports 30.72MHz sampling rate
66 | N_ra_prb = prach_freq_offset;
67 | N_sc_rb = 12;
68 | FFT_size = 2048;
69 | k_0 = N_ra_prb*N_sc_rb - N_ul_rb*N_sc_rb/2 + (FFT_size/2);
70 | K = 15000/delta_f_RA;
71 |
72 | % Convert preamble to the frequency domain
73 | x_fd_sig = fftshift(fft(x_u_v));
74 |
75 | % Construct full frequency domain signal
76 | fd_sig = zeros(1,T_fft);
77 | start = phi+K*(k_0+0.5);
78 | fd_sig(start+1:start+N_zc-1+1) = x_fd_sig;
79 |
80 | % Construct output sequence
81 | out_seq = ifft(ifftshift(fd_sig));
82 |
83 | % Add cyclic prefix
84 | if(T_fft == T_seq)
85 | prach_bb = [out_seq(end-T_cp:end), out_seq];
86 | else
87 | prach_bb = [out_seq(end-T_cp:end), out_seq, out_seq];
88 | endif
89 | endfunction
90 |
--------------------------------------------------------------------------------
/LTE_fdd_enodeb/src/LTE_fdd_enb_main.cc:
--------------------------------------------------------------------------------
1 | #line 2 "LTE_fdd_enb_main.cc" // Make __FILE__ omit the path
2 | /*******************************************************************************
3 |
4 | Copyright 2013-2014 Ben Wojtowicz
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU Affero General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU Affero General Public License for more details.
15 |
16 | You should have received a copy of the GNU Affero General Public License
17 | along with this program. If not, see .
18 |
19 | *******************************************************************************
20 |
21 | File: LTE_fdd_enb_main.cc
22 |
23 | Description: Contains all the implementations for the LTE FDD eNodeB main
24 | loop.
25 |
26 | Revision History
27 | ---------- ------------- --------------------------------------------
28 | 11/09/2013 Ben Wojtowicz Created file
29 | 06/15/2014 Ben Wojtowicz Omitting path from __FILE__.
30 | 11/01/2014 Ben Wojtowicz Added config and user file support.
31 |
32 | *******************************************************************************/
33 |
34 | /*******************************************************************************
35 | INCLUDES
36 | *******************************************************************************/
37 |
38 | #include "LTE_fdd_enb_interface.h"
39 | #include "LTE_fdd_enb_cnfg_db.h"
40 | #include "LTE_fdd_enb_hss.h"
41 |
42 | /*******************************************************************************
43 | DEFINES
44 | *******************************************************************************/
45 |
46 |
47 | /*******************************************************************************
48 | TYPEDEFS
49 | *******************************************************************************/
50 |
51 |
52 | /*******************************************************************************
53 | GLOBAL VARIABLES
54 | *******************************************************************************/
55 |
56 |
57 | /*******************************************************************************
58 | CLASS IMPLEMENTATIONS
59 | *******************************************************************************/
60 |
61 | int main(int argc, char *argv[])
62 | {
63 | LTE_fdd_enb_interface *interface = LTE_fdd_enb_interface::get_instance();
64 | LTE_fdd_enb_cnfg_db *cnfg_db = LTE_fdd_enb_cnfg_db::get_instance();
65 | LTE_fdd_enb_hss *hss = LTE_fdd_enb_hss::get_instance();
66 |
67 | interface->set_ctrl_port(LTE_FDD_ENB_DEFAULT_CTRL_PORT);
68 | interface->start_ports();
69 |
70 | // Read configuration
71 | hss->read_user_file();
72 | cnfg_db->read_cnfg_file();
73 |
74 | printf("*** LTE FDD ENB ***\n");
75 | printf("Please connect to control port %u\n", LTE_FDD_ENB_DEFAULT_CTRL_PORT);
76 |
77 | while(!interface->get_shutdown())
78 | {
79 | sleep(1);
80 | }
81 |
82 | interface->cleanup();
83 | }
84 |
--------------------------------------------------------------------------------
/octave/lte_rate_match_conv.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_rate_match_conv
18 | % Description: Rate matches convolutionally encoded data
19 | % Inputs: in_bits - Input bits to rate matcher
20 | % E - Rate matching output sequence length
21 | % Outputs: out_bits - Output bits from the rate matcher
22 | % Spec: 3GPP TS 36.212 section 5.1.4.2 v10.1.0
23 | % Notes: None
24 | % Rev History: Ben Wojtowicz 01/02/2012 Created
25 | %
26 | function [out_bits] = lte_rate_match_conv(in_bits, E)
27 | % Check in bits
28 | [this_is_three, in_bits_len] = size(in_bits);
29 | if(this_is_three ~= 3)
30 | printf("ERROR: Invalid dimension for in_bits (%u should be 3)\n", this_is_three);
31 | out_bits = 0;
32 | return;
33 | endif
34 |
35 | % Sub block intereaving
36 | % Step 1: Assign C_cc_sb to 32
37 | C_cc_sb = 32;
38 |
39 | % Step 2: Determine the number of rows
40 | R_cc_sb = 0;
41 | while(in_bits_len > (C_cc_sb*R_cc_sb))
42 | R_cc_sb = R_cc_sb + 1;
43 | endwhile
44 |
45 | % Inter-column permutation values
46 | ic_perm = [1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30];
47 |
48 | % Steps 3, 4, and 5
49 | for(x=0:this_is_three-1)
50 | % Step 3: Pack data into matrix and pad with dummy (NULL==10000 for this routine)
51 | if(in_bits_len < (C_cc_sb*R_cc_sb))
52 | N_dummy = C_cc_sb*R_cc_sb - in_bits_len;
53 | else
54 | N_dummy = 0;
55 | endif
56 | tmp = [10000*ones(1, N_dummy), in_bits(x+1,:)];
57 | idx = 0;
58 | for(n=0:R_cc_sb-1)
59 | for(m=0:C_cc_sb-1)
60 | sb_mat(n+1,m+1) = tmp(idx+1);
61 | idx = idx + 1;
62 | endfor
63 | endfor
64 |
65 | % Step 4: Inter-column permutation
66 | for(n=0:R_cc_sb-1)
67 | for(m=0:C_cc_sb-1)
68 | sb_perm_mat(n+1,m+1) = sb_mat(n+1,ic_perm(m+1)+1);
69 | endfor
70 | endfor
71 |
72 | % Step 5: Read out the bits
73 | idx = 0;
74 | for(m=0:C_cc_sb-1)
75 | for(n=0:R_cc_sb-1)
76 | v(x+1,idx+1) = sb_perm_mat(n+1,m+1);
77 | idx = idx + 1;
78 | endfor
79 | endfor
80 | endfor
81 | K_pi = R_cc_sb*C_cc_sb;
82 |
83 | % Bit collection, selection, and transmission
84 | % Create circular buffer
85 | w = [v(1,:), v(2,:), v(3,:)];
86 | K_w = 3*K_pi;
87 | % Create output
88 | k_idx = 0;
89 | j_idx = 0;
90 | while(k_idx < E)
91 | if(w(mod(j_idx, K_w)+1) ~= 10000)
92 | out_bits(k_idx+1) = w(mod(j_idx, K_w)+1);
93 | k_idx = k_idx + 1;
94 | endif
95 | j_idx = j_idx + 1;
96 | endwhile
97 | endfunction
98 |
--------------------------------------------------------------------------------
/liblte/src/liblte_common.cc:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2014 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: liblte_common.cc
21 |
22 | Description: Contains all the implementations for the LTE common library.
23 |
24 | Revision History
25 | ---------- ------------- --------------------------------------------
26 | 08/03/2014 Ben Wojtowicz Created file.
27 | 11/29/2014 Ben Wojtowicz Added liblte prefix to value_2_bits and
28 | bits_2_value.
29 |
30 | *******************************************************************************/
31 |
32 | /*******************************************************************************
33 | INCLUDES
34 | *******************************************************************************/
35 |
36 | #include "liblte_common.h"
37 |
38 | /*******************************************************************************
39 | DEFINES
40 | *******************************************************************************/
41 |
42 |
43 | /*******************************************************************************
44 | TYPEDEFS
45 | *******************************************************************************/
46 |
47 |
48 | /*******************************************************************************
49 | GLOBAL VARIABLES
50 | *******************************************************************************/
51 |
52 |
53 | /*******************************************************************************
54 | FUNCTIONS
55 | *******************************************************************************/
56 |
57 | /*********************************************************************
58 | Name: liblte_value_2_bits
59 |
60 | Description: Converts a value to a bit string
61 | *********************************************************************/
62 | void liblte_value_2_bits(uint32 value,
63 | uint8 **bits,
64 | uint32 N_bits)
65 | {
66 | uint32 i;
67 |
68 | for(i=0; i> (N_bits-i-1)) & 0x1;
71 | }
72 | *bits += N_bits;
73 | }
74 |
75 | /*********************************************************************
76 | Name: liblte_bits_2_value
77 |
78 | Description: Converts a bit string to a value
79 | *********************************************************************/
80 | uint32 liblte_bits_2_value(uint8 **bits,
81 | uint32 N_bits)
82 | {
83 | uint32 value = 0;
84 | uint32 i;
85 |
86 | for(i=0; i.
16 | %
17 | % Function: lte_code_block_deconcatenation
18 | % Description: Undoes code block concatenation for turbo coded channels
19 | % Inputs: in_bits - Code block bits to be deconcatenated
20 | % tbs - Transport block size for the channel
21 | % Outputs: out_bits - Code block deconcatenated bits
22 | % Spec: 3GPP TS 36.212 section 5.1.5 v10.1.0
23 | % Notes: None
24 | % Rev History: Ben Wojtowicz 01/10/2012 Created
25 | %
26 | function [out_bits] = lte_code_block_deconcatenation(in_bits, tbs)
27 | % Define K table 36.212 Table 5.1.3-3 v10.1.0
28 | k_table = [40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,256,264,272,280,288,296,304,312,320,328,336,344,352,360,368,376,384,392,400,408,416,424,432,440,448,456,464,472,480,488,496,504,512,528,544,560,576,592,608,624,640,656,672,688,704,720,736,752,768,784,800,816,832,848,864,880,896,912,928,944,960,976,992,1008,1024,1056,1088,1120,1152,1184,1216,1248,1280,1312,1344,1376,1408,1440,1472,1504,1536,1568,1600,1632,1664,1696,1728,1760,1792,1824,1856,1888,1920,1952,1984,2016,2048,2112,2176,2240,2304,2368,2432,2496,2560,2624,2688,2752,2816,2880,2944,3008,3072,3136,3200,3264,3328,3392,3456,3520,3584,3648,3712,3776,3840,3904,3968,4032,4096,4160,4224,4288,4352,4416,4480,4544,4608,4672,4736,4800,4864,4928,4992,5056,5120,5184,5248,5312,5376,5440,5504,5568,5632,5696,5760,5824,5888,5952,6016,6080,6144];
29 |
30 | % Determine L, C, B', K+, C+, K-, and C- 36.212 section 5.1.2 v10.1.0
31 | Z = 6144;
32 | if(tbs <= Z)
33 | L = 0;
34 | C = 1;
35 | B_prime = length(in_bits);
36 | for(n=0:length(k_table)-1)
37 | if(C*k_table(n+1) >= B_prime)
38 | K_plus = k_table(n+1);
39 | break;
40 | endif
41 | endfor
42 | K_minus = 0;
43 | C_plus = 1;
44 | C_minus = 0;
45 | else
46 | B = tbs + 24;
47 | L = 24;
48 | C = ceil(B/(Z-L));
49 | B_prime = B + C*L;
50 | for(n=0:length(k_table)-1)
51 | if(C*k_table(n+1) >= B_prime)
52 | K_plus = k_table(n+1);
53 | break;
54 | endif
55 | endfor
56 | for(n=length(k_table)-1:-1:0)
57 | if(k_table(n+1) < K_plus)
58 | K_minus = k_table(n+1);
59 | break;
60 | endif
61 | endfor
62 | K_delta = K_plus - K_minus;
63 | C_minus = floor((C*K_plus - B_prime)/K_delta);
64 | C_plus = C - C_minus;
65 | endif
66 | out_s.num_cb = C;
67 |
68 | out_bits_len = length(in_bits)/C;
69 |
70 | % Deconcatenate code blocks
71 | k_idx = 0;
72 | r_idx = 0;
73 | while(r_idx < C)
74 | j_idx = 0;
75 | while(j_idx < out_bits_len)
76 | out_bits(r_idx+1,j_idx+1) = in_bits(k_idx+1);
77 | k_idx = k_idx + 1;
78 | j_idx = j_idx + 1;
79 | endwhile
80 | r_idx = r_idx + 1;
81 | endwhile
82 | endfunction
83 |
--------------------------------------------------------------------------------
/liblte/tests/liblte_common_tests.cc:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2017 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: liblte_common_tests.cc
21 |
22 | Description: Contains all the tests for the LTE common library.
23 |
24 | Revision History
25 | ---------- ------------- --------------------------------------------
26 | 07/29/2017 Ben Wojtowicz Created file.
27 |
28 | *******************************************************************************/
29 |
30 | /*******************************************************************************
31 | INCLUDES
32 | *******************************************************************************/
33 |
34 | #include "liblte_common.h"
35 |
36 | /*******************************************************************************
37 | DEFINES
38 | *******************************************************************************/
39 |
40 |
41 | /*******************************************************************************
42 | TYPEDEFS
43 | *******************************************************************************/
44 |
45 |
46 | /*******************************************************************************
47 | GLOBAL VARIABLES
48 | *******************************************************************************/
49 |
50 |
51 | /*******************************************************************************
52 | FUNCTIONS
53 | *******************************************************************************/
54 |
55 | int main(int argc, char *argv[])
56 | {
57 | uint32 i;
58 | uint32 j;
59 | uint32 value;
60 | uint8 bits[32];
61 | uint8 *bits_ptr;
62 |
63 | // Check liblte_value_2_bits with single bit values
64 | for(i=0; i<32; i++)
65 | {
66 | bits_ptr = &bits[0];
67 | liblte_value_2_bits(1<.
17 |
18 | *******************************************************************************
19 |
20 | File: LTE_fdd_enb_gw.h
21 |
22 | Description: Contains all the definitions for the LTE FDD eNodeB
23 | IP gateway.
24 |
25 | Revision History
26 | ---------- ------------- --------------------------------------------
27 | 11/29/2014 Ben Wojtowicz Created file
28 | 12/16/2014 Ben Wojtowicz Added ol extension to message queue.
29 | 02/15/2015 Ben Wojtowicz Moved to new message queue.
30 | 12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t.
31 | 07/29/2017 Ben Wojtowicz Moved away from singleton pattern.
32 |
33 | *******************************************************************************/
34 |
35 | #ifndef __LTE_FDD_ENB_GW_H__
36 | #define __LTE_FDD_ENB_GW_H__
37 |
38 | /*******************************************************************************
39 | INCLUDES
40 | *******************************************************************************/
41 |
42 | #include "LTE_fdd_enb_interface.h"
43 | #include "LTE_fdd_enb_msgq.h"
44 |
45 | /*******************************************************************************
46 | DEFINES
47 | *******************************************************************************/
48 |
49 |
50 | /*******************************************************************************
51 | FORWARD DECLARATIONS
52 | *******************************************************************************/
53 |
54 |
55 | /*******************************************************************************
56 | TYPEDEFS
57 | *******************************************************************************/
58 |
59 |
60 | /*******************************************************************************
61 | CLASS DECLARATIONS
62 | *******************************************************************************/
63 |
64 | class LTE_fdd_enb_gw
65 | {
66 | public:
67 | // Constructor/Destructor
68 | LTE_fdd_enb_gw();
69 | ~LTE_fdd_enb_gw();
70 |
71 | // Start/Stop
72 | bool is_started(void);
73 | LTE_FDD_ENB_ERROR_ENUM start(LTE_fdd_enb_msgq *from_pdcp, LTE_fdd_enb_msgq *to_pdcp, char *err_str, LTE_fdd_enb_interface *iface);
74 | void stop(void);
75 |
76 | private:
77 | // Start/Stop
78 | LTE_fdd_enb_interface *interface;
79 | sem_t start_sem;
80 | bool started;
81 |
82 | // Communication
83 | void handle_pdcp_msg(LTE_FDD_ENB_MESSAGE_STRUCT &msg);
84 | LTE_fdd_enb_msgq *msgq_from_pdcp;
85 | LTE_fdd_enb_msgq *msgq_to_pdcp;
86 |
87 | // PDCP Message Handlers
88 | void handle_gw_data(LTE_FDD_ENB_GW_DATA_READY_MSG_STRUCT *gw_data);
89 |
90 | // GW Receive
91 | static void* receive_thread(void *inputs);
92 | pthread_t rx_thread;
93 |
94 | // TUN device
95 | int32 tun_fd;
96 | };
97 |
98 | #endif /* __LTE_FDD_ENB_GW_H__ */
99 |
--------------------------------------------------------------------------------
/octave/lte_pre_decoder_and_matched_filter_dl.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012, 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_pre_decoder_and_matched_filter_dl
18 | % Description: Matched filters and unmaps a block of downlink vectors
19 | % from resources on each antenna port
20 | % Inputs: y - Block of input vectors
21 | % h - Channel estimate
22 | % style - Style of mapping (tx_diversity or
23 | % spatial_multiplex)
24 | % Outputs: x - Block of output vectors
25 | % Spec: 3GPP TS 36.211 section 6.3.4 v10.1.0
26 | % Notes: Only supports single antenna or tx_diversity.
27 | % Rev History: Ben Wojtowicz 10/28/2011 Created
28 | % Ben Wojtowicz 01/29/2012 Fixed license statement
29 | % Ben Wojtowicz 02/19/2012 Added newline to EOF
30 | % Ben Wojtowicz 03/26/2014 Changed name to lte_pre_decoder_and_matched_filter_dl
31 | %
32 | function [x] = lte_pre_decoder_and_matched_filter_dl(y, h, style)
33 |
34 | [N_ant, M_ap_symb] = size(h);
35 |
36 | if(N_ant == 1)
37 | % 36.211 Section 6.3.4.1 v10.1.0
38 | M_layer_symb = M_ap_symb;
39 | for(n=0:M_ap_symb-1)
40 | x(n+1) = y(n+1)/h(n+1);
41 | endfor
42 | elseif(N_ant == 2)
43 | if(style == "tx_diversity")
44 | % 36.211 Section 6.3.4.3 v10.1.0
45 | M_layer_symb = M_ap_symb/2;
46 | for(n=0:M_layer_symb-1)
47 | h_norm = abs(h(1,n*2+0+1))^2 + abs(h(2,n*2+0+1))^2;
48 | x(0+1,n+1) = (conj(h(1,n*2+0+1))*y(n*2+0+1) + h(2,n*2+0+1)*conj(y(n*2+1+1)))/h_norm;
49 | x(1+1,n+1) = conj(-conj(h(2,n*2+0+1))*y(n*2+0+1) + h(1,n*2+0+1)*conj(y(n*2+1+1)))/h_norm;
50 | endfor
51 | else
52 | printf("ERROR: Style %s not supported\n", style);
53 | x = 0;
54 | endif
55 | elseif(N_ant == 4)
56 | if(style == "tx_diversity")
57 | % 36.211 Section 6.3.4.3 v10.1.0
58 | if(mod(M_ap_symb, 4) == 0)
59 | M_layer_symb = M_ap_symb/4;
60 | else
61 | M_layer_symb = (M_ap_symb+2)/4;
62 | y(:,M_ap_symb+1) = [10; 10; 10; 10];
63 | y(:,M_ap_symb+2) = [10; 10; 10; 10];
64 | endif
65 | for(n=0:M_layer_symb-1)
66 | h_norm_13 = abs(h(1,n*4+0+1))^2 + abs(h(3,n*4+0+1))^2;
67 | h_norm_24 = abs(h(2,n*4+2+1))^2 + abs(h(4,n*4+2+1))^2;
68 | x(0+1,n+1) = (conj(h(1,n*4+0+1))*y(n*4+0+1) + h(3,n*4+0+1)*conj(y(n*4+1+1)))/h_norm_13;
69 | x(1+1,n+1) = conj(-conj(h(3,n*4+0+1))*y(n*4+0+1) + h(1,n*4+0+1)*conj(y(n*4+1+1)))/h_norm_13;
70 | x(2+1,n+1) = (conj(h(2,n*4+2+1))*y(n*4+2+1) + h(4,n*4+2+1)*conj(y(n*4+3+1)))/h_norm_24;
71 | x(3+1,n+1) = conj(-conj(h(4,n*4+2+1))*y(n*4+2+1) + h(2,n*4+2+1)*conj(y(n*4+3+1)))/h_norm_24;
72 | endfor
73 | else
74 | printf("ERROR: Style %s not supported\n", style);
75 | x = 0;
76 | endif
77 | else
78 | printf("ERROR: Number of antenna ports %u not supported\n", N_ant);
79 | x = 0;
80 | endif
81 | endfunction
82 |
--------------------------------------------------------------------------------
/LTE_fdd_enodeb/hdr/LTE_fdd_enb_timer.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2014 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: LTE_fdd_enb_timer.h
21 |
22 | Description: Contains all the definitions for the LTE FDD eNodeB
23 | timer class.
24 |
25 | Revision History
26 | ---------- ------------- --------------------------------------------
27 | 05/04/2014 Ben Wojtowicz Created file
28 | 06/15/2014 Ben Wojtowicz Added millisecond resolution and seperated
29 | the callback calling functionality.
30 | 11/29/2014 Ben Wojtowicz Added timer reset support.
31 |
32 | *******************************************************************************/
33 |
34 | #ifndef __LTE_FDD_ENB_TIMER_H__
35 | #define __LTE_FDD_ENB_TIMER_H__
36 |
37 | /*******************************************************************************
38 | INCLUDES
39 | *******************************************************************************/
40 |
41 | #include "LTE_fdd_enb_interface.h"
42 |
43 | /*******************************************************************************
44 | DEFINES
45 | *******************************************************************************/
46 |
47 |
48 | /*******************************************************************************
49 | FORWARD DECLARATIONS
50 | *******************************************************************************/
51 |
52 |
53 | /*******************************************************************************
54 | TYPEDEFS
55 | *******************************************************************************/
56 |
57 |
58 | /*******************************************************************************
59 | CLASS DECLARATIONS
60 | *******************************************************************************/
61 |
62 | // Timer callback
63 | class LTE_fdd_enb_timer_cb
64 | {
65 | public:
66 | typedef void (*FuncType)(void*, uint32);
67 | LTE_fdd_enb_timer_cb();
68 | LTE_fdd_enb_timer_cb(FuncType f, void* o);
69 | void operator()(uint32 id);
70 | private:
71 | FuncType func;
72 | void *obj;
73 | };
74 | template
75 | void LTE_fdd_enb_timer_cb_wrapper(void *o, uint32 id)
76 | {
77 | return (static_cast(o)->*Func)(id);
78 | }
79 |
80 | class LTE_fdd_enb_timer
81 | {
82 | public:
83 | // Constructor/Destructor
84 | LTE_fdd_enb_timer(uint32 m_seconds, uint32 _id, LTE_fdd_enb_timer_cb _cb);
85 | ~LTE_fdd_enb_timer();
86 |
87 | // External interface
88 | void reset(void);
89 | void increment(void);
90 | bool expired(void);
91 | void call_callback(void);
92 |
93 | private:
94 | // Identity
95 | LTE_fdd_enb_timer_cb cb;
96 | uint32 id;
97 | uint32 expiry_m_seconds;
98 | uint32 current_m_seconds;
99 | };
100 |
101 | #endif /* __LTE_FDD_ENB_TIMER_H__ */
102 |
--------------------------------------------------------------------------------
/octave/lte_dci_1a_pack.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_dci_1a_pack
18 | % Description: Packs all of the fields into the Downlink Control
19 | % Indicator Format 1A.
20 | % Inputs: alloc_s - Allocation description structure containing:
21 | % N_prb - number of allocated PRBs, prb - allocated
22 | % PRBs, vrb_type - "localized" or "distributed",
23 | % modulation, pre_coding, tx_mode, rv_idx -
24 | % redundancy version number, N_codewords,
25 | % mcs - modulation and coding scheme, tbs -
26 | % transport block size, rnti
27 | % ci_present - Flag indicating if the carrier indicator is
28 | % present (0 = no, 1 = yes)
29 | % N_rb_dl - Number of resource blocks in the downlink
30 | % Outputs: dci - Packed Downlink Control Information
31 | % Spec: 3GPP TS 36.212 section 5.3.3.1.3 v10.1.0 and
32 | % 3GPP TS 36.213 section 7.1.6.3 v10.3.0 and
33 | % 3GPP TS 36.213 section 7.1.7 v10.3.0
34 | % Notes: Currently only handles SI-RNTI or P-RNTI, and localized
35 | % virtual resource blocks
36 | % Rev History: Ben Wojtowicz 01/02/2012 Created
37 | %
38 | function [dci] = lte_dci_1a_pack(alloc_s, ci_present, N_rb_dl)
39 | % Check carrier indicator
40 | if(ci_present == 1)
41 | printf("ERROR: Not handling carrier indicator\n");
42 | dci = 0;
43 | return;
44 | endif
45 |
46 | % Format 0/1A indicator is set to 1A (1)
47 | act_format_0_1a_ind = [1];
48 |
49 | % Resource block assignment
50 | if(alloc_s.rnti == 65535 || alloc_s.rnti == 65534)
51 | if(alloc_s.vrb_type == "localized")
52 | act_vrb_type_ind = [0];
53 | RIV_length = ceil(log(N_rb_dl*(N_rb_dl+1)/2)/log(2));
54 | if((alloc_s.N_prb-1) <= floor(N_rb_dl/2))
55 | RIV = N_rb_dl*(alloc_s.N_prb-1) + alloc_s.prb(1);
56 | else
57 | RIV = N_rb_dl*(N_rb_dl-alloc_s.N_prb+1) + (N_rb_dl + alloc_s.prb(1));
58 | endif
59 | act_riv = cmn_dec2bin(RIV, RIV_length);
60 | act_rba = [act_vrb_type_ind, act_riv];
61 | else
62 | printf("ERROR: Invalid vrb_type %s (only hangling localized)\n", alloc_s.vrb_type);
63 | dci = 0;
64 | return;
65 | endif
66 |
67 | % Modulation and coding scheme
68 | act_mcs = cmn_dec2bin(alloc_s.mcs, 5);
69 |
70 | % HARQ process number
71 | act_harq_proc_num = [0,0,0]; % FIXME: FDD Only
72 |
73 | % New data indicator
74 | act_new_data_ind = [0];
75 |
76 | % Redundancy version
77 | act_redund_ver = cmn_dec2bin(alloc_s.rv_idx, 2);
78 |
79 | % TPC
80 | if(alloc_s.N_prb == 2)
81 | act_tpc = [0,0];
82 | else
83 | act_tpc = [0,1];
84 | endif
85 |
86 | % Pack the fields into the DCI
87 | dci = [act_format_0_1a_ind, act_rba, act_mcs, act_harq_proc_num, act_new_data_ind, act_redund_ver, act_tpc];
88 | else
89 | printf("ERROR: Not handling C-RNTI DCIs\n");
90 | dci = 0;
91 | return;
92 | endif
93 | endfunction
94 |
--------------------------------------------------------------------------------
/octave/lte_modulation_demapper.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_modulation_demapper
18 | % Description: Maps complex-valued modulation symbols to
19 | % binary digits
20 | % Inputs: symbs - Complex-valued modulation symbols
21 | % mod_type - Modulation type (bpsk, qpsk, 16qam,
22 | % or 64qam)
23 | % Outputs: bits - Binary digits
24 | % Spec: 3GPP TS 36.211 section 7.1 v10.1.0
25 | % Notes: None
26 | % Rev History: Ben Wojtowicz 10/28/2011 Created
27 | % Ben Wojtowicz 01/29/2012 Fixed license statement
28 | % Ben Wojtowicz 02/19/2012 Added newline to EOF
29 | %
30 | function [bits] = lte_modulation_demapper(symbs, mod_type)
31 |
32 | N_symbs = length(symbs);
33 |
34 | if(mod_type == "bpsk")
35 | % 36.211 Section 7.1.1 v10.1.0
36 | for(n=0:N_symbs-1)
37 | ang = angle(symbs(n+1));
38 | if(ang > -pi/4 && ang < 3*pi/4)
39 | act_symb = +1/sqrt(2) + j/sqrt(2);
40 | sd = get_soft_decision(symbs(n+1), act_symb, 1);
41 | bits(n+1) = +sd;
42 | else
43 | act_symb = -1/sqrt(2) - j/sqrt(2);
44 | sd = get_soft_decision(symbs(n+1), act_symb, 1);
45 | bits(n+1) = -sd;
46 | endif
47 | endfor
48 | elseif(mod_type == "qpsk")
49 | % 36.211 Section 7.1.2 v10.1.0
50 | for(n=0:N_symbs-1)
51 | ang = angle(symbs(n+1));
52 | if(ang >= 0 && ang < pi/2)
53 | act_symb = +1/sqrt(2) + j/sqrt(2);
54 | sd = get_soft_decision(symbs(n+1), act_symb, 1);
55 | bits(n*2+0+1) = +sd;
56 | bits(n*2+1+1) = +sd;
57 | elseif(ang >= -pi/2 && ang < 0)
58 | act_symb = +1/sqrt(2) - j/sqrt(2);
59 | sd = get_soft_decision(symbs(n+1), act_symb, 1);
60 | bits(n*2+0+1) = +sd;
61 | bits(n*2+1+1) = -sd;
62 | elseif(ang >= pi/2 && ang < pi)
63 | act_symb = -1/sqrt(2) + j/sqrt(2);
64 | sd = get_soft_decision(symbs(n+1), act_symb, 1);
65 | bits(n*2+0+1) = -sd;
66 | bits(n*2+1+1) = +sd;
67 | else
68 | act_symb = -1/sqrt(2) - j/sqrt(2);
69 | sd = get_soft_decision(symbs(n+1), act_symb, 1);
70 | bits(n*2+0+1) = -sd;
71 | bits(n*2+1+1) = -sd;
72 | endif
73 | endfor
74 | elseif(mod_type == "16qam")
75 | % 36.211 Section 7.1.3 v10.1.0
76 | printf("ERROR: Not supporting 16qam at this time\n");
77 | bits = 0;
78 | elseif(mod_type == "64qam")
79 | % 36.211 Section 7.1.4 v10.1.0
80 | printf("ERROR: Not supporting 64qam at this time\n");
81 | bits = 0;
82 | else
83 | printf("ERROR: Invalid mod_type (%s)\n", mod_type);
84 | bits = 0;
85 | endif
86 | endfunction
87 |
88 | function [sd] = get_soft_decision(p1, p2, max_dist)
89 | dist = sqrt((real(p1)-real(p2))^2 + (imag(p1)-imag(p2))^2);
90 |
91 | if(dist >= max_dist)
92 | dist = max_dist - (max_dist/1000);
93 | endif
94 |
95 | sd = max_dist - dist;
96 | endfunction
97 |
--------------------------------------------------------------------------------
/octave/lte_pre_coder_dl.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012, 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_pre_coder_dl
18 | % Description: Generates a block of vectors to be mapped onto
19 | % resources on each downlink antenna port
20 | % Inputs: x - Block of input vectors
21 | % N_ant - Number of antennas
22 | % style - Style of mapping (tx_diversity or
23 | % spatial_multiplex)
24 | % Outputs: y - Block of output vectors
25 | % Spec: 3GPP TS 36.211 section 6.3.4 v10.1.0
26 | % Notes: Only supports single antenna or tx_diversity.
27 | % Rev History: Ben Wojtowicz 10/28/2011 Created
28 | % Ben Wojtowicz 01/29/2012 Fixed license statement
29 | % Ben Wojtowicz 02/19/2012 Added newline to EOF
30 | % Ben Wojtowicz 03/26/2014 Changed name to lte_pre_coder_dl
31 | %
32 | function [y] = lte_pre_coder_dl(x, N_ant, style)
33 |
34 | [v, M_layer_symb] = size(x);
35 |
36 | if(N_ant == 1)
37 | % 36.211 Section 6.3.4.1 v10.1.0
38 | M_ap_symb = M_layer_symb;
39 | for(n=0:M_ap_symb-1)
40 | y(n+1) = x(n+1);
41 | endfor
42 | elseif(N_ant == 2)
43 | if(style == "tx_diversity")
44 | % 36.211 section 6.3.4.3 v10.1.0
45 | for(n=0:M_layer_symb-1)
46 | y(0+1, 2*n+1) = (1/sqrt(2))*(x(0+1, n+1));
47 | y(1+1, 2*n+1) = (1/sqrt(2))*(-conj(x(1+1, n+1)));
48 | y(0+1, 2*n+1+1) = (1/sqrt(2))*(x(1+1, n+1));
49 | y(1+1, 2*n+1+1) = (1/sqrt(2))*(conj(x(0+1, n+1)));
50 | endfor
51 | M_ap_symb = 2*M_layer_symb;
52 | else
53 | printf("ERROR: Style %s not supported\n", style);
54 | y = 0;
55 | endif
56 | elseif(N_ant == 4)
57 | if(style == "tx_diversity")
58 | % 36.211 section 6.3.4.3 v10.1.0
59 | for(n=0:M_layer_symb-1)
60 | y(0+1, 4*n+1) = (1/sqrt(2))*(x(0+1, n+1));
61 | y(1+1, 4*n+1) = 0;
62 | y(2+1, 4*n+1) = (1/sqrt(2))*(-conj(x(1+1, n+1)));
63 | y(3+1, 4*n+1) = 0;
64 | y(0+1, 4*n+1+1) = (1/sqrt(2))*(x(1+1, n+1));
65 | y(1+1, 4*n+1+1) = 0;
66 | y(2+1, 4*n+1+1) = (1/sqrt(2))*(conj(x(0+1, n+1)));
67 | y(3+1, 4*n+1+1) = 0;
68 | y(0+1, 4*n+1+2) = 0;
69 | y(1+1, 4*n+1+2) = (1/sqrt(2))*(x(2+1, n+1));
70 | y(2+1, 4*n+1+2) = 0;
71 | y(3+1, 4*n+1+2) = (1/sqrt(2))*(-conj(x(3+1, n+1)));
72 | y(0+1, 4*n+1+3) = 0;
73 | y(1+1, 4*n+1+3) = (1/sqrt(2))*(x(3+1, n+1));
74 | y(2+1, 4*n+1+3) = 0;
75 | y(3+1, 4*n+1+3) = (1/sqrt(2))*(conj(x(2+1, n+1)));
76 | endfor
77 | if(x(2+1,M_layer_symb) ~= 10 && x(3+1,M_layer_symb) ~= 10)
78 | M_ap_symb = 4*M_layer_symb;
79 | else
80 | M_ap_symb = 4*M_layer_symb - 2;
81 | y = y(:,1:M_ap_symb);
82 | endif
83 | else
84 | printf("ERROR: Style %s not supported\n", style);
85 | y = 0;
86 | endif
87 | else
88 | printf("ERROR: Number of antenna ports %u not supported\n", N_ant);
89 | y = 0;
90 | endif
91 | endfunction
92 |
--------------------------------------------------------------------------------
/LTE_file_recorder/hdr/LTE_file_recorder_flowgraph.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2013,2015 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: LTE_file_recorder_flowgraph.h
21 |
22 | Description: Contains all the definitions for the LTE file recorder
23 | gnuradio flowgraph.
24 |
25 | Revision History
26 | ---------- ------------- --------------------------------------------
27 | 08/26/2013 Ben Wojtowicz Created file
28 | 11/13/2013 Ben Wojtowicz Added support for USRP B2X0.
29 | 11/30/2013 Ben Wojtowicz Added support for bladeRF.
30 | 12/06/2015 Ben Wojtowicz Changed boost::mutex to pthread_mutex_t.
31 |
32 | *******************************************************************************/
33 |
34 | #ifndef __LTE_FILE_RECORDER_FLOWGRAPH_H__
35 | #define __LTE_FILE_RECORDER_FLOWGRAPH_H__
36 |
37 | /*******************************************************************************
38 | INCLUDES
39 | *******************************************************************************/
40 |
41 | #include "LTE_file_recorder_interface.h"
42 | #include
43 | #include
44 | #include
45 |
46 | /*******************************************************************************
47 | DEFINES
48 | *******************************************************************************/
49 |
50 |
51 | /*******************************************************************************
52 | FORWARD DECLARATIONS
53 | *******************************************************************************/
54 |
55 |
56 | /*******************************************************************************
57 | TYPEDEFS
58 | *******************************************************************************/
59 |
60 | typedef enum{
61 | LTE_FILE_RECORDER_HW_TYPE_RTL_SDR = 0,
62 | LTE_FILE_RECORDER_HW_TYPE_HACKRF,
63 | LTE_FILE_RECORDER_HW_TYPE_USRP,
64 | LTE_FILE_RECORDER_HW_TYPE_BLADERF,
65 | LTE_FILE_RECORDER_HW_TYPE_UNKNOWN,
66 | }LTE_FILE_RECORDER_HW_TYPE_ENUM;
67 |
68 | /*******************************************************************************
69 | CLASS DECLARATIONS
70 | *******************************************************************************/
71 |
72 | class LTE_file_recorder_flowgraph
73 | {
74 | public:
75 | // Singleton
76 | static LTE_file_recorder_flowgraph* get_instance(void);
77 | static void cleanup(void);
78 |
79 | // Flowgraph
80 | bool is_started(void);
81 | LTE_FILE_RECORDER_STATUS_ENUM start(uint16 earfcn, std::string file_name);
82 | LTE_FILE_RECORDER_STATUS_ENUM stop(void);
83 |
84 | private:
85 | // Singleton
86 | static LTE_file_recorder_flowgraph *instance;
87 | LTE_file_recorder_flowgraph();
88 | ~LTE_file_recorder_flowgraph();
89 |
90 | // Run
91 | static void* run_thread(void *inputs);
92 |
93 | // Variables
94 | gr::top_block_sptr top_block;
95 | osmosdr::source::sptr samp_src;
96 | gr::blocks::file_sink::sptr file_sink;
97 |
98 | pthread_t start_thread;
99 | pthread_mutex_t start_mutex;
100 | bool started;
101 | };
102 |
103 | #endif /* __LTE_FILE_RECORDER_FLOWGRAPH_H__ */
104 |
--------------------------------------------------------------------------------
/liblte/hdr/liblte_common.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2012-2016 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: liblte_common.h
21 |
22 | Description: Contains all the common definitions for the LTE library.
23 |
24 | Revision History
25 | ---------- ------------- --------------------------------------------
26 | 02/26/2012 Ben Wojtowicz Created file.
27 | 07/21/2013 Ben Wojtowicz Added a common message structure.
28 | 06/15/2014 Ben Wojtowicz Split LIBLTE_MSG_STRUCT into bit and byte
29 | aligned messages.
30 | 08/03/2014 Ben Wojtowicz Commonized value_2_bits and bits_2_value.
31 | 11/29/2014 Ben Wojtowicz Added liblte prefix to value_2_bits and
32 | bits_2_value.
33 | 07/14/2015 Ben Wojtowicz Added an error code for DCIs with invalid
34 | contents.
35 | 07/03/2016 Ben Wojtowicz Increased the maximum message size.
36 |
37 | *******************************************************************************/
38 |
39 | #ifndef __LIBLTE_COMMON_H__
40 | #define __LIBLTE_COMMON_H__
41 |
42 | /*******************************************************************************
43 | INCLUDES
44 | *******************************************************************************/
45 |
46 | #include "typedefs.h"
47 | #include
48 |
49 | /*******************************************************************************
50 | DEFINES
51 | *******************************************************************************/
52 |
53 | // FIXME: This was chosen arbitrarily
54 | #define LIBLTE_MAX_MSG_SIZE 5512
55 |
56 | /*******************************************************************************
57 | TYPEDEFS
58 | *******************************************************************************/
59 |
60 | typedef enum{
61 | LIBLTE_SUCCESS = 0,
62 | LIBLTE_ERROR_INVALID_INPUTS,
63 | LIBLTE_ERROR_DECODE_FAIL,
64 | LIBLTE_ERROR_INVALID_CRC,
65 | LIBLTE_ERROR_INVALID_CONTENTS,
66 | }LIBLTE_ERROR_ENUM;
67 |
68 | typedef struct{
69 | uint32 N_bits;
70 | uint8 msg[LIBLTE_MAX_MSG_SIZE];
71 | }LIBLTE_BIT_MSG_STRUCT;
72 |
73 | typedef struct{
74 | uint32 N_bytes;
75 | uint8 msg[LIBLTE_MAX_MSG_SIZE];
76 | }LIBLTE_BYTE_MSG_STRUCT;
77 |
78 | /*******************************************************************************
79 | DECLARATIONS
80 | *******************************************************************************/
81 |
82 | /*********************************************************************
83 | Name: liblte_value_2_bits
84 |
85 | Description: Converts a value to a bit string
86 | *********************************************************************/
87 | void liblte_value_2_bits(uint32 value,
88 | uint8 **bits,
89 | uint32 N_bits);
90 |
91 | /*********************************************************************
92 | Name: liblte_bits_2_value
93 |
94 | Description: Converts a bit string to a value
95 | *********************************************************************/
96 | uint32 liblte_bits_2_value(uint8 **bits,
97 | uint32 N_bits);
98 |
99 | #endif /* __LIBLTE_COMMON_H__ */
100 |
--------------------------------------------------------------------------------
/octave/lte_ulsch_channel_interleaver.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_ulsch_channel_interleaver
18 | % Description: Interleaves ULSCH data with RI and ACK control information
19 | % Inputs: data_bits - Data bits to interleave
20 | % ri_bits - RI control bits to interleave
21 | % ack_bits - ACK control bits to interleave
22 | % N_l - Number of layers
23 | % Q_m - Number of bits per modulation symbol
24 | % Outputs: out_bits - Interleaved bits
25 | % Spec: 3GPP TS 36.212 section 5.2.2.8 v10.1.0
26 | % Notes: Only supporting normal CP
27 | % Rev History: Ben Wojtowicz 03/26/2014 Created
28 | %
29 | function [out_bits] = lte_ulsch_channel_interleaver(data_bits, ri_bits, ack_bits, N_l, Q_m)
30 |
31 | N_pusch_symbs = 12;
32 | ri_column_set = [1, 4, 7, 10];
33 | ack_column_set = [2, 3, 8, 9];
34 |
35 | [N_data_bits, data_vec_len] = size(data_bits);
36 | [N_ri_bits, ri_vec_len] = size(ri_bits);
37 | [N_ack_bits, ack_vec_len] = size(ack_bits);
38 |
39 | % Step 1: Define C_mux
40 | C_mux = N_pusch_symbs;
41 |
42 | % Step 2: Define R_mux and R_prime_mux
43 | H_prime = N_data_bits;
44 | H_vec_len = data_vec_len;
45 | if(ri_vec_len == H_vec_len)
46 | H_prime_total = H_prime + N_ri_bits;
47 | else
48 | H_prime_total = H_prime;
49 | endif
50 | R_mux = (H_prime_total*Q_m*N_l)/C_mux;
51 | R_prime_mux = R_mux/(Q_m*N_l);
52 |
53 | % Initialize the matricies
54 | y_idx = -10000*ones(1,C_mux*R_prime_mux);
55 | y_mat = zeros(1,C_mux*R_mux);
56 |
57 | % Step 3: Interleave the RI control bits
58 | if(ri_vec_len == H_vec_len)
59 | n = 0;
60 | m = 0;
61 | r = R_prime_mux-1;
62 | while(n < N_ri_bits)
63 | C_ri = ri_column_set(m+1);
64 | y_idx(r*C_mux+C_ri+1) = 1;
65 | for(k=0:(Q_m*N_l)-1)
66 | y_mat(C_mux*r*Q_m*N_l + C_ri*Q_m*N_l + k + 1) = ri_bits(n+1,k+1);
67 | endfor
68 | n = n + 1;
69 | r = R_prime_mux - 1 - floor(n/4);
70 | m = mod(m+3, 4);
71 | endwhile
72 | endif
73 |
74 | % Step 4: Interleave the data bits
75 | n = 0;
76 | k = 0;
77 | while(k < H_prime)
78 | if(y_idx(n+1) == -10000)
79 | y_idx(n+1) = 1;
80 | for(m=0:(Q_m*N_l)-1)
81 | y_mat(n*(Q_m*N_l) + m + 1) = data_bits(k+1,m+1);
82 | endfor
83 | k = k + 1;
84 | endif
85 | n = n + 1;
86 | endwhile
87 |
88 | % Step 5: Interleave the ACK control bits
89 | if(ack_vec_len == H_vec_len)
90 | n = 0;
91 | m = 0;
92 | r = R_prime_mux-1;
93 | while(n < N_ack_bits)
94 | C_ack = ack_column_set(m+1);
95 | y_idx(r*C_mux+C_ack+1) = 2;
96 | for(k=0:(Q_m*N_l)-1)
97 | y_mat(C_mux*r*Q_m*N_l + C_ack*Q_m*N_l + k + 1) = ack_bits(n+1,k+1);
98 | endfor
99 | n = n + 1;
100 | r = R_prime_mux - 1 - floor(n/4);
101 | m = mod(m+3, 4);
102 | endwhile
103 | endif
104 |
105 | % Step 6: Read out the bits
106 | idx = 0;
107 | for(n=0:C_mux-1)
108 | for(m=0:R_prime_mux-1)
109 | for(k=0:H_vec_len-1)
110 | out_bits(idx+1) = y_mat(m*C_mux*Q_m*N_l + n*Q_m*N_l + k + 1);
111 | idx = idx + 1;
112 | endfor
113 | endfor
114 | endfor
115 | endfunction
116 |
--------------------------------------------------------------------------------
/LTE_fdd_enodeb/src/LTE_fdd_enb_timer.cc:
--------------------------------------------------------------------------------
1 | #line 2 "LTE_fdd_enb_timer.cc" // Make __FILE__ omit the path
2 | /*******************************************************************************
3 |
4 | Copyright 2014 Ben Wojtowicz
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU Affero General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU Affero General Public License for more details.
15 |
16 | You should have received a copy of the GNU Affero General Public License
17 | along with this program. If not, see .
18 |
19 | *******************************************************************************
20 |
21 | File: LTE_fdd_enb_timer.cc
22 |
23 | Description: Contains all the implementations for the LTE FDD eNodeB
24 | timer class.
25 |
26 | Revision History
27 | ---------- ------------- --------------------------------------------
28 | 05/04/2014 Ben Wojtowicz Created file
29 | 06/15/2014 Ben Wojtowicz Added millisecond resolution and seperated
30 | the callback calling functionality.
31 | 11/29/2014 Ben Wojtowicz Added timer reset support.
32 |
33 | *******************************************************************************/
34 |
35 | /*******************************************************************************
36 | INCLUDES
37 | *******************************************************************************/
38 |
39 | #include "LTE_fdd_enb_timer.h"
40 |
41 | /*******************************************************************************
42 | DEFINES
43 | *******************************************************************************/
44 |
45 |
46 | /*******************************************************************************
47 | TYPEDEFS
48 | *******************************************************************************/
49 |
50 |
51 | /*******************************************************************************
52 | GLOBAL VARIABLES
53 | *******************************************************************************/
54 |
55 |
56 | /*******************************************************************************
57 | CLASS IMPLEMENTATIONS
58 | *******************************************************************************/
59 |
60 | /******************/
61 | /* Callback */
62 | /******************/
63 | LTE_fdd_enb_timer_cb::LTE_fdd_enb_timer_cb()
64 | {
65 | }
66 | LTE_fdd_enb_timer_cb::LTE_fdd_enb_timer_cb(FuncType f, void* o)
67 | {
68 | func = f;
69 | obj = o;
70 | }
71 | void LTE_fdd_enb_timer_cb::operator()(uint32 id)
72 | {
73 | return (*func)(obj, id);
74 | }
75 |
76 | /********************************/
77 | /* Constructor/Destructor */
78 | /********************************/
79 | LTE_fdd_enb_timer::LTE_fdd_enb_timer(uint32 m_seconds,
80 | uint32 _id,
81 | LTE_fdd_enb_timer_cb _cb)
82 | {
83 | cb = _cb;
84 | id = _id;
85 | expiry_m_seconds = m_seconds;
86 | current_m_seconds = 0;
87 | }
88 | LTE_fdd_enb_timer::~LTE_fdd_enb_timer()
89 | {
90 | }
91 |
92 | /****************************/
93 | /* External Interface */
94 | /****************************/
95 | void LTE_fdd_enb_timer::reset(void)
96 | {
97 | current_m_seconds = 0;
98 | }
99 | void LTE_fdd_enb_timer::increment(void)
100 | {
101 | current_m_seconds++;
102 | }
103 | bool LTE_fdd_enb_timer::expired(void)
104 | {
105 | bool exp = false;
106 |
107 | if(current_m_seconds > expiry_m_seconds)
108 | {
109 | exp = true;
110 | }
111 |
112 | return(exp);
113 | }
114 | void LTE_fdd_enb_timer::call_callback(void)
115 | {
116 | if(expired())
117 | {
118 | cb(id);
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/LTE_fdd_enodeb/hdr/LTE_fdd_enb_timer_mgr.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2014-2015 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: LTE_fdd_enb_timer_mgr.h
21 |
22 | Description: Contains all the definitions for the LTE FDD eNodeB
23 | timer manager.
24 |
25 | Revision History
26 | ---------- ------------- --------------------------------------------
27 | 05/04/2014 Ben Wojtowicz Created file
28 | 06/15/2014 Ben Wojtowicz Added millisecond resolution.
29 | 08/03/2014 Ben Wojtowicz Added an invalid timer id.
30 | 11/29/2014 Ben Wojtowicz Added timer reset support.
31 | 02/15/2015 Ben Wojtowicz Moved to new message queue for timer ticks.
32 | 12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t.
33 |
34 | *******************************************************************************/
35 |
36 | #ifndef __LTE_FDD_ENB_TIMER_MGR_H__
37 | #define __LTE_FDD_ENB_TIMER_MGR_H__
38 |
39 | /*******************************************************************************
40 | INCLUDES
41 | *******************************************************************************/
42 |
43 | #include "LTE_fdd_enb_interface.h"
44 | #include "LTE_fdd_enb_timer.h"
45 | #include "LTE_fdd_enb_msgq.h"
46 |
47 | /*******************************************************************************
48 | DEFINES
49 | *******************************************************************************/
50 |
51 | #define LTE_FDD_ENB_INVALID_TIMER_ID 0xFFFFFFFF
52 |
53 | /*******************************************************************************
54 | FORWARD DECLARATIONS
55 | *******************************************************************************/
56 |
57 |
58 | /*******************************************************************************
59 | TYPEDEFS
60 | *******************************************************************************/
61 |
62 |
63 | /*******************************************************************************
64 | CLASS DECLARATIONS
65 | *******************************************************************************/
66 |
67 | class LTE_fdd_enb_timer_mgr
68 | {
69 | public:
70 | // Singleton
71 | static LTE_fdd_enb_timer_mgr* get_instance(void);
72 | static void cleanup(void);
73 |
74 | // Start/Stop
75 | void start(LTE_fdd_enb_msgq *from_mac, LTE_fdd_enb_interface *iface);
76 | void stop(void);
77 |
78 | // External Interface
79 | LTE_FDD_ENB_ERROR_ENUM start_timer(uint32 m_seconds, LTE_fdd_enb_timer_cb cb, uint32 *timer_id);
80 | LTE_FDD_ENB_ERROR_ENUM stop_timer(uint32 timer_id);
81 | LTE_FDD_ENB_ERROR_ENUM reset_timer(uint32 timer_id);
82 |
83 | private:
84 | // Singleton
85 | static LTE_fdd_enb_timer_mgr *instance;
86 | LTE_fdd_enb_timer_mgr();
87 | ~LTE_fdd_enb_timer_mgr();
88 |
89 | // Start/Stop
90 | LTE_fdd_enb_interface *interface;
91 | sem_t start_sem;
92 | bool started;
93 |
94 | // Communication
95 | void handle_msg(LTE_FDD_ENB_MESSAGE_STRUCT &msg);
96 | void handle_tick(void);
97 | LTE_fdd_enb_msgq *msgq_from_mac;
98 |
99 | // Timer Storage
100 | sem_t timer_sem;
101 | std::map timer_map;
102 | uint32 next_timer_id;
103 | };
104 |
105 | #endif /* __LTE_FDD_ENB_TIMER_MGR_H__ */
106 |
--------------------------------------------------------------------------------
/octave/lte_ulsch_channel_deinterleaver.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2014 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_ulsch_channel_deinterleaver
18 | % Description: Deinterleaves ULSCH data from RI and ACK control information
19 | % Inputs: in_bits - Interleaved bits
20 | % N_ri_bits - Number of RI control bits to deinterleave
21 | % N_ack_bits - Number of ACK control bits to deinterleave
22 | % N_l - Number of layers
23 | % Q_m - Number of bits per modulation symbol
24 | % Outputs: data_bits - Deinterleaved data bits
25 | % ri_bits - Deinterleaved RI control bits
26 | % ack_bits - Deinterleaved ACK control bits
27 | % Spec: 3GPP TS 36.212 section 5.2.2.8 v10.1.0
28 | % Notes: Only supporting normal CP
29 | % Rev History: Ben Wojtowicz 03/26/2014 Created
30 | %
31 | function [data_bits, ri_bits, ack_bits] = lte_ulsch_channel_deinterleaver(in_bits, N_ri_bits, N_ack_bits, N_l, Q_m)
32 |
33 | N_pusch_symbs = 12;
34 | ri_column_set = [1, 4, 7, 10];
35 | ack_column_set = [2, 3, 8, 9];
36 |
37 | % Step 1: Define C_mux
38 | C_mux = N_pusch_symbs;
39 |
40 | % Step 2: Define R_mux and R_prime_mux
41 | H_prime = length(in_bits)/(Q_m*N_l);
42 | H_prime_total = H_prime + N_ri_bits;
43 | R_mux = (H_prime_total*Q_m*N_l)/C_mux;
44 | R_prime_mux = R_mux/(Q_m*N_l);
45 |
46 | % Initialize the matricies
47 | y_idx = -10000*ones(1,C_mux*R_prime_mux);
48 | y_mat = zeros(1,C_mux*R_mux);
49 |
50 | % Step 6: Construct matrix
51 | idx = 0;
52 | for(n=0:C_mux-1)
53 | for(m=0:R_prime_mux-1)
54 | for(k=0:(Q_m*N_l)-1)
55 | y_mat(m*C_mux*Q_m*N_l + n*Q_m*N_l + k + 1) = in_bits(idx+1);
56 | idx = idx + 1;
57 | endfor
58 | endfor
59 | endfor
60 |
61 | % Step 5: Deinterleave the ACK control bits
62 | n = 0;
63 | m = 0;
64 | r = R_prime_mux-1;
65 | if(N_ack_bits == 0)
66 | ack_bits = 0;
67 | endif
68 | while(n < N_ack_bits)
69 | C_ack = ack_column_set(m+1);
70 | for(k=0:(Q_m*N_l)-1)
71 | ack_bits(n+1,k+1) = y_mat(C_mux*r*Q_m*N_l + C_ack*Q_m*N_l + k + 1);
72 | endfor
73 | y_idx(C_mux*r + C_ack + 1) = 2;
74 | n = n + 1;
75 | r = R_prime_mux - 1 - floor(n/4);
76 | m = mod(m+3, 4);
77 | endwhile
78 |
79 | % Step 3: Deinterleave the RI control bits
80 | n = 0;
81 | m = 0;
82 | r = R_prime_mux-1;
83 | if(N_ri_bits == 0)
84 | ri_bits = 0;
85 | endif
86 | while(n < N_ri_bits)
87 | C_ri = ri_column_set(m+1);
88 | for(k=0:(Q_m*N_l)-1)
89 | ri_bits(n+1,k+1) = y_mat(C_mux*r*Q_m*N_l + C_ri*Q_m*N_l + k + 1);
90 | endfor
91 | y_idx(C_mux*r + C_ri + 1) = 1;
92 | n = n + 1;
93 | r = R_prime_mux - 1 - floor(n/4);
94 | m = mod(m+3, 4);
95 | endwhile
96 |
97 | % Step 4: Interleave the data bits
98 | n = 0;
99 | k = 0;
100 | while(k < H_prime)
101 | if(y_idx(n+1) == -10000)
102 | y_idx(n+1) = 1;
103 | for(m=0:(Q_m*N_l)-1)
104 | data_bits(k+1,m+1) = y_mat(n*(Q_m*N_l) + m + 1);
105 | endfor
106 | k = k + 1;
107 | elseif(y_idx(n+1) == 2)
108 | data_bits(k+1,:) = -10000*ones(1,Q_m*N_l);
109 | k = k + 1;
110 | endif
111 | n = n + 1;
112 | endwhile
113 | endfunction
114 |
--------------------------------------------------------------------------------
/libtools/hdr/libtools_helpers.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2017 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: libtools_helpers.h
21 |
22 | Description: Contains all the definitions for helper functions.
23 |
24 | Revision History
25 | ---------- ------------- --------------------------------------------
26 | 07/29/2017 Ben Wojtowicz Created file
27 |
28 | *******************************************************************************/
29 |
30 | #ifndef __LIBTOOLS_HELPERS_H__
31 | #define __LIBTOOLS_HELPERS_H__
32 |
33 | /*******************************************************************************
34 | INCLUDES
35 | *******************************************************************************/
36 |
37 | #include "typedefs.h"
38 | #include
39 |
40 | /*******************************************************************************
41 | DEFINES
42 | *******************************************************************************/
43 |
44 |
45 | /*******************************************************************************
46 | FORWARD DECLARATIONS
47 | *******************************************************************************/
48 |
49 |
50 | /*******************************************************************************
51 | TYPEDEFS
52 | *******************************************************************************/
53 |
54 |
55 | /*******************************************************************************
56 | FUNCTION DECLARATIONS
57 | *******************************************************************************/
58 |
59 | /*********************************************************************
60 | Name: to_string
61 |
62 | Description: Converts various types to a string.
63 | *********************************************************************/
64 | std::string to_string(int32 value);
65 | std::string to_string(uint32 value);
66 | std::string to_string(int64 value);
67 | std::string to_string(uint64 value);
68 | std::string to_string(uint64 value, uint32 num_digits);
69 | std::string to_string(uint8 *value, uint32 num_bytes);
70 | std::string to_string(double value);
71 | std::string to_string(const char *value);
72 |
73 | /*********************************************************************
74 | Name: to_number
75 |
76 | Description: Converts a string to various types.
77 | *********************************************************************/
78 | // FIXME: Use template
79 | bool to_number(std::string str, uint16 *number);
80 | bool to_number(std::string str, uint64 *number);
81 | bool to_number(std::string str, uint32 num_digits, uint16 *number);
82 | bool to_number(std::string str, uint32 num_digits, uint64 *number);
83 | bool to_number(std::string str, uint32 num_bytes, uint8 *number);
84 |
85 | /*********************************************************************
86 | Name: get_formatted_time
87 |
88 | Description: Populates a string with a formatted time.
89 | *********************************************************************/
90 | void get_formatted_time(std::string &time_string);
91 |
92 | /*********************************************************************
93 | Name: is_string_valid_as_number
94 |
95 | Description: Checks if the string is valid as a number (base 10
96 | or 16) and is of a specific number of digits.
97 | *********************************************************************/
98 | bool is_string_valid_as_number(std::string str, uint32 num_digits, uint8 base);
99 |
100 | #endif /* __LIBTOOLS_HELPERS_H__ */
101 |
--------------------------------------------------------------------------------
/octave/lte_generate_sss.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2011-2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_generate_sss
18 | % Description: Generates LTE secondary synchronization signals
19 | % Inputs: N_id_1 - Physical layer cell identity group
20 | % N_id_2 - Physical layer identity
21 | % Outputs: sss_d_u_0 - The sequence d(n) used for the secondary
22 | % synchronization signal, an interleaved
23 | % concatenation of two length-31 binary
24 | % sequences for subframe 0
25 | % Outputs: sss_d_u_5 - The sequence d(n) used for the secondary
26 | % synchronization signal, an interleaved
27 | % concatenation of two length-31 binary
28 | % sequences for subframe 5
29 | % Spec: 3GPP TS 36.211 section 6.11.2.1 v10.1.0
30 | % Notes: None
31 | % Rev History: Ben Wojtowicz 10/28/2011 Created
32 | % Ben Wojtowicz 01/29/2012 Fixed license statement
33 | %
34 | function [sss_d_u_0, sss_d_u_5] = lte_generate_sss(N_id_1, N_id_2)
35 | % Validate N_id_1
36 | if(~(N_id_1 >= 0 && N_id_1 <= 167))
37 | printf("ERROR: Invalid N_id_1 (%u)\n", N_id_1);
38 | sss_d_u_0 = 0;
39 | sss_d_u_5 = 0;
40 | return;
41 | endif
42 |
43 | % Validate N_id_2
44 | if(~(N_id_2 >= 0 && N_id_2 <= 2))
45 | printf("ERROR: Invalid N_id_2 (%u)\n", N_id_2);
46 | sss_d_u_0 = 0;
47 | sss_d_u_5 = 0;
48 | return;
49 | endif
50 |
51 | % Generate m0 and m1
52 | q_prime = floor(N_id_1/30);
53 | q = floor((N_id_1 + (q_prime*(q_prime+1)/2))/30);
54 | m_prime = N_id_1 + (q*(q+1)/2);
55 | m0 = mod(m_prime, 31);
56 | m1 = mod((m0 + floor(m_prime/31) + 1), 31);
57 |
58 | % Generate s_tilda
59 | x_s_tilda(0+1) = 0;
60 | x_s_tilda(1+1) = 0;
61 | x_s_tilda(2+1) = 0;
62 | x_s_tilda(3+1) = 0;
63 | x_s_tilda(4+1) = 1;
64 | for(i_hat=0:25)
65 | x_s_tilda(i_hat+5+1) = mod((x_s_tilda(i_hat+2+1) + x_s_tilda(i_hat+1)), 2);
66 | endfor
67 | for(idx=0:30)
68 | s_tilda(idx+1) = 1 - 2*x_s_tilda(idx+1);
69 | endfor
70 |
71 | % Generate c_tilda
72 | x_c_tilda(0+1) = 0;
73 | x_c_tilda(1+1) = 0;
74 | x_c_tilda(2+1) = 0;
75 | x_c_tilda(3+1) = 0;
76 | x_c_tilda(4+1) = 1;
77 | for(i_hat=0:25)
78 | x_c_tilda(i_hat+5+1) = mod((x_c_tilda(i_hat+3+1) + x_c_tilda(i_hat+1)), 2);
79 | endfor
80 | for(idx=0:30)
81 | c_tilda(idx+1) = 1 - 2*x_c_tilda(idx+1);
82 | endfor
83 |
84 | % Generate z_tilda
85 | x_z_tilda(0+1) = 0;
86 | x_z_tilda(1+1) = 0;
87 | x_z_tilda(2+1) = 0;
88 | x_z_tilda(3+1) = 0;
89 | x_z_tilda(4+1) = 1;
90 | for(i_hat=0:25)
91 | x_z_tilda(i_hat+5+1) = mod((x_z_tilda(i_hat+4+1) + x_z_tilda(i_hat+2+1) + x_z_tilda(i_hat+1+1) + x_z_tilda(i_hat+1)), 2);
92 | endfor
93 | for(idx=0:30)
94 | z_tilda(idx+1) = 1 - 2*x_z_tilda(idx+1);
95 | endfor
96 |
97 | % Generate s0_m0 and s1_m1
98 | for(n=0:30)
99 | s0_m0(n+1) = s_tilda(mod(n + m0, 31)+1);
100 | s1_m1(n+1) = s_tilda(mod(n + m1, 31)+1);
101 | endfor
102 |
103 | % Generate c0 and c1
104 | for(n=0:30)
105 | c0(n+1) = c_tilda(mod(n + N_id_2, 31)+1);
106 | c1(n+1) = c_tilda(mod(n + N_id_2 + 3, 31)+1);
107 | endfor
108 |
109 | % Generate z1_m0 and z1_m1
110 | for(n=0:30)
111 | z1_m0(n+1) = z_tilda(mod(n + mod(m0, 8), 31)+1);
112 | z1_m1(n+1) = z_tilda(mod(n + mod(m1, 8), 31)+1);
113 | endfor
114 |
115 | % Generate SSS
116 | for(n=0:30)
117 | sss_d_u_0(2*n+1) = s0_m0(n+1) * c0(n+1);
118 | sss_d_u_5(2*n+1) = s1_m1(n+1) * c0(n+1);
119 |
120 | sss_d_u_0(2*n+1+1) = s1_m1(n+1) * c1(n+1) * z1_m0(n+1);
121 | sss_d_u_5(2*n+1+1) = s0_m0(n+1) * c1(n+1) * z1_m1(n+1);
122 | endfor
123 | endfunction
124 |
--------------------------------------------------------------------------------
/octave/lte_code_block_desegmentation.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_code_block_desegmentation
18 | % Description: Performs code block desegmentation for turbo coded channels
19 | % Inputs: in_bits - Bits to be code block desegmented
20 | % tbs - Transport block size
21 | % Outputs: out_bits - Code block desegmented bits
22 | % Spec: 3GPP TS 36.212 section 5.1.2 v10.1.0
23 | % Notes: None
24 | % Rev History: Ben Wojtowicz 01/10/2012 Created
25 | %
26 | function [out_bits] = lte_code_block_desegmentation(in_bits, tbs)
27 | % Define K table 36.212 Table 5.1.3-3 v10.1.0
28 | k_table = [40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,256,264,272,280,288,296,304,312,320,328,336,344,352,360,368,376,384,392,400,408,416,424,432,440,448,456,464,472,480,488,496,504,512,528,544,560,576,592,608,624,640,656,672,688,704,720,736,752,768,784,800,816,832,848,864,880,896,912,928,944,960,976,992,1008,1024,1056,1088,1120,1152,1184,1216,1248,1280,1312,1344,1376,1408,1440,1472,1504,1536,1568,1600,1632,1664,1696,1728,1760,1792,1824,1856,1888,1920,1952,1984,2016,2048,2112,2176,2240,2304,2368,2432,2496,2560,2624,2688,2752,2816,2880,2944,3008,3072,3136,3200,3264,3328,3392,3456,3520,3584,3648,3712,3776,3840,3904,3968,4032,4096,4160,4224,4288,4352,4416,4480,4544,4608,4672,4736,4800,4864,4928,4992,5056,5120,5184,5248,5312,5376,5440,5504,5568,5632,5696,5760,5824,5888,5952,6016,6080,6144];
29 |
30 | % Define Z
31 | Z = 6144;
32 |
33 | % Determine L, C, B', K+, C+, K-, and C-
34 | if(tbs+24 <= Z)
35 | L = 0;
36 | C = 1;
37 | B_prime = tbs+24;
38 | for(n=0:length(k_table)-1)
39 | if(C*k_table(n+1) >= B_prime)
40 | K_plus = k_table(n+1);
41 | break;
42 | endif
43 | endfor
44 | K_minus = 0;
45 | C_plus = 1;
46 | C_minus = 0;
47 | else
48 | B = tbs+24;
49 | L = 24;
50 | C = ceil(B/(Z-L));
51 | B_prime = B + C*L;
52 | for(n=0:length(k_table)-1)
53 | if(C*k_table(n+1) >= B_prime)
54 | K_plus = k_table(n+1);
55 | break;
56 | endif
57 | endfor
58 | for(n=length(k_table)-1:-1:0)
59 | if(k_table(n+1) < K_plus)
60 | K_minus = k_table(n+1);
61 | break;
62 | endif
63 | endfor
64 | K_delta = K_plus - K_minus;
65 | C_minus = floor((C*K_plus - B_prime)/K_delta);
66 | C_plus = C - C_minus;
67 | endif
68 |
69 | % Determine the number of filler bits
70 | F = C_plus*K_plus + C_minus*K_minus - B_prime;
71 |
72 | % Determine the output bits
73 | k_idx = F;
74 | s_idx = 0;
75 | for(r_idx=0:C-1)
76 | % Determine the K for this code block
77 | if(r_idx < C_minus)
78 | K_r = K_minus;
79 | else
80 | K_r = K_plus;
81 | endif
82 |
83 | % Check CRC if more than 1 code block is present
84 | if(C > 1)
85 | calc_p_cb_bits = lte_calc_crc(in_bits(r_idx+1,1:K_r-24), "24B");
86 | p_cb_bits = in_bits(r_idx+1,K_r-24+1:K_r);
87 | ber = 0;
88 | for(n=0:length(p_cb_bits)-1)
89 | if(p_cb_bits(n+1) ~= calc_p_cb_bits(n+1))
90 | ber = ber + 1;
91 | endif
92 | endfor
93 | if(ber == 0)
94 | printf("CB CRC CORRECT\n");
95 | else
96 | printf("CB CRC INCORRECT\n");
97 | endif
98 | endif
99 |
100 | % Create the output bits
101 | while(k_idx < K_r - L)
102 | out_bits(s_idx+1) = in_bits(r_idx+1,k_idx+1);
103 | k_idx = k_idx + 1;
104 | s_idx = s_idx + 1;
105 | endwhile
106 | k_idx = 0;
107 | endfor
108 | endfunction
109 |
--------------------------------------------------------------------------------
/LTE_file_recorder/hdr/LTE_file_recorder_interface.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2013,2015 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: LTE_file_recorder_interface.h
21 |
22 | Description: Contains all the definitions for the LTE file recorder
23 | interface.
24 |
25 | Revision History
26 | ---------- ------------- --------------------------------------------
27 | 08/26/2013 Ben Wojtowicz Created file
28 | 12/06/2015 Ben Wojtowicz Changed boost::mutex to pthread_mutex_t.
29 |
30 | *******************************************************************************/
31 |
32 | #ifndef __LTE_FILE_RECORDER_INTERFACE_H__
33 | #define __LTE_FILE_RECORDER_INTERFACE_H__
34 |
35 | /*******************************************************************************
36 | INCLUDES
37 | *******************************************************************************/
38 |
39 | #include "liblte_interface.h"
40 | #include "libtools_socket_wrap.h"
41 | #include
42 |
43 | /*******************************************************************************
44 | DEFINES
45 | *******************************************************************************/
46 |
47 | #define LTE_FILE_RECORDER_DEFAULT_CTRL_PORT 25000
48 |
49 | /*******************************************************************************
50 | FORWARD DECLARATIONS
51 | *******************************************************************************/
52 |
53 |
54 | /*******************************************************************************
55 | TYPEDEFS
56 | *******************************************************************************/
57 |
58 | typedef enum{
59 | LTE_FILE_RECORDER_STATUS_OK = 0,
60 | LTE_FILE_RECORDER_STATUS_FAIL,
61 | }LTE_FILE_RECORDER_STATUS_ENUM;
62 |
63 | /*******************************************************************************
64 | CLASS DECLARATIONS
65 | *******************************************************************************/
66 |
67 | class LTE_file_recorder_interface
68 | {
69 | public:
70 | // Singleton
71 | static LTE_file_recorder_interface* get_instance(void);
72 | static void cleanup(void);
73 |
74 | // Communication
75 | void set_ctrl_port(int16 port);
76 | void start_ctrl_port(void);
77 | void stop_ctrl_port(void);
78 | void send_ctrl_msg(std::string msg);
79 | void send_ctrl_info_msg(std::string msg);
80 | void send_ctrl_status_msg(LTE_FILE_RECORDER_STATUS_ENUM status, std::string msg);
81 | static void handle_ctrl_msg(std::string msg);
82 | static void handle_ctrl_connect(void);
83 | static void handle_ctrl_disconnect(void);
84 | static void handle_ctrl_error(LIBTOOLS_SOCKET_WRAP_ERROR_ENUM err);
85 | pthread_mutex_t ctrl_mutex;
86 | libtools_socket_wrap *ctrl_socket;
87 | int16 ctrl_port;
88 | static bool ctrl_connected;
89 |
90 | // Get/Set
91 | bool get_shutdown(void);
92 |
93 | private:
94 | // Singleton
95 | static LTE_file_recorder_interface *instance;
96 | LTE_file_recorder_interface();
97 | ~LTE_file_recorder_interface();
98 |
99 | // Handlers
100 | void handle_read(std::string msg);
101 | void handle_write(std::string msg);
102 | void handle_start(void);
103 | void handle_stop(void);
104 | void handle_help(void);
105 |
106 | // Reads/Writes
107 | void read_earfcn(void);
108 | void write_earfcn(std::string earfcn_str);
109 | void read_file_name(void);
110 | void write_file_name(std::string file_name_str);
111 |
112 | // Variables
113 | std::string file_name;
114 | uint16 earfcn;
115 | bool shutdown;
116 | };
117 |
118 | #endif /* __LTE_FILE_RECORDER_INTERFACE_H__ */
119 |
--------------------------------------------------------------------------------
/octave/lte_sib1_pack.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_sib1_pack
18 | % Description: Packs all of the fields into a System Information Type 1 message
19 | % Inputs: mcc - Mobile Country Code
20 | % mnc - Mobile Network Code
21 | % tac - Tracking Area Code
22 | % cell_id - Cell identity
23 | % q_rx_lev_min - Minimum RX level for access to the network
24 | % freq_band - Frequency band used
25 | % Outputs: sib1 - Packed System Information Type 1 message
26 | % Spec: 3GPP TS 36.331 section 6.2.2 v10.0.0
27 | % Notes: None
28 | % Rev History: Ben Wojtowicz 1/22/2012 Created
29 | %
30 | function [sib1] = lte_sib1_pack(mcc, mnc, tac, cell_id, q_rx_lev_min, freq_band)
31 | % Check mcc
32 | if(!(mcc >= 0 && mcc <= 999))
33 | printf("ERROR: Invalid mcc %u (range is 0 to 999)\n", mcc);
34 | sib1 = 0;
35 | return;
36 | endif
37 |
38 | % Check mnc
39 | if(!(mnc >= 0 && mnc <= 999))
40 | printf("ERROR: Invalid mnc %u (range is 0 to 999)\n", mnc);
41 | sib1 = 0;
42 | return;
43 | endif
44 |
45 | % Check tac
46 | if(!(tac >= 0 && tac <= 65535))
47 | printf("ERROR: Invalid TAC %u (range is 0 to 65535)\n", tac);
48 | sib1 = 0;
49 | return;
50 | endif
51 |
52 | % Check cell_id
53 | if(!(cell_id >= 0 && cell_id <= 268435455))
54 | printf("ERROR: Invalid cell_id %u (range is 0 to 268435455)\n", cell_id);
55 | sib1 = 0;
56 | return;
57 | endif
58 |
59 | % Check q_rx_lev_min
60 | if(!(q_rx_lev_min >= -70 && q_rx_lev_min <= -22))
61 | printf("ERROR: Invalid q_rx_lev_min %u (range is -70 to -22)\n", q_rx_lev_min);
62 | sib1 = 0;
63 | return;
64 | endif
65 |
66 | % Check freq_band
67 | if(!(freq_band >= 1 && freq_band <= 43))
68 | printf("ERROR: Invalid freq_band %u (range is 1 to 43)\n", freq_band);
69 | sib1 = 0;
70 | return;
71 | endif
72 |
73 | % Convert MCC and MNC to digits
74 | tmp_mcc = mcc;
75 | tmp_mnc = mnc;
76 | for(n=0:2)
77 | mcc_dig(n+1) = floor(tmp_mcc/10^(2-n));
78 | mnc_dig(n+1) = floor(tmp_mnc/10^(2-n));
79 | tmp_mcc = tmp_mcc - mcc_dig(n+1)*10^(2-n);
80 | tmp_mnc = tmp_mnc - mnc_dig(n+1)*10^(2-n);
81 | endfor
82 |
83 | % Optional field indicators
84 | act_opt_field_inds = [0,0,0];
85 |
86 | % Cell Access Related Info
87 | act_num_plmn_ids = [0,0,0];
88 | act_mcc = [1,cmn_dec2bin(mcc_dig(1),4),cmn_dec2bin(mcc_dig(2),4),cmn_dec2bin(mcc_dig(3),4)];
89 | act_mnc = [1,cmn_dec2bin(mnc_dig(1),4),cmn_dec2bin(mnc_dig(2),4),cmn_dec2bin(mnc_dig(3),4)];
90 | act_crou = [1];
91 | act_tac = [cmn_dec2bin(tac, 16)];
92 | act_cell_id = [cmn_dec2bin(cell_id, 28)];
93 | act_cb = [1];
94 | act_ifr = [1];
95 | act_csg_ind = [0];
96 | act_car_info = [0,act_num_plmn_ids,act_mcc,act_mnc,act_crou,act_tac,act_cell_id,act_cb,act_ifr,act_csg_ind];
97 |
98 | % Cell Selection Info
99 | act_q_rx_lev_min = cmn_dec2bin(q_rx_lev_min+70, 6);
100 | act_cs_info = [0,act_q_rx_lev_min];
101 |
102 | % Frequency Band Indicator
103 | act_f_band_ind = cmn_dec2bin(freq_band-1, 6);
104 |
105 | % Scheduling Info List (size 1-32)
106 | act_sched_info_list_size = [0,0,0,0,0];
107 | act_si_periodicity = [0,0,0];
108 | act_sib_mapping_info_size = [0,0,0,0,0];
109 | act_sched_info_list = [act_sched_info_list_size, act_si_periodicity, act_sib_mapping_info_size];
110 |
111 | % SI Window Length
112 | act_si_window_len = [0,0,0];
113 |
114 | % SI Value Tag
115 | act_si_value_tag = [0,0,0,0,0];
116 |
117 | % Pack SIB1
118 | sib1 = [act_opt_field_inds,act_car_info,act_cs_info,act_f_band_ind,act_sched_info_list,act_si_window_len,act_si_value_tag];
119 | endfunction
120 |
--------------------------------------------------------------------------------
/octave/lte_code_block_segmentation.m:
--------------------------------------------------------------------------------
1 | %
2 | % Copyright 2012 Ben Wojtowicz
3 | %
4 | % This program is free software: you can redistribute it and/or modify
5 | % it under the terms of the GNU Affero General Public License as published by
6 | % the Free Software Foundation, either version 3 of the License, or
7 | % (at your option) any later version.
8 | %
9 | % This program is distributed in the hope that it will be useful,
10 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | % GNU Affero General Public License for more details.
13 | %
14 | % You should have received a copy of the GNU Affero General Public License
15 | % along with this program. If not, see .
16 | %
17 | % Function: lte_code_block_segmentation
18 | % Description: Performs code block segmentation for turbo coded channels
19 | % Inputs: in_bits - Bits to be code block segmented
20 | % Outputs: out_s - Structure containing all of the segmented
21 | % code blocks and sizes and the number of filler
22 | % bits
23 | % Spec: 3GPP TS 36.212 section 5.1.2 v10.1.0
24 | % Notes: None
25 | % Rev History: Ben Wojtowicz 01/09/2012 Created
26 | %
27 | function [out_s] = lte_code_block_segmentation(in_bits)
28 | % Define K table 36.212 Table 5.1.3-3 v10.1.0
29 | k_table = [40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,256,264,272,280,288,296,304,312,320,328,336,344,352,360,368,376,384,392,400,408,416,424,432,440,448,456,464,472,480,488,496,504,512,528,544,560,576,592,608,624,640,656,672,688,704,720,736,752,768,784,800,816,832,848,864,880,896,912,928,944,960,976,992,1008,1024,1056,1088,1120,1152,1184,1216,1248,1280,1312,1344,1376,1408,1440,1472,1504,1536,1568,1600,1632,1664,1696,1728,1760,1792,1824,1856,1888,1920,1952,1984,2016,2048,2112,2176,2240,2304,2368,2432,2496,2560,2624,2688,2752,2816,2880,2944,3008,3072,3136,3200,3264,3328,3392,3456,3520,3584,3648,3712,3776,3840,3904,3968,4032,4096,4160,4224,4288,4352,4416,4480,4544,4608,4672,4736,4800,4864,4928,4992,5056,5120,5184,5248,5312,5376,5440,5504,5568,5632,5696,5760,5824,5888,5952,6016,6080,6144];
30 |
31 | % Define Z
32 | Z = 6144;
33 |
34 | % Determine L, C, B', K+, C+, K-, and C-
35 | if(length(in_bits) <= Z)
36 | L = 0;
37 | C = 1;
38 | B_prime = length(in_bits);
39 | for(n=0:length(k_table)-1)
40 | if(C*k_table(n+1) >= B_prime)
41 | K_plus = k_table(n+1);
42 | break;
43 | endif
44 | endfor
45 | K_minus = 0;
46 | C_plus = 1;
47 | C_minus = 0;
48 | else
49 | B = length(in_bits);
50 | L = 24;
51 | C = ceil(B/(Z-L));
52 | B_prime = B + C*L;
53 | for(n=0:length(k_table)-1)
54 | if(C*k_table(n+1) >= B_prime)
55 | K_plus = k_table(n+1);
56 | break;
57 | endif
58 | endfor
59 | for(n=length(k_table)-1:-1:0)
60 | if(k_table(n+1) < K_plus)
61 | K_minus = k_table(n+1);
62 | break;
63 | endif
64 | endfor
65 | K_delta = K_plus - K_minus;
66 | C_minus = floor((C*K_plus - B_prime)/K_delta);
67 | C_plus = C - C_minus;
68 | endif
69 |
70 | % Determine the number of filler bits and add them
71 | out_s.num_cb = C;
72 | out_s.F = C_plus*K_plus + C_minus*K_minus - B_prime;
73 | for(n=0:out_s.F-1)
74 | tmp.bits(n+1) = 10000;
75 | endfor
76 |
77 | % Add the input bits
78 | k_idx = out_s.F;
79 | s_idx = 0;
80 | for(r_idx=0:C-1)
81 | % Determine the K for this code block
82 | if(r_idx < C_minus)
83 | K_r = K_minus;
84 | else
85 | K_r = K_plus;
86 | endif
87 | tmp.len = K_r;
88 |
89 | % Add the input bits
90 | while(k_idx < K_r - L)
91 | tmp.bits(k_idx+1) = in_bits(s_idx+1);
92 | k_idx = k_idx + 1;
93 | s_idx = s_idx + 1;
94 | endwhile
95 |
96 | % Add CRC if more than 1 code block is needed
97 | if(C > 1)
98 | tmp.len = tmp.len + L;
99 | p_cb_bits = lte_calc_crc(out_bits(r_idx+1,:), "24B");
100 | while(k_idx < K_r)
101 | tmp.bits(k_idx+1) = p_cb_bits(k_idx+L-K_r+1);
102 | k_idx = k_idx + 1;
103 | endwhile
104 | endif
105 | k_idx = 0;
106 |
107 | % Store this code block into the output structure
108 | out_s.cb(r_idx+1) = tmp;
109 | endfor
110 | endfunction
111 |
--------------------------------------------------------------------------------
/LTE_fdd_enodeb/hdr/LTE_fdd_enb_pdcp.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | Copyright 2013-2017 Ben Wojtowicz
4 |
5 | This program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU Affero General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU Affero General Public License for more details.
14 |
15 | You should have received a copy of the GNU Affero General Public License
16 | along with this program. If not, see .
17 |
18 | *******************************************************************************
19 |
20 | File: LTE_fdd_enb_pdcp.h
21 |
22 | Description: Contains all the definitions for the LTE FDD eNodeB
23 | packet data convergence protocol layer.
24 |
25 | Revision History
26 | ---------- ------------- --------------------------------------------
27 | 11/09/2013 Ben Wojtowicz Created file
28 | 05/04/2014 Ben Wojtowicz Added communication to RLC and RRC.
29 | 11/29/2014 Ben Wojtowicz Added communication to IP gateway.
30 | 12/16/2014 Ben Wojtowicz Added ol extension to message queues.
31 | 02/15/2015 Ben Wojtowicz Moved to new message queue.
32 | 12/06/2015 Ben Wojtowicz Changed boost::mutex to sem_t.
33 | 02/13/2016 Ben Wojtowicz Removed boost message queue include.
34 | 07/29/2017 Ben Wojtowicz Moved away from singleton pattern.
35 |
36 | *******************************************************************************/
37 |
38 | #ifndef __LTE_FDD_ENB_PDCP_H__
39 | #define __LTE_FDD_ENB_PDCP_H__
40 |
41 | /*******************************************************************************
42 | INCLUDES
43 | *******************************************************************************/
44 |
45 | #include "LTE_fdd_enb_cnfg_db.h"
46 | #include "LTE_fdd_enb_msgq.h"
47 |
48 | /*******************************************************************************
49 | DEFINES
50 | *******************************************************************************/
51 |
52 |
53 | /*******************************************************************************
54 | FORWARD DECLARATIONS
55 | *******************************************************************************/
56 |
57 |
58 | /*******************************************************************************
59 | TYPEDEFS
60 | *******************************************************************************/
61 |
62 |
63 | /*******************************************************************************
64 | CLASS DECLARATIONS
65 | *******************************************************************************/
66 |
67 | class LTE_fdd_enb_pdcp
68 | {
69 | public:
70 | // Constructor/Destructor
71 | LTE_fdd_enb_pdcp();
72 | ~LTE_fdd_enb_pdcp();
73 |
74 | // Start/Stop
75 | void start(LTE_fdd_enb_msgq *from_rlc, LTE_fdd_enb_msgq *from_rrc, LTE_fdd_enb_msgq *from_gw, LTE_fdd_enb_msgq *to_rlc, LTE_fdd_enb_msgq *to_rrc, LTE_fdd_enb_msgq *to_gw, LTE_fdd_enb_interface *iface);
76 | void stop(void);
77 |
78 | // External interface
79 | void update_sys_info(void);
80 |
81 | private:
82 | // Start/Stop
83 | LTE_fdd_enb_interface *interface;
84 | sem_t start_sem;
85 | bool started;
86 |
87 | // Communication
88 | void handle_rlc_msg(LTE_FDD_ENB_MESSAGE_STRUCT &msg);
89 | void handle_rrc_msg(LTE_FDD_ENB_MESSAGE_STRUCT &msg);
90 | void handle_gw_msg(LTE_FDD_ENB_MESSAGE_STRUCT &msg);
91 | LTE_fdd_enb_msgq *msgq_from_rlc;
92 | LTE_fdd_enb_msgq *msgq_from_rrc;
93 | LTE_fdd_enb_msgq *msgq_from_gw;
94 | LTE_fdd_enb_msgq *msgq_to_rlc;
95 | LTE_fdd_enb_msgq *msgq_to_rrc;
96 | LTE_fdd_enb_msgq *msgq_to_gw;
97 |
98 | // RLC Message Handlers
99 | void handle_pdu_ready(LTE_FDD_ENB_PDCP_PDU_READY_MSG_STRUCT *pdu_ready);
100 |
101 | // RRC Message Handlers
102 | void handle_sdu_ready(LTE_FDD_ENB_PDCP_SDU_READY_MSG_STRUCT *sdu_ready);
103 |
104 | // GW Message Handlers
105 | void handle_data_sdu_ready(LTE_FDD_ENB_PDCP_DATA_SDU_READY_MSG_STRUCT *data_sdu_ready);
106 |
107 | // Parameters
108 | sem_t sys_info_sem;
109 | LTE_FDD_ENB_SYS_INFO_STRUCT sys_info;
110 | };
111 |
112 | #endif /* __LTE_FDD_ENB_PDCP_H__ */
113 |
--------------------------------------------------------------------------------