From 551f32cc209989167c9f3d19dde7011c958e3bb0 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Sun, 8 Apr 2018 13:00:08 -0700 Subject: [PATCH] more splitting eNB/UE files/directories --- cmake_targets/CMakeLists.txt | 175 +- cmake_targets/lte-simulators/CMakeLists.txt | 2 +- common/ran_context.h | 6 +- openair1/PHY/CODING/{defs.h => coding_defs.h} | 17 +- .../PHY/CODING/{extern.h => coding_extern.h} | 0 openair1/PHY/CODING/{vars.h => coding_vars.h} | 0 openair1/PHY/LTE_TRANSPORT/dci.h | 5 + openair1/PHY/LTE_TRANSPORT/mdci.h | 4 + openair1/PHY/LTE_TRANSPORT/pcfich.c | 121 - openair1/PHY/LTE_TRANSPORT/pch.c | 54 - openair1/PHY/LTE_TRANSPORT/phich.c | 10 +- openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c | 209 -- openair1/PHY/LTE_TRANSPORT/pmch.c | 798 ------ openair1/PHY/LTE_TRANSPORT/prach.c | 1234 +-------- openair1/PHY/LTE_TRANSPORT/prach.h | 35 - openair1/PHY/LTE_TRANSPORT/prach_common.c | 749 ++++++ openair1/PHY/LTE_TRANSPORT/print_stats.c | 804 ------ openair1/PHY/LTE_TRANSPORT/proto.h | 2275 ----------------- openair1/PHY/LTE_TRANSPORT/pucch.c | 1079 +------- openair1/PHY/LTE_TRANSPORT/pucch_common.c | 276 ++ openair1/PHY/LTE_TRANSPORT/sss.c | 380 --- openair1/PHY/LTE_TRANSPORT/transport_common.h | 177 ++ .../LTE_TRANSPORT/{defs.h => transport_eNB.h} | 477 +--- openair1/PHY/LTE_TRANSPORT/transport_proto.h | 601 +++++ .../PHY/LTE_TRANSPORT/{uci.h => uci_common.h} | 0 openair1/PHY/LTE_TRANSPORT/uci_tools.c | 751 ------ .../initial_sync.c | 0 openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c | 115 - openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c | 737 ------ openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c | 107 +- .../PHY/LTE_UE_TRANSPORT/power_control_ue.c | 152 ++ openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c | 533 ++++ openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c | 877 +++++++ .../srs_modulation.c | 0 openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c | 420 +++ openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h | 335 +++ openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c | 264 ++ openair1/PHY/TOOLS/{defs.h => tools_defs.h} | 0 .../PHY/TOOLS/{extern.h => tools_extern.h} | 0 openair1/PHY/TOOLS/{vars.h => tools_vars.h} | 0 openair1/PHY/{defs.h => defs_eNB.h} | 1533 ++++------- openair1/PHY/impl_defs_lte.h | 1210 --------- openair1/PHY/impl_defs_top.h | 2 +- openair1/PHY/{extern.h => phy_extern.h} | 2 +- openair1/PHY/{vars.h => phy_vars.h} | 0 openair1/SCHED/fapi_l1.c | 4 - openair1/SCHED/fapi_l1.h | 8 +- openair1/SCHED/{defs.h => sched_eNB.h} | 0 .../SCHED/{extern.h => sched_eNB_extern.h} | 0 openair1/SCHED/{vars.h => sched_eNB_vars.h} | 0 .../phy_procedures_lte_ue.c | 0 openair1/{SCHED => SCHED_UE}/pucch_pc.c | 0 openair1/{SCHED => SCHED_UE}/pusch_pc.c | 0 openair1/{SCHED => SCHED_UE}/srs_pc.c | 0 openair2/LAYER2/MAC/{defs.h => mac.h} | 7 +- .../LAYER2/MAC/{extern.h => mac_extern.h} | 27 +- openair2/LAYER2/MAC/{proto.h => mac_proto.h} | 2 +- openair2/LAYER2/MAC/{vars.h => mac_vars.h} | 0 openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 2 +- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h | 2 +- .../LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h | 2 +- .../RLC/AM_v9.3.0/rlc_am_status_report.h | 2 +- openair2/LAYER2/RLC/rlc.h | 2 +- openair2/PHY_INTERFACE/IF_Module.h | 5 +- openair2/RRC/{LITE => LTE}/L2_interface.c | 0 .../RRC/{LITE => LTE}/L2_interface_common.c | 0 openair2/RRC/{LITE => LTE}/L2_interface_ue.c | 0 .../RRC/{LITE => LTE}/MESSAGES/Makefile.inc | 0 .../RRC/{LITE => LTE}/MESSAGES/README.txt | 0 .../RRC/{LITE => LTE}/MESSAGES/asn1_msg.c | 0 .../RRC/{LITE => LTE}/MESSAGES/asn1_msg.h | 0 .../{LITE => LTE}/MESSAGES/asn1_msg_NB_IoT.c | 0 .../{LITE => LTE}/MESSAGES/asn1_msg_NB_IoT.h | 0 .../RRC/{LITE => LTE}/MESSAGES/asn1_patch | 0 .../MESSAGES/asn1c/ASN1_files/36331-860.txt | 0 .../MESSAGES/asn1c/ASN1_files/36331-a20.txt | 0 .../MESSAGES/asn1c/ASN1_files/36331-ah0.txt | 0 .../MESSAGES/asn1c/ASN1_files/36331-c60.txt | 0 .../EUTRA-InterNodeDefinitions-86.asn | 0 .../EUTRA-InterNodeDefinitions-a20.asn | 0 .../EUTRA-InterNodeDefinitions-ah0.asn | 0 .../EUTRA-InterNodeDefinitions-c60.asn | 0 .../ASN1_files/EUTRA-RRC-Definitions-86.asn | 0 .../EUTRA-RRC-Definitions-a20-lola.asn | 0 .../ASN1_files/EUTRA-RRC-Definitions-a20.asn | 0 .../EUTRA-RRC-Definitions-a20.asn.orig | 0 .../ASN1_files/EUTRA-RRC-Definitions-ah0.asn | 0 .../ASN1_files/EUTRA-RRC-Definitions-c60.asn | 0 .../ASN1_files/EUTRA-UE-Variables-86.asn | 0 .../ASN1_files/EUTRA-UE-Variables-a20.asn | 0 .../ASN1_files/EUTRA-UE-Variables-ah0.asn | 0 .../ASN1_files/EUTRA-UE-Variables-c60.asn | 0 .../MESSAGES/asn1c/ASN1_files/RRC-e30.asn | 0 .../ASN1_files/extract_asn1_from_spec.pl | 0 openair2/RRC/{LITE => LTE}/defs_NB_IoT.h | 0 openair2/RRC/{LITE => LTE}/extern_NB_IoT.h | 2 +- openair2/RRC/{LITE => LTE}/plmn_data.h | 0 openair2/RRC/{LITE => LTE}/proto_NB_IoT.h | 2 +- openair2/RRC/{LITE => LTE}/rrc_2_rrm_msg.c | 0 openair2/RRC/{LITE => LTE}/rrc_UE.c | 0 openair2/RRC/{LITE => LTE}/rrc_UE_ral.c | 0 openair2/RRC/{LITE => LTE}/rrc_UE_ral.h | 0 openair2/RRC/{LITE => LTE}/rrc_common.c | 0 openair2/RRC/{LITE/defs.h => LTE/rrc_defs.h} | 8 +- openair2/RRC/{LITE => LTE}/rrc_eNB.c | 0 openair2/RRC/{LITE => LTE}/rrc_eNB_GTPV1U.c | 0 openair2/RRC/{LITE => LTE}/rrc_eNB_GTPV1U.h | 0 openair2/RRC/{LITE => LTE}/rrc_eNB_S1AP.c | 0 openair2/RRC/{LITE => LTE}/rrc_eNB_S1AP.h | 0 .../RRC/{LITE => LTE}/rrc_eNB_UE_context.c | 0 .../RRC/{LITE => LTE}/rrc_eNB_UE_context.h | 0 openair2/RRC/{LITE => LTE}/rrc_eNB_ral.c | 0 openair2/RRC/{LITE => LTE}/rrc_eNB_ral.h | 0 .../RRC/{LITE/extern.h => LTE/rrc_extern.h} | 0 .../RRC/{LITE/proto.h => LTE/rrc_proto.h} | 2 +- .../RRC/{LITE => LTE}/rrc_rrm_interface.c | 0 .../RRC/{LITE => LTE}/rrc_rrm_interface.h | 0 openair2/RRC/{LITE => LTE}/rrc_types.h | 0 openair2/RRC/{LITE => LTE}/rrc_types_NB_IoT.h | 0 openair2/RRC/{LITE/vars.h => LTE/rrc_vars.h} | 0 openair2/RRC/{LITE => LTE}/rrm_2_rrc_msg.c | 0 openair2/RRC/{LITE => LTE}/utils.c | 0 openair2/UTIL/MEM/mem_block.c | 2 +- 123 files changed, 4987 insertions(+), 11618 deletions(-) rename openair1/PHY/CODING/{defs.h => coding_defs.h} (96%) rename openair1/PHY/CODING/{extern.h => coding_extern.h} (100%) rename openair1/PHY/CODING/{vars.h => coding_vars.h} (100%) delete mode 100644 openair1/PHY/LTE_TRANSPORT/pch.c delete mode 100644 openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c delete mode 100644 openair1/PHY/LTE_TRANSPORT/prach.h create mode 100644 openair1/PHY/LTE_TRANSPORT/prach_common.c delete mode 100644 openair1/PHY/LTE_TRANSPORT/print_stats.c delete mode 100644 openair1/PHY/LTE_TRANSPORT/proto.h create mode 100644 openair1/PHY/LTE_TRANSPORT/pucch_common.c create mode 100644 openair1/PHY/LTE_TRANSPORT/transport_common.h rename openair1/PHY/LTE_TRANSPORT/{defs.h => transport_eNB.h} (55%) create mode 100644 openair1/PHY/LTE_TRANSPORT/transport_proto.h rename openair1/PHY/LTE_TRANSPORT/{uci.h => uci_common.h} (100%) rename openair1/PHY/{LTE_TRANSPORT => LTE_UE_TRANSPORT}/initial_sync.c (100%) create mode 100644 openair1/PHY/LTE_UE_TRANSPORT/power_control_ue.c create mode 100644 openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c create mode 100644 openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c rename openair1/PHY/{LTE_TRANSPORT => LTE_UE_TRANSPORT}/srs_modulation.c (100%) create mode 100644 openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c create mode 100644 openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h create mode 100644 openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c rename openair1/PHY/TOOLS/{defs.h => tools_defs.h} (100%) rename openair1/PHY/TOOLS/{extern.h => tools_extern.h} (100%) rename openair1/PHY/TOOLS/{vars.h => tools_vars.h} (100%) rename openair1/PHY/{defs.h => defs_eNB.h} (53%) rename openair1/PHY/{extern.h => phy_extern.h} (99%) rename openair1/PHY/{vars.h => phy_vars.h} (100%) rename openair1/SCHED/{defs.h => sched_eNB.h} (100%) rename openair1/SCHED/{extern.h => sched_eNB_extern.h} (100%) rename openair1/SCHED/{vars.h => sched_eNB_vars.h} (100%) rename openair1/{SCHED => SCHED_UE}/phy_procedures_lte_ue.c (100%) rename openair1/{SCHED => SCHED_UE}/pucch_pc.c (100%) rename openair1/{SCHED => SCHED_UE}/pusch_pc.c (100%) rename openair1/{SCHED => SCHED_UE}/srs_pc.c (100%) rename openair2/LAYER2/MAC/{defs.h => mac.h} (99%) rename openair2/LAYER2/MAC/{extern.h => mac_extern.h} (75%) rename openair2/LAYER2/MAC/{proto.h => mac_proto.h} (99%) rename openair2/LAYER2/MAC/{vars.h => mac_vars.h} (100%) rename openair2/RRC/{LITE => LTE}/L2_interface.c (100%) rename openair2/RRC/{LITE => LTE}/L2_interface_common.c (100%) rename openair2/RRC/{LITE => LTE}/L2_interface_ue.c (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/Makefile.inc (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/README.txt (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1_msg.c (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1_msg.h (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1_msg_NB_IoT.c (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1_msg_NB_IoT.h (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1_patch (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/36331-860.txt (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/36331-a20.txt (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/36331-ah0.txt (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/36331-c60.txt (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-86.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-a20.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-ah0.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-c60.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn.orig (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-ah0.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-c60.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-86.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-a20.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-ah0.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-c60.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/RRC-e30.asn (100%) rename openair2/RRC/{LITE => LTE}/MESSAGES/asn1c/ASN1_files/extract_asn1_from_spec.pl (100%) rename openair2/RRC/{LITE => LTE}/defs_NB_IoT.h (100%) rename openair2/RRC/{LITE => LTE}/extern_NB_IoT.h (98%) rename openair2/RRC/{LITE => LTE}/plmn_data.h (100%) rename openair2/RRC/{LITE => LTE}/proto_NB_IoT.h (99%) rename openair2/RRC/{LITE => LTE}/rrc_2_rrm_msg.c (100%) rename openair2/RRC/{LITE => LTE}/rrc_UE.c (100%) rename openair2/RRC/{LITE => LTE}/rrc_UE_ral.c (100%) rename openair2/RRC/{LITE => LTE}/rrc_UE_ral.h (100%) rename openair2/RRC/{LITE => LTE}/rrc_common.c (100%) rename openair2/RRC/{LITE/defs.h => LTE/rrc_defs.h} (99%) rename openair2/RRC/{LITE => LTE}/rrc_eNB.c (100%) rename openair2/RRC/{LITE => LTE}/rrc_eNB_GTPV1U.c (100%) rename openair2/RRC/{LITE => LTE}/rrc_eNB_GTPV1U.h (100%) rename openair2/RRC/{LITE => LTE}/rrc_eNB_S1AP.c (100%) rename openair2/RRC/{LITE => LTE}/rrc_eNB_S1AP.h (100%) rename openair2/RRC/{LITE => LTE}/rrc_eNB_UE_context.c (100%) rename openair2/RRC/{LITE => LTE}/rrc_eNB_UE_context.h (100%) rename openair2/RRC/{LITE => LTE}/rrc_eNB_ral.c (100%) rename openair2/RRC/{LITE => LTE}/rrc_eNB_ral.h (100%) rename openair2/RRC/{LITE/extern.h => LTE/rrc_extern.h} (100%) rename openair2/RRC/{LITE/proto.h => LTE/rrc_proto.h} (99%) rename openair2/RRC/{LITE => LTE}/rrc_rrm_interface.c (100%) rename openair2/RRC/{LITE => LTE}/rrc_rrm_interface.h (100%) rename openair2/RRC/{LITE => LTE}/rrc_types.h (100%) rename openair2/RRC/{LITE => LTE}/rrc_types_NB_IoT.h (100%) rename openair2/RRC/{LITE/vars.h => LTE/rrc_vars.h} (100%) rename openair2/RRC/{LITE => LTE}/rrm_2_rrc_msg.c (100%) rename openair2/RRC/{LITE => LTE}/utils.c (100%) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index a22babc33f..785dcf7605 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -283,13 +283,13 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) add_list2_option(RRC_ASN1_VERSION "Rel10" "ASN.1 version of RRC interface" "Rel8" "Rel10" "CBA") if (${RRC_ASN1_VERSION} STREQUAL "Rel8") - set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn) + set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn) elseif (${RRC_ASN1_VERSION} STREQUAL "CBA") - set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn) + set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn) elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10") - set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn) + set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn) else() - set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn) + set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn) endif (${RRC_ASN1_VERSION} STREQUAL "Rel8") set (RRC_FULL_DIR ${asn1_generated_dir}/${RRC_ASN1_VERSION}) @@ -314,8 +314,8 @@ file(GLOB rrc_h ${RRC_FULL_DIR}/*.h) set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn1_constants.h) set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code add_library(RRC_LIB ${rrc_h} ${rrc_source} - ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c - ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c) + ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg.c + ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c) include_directories ("${RRC_FULL_DIR}") # add the command to generate the source code @@ -708,7 +708,7 @@ include_directories("${OPENAIR_BIN_DIR}") # add directories to find all include files # the internal rule is to use generic names such as defs.h # but to make it uniq name as adding the relative path in the include directtive -# example: #include "RRC/LITE/defs.h" +# example: #include "RRC/LTE/defs.h" #find_path (include_dirs_all *.h ${OPENAIR_DIR}) #find_path (include_dirs_all *.h PATHS /usr/include NO_CMAKE_PATH) #include_directories("${include_dirs_all}") @@ -740,8 +740,8 @@ include_directories("${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0") include_directories("${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0") include_directories("${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0") include_directories("${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0") -include_directories("${OPENAIR2_DIR}/RRC/LITE/MESSAGES") -include_directories("${OPENAIR2_DIR}/RRC/LITE") +include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES") +include_directories("${OPENAIR2_DIR}/RRC/LTE") include_directories("${OPENAIR3_DIR}/RAL-LTE/INTERFACE-802.21/INCLUDE") include_directories("${OPENAIR3_DIR}/RAL-LTE/LTE_RAL_ENB/INCLUDE") include_directories("${OPENAIR3_DIR}/RAL-LTE/LTE_RAL_UE/INCLUDE") @@ -781,7 +781,7 @@ include_directories("${OPENAIR2_DIR}/UTIL/OTG") include_directories("${OPENAIR2_DIR}/UTIL/CLI") include_directories("${OPENAIR2_DIR}/UTIL/OPT") include_directories("${OPENAIR2_DIR}/UTIL/OMV") -include_directories("${OPENAIR2_DIR}/RRC/LITE/MESSAGES") +include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES") include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/shared") include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/include") include_directories("${OPENAIR_DIR}") @@ -893,9 +893,9 @@ endif() include_directories(${OPENAIR_DIR}/common/utils/msc) set(UTIL_SRC - ${OPENAIR2_DIR}/UTIL/CLI/cli.c - ${OPENAIR2_DIR}/UTIL/CLI/cli_cmd.c - ${OPENAIR2_DIR}/UTIL/CLI/cli_server.c +# ${OPENAIR2_DIR}/UTIL/CLI/cli.c +# ${OPENAIR2_DIR}/UTIL/CLI/cli_cmd.c +# ${OPENAIR2_DIR}/UTIL/CLI/cli_server.c ${OPENAIR2_DIR}/UTIL/FIFO/pad_list.c ${OPENAIR2_DIR}/UTIL/LISTS/list.c ${OPENAIR2_DIR}/UTIL/LISTS/list2.c @@ -903,32 +903,32 @@ set(UTIL_SRC ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c ${OPENAIR2_DIR}/UTIL/MATH/oml.c ${OPENAIR2_DIR}/UTIL/MEM/mem_block.c - ${OPENAIR2_DIR}/UTIL/OCG/OCG.c - ${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c - ${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c - ${OPENAIR2_DIR}/UTIL/OCG/OCG_generate_report.c - ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_filename.c - ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_XML.c - ${OPENAIR2_DIR}/UTIL/OCG/OCG_save_XML.c - ${OPENAIR2_DIR}/UTIL/OMG/common.c - ${OPENAIR2_DIR}/UTIL/OMG/grid.c - ${OPENAIR2_DIR}/UTIL/OMG/job.c - ${OPENAIR2_DIR}/UTIL/OMG/mobility_parser.c - ${OPENAIR2_DIR}/UTIL/OMG/omg.c +# ${OPENAIR2_DIR}/UTIL/OCG/OCG.c +# ${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c +# ${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c +# ${OPENAIR2_DIR}/UTIL/OCG/OCG_generate_report.c +# ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_filename.c +# ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_XML.c +# ${OPENAIR2_DIR}/UTIL/OCG/OCG_save_XML.c +# ${OPENAIR2_DIR}/UTIL/OMG/common.c +# ${OPENAIR2_DIR}/UTIL/OMG/grid.c +# ${OPENAIR2_DIR}/UTIL/OMG/job.c +# ${OPENAIR2_DIR}/UTIL/OMG/mobility_parser.c +# ${OPENAIR2_DIR}/UTIL/OMG/omg.c #${OPENAIR2_DIR}/UTIL/OMG/omg_hashtable.c - ${OPENAIR2_DIR}/UTIL/OMG/rwalk.c - ${OPENAIR2_DIR}/UTIL/OMG/rwp.c - ${OPENAIR2_DIR}/UTIL/OMG/static.c - ${OPENAIR2_DIR}/UTIL/OMG/steadystaterwp.c - ${OPENAIR2_DIR}/UTIL/OMG/trace.c - ${OPENAIR2_DIR}/UTIL/OMG/trace_hashtable.c +# ${OPENAIR2_DIR}/UTIL/OMG/rwalk.c +# ${OPENAIR2_DIR}/UTIL/OMG/rwp.c +# ${OPENAIR2_DIR}/UTIL/OMG/static.c +# ${OPENAIR2_DIR}/UTIL/OMG/steadystaterwp.c +# ${OPENAIR2_DIR}/UTIL/OMG/trace.c +# ${OPENAIR2_DIR}/UTIL/OMG/trace_hashtable.c ${OPENAIR2_DIR}/UTIL/OPT/probe.c - ${OPENAIR2_DIR}/UTIL/OTG/otg_tx.c - ${OPENAIR2_DIR}/UTIL/OTG/otg.c - ${OPENAIR2_DIR}/UTIL/OTG/otg_kpi.c - ${OPENAIR2_DIR}/UTIL/OTG/otg_models.c - ${OPENAIR2_DIR}/UTIL/OTG/otg_form.c - ${OPENAIR2_DIR}/UTIL/OTG/otg_rx.c +# ${OPENAIR2_DIR}/UTIL/OTG/otg_tx.c +# ${OPENAIR2_DIR}/UTIL/OTG/otg.c +# ${OPENAIR2_DIR}/UTIL/OTG/otg_kpi.c +# ${OPENAIR2_DIR}/UTIL/OTG/otg_models.c +# ${OPENAIR2_DIR}/UTIL/OTG/otg_form.c +# ${OPENAIR2_DIR}/UTIL/OTG/otg_rx.c ) add_library(UTIL ${UTIL_SRC}) @@ -967,25 +967,18 @@ add_library(SECU_CN ${SECU_CN_SRC}) set(SCHED_SRC ${OPENAIR1_DIR}/SCHED/fapi_l1.c ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_eNb.c - ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c ${OPENAIR1_DIR}/SCHED/prach_procedures.c ${OPENAIR1_DIR}/SCHED/ru_procedures.c -# ${OPENAIR1_DIR}/SCHED/phy_mac_stub.c - ${OPENAIR1_DIR}/SCHED/pucch_pc.c - ${OPENAIR1_DIR}/SCHED/pusch_pc.c - ${OPENAIR1_DIR}/SCHED/srs_pc.c ) add_library(SCHED_LIB ${SCHED_SRC}) set(SCHED_SRC_UE - ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c + ${OPENAIR1_DIR}/SCHED_UE/phy_procedures_lte_ue.c ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c - ${OPENAIR1_DIR}/SCHED/ru_procedures.c - ${OPENAIR1_DIR}/SCHED/prach_procedures.c - ${OPENAIR1_DIR}/SCHED/pucch_pc.c - ${OPENAIR1_DIR}/SCHED/pusch_pc.c - ${OPENAIR1_DIR}/SCHED/srs_pc.c + ${OPENAIR1_DIR}/SCHED_UE/pucch_pc.c + ${OPENAIR1_DIR}/SCHED_UE/pusch_pc.c + ${OPENAIR1_DIR}/SCHED_UE/srs_pc.c ) add_library(SCHED_UE_LIB ${SCHED_SRC_UE}) @@ -1066,13 +1059,9 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_demodulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/power_control.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_decoding.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/uci_tools.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c @@ -1082,38 +1071,23 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pch.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/srs_modulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/drs_modulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_modulation.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_coding.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_decoding.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c ${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c - ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c - ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c ${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c ${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c ${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_est_freq_offset.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/adjust_gain.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c @@ -1126,11 +1100,9 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/CODING/crc_byte.c ${PHY_TURBOIF} ${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c - ${OPENAIR1_DIR}/PHY/CODING/viterbi.c ${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c ${OPENAIR1_DIR}/PHY/INIT/lte_init.c ${OPENAIR1_DIR}/PHY/INIT/lte_init_ru.c - ${OPENAIR1_DIR}/PHY/INIT/lte_init_ue.c ${OPENAIR1_DIR}/PHY/INIT/init_top.c ${OPENAIR1_DIR}/PHY/INIT/lte_parms.c ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c @@ -1152,45 +1124,33 @@ set(PHY_SRC_UE # depend on code generation from asn1c ${RRC_FULL_DIR}/asn1_constants.h # actual source - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pss.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_demodulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/power_control.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_decoding.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/sss_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/power_control_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/uci_tools.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/edci.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pch.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pbch_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dci_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/phich_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pcfich_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pucch_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/prach_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pmch_ue.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/pch_ue.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/srs_modulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/drs_modulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_modulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_coding.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_decoding.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/srs_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/drs_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/ulsch_coding.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/initial_sync.c ${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c - ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c ${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c ${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c ${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c @@ -1201,10 +1161,8 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_est_freq_offset.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/adjust_gain.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c @@ -1245,8 +1203,7 @@ if (${SMBV}) endif (${SMBV}) if (${COMPILATION_AVX2} STREQUAL "True") - set(PHY_SRC ${PHY_SRC} ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c) - set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c) + set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c) endif () add_library(PHY ${PHY_SRC}) @@ -1260,7 +1217,7 @@ set(RLC_DIR ${OPENAIR2_DIR}/LAYER2/RLC) set(RLC_UM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0) set(RLC_AM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0) set(RLC_TM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0) -set(RRC_DIR ${OPENAIR2_DIR}/RRC/LITE) +set(RRC_DIR ${OPENAIR2_DIR}/RRC/LTE) set(PDCP_DIR ${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0) set(L2_SRC ${OPENAIR2_DIR}/LAYER2/openair2_proc.c @@ -2241,7 +2198,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr ) target_link_libraries (${myExe} - -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group + -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_UE_LIB PHY LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl ) endforeach(myExe) @@ -2278,7 +2235,7 @@ add_executable(test_epc_play_scenario ) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_link_libraries (test_epc_play_scenario - -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} + -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} ) @@ -2435,7 +2392,7 @@ list(APPEND oai_nw_drv_src device.c common.c ioctl.c classifier.c tool.c) if(OAI_NW_DRIVER_USE_NETLINK) list(APPEND oai_nw_drv_src netlink.c) endif() -make_driver(oai_nw_drv ${OPENAIR2_DIR}/NETWORK_DRIVER/LITE ${oai_nw_drv_src}) +make_driver(oai_nw_drv ${OPENAIR2_DIR}/NETWORK_DRIVER/LTE ${oai_nw_drv_src}) # Exmimo board drivers ######################### diff --git a/cmake_targets/lte-simulators/CMakeLists.txt b/cmake_targets/lte-simulators/CMakeLists.txt index ca754449d7..b7e83a92a0 100644 --- a/cmake_targets/lte-simulators/CMakeLists.txt +++ b/cmake_targets/lte-simulators/CMakeLists.txt @@ -8,5 +8,5 @@ set(DEBUG_PHY False) set(MU_RECIEVER False) set(NAS_UE False) set(MESSAGE_CHART_GENERATOR False) - +set(RRC_ASN1_VERSION "Rel14") include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt) diff --git a/common/ran_context.h b/common/ran_context.h index 4380dc65f1..08c05411c9 100644 --- a/common/ran_context.h +++ b/common/ran_context.h @@ -35,11 +35,11 @@ #include <pthread.h> #include "COMMON/platform_constants.h" -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" #include "PHY/types.h" #include "PHY/impl_defs_top.h" #include "PHY/impl_defs_lte.h" -#include "RRC/LITE/defs.h" +#include "RRC/LTE/rrc_defs.h" #include "flexran_agent_defs.h" #include "gtpv1u.h" @@ -49,7 +49,7 @@ #include "gtpv1u_eNB_defs.h" #include "PHY/defs_L1_NB_IoT.h" -#include "RRC/LITE/defs_NB_IoT.h" +#include "RRC/LTE/defs_NB_IoT.h" typedef struct { /// RAN context config file name char *config_file_name; diff --git a/openair1/PHY/CODING/defs.h b/openair1/PHY/CODING/coding_defs.h similarity index 96% rename from openair1/PHY/CODING/defs.h rename to openair1/PHY/CODING/coding_defs.h index 40e19964df..d2975f3f93 100644 --- a/openair1/PHY/CODING/defs.h +++ b/openair1/PHY/CODING/coding_defs.h @@ -29,7 +29,7 @@ #include <stdint.h> -#include "PHY/defs.h" +#include "PHY/defs_common.h" #define CRC24_A 0 #define CRC24_B 1 @@ -75,20 +75,7 @@ int32_t lte_segmentation(uint8_t *input_buffer, uint32_t *Kminus, uint32_t *F); -/** \fn int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs) - \brief this functions calculates the delta MCS in dB based on the lte_segmentation function -\param tbs transport block size -\param nb_rb number of required rb -\param control_only a flag for the type of data -\param ncp cyclic prefix -\param use_srs a flag indicating the use of srs in the current SF -\returns ue_tx_power estimated ue tx power = delat_ mcs + bw_factor -*/ -int16_t estimate_ue_tx_power(uint32_t tbs, - uint32_t nb_rb, - uint8_t control_only, - lte_prefix_type_t ncp, - uint8_t use_srs); + /** \fn uint32_t sub_block_interleaving_turbo(uint32_t D, uint8_t *d,uint8_t *w) \brief This is the subblock interleaving algorithm from 36-212 (Release 8, 8.6 2009-03), pages 15-16. diff --git a/openair1/PHY/CODING/extern.h b/openair1/PHY/CODING/coding_extern.h similarity index 100% rename from openair1/PHY/CODING/extern.h rename to openair1/PHY/CODING/coding_extern.h diff --git a/openair1/PHY/CODING/vars.h b/openair1/PHY/CODING/coding_vars.h similarity index 100% rename from openair1/PHY/CODING/vars.h rename to openair1/PHY/CODING/coding_vars.h diff --git a/openair1/PHY/LTE_TRANSPORT/dci.h b/openair1/PHY/LTE_TRANSPORT/dci.h index 9381dd63fd..d7dd907e77 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.h +++ b/openair1/PHY/LTE_TRANSPORT/dci.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __DCI__h__ +#define __DCI__h__ + #include <stdint.h> /// DCI Format Type 0 (5 MHz,TDD0, 27 bits) @@ -3014,3 +3017,5 @@ struct DCI_INFO_EXTRACTED { uint64_t ap_si_nl_id:3; }; typedef struct DCI_INFO_EXTRACTED DCI_INFO_EXTRACTED_t; + +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/mdci.h b/openair1/PHY/LTE_TRANSPORT/mdci.h index 060227eac0..7be2785308 100644 --- a/openair1/PHY/LTE_TRANSPORT/mdci.h +++ b/openair1/PHY/LTE_TRANSPORT/mdci.h @@ -30,6 +30,9 @@ * \warning */ +#ifndef __M_DCI__H__ +#define __M_DCI__H__ + #include <stdint.h> @@ -467,3 +470,4 @@ struct DCI6_2_di_20MHz { typedef struct DCI6_2_di_20MHz DCI6_2_di_20MHz_t; #define sizeof_DCI6_2_20MHz_t 13 +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/pcfich.c b/openair1/PHY/LTE_TRANSPORT/pcfich.c index b7e24cb87d..01a8fa7a81 100644 --- a/openair1/PHY/LTE_TRANSPORT/pcfich.c +++ b/openair1/PHY/LTE_TRANSPORT/pcfich.c @@ -96,32 +96,6 @@ void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms, } } -void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t subframe, - int16_t *d) -{ - - uint32_t i; - uint8_t reset; - uint32_t x1, x2, s=0; - - reset = 1; - // x1 is set in lte_gold_generic - x2 = ((((2*frame_parms->Nid_cell)+1)*(1+subframe))<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.7.1 - - for (i=0; i<32; i++) { - if ((i&0x1f)==0) { - s = lte_gold_generic(&x1, &x2, reset); - //printf("lte_gold[%d]=%x\n",i,s); - reset = 0; - } - - if (((s>>(i&0x1f))&1) == 1) - d[i]=-d[i]; - - } -} - uint8_t pcfich_b[4][32]= {{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}, {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,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}, @@ -215,98 +189,3 @@ void generate_pcfich(uint8_t num_pdcch_symbols, } -uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t subframe, - LTE_UE_PDCCH *lte_ue_pdcch_vars, - MIMO_mode_t mimo_mode) -{ - - uint8_t pcfich_quad; - uint8_t i,j; - uint16_t reg_offset; - - int32_t **rxdataF_comp = lte_ue_pdcch_vars->rxdataF_comp; - int16_t pcfich_d[32],*pcfich_d_ptr; - int32_t metric,old_metric=-16384; - uint8_t num_pdcch_symbols=3; - uint16_t *pcfich_reg = frame_parms->pcfich_reg; - - // demapping - // loop over 4 quadruplets and lookup REGs - // m=0; - pcfich_d_ptr = pcfich_d; - - for (pcfich_quad=0; pcfich_quad<4; pcfich_quad++) { - reg_offset = (pcfich_reg[pcfich_quad]*4); - - for (i=0; i<4; i++) { - - pcfich_d_ptr[0] = ((int16_t*)&rxdataF_comp[0][reg_offset+i])[0]; // RE component - pcfich_d_ptr[1] = ((int16_t*)&rxdataF_comp[0][reg_offset+i])[1]; // IM component -#ifdef DEBUG_PCFICH - printf("rx_pcfich: quad %d, i %d, offset %d => (%d,%d) => pcfich_d_ptr[0] %d \n",pcfich_quad,i,reg_offset+i, - ((int16_t*)&rxdataF_comp[0][reg_offset+i])[0], - ((int16_t*)&rxdataF_comp[0][reg_offset+i])[1], - pcfich_d_ptr[0]); -#endif - pcfich_d_ptr+=2; - } - - /* - } - else { // ALAMOUTI - for (i=0;i<4;i+=2) { - pcfich_d_ptr[0] = 0; - pcfich_d_ptr[1] = 0; - pcfich_d_ptr[2] = 0; - pcfich_d_ptr[3] = 0; - for (j=0;j<frame_parms->nb_antennas_rx;j++) { - - pcfich_d_ptr[0] += (((int16_t*)&rxdataF_comp[j][reg_offset+i])[0]+ - ((int16_t*)&rxdataF_comp[j+2][reg_offset+i+1])[0]); // RE component - pcfich_d_ptr[1] += (((int16_t*)&rxdataF_comp[j][reg_offset+i])[1] - - ((int16_t*)&rxdataF_comp[j+2][reg_offset+i+1])[1]);// IM component - - pcfich_d_ptr[2] += (((int16_t*)&rxdataF_comp[j][reg_offset+i+1])[0]- - ((int16_t*)&rxdataF_comp[j+2][reg_offset+i])[0]); // RE component - pcfich_d_ptr[3] += (((int16_t*)&rxdataF_comp[j][reg_offset+i+1])[1] + - ((int16_t*)&rxdataF_comp[j+2][reg_offset+i])[1]);// IM component - - - } - - pcfich_d_ptr+=4; - - } - */ - } - - // pcfhich unscrambling - - pcfich_unscrambling(frame_parms,subframe,pcfich_d); - - // pcfich detection - - for (i=0; i<3; i++) { - metric = 0; - - for (j=0; j<32; j++) { - // printf("pcfich_b[%d][%d] %d => pcfich_d[%d] %d\n",i,j,pcfich_b[i][j],j,pcfich_d[j]); - metric += (int32_t)(((pcfich_b[i][j]==0) ? (pcfich_d[j]) : (-pcfich_d[j]))); - } - -#ifdef DEBUG_PCFICH - printf("metric %d : %d\n",i,metric); -#endif - - if (metric > old_metric) { - num_pdcch_symbols = 1+i; - old_metric = metric; - } - } - -#ifdef DEBUG_PCFICH - printf("[PHY] PCFICH detected for %d PDCCH symbols\n",num_pdcch_symbols); -#endif - return(num_pdcch_symbols); -} diff --git a/openair1/PHY/LTE_TRANSPORT/pch.c b/openair1/PHY/LTE_TRANSPORT/pch.c deleted file mode 100644 index 600c5215bd..0000000000 --- a/openair1/PHY/LTE_TRANSPORT/pch.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "assertions.h" - -const unsigned int Ttab[4] = {32,64,128,256}; - -// This function implements the initialization of paging parameters for UE (See Section 7, 36.304) -// It must be called after setting IMSImod1024 during UE startup and after receiving SIB2 -int init_ue_paging_info(PHY_VARS_UE *ue, long defaultPagingCycle, long nB) { - - LTE_DL_FRAME_PARMS *fp = &ue->frame_parms; - - unsigned int T = Ttab[defaultPagingCycle]; - unsigned int N = (nB<=2) ? T : (T>>(nB-2)); - unsigned int Ns = (nB<2) ? (1<<(2-nB)) : 1; - unsigned int UE_ID = ue->IMSImod1024; - unsigned int i_s = (UE_ID/N)%Ns; - - - ue->PF = (T/N) * (UE_ID % N); - - // This implements Section 7.2 from 36.304 - if (Ns==1) - ue->PO = (fp->frame_type==FDD) ? 9 : 0; - else if (Ns==2) - ue->PO = (fp->frame_type==FDD) ? (4+(5*i_s)) : (5*i_s); - else if (Ns==4) - ue->PO = (fp->frame_type==FDD) ? (4*(i_s&1)+(5*(i_s>>1))) : ((i_s&1)+(5*(i_s>>1))); - else - AssertFatal(1==0,"init_ue_paging_info: Ns is %d\n",Ns); - - return(0); -} diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c index 2bd7140c32..2115829a13 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -30,13 +30,13 @@ * \warning */ -#include "PHY/defs.h" +#include "PHY/defs_eNB.h" #include "PHY/extern.h" -#include "SCHED/defs.h" -#include "defs.h" +#include "SCHED/sched_eNB.h" +#include "transport_eNB.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/mac_extern.h" +#include "LAYER2/MAC/mac.h" #include "T.h" diff --git a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c deleted file mode 100644 index 63aac7f091..0000000000 --- a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file PHY/LTE_TRANSPORT/uespec_pilots.c -* \brief Top-level routines for generating DL ue-specific reference signals V12.5 2015-03 -* \author X.JIANG -* \date 2011 -* \version 0.1 -* \company Eurecom -* \email: xiwen.jiangeurecom.fr -* \note -* \warning -*/ -//#include "defs.h" -#include "PHY/defs.h" - -void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, - uint8_t UE_id, - int32_t **txdataF, - int16_t amp, - uint16_t Ntti, - uint8_t beamforming_mode) -{ - - /*LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; - - uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol; - uint8_t second_pilot,aa; - - // printf("Doing TX pilots Nsymb %d, second_pilot %d\n",Nsymb,second_pilot); - - switch(beamforming_mode){ - case 7: - for (tti=0; tti<Ntti; tti++) { - - tti_offset = tti*frame_parms->ofdm_symbol_size*Nsymb; - samples_per_symbol = frame_parms->ofdm_symbol_size; - slot_offset = (tti*2)%20; - - // printf("tti %d : offset %d (slot %d)\n",tti,tti_offset,slot_offset); - //Generate UE specific Pilots - printf("generate_dl_ue_spec:tti_offset=%d\n",tti_offset); - - if(frame_parms->Ncp==0) { - for(aa=0;aa<frame_parms->nb_antennas_tx;aa++){ - //antenna port 5 symbol 0 slot 0 - lte_dl_ue_spec(phy_vars_eNB, - UE_id, - &txdataF[aa][tti_offset+3*samples_per_symbol], - amp, - slot_offset, - 1, - 5, - 0); - - //antenna port 5 symbol 1 slot 0 - lte_dl_ue_spec(phy_vars_eNB, - UE_id, - &txdataF[aa][tti_offset+6*samples_per_symbol], - amp, - slot_offset, - 1, - 5, - 0); - - //antenna port 5 symbol 0 slot 1 - lte_dl_ue_spec(phy_vars_eNB, - UE_id, - &txdataF[aa][tti_offset+9*samples_per_symbol], - amp, - slot_offset+1, - 0, - 5, - 0); - - //antenna port 5 symbol 1 slot 1 - lte_dl_ue_spec(phy_vars_eNB, - UE_id, - &txdataF[aa][tti_offset+12*samples_per_symbol], - amp, - slot_offset+1, - 1, - 5, - 0); - } - } else{ - msg("generate_ue_soec_pilots:Extented Cyclic Prefix for TM7 is not supported yet.\n"); - } - - - } - break; - - case 8: - case 9: - case 10: - default: - msg("[generate_ue_spec_pilots(in uespec_pilots.c)]ERROR:beamforming mode %d is not supported\n",beamforming_mode); - - }*/ -} - -/*int generate_ue_spec_pilots_slot(PHY_VARS_eNB *phy_vars_eNB, - int32_t **txdataF, - int16_t amp, - uint16_t slot, - int first_pilot_only) -{ - - LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; - uint32_t slot_offset,Nsymb,samples_per_symbol; - uint8_t second_pilot; - - if (slot<0 || slot>= 20) { - msg("generate_pilots_slot: slot not in range (%d)\n",slot); - return(-1); - } - - Nsymb = (frame_parms->Ncp==0)?7:6; - second_pilot = (frame_parms->Ncp==0)?4:3; - - - slot_offset = slot*frame_parms->ofdm_symbol_size*Nsymb; - samples_per_symbol = frame_parms->ofdm_symbol_size; - - // printf("tti %d : offset %d (slot %d)\n",tti,tti_offset,slot_offset); - //Generate Pilots - - //antenna 0 symbol 0 slot 0 - lte_dl_cell_spec(phy_vars_eNB, - &txdataF[0][slot_offset], - amp, - slot, - 0, - 0); - - - if (first_pilot_only==0) { - //antenna 0 symbol 3 slot 0 - lte_dl_cell_spec(phy_vars_eNB, - &txdataF[0][slot_offset+(second_pilot*samples_per_symbol)], - amp, - slot, - 1, - 0); - } - - if (frame_parms->nb_antennas_tx > 1) { - if (frame_parms->mode1_flag) { - // antenna 1 symbol 0 slot 0 - lte_dl_cell_spec(phy_vars_eNB, - &txdataF[1][slot_offset], - amp, - slot, - 0, - 0); - - if (first_pilot_only==0) { - // antenna 1 symbol 3 slot 0 - lte_dl_cell_spec(phy_vars_eNB, - &txdataF[1][slot_offset+(second_pilot*samples_per_symbol)], - amp, - slot, - 1, - 0); - } - } else { - - // antenna 1 symbol 0 slot 0 - lte_dl_cell_spec(phy_vars_eNB, - &txdataF[1][slot_offset], - amp, - slot, - 0, - 1); - - if (first_pilot_only == 0) { - // antenna 1 symbol 3 slot 0 - lte_dl_cell_spec(phy_vars_eNB, - &txdataF[1][slot_offset+(second_pilot*samples_per_symbol)], - amp, - slot, - 1, - 1); - } - } - } - - return(0); -}*/ - diff --git a/openair1/PHY/LTE_TRANSPORT/pmch.c b/openair1/PHY/LTE_TRANSPORT/pmch.c index e756df1fe1..e6b364c74d 100644 --- a/openair1/PHY/LTE_TRANSPORT/pmch.c +++ b/openair1/PHY/LTE_TRANSPORT/pmch.c @@ -41,53 +41,6 @@ -void dump_mch(PHY_VARS_UE *ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe) -{ - - unsigned int nsymb_pmch=12; - char fname[32],vname[32]; - int N_RB_DL=ue->frame_parms.N_RB_DL; - - sprintf(fname,"mch_rxF_ext0.m"); - sprintf(vname,"pmch_rxF_ext0"); - write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_ext[0],12*N_RB_DL*nsymb_pmch,1,1); - sprintf(fname,"mch_ch_ext00.m"); - sprintf(vname,"pmch_ch_ext00"); - write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb_pmch,1,1); - /* - write_output("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb_pmch,1,1); - write_output("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb_pmch,1,1); - write_output("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb_pmch,1,1); - write_output("dlsch%d_rho.m","dl_rho",pdsch_vars[eNB_id]->rho[0],12*N_RB_DL*nsymb_pmch,1,1); - */ - sprintf(fname,"mch_rxF_comp0.m"); - sprintf(vname,"pmch_rxF_comp0"); - write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb_pmch,1,1); - sprintf(fname,"mch_rxF_llr.m"); - sprintf(vname,"pmch_llr"); - write_output(fname,vname, ue->pdsch_vars_MCH[eNB_id]->llr[0],coded_bits_per_codeword,1,0); - sprintf(fname,"mch_mag1.m"); - sprintf(vname,"pmch_mag1"); - write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_mag0[0],12*N_RB_DL*nsymb_pmch,1,1); - sprintf(fname,"mch_mag2.m"); - sprintf(vname,"pmch_mag2"); - write_output(fname,vname,ue->pdsch_vars_MCH[eNB_id]->dl_ch_magb0[0],12*N_RB_DL*nsymb_pmch,1,1); - - write_output("mch00_ch0.m","pmch00_ch0", - &(ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0]), - ue->frame_parms.ofdm_symbol_size*12,1,1); - - write_output("rxsig_mch.m","rxs_mch", - &ue->common_vars.rxdata[0][subframe*ue->frame_parms.samples_per_tti], - ue->frame_parms.samples_per_tti,1,1); - - /* - if (PHY_vars_eNB_g) - write_output("txsig_mch.m","txs_mch", - &PHY_vars_eNB_g[0][0]->common_vars.txdata[0][0][subframe*ue->frame_parms.samples_per_tti], - ue->frame_parms.samples_per_tti,1,1);*/ -} - int is_pmch_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms) { @@ -234,51 +187,6 @@ void fill_eNB_dlsch_MCH(PHY_VARS_eNB *eNB,int mcs,int ndi,int rvidx) } -void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id) -{ - - LTE_UE_DLSCH_t *dlsch = ue->dlsch_MCH[eNB_id]; - LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; - - // dlsch->rnti = M_RNTI; - dlsch->harq_processes[0]->mcs = mcs; - dlsch->harq_processes[0]->rvidx = rvidx; - // dlsch->harq_processes[0]->Ndi = ndi; - dlsch->harq_processes[0]->Nl = 1; - dlsch->harq_processes[0]->TBS = TBStable[get_I_TBS(dlsch->harq_processes[0]->mcs)][frame_parms->N_RB_DL-1]; - dlsch->current_harq_pid = 0; - dlsch->harq_processes[0]->nb_rb = frame_parms->N_RB_DL; - - switch(frame_parms->N_RB_DL) { - case 6: - dlsch->harq_processes[0]->rb_alloc_even[0] = 0x3f; - dlsch->harq_processes[0]->rb_alloc_odd[0] = 0x3f; - break; - - case 25: - dlsch->harq_processes[0]->rb_alloc_even[0] = 0x1ffffff; - dlsch->harq_processes[0]->rb_alloc_odd[0] = 0x1ffffff; - break; - - case 50: - dlsch->harq_processes[0]->rb_alloc_even[0] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc_odd[0] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc_even[1] = 0x3ffff; - dlsch->harq_processes[0]->rb_alloc_odd[1] = 0x3ffff; - break; - - case 100: - dlsch->harq_processes[0]->rb_alloc_even[0] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc_odd[0] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc_even[1] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc_odd[1] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc_even[2] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc_odd[2] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc_even[3] = 0xf; - dlsch->harq_processes[0]->rb_alloc_odd[3] = 0xf; - break; - } -} void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a) { @@ -337,709 +245,3 @@ void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a) } -void mch_extract_rbs(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - unsigned char symbol, - unsigned char subframe, - LTE_DL_FRAME_PARMS *frame_parms) -{ - - int pilots=0,i,j,offset,aarx; - - // printf("Extracting PMCH: symbol %d\n",symbol); - if ((symbol==2)|| - (symbol==10)) { - pilots = 1; - offset = 1; - } else if (symbol==6) { - pilots = 1; - offset = 0; - } - - - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - - if (pilots==1) { - for (i=offset,j=0; i<frame_parms->N_RB_DL*6; i+=2,j++) { - /* printf("MCH with pilots: i %d, j %d => %d,%d\n",i,j, - *(int16_t*)&rxdataF[aarx][i+frame_parms->first_carrier_offset + (symbol*frame_parms->ofdm_symbol_size)], - *(int16_t*)(1+&rxdataF[aarx][i+frame_parms->first_carrier_offset + (symbol*frame_parms->ofdm_symbol_size)])); - */ - rxdataF_ext[aarx][j+symbol*(frame_parms->N_RB_DL*12)] = rxdataF[aarx][i+frame_parms->first_carrier_offset + (symbol*frame_parms->ofdm_symbol_size)]; - rxdataF_ext[aarx][(frame_parms->N_RB_DL*3)+j+symbol*(frame_parms->N_RB_DL*12)] = rxdataF[aarx][i+1+ (symbol*frame_parms->ofdm_symbol_size)]; - dl_ch_estimates_ext[aarx][j+symbol*(frame_parms->N_RB_DL*12)] = dl_ch_estimates[aarx][i+(symbol*frame_parms->ofdm_symbol_size)]; - dl_ch_estimates_ext[aarx][(frame_parms->N_RB_DL*3)+j+symbol*(frame_parms->N_RB_DL*12)] = dl_ch_estimates[aarx][i+(frame_parms->N_RB_DL*6)+(symbol*frame_parms->ofdm_symbol_size)]; - } - } else { - - memcpy((void*)&rxdataF_ext[aarx][symbol*(frame_parms->N_RB_DL*12)], - (void*)&rxdataF[aarx][frame_parms->first_carrier_offset + (symbol*frame_parms->ofdm_symbol_size)], - frame_parms->N_RB_DL*24); - memcpy((void*)&rxdataF_ext[aarx][(frame_parms->N_RB_DL*6) + symbol*(frame_parms->N_RB_DL*12)], - (void*)&rxdataF[aarx][1 + (symbol*frame_parms->ofdm_symbol_size)], - frame_parms->N_RB_DL*24); - memcpy((void*)&dl_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)], - (void*)&dl_ch_estimates[aarx][(symbol*frame_parms->ofdm_symbol_size)], - frame_parms->N_RB_DL*48); - - } - - } - - - -} - -void mch_channel_level(int **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - int *avg, - uint8_t symbol, - unsigned short nb_rb) -{ - - int i,aarx,nre; -#if defined(__x86_64__) || defined(__i386__) - __m128i *dl_ch128,avg128; -#elif defined(__arm__) - int32x4_t avg128; -#endif - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { -#if defined(__x86_64__) || defined(__i386__) - //clear average level - avg128 = _mm_setzero_si128(); - // 5 is always a symbol with no pilots for both normal and extended prefix - - dl_ch128=(__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; -#elif defined(__arm__) - - -#endif - if ((symbol == 2) || (symbol == 6) || (symbol == 10)) - nre = (frame_parms->N_RB_DL*6); - else - nre = (frame_parms->N_RB_DL*12); - - for (i=0; i<(nre>>2); i++) { -#if defined(__x86_64__) || defined(__i386__) - avg128 = _mm_add_epi32(avg128,_mm_madd_epi16(dl_ch128[0],dl_ch128[0])); -#elif defined(__arm__) - -#endif - } - - avg[aarx] = (((int*)&avg128)[0] + - ((int*)&avg128)[1] + - ((int*)&avg128)[2] + - ((int*)&avg128)[3])/nre; - - // printf("Channel level : %d\n",avg[(aatx<<1)+aarx]); - } - -#if defined(__x86_64__) || defined(__i386__) - _mm_empty(); - _m_empty(); -#endif -} - -void mch_channel_compensation(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - LTE_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned char mod_order, - unsigned char output_shift) -{ - - int aarx,nre,i; -#if defined(__x86_64__) || defined(__i386__) - __m128i *dl_ch128,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128; - __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; -#elif defined(__arm__) - -#endif - if ((symbol == 2) || (symbol == 6) || (symbol == 10)) - nre = frame_parms->N_RB_DL*6; - else - nre = frame_parms->N_RB_DL*12; - -#if defined(__x86_64__) || defined(__i386__) - if (mod_order == 4) { - QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) - QAM_amp128b = _mm_setzero_si128(); - } else if (mod_order == 6) { - QAM_amp128 = _mm_set1_epi16(QAM64_n1); // - QAM_amp128b = _mm_set1_epi16(QAM64_n2); - } -#elif defined(__arm__) - -#endif - - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - -#if defined(__x86_64__) || defined(__i386__) - - dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; - dl_ch_mag128 = (__m128i *)&dl_ch_mag[aarx][symbol*frame_parms->N_RB_DL*12]; - dl_ch_mag128b = (__m128i *)&dl_ch_magb[aarx][symbol*frame_parms->N_RB_DL*12]; - rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12]; - rxdataF_comp128 = (__m128i *)&rxdataF_comp[aarx][symbol*frame_parms->N_RB_DL*12]; -#elif defined(__arm__) - -#endif - - for (i=0; i<(nre>>2); i+=2) { - if (mod_order>2) { - // get channel amplitude if not QPSK -#if defined(__x86_64__) || defined(__i386__) - - mmtmpD0 = _mm_madd_epi16(dl_ch128[0],dl_ch128[0]); - mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); - - mmtmpD1 = _mm_madd_epi16(dl_ch128[1],dl_ch128[1]); - mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); - - mmtmpD0 = _mm_packs_epi32(mmtmpD0,mmtmpD1); - - // store channel magnitude here in a new field of dlsch - - dl_ch_mag128[0] = _mm_unpacklo_epi16(mmtmpD0,mmtmpD0); - dl_ch_mag128b[0] = dl_ch_mag128[0]; - dl_ch_mag128[0] = _mm_mulhi_epi16(dl_ch_mag128[0],QAM_amp128); - dl_ch_mag128[0] = _mm_slli_epi16(dl_ch_mag128[0],1); - - dl_ch_mag128[1] = _mm_unpackhi_epi16(mmtmpD0,mmtmpD0); - dl_ch_mag128b[1] = dl_ch_mag128[1]; - dl_ch_mag128[1] = _mm_mulhi_epi16(dl_ch_mag128[1],QAM_amp128); - dl_ch_mag128[1] = _mm_slli_epi16(dl_ch_mag128[1],1); - - - dl_ch_mag128b[0] = _mm_mulhi_epi16(dl_ch_mag128b[0],QAM_amp128b); - dl_ch_mag128b[0] = _mm_slli_epi16(dl_ch_mag128b[0],1); - - - dl_ch_mag128b[1] = _mm_mulhi_epi16(dl_ch_mag128b[1],QAM_amp128b); - dl_ch_mag128b[1] = _mm_slli_epi16(dl_ch_mag128b[1],1); - -#elif defined(__arm__) - -#endif - } - -#if defined(__x86_64__) || defined(__i386__) - - // multiply by conjugated channel - mmtmpD0 = _mm_madd_epi16(dl_ch128[0],rxdataF128[0]); - // print_ints("re",&mmtmpD0); - - // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) - mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[0],_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]); - // print_ints("im",&mmtmpD1); - mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[0]); - // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) - mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); - // print_ints("re(shift)",&mmtmpD0); - mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); - // print_ints("im(shift)",&mmtmpD1); - mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); - mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); - // print_ints("c0",&mmtmpD2); - // print_ints("c1",&mmtmpD3); - rxdataF_comp128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - // print_shorts("rx:",rxdataF128); - // print_shorts("ch:",dl_ch128); - // print_shorts("pack:",rxdataF_comp128); - - // multiply by conjugated channel - mmtmpD0 = _mm_madd_epi16(dl_ch128[1],rxdataF128[1]); - // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) - mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[1],_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); - mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[1]); - // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) - mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); - mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); - mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); - mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); - - rxdataF_comp128[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - // print_shorts("rx:",rxdataF128+1); - // print_shorts("ch:",dl_ch128+1); - // print_shorts("pack:",rxdataF_comp128+1); - - dl_ch128+=2; - dl_ch_mag128+=2; - dl_ch_mag128b+=2; - rxdataF128+=2; - rxdataF_comp128+=2; - -#elif defined(__arm__) - -#endif - } - } - -#if defined(__x86_64__) || defined(__i386__) - _mm_empty(); - _m_empty(); -#endif - -} - -void mch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **dl_ch_mag, - int **dl_ch_magb, - unsigned char symbol) -{ - - - int i; -#if defined(__x86_64__) || defined(__i386__) - __m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*dl_ch_mag128_0,*dl_ch_mag128_1,*dl_ch_mag128_0b,*dl_ch_mag128_1b; -#elif defined(__arm__) - int16x8_t *rxdataF_comp128_0,*rxdataF_comp128_1,*dl_ch_mag128_0,*dl_ch_mag128_1,*dl_ch_mag128_0b,*dl_ch_mag128_1b; -#endif - if (frame_parms->nb_antennas_rx>1) { - -#if defined(__x86_64__) || defined(__i386__) - - rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12]; - rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12]; - dl_ch_mag128_0 = (__m128i *)&dl_ch_mag[0][symbol*frame_parms->N_RB_DL*12]; - dl_ch_mag128_1 = (__m128i *)&dl_ch_mag[1][symbol*frame_parms->N_RB_DL*12]; - dl_ch_mag128_0b = (__m128i *)&dl_ch_magb[0][symbol*frame_parms->N_RB_DL*12]; - dl_ch_mag128_1b = (__m128i *)&dl_ch_magb[1][symbol*frame_parms->N_RB_DL*12]; - -#elif defined(__arm__) - rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12]; - rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12]; - dl_ch_mag128_0 = (int16x8_t *)&dl_ch_mag[0][symbol*frame_parms->N_RB_DL*12]; - dl_ch_mag128_1 = (int16x8_t *)&dl_ch_mag[1][symbol*frame_parms->N_RB_DL*12]; - dl_ch_mag128_0b = (int16x8_t *)&dl_ch_magb[0][symbol*frame_parms->N_RB_DL*12]; - dl_ch_mag128_1b = (int16x8_t *)&dl_ch_magb[1][symbol*frame_parms->N_RB_DL*12]; - -#endif - // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation) - for (i=0; i<frame_parms->N_RB_DL*3; i++) { -#if defined(__x86_64__) || defined(__i386__) - rxdataF_comp128_0[i] = _mm_adds_epi16(_mm_srai_epi16(rxdataF_comp128_0[i],1),_mm_srai_epi16(rxdataF_comp128_1[i],1)); - dl_ch_mag128_0[i] = _mm_adds_epi16(_mm_srai_epi16(dl_ch_mag128_0[i],1),_mm_srai_epi16(dl_ch_mag128_1[i],1)); - dl_ch_mag128_0b[i] = _mm_adds_epi16(_mm_srai_epi16(dl_ch_mag128_0b[i],1),_mm_srai_epi16(dl_ch_mag128_1b[i],1)); -#elif defined(__arm__) - rxdataF_comp128_0[i] = vhaddq_s16(rxdataF_comp128_0[i],rxdataF_comp128_1[i]); - dl_ch_mag128_0[i] = vhaddq_s16(dl_ch_mag128_0[i],dl_ch_mag128_1[i]); - dl_ch_mag128_0b[i] = vhaddq_s16(dl_ch_mag128_0b[i],dl_ch_mag128_1b[i]); -#endif - } - } -#if defined(__x86_64__) || defined(__i386__) - _mm_empty(); - _m_empty(); -#endif -} - -int mch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - short *dlsch_llr, - unsigned char symbol, - short **llr32p) -{ - - uint32_t *rxF = (uint32_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; - uint32_t *llr32; - int i,len; - - if (symbol==2) { - llr32 = (uint32_t*)dlsch_llr; - } else { - llr32 = (uint32_t*)(*llr32p); - } - - AssertFatal(llr32!=NULL,"dlsch_qpsk_llr: llr is null, symbol %d, llr32=%p\n",symbol, llr32); - - - if ((symbol==2) || (symbol==6) || (symbol==10)) { - len = frame_parms->N_RB_DL*6; - } else { - len = frame_parms->N_RB_DL*12; - } - - // printf("dlsch_qpsk_llr: symbol %d,len %d,pbch_pss_sss_adjust %d\n",symbol,len,pbch_pss_sss_adjust); - for (i=0; i<len; i++) { - *llr32 = *rxF; - rxF++; - llr32++; - } - - *llr32p = (short *)llr32; - -#if defined(__x86_64__) || defined(__i386__) - _mm_empty(); - _m_empty(); -#endif - - return(0); -} - -//---------------------------------------------------------------------------------------------- -// 16-QAM -//---------------------------------------------------------------------------------------------- - -void mch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - short *dlsch_llr, - int **dl_ch_mag, - unsigned char symbol, - int16_t **llr32p) -{ - -#if defined(__x86_64__) || defined(__i386__) - __m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; - __m128i *ch_mag; - __m128i llr128[2],xmm0; - uint32_t *llr32; -#elif defined(__arm__) - int16x8_t *rxF = (int16x8_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; - int16x8_t *ch_mag; - int16x8_t llr128[2],xmm0; - int16_t *llr16; -#endif - int i,len; - unsigned char len_mod4=0; - -#if defined(__x86_64__) || defined(__i386__) - if (symbol==2) { - llr32 = (uint32_t*)dlsch_llr; - } else { - llr32 = (uint32_t*)*llr32p; - } -#elif defined(__arm__) - if (symbol==2) { - llr16 = (int16_t*)dlsch_llr; - } else { - llr16 = (int16_t*)*llr32p; - } -#endif -#if defined(__x86_64__) || defined(__i386__) - ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; -#elif defined(__arm__) - ch_mag = (int16x8_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; -#endif - if ((symbol==2) || (symbol==6) || (symbol==10)) { - len = frame_parms->N_RB_DL*6; - } else { - len = frame_parms->N_RB_DL*12; - } - - - - // update output pointer according to number of REs in this symbol (<<2 because 4 bits per RE) - if (symbol==2) - *llr32p = dlsch_llr + (len<<2); - else - *llr32p += (len<<2); - - len_mod4 = len&3; - len>>=2; // length in quad words (4 REs) - len+=(len_mod4==0 ? 0 : 1); - - for (i=0; i<len; i++) { - -#if defined(__x86_64__) || defined(__i386__) - xmm0 = _mm_abs_epi16(rxF[i]); - xmm0 = _mm_subs_epi16(ch_mag[i],xmm0); - - // lambda_1=y_R, lambda_2=|y_R|-|h|^2, lamda_3=y_I, lambda_4=|y_I|-|h|^2 - llr128[0] = _mm_unpacklo_epi32(rxF[i],xmm0); - llr128[1] = _mm_unpackhi_epi32(rxF[i],xmm0); - llr32[0] = ((uint32_t *)&llr128[0])[0]; - llr32[1] = ((uint32_t *)&llr128[0])[1]; - llr32[2] = ((uint32_t *)&llr128[0])[2]; - llr32[3] = ((uint32_t *)&llr128[0])[3]; - llr32[4] = ((uint32_t *)&llr128[1])[0]; - llr32[5] = ((uint32_t *)&llr128[1])[1]; - llr32[6] = ((uint32_t *)&llr128[1])[2]; - llr32[7] = ((uint32_t *)&llr128[1])[3]; - llr32+=8; - -#elif defined(__arm__) - xmm0 = vabsq_s16(rxF[i]); - xmm0 = vsubq_s16(ch_mag[i],xmm0); - - // lambda_1=y_R, lambda_2=|y_R|-|h|^2, lamda_3=y_I, lambda_4=|y_I|-|h|^2 - - llr16[0] = vgetq_lane_s16(rxF[i],0); - llr16[1] = vgetq_lane_s16(xmm0,0); - llr16[2] = vgetq_lane_s16(rxF[i],1); - llr16[3] = vgetq_lane_s16(xmm0,1); - llr16[4] = vgetq_lane_s16(rxF[i],2); - llr16[5] = vgetq_lane_s16(xmm0,2); - llr16[6] = vgetq_lane_s16(rxF[i],2); - llr16[7] = vgetq_lane_s16(xmm0,3); - llr16[8] = vgetq_lane_s16(rxF[i],4); - llr16[9] = vgetq_lane_s16(xmm0,4); - llr16[10] = vgetq_lane_s16(rxF[i],5); - llr16[11] = vgetq_lane_s16(xmm0,5); - llr16[12] = vgetq_lane_s16(rxF[i],6); - llr16[13] = vgetq_lane_s16(xmm0,6); - llr16[14] = vgetq_lane_s16(rxF[i],7); - llr16[15] = vgetq_lane_s16(xmm0,7); - llr16+=16; -#endif - - } - -#if defined(__x86_64__) || defined(__i386__) - _mm_empty(); - _m_empty(); -#endif -} - -//---------------------------------------------------------------------------------------------- -// 64-QAM -//---------------------------------------------------------------------------------------------- - -void mch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - short *dlsch_llr, - int **dl_ch_mag, - int **dl_ch_magb, - unsigned char symbol, - short **llr_save) -{ - -#if defined(__x86_64__) || defined(__i386__) - __m128i xmm1,xmm2,*ch_mag,*ch_magb; - __m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; -#elif defined(__arm__) - int16x8_t xmm1,xmm2,*ch_mag,*ch_magb; - int16x8_t *rxF = (int16x8_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; -#endif - - int i,len,len2; - // int j=0; - unsigned char len_mod4; - short *llr; - int16_t *llr2; - - if (symbol==2) - llr = dlsch_llr; - else - llr = *llr_save; - -#if defined(__x86_64__) || defined(__i386__) - ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; - ch_magb = (__m128i*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)]; -#elif defined(__arm__) - ch_mag = (int16x8_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; - ch_magb = (int16x8_t*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)]; -#endif - if ((symbol==2) || (symbol==6) || (symbol==10)) { - len = frame_parms->N_RB_DL*6; - } else { - len = frame_parms->N_RB_DL*12; - } - - - llr2 = llr; - llr += (len*6); - - len_mod4 =len&3; - len2=len>>2; // length in quad words (4 REs) - len2+=(len_mod4?0:1); - - - for (i=0; i<len2; i++) { -#if defined(__x86_64__) || defined(__i386__) - xmm1 = _mm_abs_epi16(rxF[i]); - xmm1 = _mm_subs_epi16(ch_mag[i],xmm1); - xmm2 = _mm_abs_epi16(xmm1); - xmm2 = _mm_subs_epi16(ch_magb[i],xmm2); -#elif defined(__arm__) - xmm1 = vabsq_s16(rxF[i]); - xmm1 = vsubq_s16(ch_mag[i],xmm1); - xmm2 = vabsq_s16(xmm1); - xmm2 = vsubq_s16(ch_magb[i],xmm2); -#endif - - /* - printf("pmch i: %d => mag (%d,%d) (%d,%d)\n",i,((short *)&ch_mag[i])[0],((short *)&ch_magb[i])[0], - ((short *)&rxF[i])[0],((short *)&rxF[i])[1]); - */ - // loop over all LLRs in quad word (24 coded bits) - /* - for (j=0;j<8;j+=2) { - llr2[0] = ((short *)&rxF[i])[j]; - llr2[1] = ((short *)&rxF[i])[j+1]; - llr2[2] = _mm_extract_epi16(xmm1,j); - llr2[3] = _mm_extract_epi16(xmm1,j+1);//((short *)&xmm1)[j+1]; - llr2[4] = _mm_extract_epi16(xmm2,j);//((short *)&xmm2)[j]; - llr2[5] = _mm_extract_epi16(xmm2,j+1);//((short *)&xmm2)[j+1]; - - llr2+=6; - } - */ - llr2[0] = ((short *)&rxF[i])[0]; - llr2[1] = ((short *)&rxF[i])[1]; -#if defined(__x86_64__) || defined(__i386__) - llr2[2] = _mm_extract_epi16(xmm1,0); - llr2[3] = _mm_extract_epi16(xmm1,1);//((short *)&xmm1)[j+1]; - llr2[4] = _mm_extract_epi16(xmm2,0);//((short *)&xmm2)[j]; - llr2[5] = _mm_extract_epi16(xmm2,1);//((short *)&xmm2)[j+1]; -#elif defined(__arm__) - llr2[2] = vgetq_lane_s16(xmm1,0); - llr2[3] = vgetq_lane_s16(xmm1,1);//((short *)&xmm1)[j+1]; - llr2[4] = vgetq_lane_s16(xmm2,0);//((short *)&xmm2)[j]; - llr2[5] = vgetq_lane_s16(xmm2,1);//((short *)&xmm2)[j+1]; -#endif - - llr2+=6; - llr2[0] = ((short *)&rxF[i])[2]; - llr2[1] = ((short *)&rxF[i])[3]; -#if defined(__x86_64__) || defined(__i386__) - llr2[2] = _mm_extract_epi16(xmm1,2); - llr2[3] = _mm_extract_epi16(xmm1,3);//((short *)&xmm1)[j+1]; - llr2[4] = _mm_extract_epi16(xmm2,2);//((short *)&xmm2)[j]; - llr2[5] = _mm_extract_epi16(xmm2,3);//((short *)&xmm2)[j+1]; -#elif defined(__arm__) - llr2[2] = vgetq_lane_s16(xmm1,2); - llr2[3] = vgetq_lane_s16(xmm1,3);//((short *)&xmm1)[j+1]; - llr2[4] = vgetq_lane_s16(xmm2,2);//((short *)&xmm2)[j]; - llr2[5] = vgetq_lane_s16(xmm2,3);//((short *)&xmm2)[j+1]; -#endif - llr2+=6; - llr2[0] = ((short *)&rxF[i])[4]; - llr2[1] = ((short *)&rxF[i])[5]; -#if defined(__x86_64__) || defined(__i386__) - llr2[2] = _mm_extract_epi16(xmm1,4); - llr2[3] = _mm_extract_epi16(xmm1,5);//((short *)&xmm1)[j+1]; - llr2[4] = _mm_extract_epi16(xmm2,4);//((short *)&xmm2)[j]; - llr2[5] = _mm_extract_epi16(xmm2,5);//((short *)&xmm2)[j+1]; -#elif defined(__arm__) - llr2[2] = vgetq_lane_s16(xmm1,4); - llr2[3] = vgetq_lane_s16(xmm1,5);//((short *)&xmm1)[j+1]; - llr2[4] = vgetq_lane_s16(xmm2,4);//((short *)&xmm2)[j]; - llr2[5] = vgetq_lane_s16(xmm2,5);//((short *)&xmm2)[j+1]; -#endif - llr2+=6; - llr2[0] = ((short *)&rxF[i])[6]; - llr2[1] = ((short *)&rxF[i])[7]; -#if defined(__x86_64__) || defined(__i386__) - llr2[2] = _mm_extract_epi16(xmm1,6); - llr2[3] = _mm_extract_epi16(xmm1,7);//((short *)&xmm1)[j+1]; - llr2[4] = _mm_extract_epi16(xmm2,6);//((short *)&xmm2)[j]; - llr2[5] = _mm_extract_epi16(xmm2,7);//((short *)&xmm2)[j+1]; -#elif defined(__arm__) - llr2[2] = vgetq_lane_s16(xmm1,6); - llr2[3] = vgetq_lane_s16(xmm1,7);//((short *)&xmm1)[j+1]; - llr2[4] = vgetq_lane_s16(xmm2,6);//((short *)&xmm2)[j]; - llr2[5] = vgetq_lane_s16(xmm2,7);//((short *)&xmm2)[j+1]; -#endif - llr2+=6; - } - - *llr_save = llr; -#if defined(__x86_64__) || defined(__i386__) - _mm_empty(); - _m_empty(); -#endif -} - -int avg_pmch[4]; -int rx_pmch(PHY_VARS_UE *ue, - unsigned char eNB_id, - uint8_t subframe, - unsigned char symbol) -{ - - LTE_UE_COMMON *common_vars = &ue->common_vars; - LTE_UE_PDSCH **pdsch_vars = &ue->pdsch_vars_MCH[eNB_id]; - LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - LTE_UE_DLSCH_t **dlsch = &ue->dlsch_MCH[eNB_id]; - int avgs,aarx; - - //printf("*********************mch: symbol %d\n",symbol); - - mch_extract_rbs(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF, - common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id], - pdsch_vars[eNB_id]->rxdataF_ext, - pdsch_vars[eNB_id]->dl_ch_estimates_ext, - symbol, - subframe, - frame_parms); - - if (symbol == 2) { - mch_channel_level(pdsch_vars[eNB_id]->dl_ch_estimates_ext, - frame_parms, - avg_pmch, - symbol, - frame_parms->N_RB_DL); - } - - avgs = 0; - - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) - avgs = cmax(avgs,avg_pmch[aarx]); - - if (get_Qm(dlsch[0]->harq_processes[0]->mcs)==2) - pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2) ;// + 2 - else - pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2); // + 5;// + 2 - - mch_channel_compensation(pdsch_vars[eNB_id]->rxdataF_ext, - pdsch_vars[eNB_id]->dl_ch_estimates_ext, - pdsch_vars[eNB_id]->dl_ch_mag0, - pdsch_vars[eNB_id]->dl_ch_magb0, - pdsch_vars[eNB_id]->rxdataF_comp0, - frame_parms, - symbol, - get_Qm(dlsch[0]->harq_processes[0]->mcs), - pdsch_vars[eNB_id]->log2_maxh); - - - if (frame_parms->nb_antennas_rx > 1) - mch_detection_mrc(frame_parms, - pdsch_vars[eNB_id]->rxdataF_comp0, - pdsch_vars[eNB_id]->dl_ch_mag0, - pdsch_vars[eNB_id]->dl_ch_magb0, - symbol); - - switch (get_Qm(dlsch[0]->harq_processes[0]->mcs)) { - case 2 : - mch_qpsk_llr(frame_parms, - pdsch_vars[eNB_id]->rxdataF_comp0, - pdsch_vars[eNB_id]->llr[0], - symbol, - pdsch_vars[eNB_id]->llr128); - break; - - case 4: - mch_16qam_llr(frame_parms, - pdsch_vars[eNB_id]->rxdataF_comp0, - pdsch_vars[eNB_id]->llr[0], - pdsch_vars[eNB_id]->dl_ch_mag0, - symbol, - pdsch_vars[eNB_id]->llr128); - break; - - case 6: - mch_64qam_llr(frame_parms, - pdsch_vars[eNB_id]->rxdataF_comp0, - pdsch_vars[eNB_id]->llr[0], - pdsch_vars[eNB_id]->dl_ch_mag0, - pdsch_vars[eNB_id]->dl_ch_magb0, - symbol, - pdsch_vars[eNB_id]->llr128); - break; - } - - return(0); -} - diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index b58aa91636..9c74738013 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -37,1057 +37,12 @@ #include "SCHED/defs.h" #include "SCHED/extern.h" #include "UTIL/LOG/vcd_signal_dumper.h" +#include "prach_common.c" //#define PRACH_DEBUG 1 //#define PRACH_WRITE_OUTPUT_DEBUG 1 -uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419}; -uint16_t NCS_restricted[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case -uint16_t NCS_4[7] = {2,4,6,8,10,12,15}; - -int16_t ru[2*839]; // quantized roots of unity -uint32_t ZC_inv[839]; // multiplicative inverse for roots u -uint16_t du[838]; - -typedef struct { - uint8_t f_ra; - uint8_t t0_ra; - uint8_t t1_ra; - uint8_t t2_ra; -} PRACH_TDD_PREAMBLE_MAP_elem; -typedef struct { - uint8_t num_prach; - PRACH_TDD_PREAMBLE_MAP_elem map[6]; -} PRACH_TDD_PREAMBLE_MAP; - -// This is table 5.7.1-4 from 36.211 -PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = { - // TDD Configuration Index 0 - { {1,{{0,1,0,2}}},{1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}}, - // TDD Configuration Index 1 - { {1,{{0,2,0,2}}},{1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}}, - // TDD Configuration Index 2 - { {1,{{0,1,1,2}}},{1,{{0,1,1,1}}}, {1,{{0,1,1,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,1}}}}, - // TDD Configuration Index 3 - { {1,{{0,0,0,2}}},{1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}}, - // TDD Configuration Index 4 - { {1,{{0,0,1,2}}},{1,{{0,0,1,1}}}, {1,{{0,0,1,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,1}}}}, - // TDD Configuration Index 5 - { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}}, - // TDD Configuration Index 6 - { {2,{{0,0,0,2},{0,0,1,2}}}, {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {2,{{0,0,0,1},{0,0,0,2}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {2,{{0,0,0,2},{0,0,1,1}}}}, - // TDD Configuration Index 7 - { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,2}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}}, - // TDD Configuration Index 8 - { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,1,1}}}}, - // TDD Configuration Index 9 - { {3,{{0,0,0,1},{0,0,0,2},{0,0,1,2}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,0,2}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {3,{{0,0,0,1},{0,0,0,2},{0,0,1,1}}}}, - // TDD Configuration Index 10 - { {3,{{0,0,0,0},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,2},{0,0,1,0}}}}, - // TDD Configuration Index 11 - { {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,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},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}}, - // TDD Configuration Index 12 - { {4,{{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, - {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, - {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,2}}}, - {4,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1}}}, - {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}, - {4,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}} - }, - // TDD Configuration Index 13 - { {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {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,0,0}}}, - {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1}}}, - {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,0,0}}}, - {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1}}} - }, - // TDD Configuration Index 14 - { {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {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,0,0}}}, - {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,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,0},{0,0,0,0}}}, - {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,1}}} - }, - // TDD Configuration Index 15 - { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1}}}, - {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1},{1,0,0,2}}}, - {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,1}}}, {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, - {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}} - }, - // TDD Configuration Index 16 - { {5,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,1,1}}}, - {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,1,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,2}}}, - {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,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,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}} - }, - // TDD Configuration Index 17 - { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0}}}, - {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1}}}, - {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,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}}} - }, - // TDD Configuration Index 18 - { {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, - {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, - {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}}, - {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1},{1,0,0,2}}}, - {6,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0},{2,0,0,1}}}, - {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}}, - {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,0,2}}} - }, - // TDD Configuration Index 19 - { {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}}}, - {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0},{1,0,1,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,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},{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,0},{0,0,0,0}}}, - {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,1,1}}} - }, - // TDD Configuration Index 20 - { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}}, - // TDD Configuration Index 21 - { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}}, - - // TDD Configuration Index 22 - { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}}, - - // TDD Configuration Index 23 - { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}}, - - // TDD Configuration Index 24 - { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}}, - - // TDD Configuration Index 25 - { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}}, - - // TDD Configuration Index 26 - { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}}, - - // TDD Configuration Index 27 - { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, - {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, - {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}}, - {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}, - {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, - {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}} - }, - - // TDD Configuration Index 28 - { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, - {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}}, - {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{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}}}, - {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}} - }, - - // TDD Configuration Index 29 - { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}}, - {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,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}}}, - {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}}, - {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,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}}}, - {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}} - }, - - - // TDD Configuration Index 30 - { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}}, - - // TDD Configuration Index 31 - { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}}, - - // TDD Configuration Index 32 - { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}}, - - // TDD Configuration Index 33 - { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}}, - - // TDD Configuration Index 34 - { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}}, - - // TDD Configuration Index 35 - { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}}, - - // TDD Configuration Index 36 - { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}}, - - // TDD Configuration Index 37 - { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, - {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, - {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}}, - {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}, - {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, - {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}} - }, - - // TDD Configuration Index 38 - { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, - {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}}, - {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{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}}}, - {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}} - }, - - // TDD Configuration Index 39 - { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}}, - {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,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}}}, - {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}}, - {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,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}}}, - {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}} - }, - - // TDD Configuration Index 40 - { {1,{{0,1,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}}, - // TDD Configuration Index 41 - { {1,{{0,2,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}}, - - // TDD Configuration Index 42 - { {1,{{0,1,1,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}}}}, - - // TDD Configuration Index 43 - { {1,{{0,0,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}}, - - // TDD Configuration Index 44 - { {1,{{0,0,1,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}}}}, - - // TDD Configuration Index 45 - { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}}, - - // TDD Configuration Index 46 - { {3,{{0,0,0,0},{0,0,1,0},{1,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}}}, {3,{{0,0,0,0},{1,0,0,0},{2,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}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}}, - - // TDD Configuration Index 47 - { {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,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,0,0,0}}}, - {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,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,0},{0,0,0,0}}}, - {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}} - } -}; - - - -uint16_t prach_root_sequence_map0_3[838] = { 129, 710, 140, 699, 120, 719, 210, 629, 168, 671, 84, 755, 105, 734, 93, 746, 70, 769, 60, 779, - 2, 837, 1, 838, - 56, 783, 112, 727, 148, 691, - 80, 759, 42, 797, 40, 799, - 35, 804, 73, 766, 146, 693, - 31, 808, 28, 811, 30, 809, 27, 812, 29, 810, - 24, 815, 48, 791, 68, 771, 74, 765, 178, 661, 136, 703, - 86, 753, 78, 761, 43, 796, 39, 800, 20, 819, 21, 818, - 95, 744, 202, 637, 190, 649, 181, 658, 137, 702, 125, 714, 151, 688, - 217, 622, 128, 711, 142, 697, 122, 717, 203, 636, 118, 721, 110, 729, 89, 750, 103, 736, 61, - 778, 55, 784, 15, 824, 14, 825, - 12, 827, 23, 816, 34, 805, 37, 802, 46, 793, 207, 632, 179, 660, 145, 694, 130, 709, 223, 616, - 228, 611, 227, 612, 132, 707, 133, 706, 143, 696, 135, 704, 161, 678, 201, 638, 173, 666, 106, - 733, 83, 756, 91, 748, 66, 773, 53, 786, 10, 829, 9, 830, - 7, 832, 8, 831, 16, 823, 47, 792, 64, 775, 57, 782, 104, 735, 101, 738, 108, 731, 208, 631, 184, - 655, 197, 642, 191, 648, 121, 718, 141, 698, 149, 690, 216, 623, 218, 621, - 152, 687, 144, 695, 134, 705, 138, 701, 199, 640, 162, 677, 176, 663, 119, 720, 158, 681, 164, - 675, 174, 665, 171, 668, 170, 669, 87, 752, 169, 670, 88, 751, 107, 732, 81, 758, 82, 757, 100, - 739, 98, 741, 71, 768, 59, 780, 65, 774, 50, 789, 49, 790, 26, 813, 17, 822, 13, 826, 6, 833, - 5, 834, 33, 806, 51, 788, 75, 764, 99, 740, 96, 743, 97, 742, 166, 673, 172, 667, 175, 664, 187, - 652, 163, 676, 185, 654, 200, 639, 114, 725, 189, 650, 115, 724, 194, 645, 195, 644, 192, 647, - 182, 657, 157, 682, 156, 683, 211, 628, 154, 685, 123, 716, 139, 700, 212, 627, 153, 686, 213, - 626, 215, 624, 150, 689, - 225, 614, 224, 615, 221, 618, 220, 619, 127, 712, 147, 692, 124, 715, 193, 646, 205, 634, 206, - 633, 116, 723, 160, 679, 186, 653, 167, 672, 79, 760, 85, 754, 77, 762, 92, 747, 58, 781, 62, - 777, 69, 770, 54, 785, 36, 803, 32, 807, 25, 814, 18, 821, 11, 828, 4, 835, - 3, 836, 19, 820, 22, 817, 41, 798, 38, 801, 44, 795, 52, 787, 45, 794, 63, 776, 67, 772, 72, - 767, 76, 763, 94, 745, 102, 737, 90, 749, 109, 730, 165, 674, 111, 728, 209, 630, 204, 635, 117, - 722, 188, 651, 159, 680, 198, 641, 113, 726, 183, 656, 180, 659, 177, 662, 196, 643, 155, 684, - 214, 625, 126, 713, 131, 708, 219, 620, 222, 617, 226, 613, - 230, 609, 232, 607, 262, 577, 252, 587, 418, 421, 416, 423, 413, 426, 411, 428, 376, 463, 395, - 444, 283, 556, 285, 554, 379, 460, 390, 449, 363, 476, 384, 455, 388, 451, 386, 453, 361, 478, - 387, 452, 360, 479, 310, 529, 354, 485, 328, 511, 315, 524, 337, 502, 349, 490, 335, 504, 324, - 515, - 323, 516, 320, 519, 334, 505, 359, 480, 295, 544, 385, 454, 292, 547, 291, 548, 381, 458, 399, - 440, 380, 459, 397, 442, 369, 470, 377, 462, 410, 429, 407, 432, 281, 558, 414, 425, 247, 592, - 277, 562, 271, 568, 272, 567, 264, 575, 259, 580, - 237, 602, 239, 600, 244, 595, 243, 596, 275, 564, 278, 561, 250, 589, 246, 593, 417, 422, 248, - 591, 394, 445, 393, 446, 370, 469, 365, 474, 300, 539, 299, 540, 364, 475, 362, 477, 298, 541, - 312, 527, 313, 526, 314, 525, 353, 486, 352, 487, 343, 496, 327, 512, 350, 489, 326, 513, 319, - 520, 332, 507, 333, 506, 348, 491, 347, 492, 322, 517, - 330, 509, 338, 501, 341, 498, 340, 499, 342, 497, 301, 538, 366, 473, 401, 438, 371, 468, 408, - 431, 375, 464, 249, 590, 269, 570, 238, 601, 234, 605, - 257, 582, 273, 566, 255, 584, 254, 585, 245, 594, 251, 588, 412, 427, 372, 467, 282, 557, 403, - 436, 396, 443, 392, 447, 391, 448, 382, 457, 389, 450, 294, 545, 297, 542, 311, 528, 344, 495, - 345, 494, 318, 521, 331, 508, 325, 514, 321, 518, - 346, 493, 339, 500, 351, 488, 306, 533, 289, 550, 400, 439, 378, 461, 374, 465, 415, 424, 270, - 569, 241, 598, - 231, 608, 260, 579, 268, 571, 276, 563, 409, 430, 398, 441, 290, 549, 304, 535, 308, 531, 358, - 481, 316, 523, - 293, 546, 288, 551, 284, 555, 368, 471, 253, 586, 256, 583, 263, 576, - 242, 597, 274, 565, 402, 437, 383, 456, 357, 482, 329, 510, - 317, 522, 307, 532, 286, 553, 287, 552, 266, 573, 261, 578, - 236, 603, 303, 536, 356, 483, - 355, 484, 405, 434, 404, 435, 406, 433, - 235, 604, 267, 572, 302, 537, - 309, 530, 265, 574, 233, 606, - 367, 472, 296, 543, - 336, 503, 305, 534, 373, 466, 280, 559, 279, 560, 419, 420, 240, 599, 258, 581, 229, 610 - }; - -uint16_t prach_root_sequence_map4[138] = { 1,138,2,137,3,136,4,135,5,134,6,133,7,132,8,131,9,130,10,129, - 11,128,12,127,13,126,14,125,15,124,16,123,17,122,18,121,19,120,20,119, - 21,118,22,117,23,116,24,115,25,114,26,113,27,112,28,111,29,110,30,109, - 31,108,32,107,33,106,34,105,35,104,36,103,37,102,38,101,39,100,40,99, - 41,98,42,97,43,96,44,95,45,94,46,93,47,92,48,91,49,90,50,89, - 51,88,52,87,53,86,54,85,55,84,56,83,57,82,58,81,59,80,60,79, - 61,78,62,77,63,76,64,75,65,74,66,73,67,72,68,71,69,70 - }; - -void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) -{ - - FILE *fd; - - fd = fopen("prach_config.txt","w"); - fprintf(fd,"prach_config: subframe = %d\n",subframe); - fprintf(fd,"prach_config: N_RB_UL = %d\n",frame_parms->N_RB_UL); - fprintf(fd,"prach_config: frame_type = %s\n",(frame_parms->frame_type==1) ? "TDD":"FDD"); - - if(frame_parms->frame_type==1) fprintf(fd,"prach_config: tdd_config = %d\n",frame_parms->tdd_config); - - fprintf(fd,"prach_config: rootSequenceIndex = %d\n",frame_parms->prach_config_common.rootSequenceIndex); - fprintf(fd,"prach_config: prach_ConfigIndex = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex); - fprintf(fd,"prach_config: Ncs_config = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig); - fprintf(fd,"prach_config: highSpeedFlag = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.highSpeedFlag); - fprintf(fd,"prach_config: n_ra_prboffset = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset); - fclose(fd); - -} - -// This function computes the du -void fill_du(uint8_t prach_fmt) -{ - - uint16_t iu,u,p; - uint16_t N_ZC; - uint16_t *prach_root_sequence_map; - - if (prach_fmt<4) { - N_ZC = 839; - prach_root_sequence_map = prach_root_sequence_map0_3; - } else { - N_ZC = 139; - prach_root_sequence_map = prach_root_sequence_map4; - } - - for (iu=0; iu<(N_ZC-1); iu++) { - - u=prach_root_sequence_map[iu]; - p=1; - - while (((u*p)%N_ZC)!=1) - p++; - - du[u] = ((p<(N_ZC>>1)) ? p : (N_ZC-p)); - } - -} - -uint8_t get_num_prach_tdd(module_id_t Mod_id) -{ - LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][0]->frame_parms; - return(tdd_preamble_map[fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex][fp->tdd_config].num_prach); -} - -uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index) -{ - LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][0]->frame_parms; - return(tdd_preamble_map[fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex][fp->tdd_config].map[tdd_map_index].f_ra); -} - -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type) -{ - - if (frame_type == FDD) // FDD - return(prach_ConfigIndex>>4); - - else { - if (prach_ConfigIndex < 20) - return (0); - - if (prach_ConfigIndex < 30) - return (1); - - if (prach_ConfigIndex < 40) - return (2); - - if (prach_ConfigIndex < 48) - return (3); - else - return (4); - } -} - -uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t prach_ConfigIndex, - uint8_t n_ra_prboffset, - uint8_t tdd_mapindex, uint16_t Nf) -{ - lte_frame_type_t frame_type = frame_parms->frame_type; - uint8_t tdd_config = frame_parms->tdd_config; - - uint8_t n_ra_prb; - uint8_t f_ra,t1_ra; - uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type); - uint8_t Nsp=2; - - if (frame_type == TDD) { // TDD - - if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) { - LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex); - return(-1); - } - - // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211) - f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra; - - if (prach_fmt < 4) { - if ((f_ra&1) == 0) { - n_ra_prb = n_ra_prboffset + 6*(f_ra>>1); - } else { - n_ra_prb = frame_parms->N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1); - } - } else { - if ((tdd_config >2) && (tdd_config<6)) - Nsp = 2; - - t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra; - if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) { - n_ra_prb = 6*f_ra; - } else { - n_ra_prb = frame_parms->N_RB_UL - 6*(f_ra+1); - } - } - } - else { //FDD - n_ra_prb = n_ra_prboffset; - } - return(n_ra_prb); -} - -int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) -{ - // uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; - uint8_t tdd_config = frame_parms->tdd_config; - uint8_t t0_ra; - uint8_t t1_ra; - uint8_t t2_ra; - - int prach_mask = 0; - - if (frame_parms->frame_type == FDD) { //FDD - //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41) - if ((((frame&1) == 1) && (subframe < 9)) || - (((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames - if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50 - ((prach_ConfigIndex&0x1f)==18) || // 18,50 - ((prach_ConfigIndex&0xf)==15)) // 15,47 - return(0); - - switch (prach_ConfigIndex&0x1f) { - case 0: - case 3: - if (subframe==1) prach_mask = 1; - break; - - case 1: - case 4: - if (subframe==4) prach_mask = 1; - break; - - case 2: - case 5: - if (subframe==7) prach_mask = 1; - break; - - case 6: - if ((subframe==1) || (subframe==6)) prach_mask=1; - break; - - case 7: - if ((subframe==2) || (subframe==7)) prach_mask=1; - break; - - case 8: - if ((subframe==3) || (subframe==8)) prach_mask=1; - break; - - case 9: - if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1; - break; - - case 10: - if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1; - break; - - case 11: - if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1; - break; - - case 12: - if ((subframe&1)==0) prach_mask=1; - break; - - case 13: - if ((subframe&1)==1) prach_mask=1; - break; - - case 14: - prach_mask=1; - break; - - case 15: - if (subframe==9) prach_mask=1; - break; - } - } else { // TDD - - AssertFatal(prach_ConfigIndex<64, - "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex); - AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0, - "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex); - - t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra; - t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra; - t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra; -#ifdef PRACH_DEBUG - LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n", - prach_ConfigIndex, - subframe, - t0_ra,t1_ra,t2_ra); -#endif - - if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames - ((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames - (t0_ra == 0)) && // PRACH is in all frames - (((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame - (((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame - if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe - (((subframe%5)-2)==t2_ra)) prach_mask=1; - else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS - } - } - - return(prach_mask); -} - -int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe) { - - uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; - int prach_mask = is_prach_subframe0(frame_parms,prach_ConfigIndex,frame,subframe); - -#ifdef Rel14 - int i; - - for (i=0;i<4;i++) { - if (frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] == 1) - prach_mask|=(is_prach_subframe0(frame_parms,frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],frame,subframe)<<(i+1)); - } -#endif - return(prach_mask); -} - -int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint16_t Nf ) -{ - - lte_frame_type_t frame_type = ue->frame_parms.frame_type; - //uint8_t tdd_config = ue->frame_parms.tdd_config; - uint16_t rootSequenceIndex = ue->frame_parms.prach_config_common.rootSequenceIndex; - uint8_t prach_ConfigIndex = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex; - uint8_t Ncs_config = ue->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig; - uint8_t restricted_set = ue->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag; - //uint8_t n_ra_prboffset = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset; - uint8_t preamble_index = ue->prach_resources[eNB_id]->ra_PreambleIndex; - uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index; - int16_t *prachF = ue->prach_vars[eNB_id]->prachF; - static int16_t prach_tmp[45600*2] __attribute__((aligned(32))); - int16_t *prach = prach_tmp; - int16_t *prach2; - int16_t amp = ue->prach_vars[eNB_id]->amp; - int16_t Ncp; - uint8_t n_ra_prb; - uint16_t NCS; - uint16_t *prach_root_sequence_map; - uint16_t preamble_offset,preamble_shift; - uint16_t preamble_index0,n_shift_ra,n_shift_ra_bar; - uint16_t d_start,numshift; - - uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type); - //uint8_t Nsp=2; - //uint8_t f_ra,t1_ra; - uint16_t N_ZC = (prach_fmt<4)?839:139; - uint8_t not_found; - int k; - int16_t *Xu; - uint16_t u; - int32_t Xu_re,Xu_im; - uint16_t offset,offset2; - int prach_start; - int i, prach_len; - uint16_t first_nonzero_root_idx=0; - -#if defined(EXMIMO) || defined(OAI_USRP) - prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset); -#ifdef PRACH_DEBUG - LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, - prach_start, - ue->rx_offset, - ue->hw_timing_advance, - ue->N_TA_offset); -#endif - - if (prach_start<0) - prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); - - if (prach_start>=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) - prach_start-=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); - -#else //normal case (simulation) - prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset; - LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, - prach_start, - ue->rx_offset, - ue->hw_timing_advance, - ue->N_TA_offset); - -#endif - - - // First compute physical root sequence - if (restricted_set == 0) { - AssertFatal(Ncs_config <= 15, - "[PHY] FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", Ncs_config ); - NCS = NCS_unrestricted[Ncs_config]; - } else { - AssertFatal(Ncs_config <= 14, - "[PHY] FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", Ncs_config ); - NCS = NCS_restricted[Ncs_config]; - } - - n_ra_prb = get_prach_prb_offset(&(ue->frame_parms), - ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex, - ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset, - tdd_mapindex, Nf); - prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4; - - /* - // this code is not part of get_prach_prb_offset - if (frame_type == TDD) { // TDD - - if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) { - LOG_E( PHY, "[PHY][UE %"PRIu8"] Illegal prach_ConfigIndex %"PRIu8" for ", ue->Mod_id, prach_ConfigIndex ); - } - - // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211) - f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra; - - if (prach_fmt < 4) { - if ((f_ra&1) == 0) { - n_ra_prb = n_ra_prboffset + 6*(f_ra>>1); - } else { - n_ra_prb = ue->frame_parms.N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1); - } - } else { - if ((tdd_config >2) && (tdd_config<6)) - Nsp = 2; - - t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra; - - if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) { - n_ra_prb = 6*f_ra; - } else { - n_ra_prb = ue->frame_parms.N_RB_UL - 6*(f_ra+1); - } - } - } - */ - - // This is the relative offset (for unrestricted case) in the root sequence table (5.7.2-4 from 36.211) for the given preamble index - preamble_offset = ((NCS==0)? preamble_index : (preamble_index/(N_ZC/NCS))); - - if (restricted_set == 0) { - // This is the \nu corresponding to the preamble index - preamble_shift = (NCS==0)? 0 : (preamble_index % (N_ZC/NCS)); - preamble_shift *= NCS; - } else { // This is the high-speed case - -#ifdef PRACH_DEBUG - LOG_I(PHY,"[UE %d] High-speed mode, NCS_config %d\n",ue->Mod_id,Ncs_config); -#endif - - not_found = 1; - preamble_index0 = preamble_index; - // set preamble_offset to initial rootSequenceIndex and look if we need more root sequences for this - // preamble index and find the corresponding cyclic shift - preamble_offset = 0; // relative rootSequenceIndex; - - while (not_found == 1) { - // current root depending on rootSequenceIndex and preamble_offset - int index = (rootSequenceIndex + preamble_offset) % N_ZC; - - if (prach_fmt<4) { - // prach_root_sequence_map points to prach_root_sequence_map0_3 - DevAssert( index < sizeof(prach_root_sequence_map0_3) / sizeof(prach_root_sequence_map0_3[0]) ); - } else { - // prach_root_sequence_map points to prach_root_sequence_map4 - DevAssert( index < sizeof(prach_root_sequence_map4) / sizeof(prach_root_sequence_map4[0]) ); - } - - u = prach_root_sequence_map[index]; - - uint16_t n_group_ra = 0; - - if ( (du[u]<(N_ZC/3)) && (du[u]>=NCS) ) { - n_shift_ra = du[u]/NCS; - d_start = (du[u]<<1) + (n_shift_ra * NCS); - n_group_ra = N_ZC/d_start; - n_shift_ra_bar = max(0,(N_ZC-(du[u]<<1)-(n_group_ra*d_start))/N_ZC); - } else if ( (du[u]>=(N_ZC/3)) && (du[u]<=((N_ZC - NCS)>>1)) ) { - n_shift_ra = (N_ZC - (du[u]<<1))/NCS; - d_start = N_ZC - (du[u]<<1) + (n_shift_ra * NCS); - n_group_ra = du[u]/d_start; - n_shift_ra_bar = min(n_shift_ra,max(0,(du[u]- (n_group_ra*d_start))/NCS)); - } else { - n_shift_ra = 0; - n_shift_ra_bar = 0; - } - - // This is the number of cyclic shifts for the current root u - numshift = (n_shift_ra*n_group_ra) + n_shift_ra_bar; - - if (numshift>0 && preamble_index0==preamble_index) - first_nonzero_root_idx = preamble_offset; - - if (preamble_index0 < numshift) { - not_found = 0; - preamble_shift = (d_start * (preamble_index0/n_shift_ra)) + ((preamble_index0%n_shift_ra)*NCS); - - } else { // skip to next rootSequenceIndex and recompute parameters - preamble_offset++; - preamble_index0 -= numshift; - } - } - } - - // now generate PRACH signal -#ifdef PRACH_DEBUG - - if (NCS>0) - LOG_I(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, NCS %d (NCS_config %d, N_ZC/NCS %d) n_ra_prb %d: Preamble_offset %d, Preamble_shift %d\n", - rootSequenceIndex,preamble_index,NCS,Ncs_config,N_ZC/NCS,n_ra_prb, - preamble_offset,preamble_shift); - -#endif - - // nsymb = (frame_parms->Ncp==0) ? 14:12; - // subframe_offset = (unsigned int)frame_parms->ofdm_symbol_size*subframe*nsymb; - - k = (12*n_ra_prb) - 6*ue->frame_parms.N_RB_UL; - - if (k<0) - k+=ue->frame_parms.ofdm_symbol_size; - - k*=12; - k+=13; - - Xu = (int16_t*)ue->X_u[preamble_offset-first_nonzero_root_idx]; - - /* - k+=(12*ue->frame_parms.first_carrier_offset); - if (k>(12*ue->frame_parms.ofdm_symbol_size)) - k-=(12*ue->frame_parms.ofdm_symbol_size); - */ - k*=2; - - switch (ue->frame_parms.N_RB_UL) { - case 6: - memset((void*)prachF,0,4*1536); - break; - - case 15: - memset((void*)prachF,0,4*3072); - break; - - case 25: - memset((void*)prachF,0,4*6144); - break; - - case 50: - memset((void*)prachF,0,4*12288); - break; - - case 75: - memset((void*)prachF,0,4*18432); - break; - - case 100: - if (ue->frame_parms.threequarter_fs == 0) - memset((void*)prachF,0,4*24576); - else - memset((void*)prachF,0,4*18432); - break; - } - - for (offset=0,offset2=0; offset<N_ZC; offset++,offset2+=preamble_shift) { - - if (offset2 >= N_ZC) - offset2 -= N_ZC; - - Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15); - Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15); - prachF[k++]= ((Xu_re*ru[offset2<<1]) - (Xu_im*ru[1+(offset2<<1)]))>>15; - prachF[k++]= ((Xu_im*ru[offset2<<1]) + (Xu_re*ru[1+(offset2<<1)]))>>15; - - if (k==(12*2*ue->frame_parms.ofdm_symbol_size)) - k=0; - } - - switch (prach_fmt) { - case 0: - Ncp = 3168; - break; - - case 1: - case 3: - Ncp = 21024; - break; - - case 2: - Ncp = 6240; - break; - - case 4: - Ncp = 448; - break; - - default: - Ncp = 3168; - break; - } - - switch (ue->frame_parms.N_RB_UL) { - case 6: - Ncp>>=4; - prach+=4; // makes prach2 aligned to 128-bit - break; - - case 15: - Ncp>>=3; - break; - - case 25: - Ncp>>=2; - break; - - case 50: - Ncp>>=1; - break; - - case 75: - Ncp=(Ncp*3)>>2; - break; - } - - if (ue->frame_parms.threequarter_fs == 1) - Ncp=(Ncp*3)>>2; - - prach2 = prach+(Ncp<<1); - - // do IDFT - switch (ue->frame_parms.N_RB_UL) { - case 6: - if (prach_fmt == 4) { - idft256(prachF,prach2,1); - memmove( prach, prach+512, Ncp<<2 ); - prach_len = 256+Ncp; - } else { - idft1536(prachF,prach2,1); - memmove( prach, prach+3072, Ncp<<2 ); - prach_len = 1536+Ncp; - - if (prach_fmt>1) { - memmove( prach2+3072, prach2, 6144 ); - prach_len = 2*1536+Ncp; - } - } - - break; - - case 15: - if (prach_fmt == 4) { - idft512(prachF,prach2,1); - //TODO: account for repeated format in dft output - memmove( prach, prach+1024, Ncp<<2 ); - prach_len = 512+Ncp; - } else { - idft3072(prachF,prach2); - memmove( prach, prach+6144, Ncp<<2 ); - prach_len = 3072+Ncp; - - if (prach_fmt>1) { - memmove( prach2+6144, prach2, 12288 ); - prach_len = 2*3072+Ncp; - } - } - - break; - - case 25: - default: - if (prach_fmt == 4) { - idft1024(prachF,prach2,1); - memmove( prach, prach+2048, Ncp<<2 ); - prach_len = 1024+Ncp; - } else { - idft6144(prachF,prach2); - /*for (i=0;i<6144*2;i++) - prach2[i]<<=1;*/ - memmove( prach, prach+12288, Ncp<<2 ); - prach_len = 6144+Ncp; - - if (prach_fmt>1) { - memmove( prach2+12288, prach2, 24576 ); - prach_len = 2*6144+Ncp; - } - } - - break; - - case 50: - if (prach_fmt == 4) { - idft2048(prachF,prach2,1); - memmove( prach, prach+4096, Ncp<<2 ); - prach_len = 2048+Ncp; - } else { - idft12288(prachF,prach2); - memmove( prach, prach+24576, Ncp<<2 ); - prach_len = 12288+Ncp; - - if (prach_fmt>1) { - memmove( prach2+24576, prach2, 49152 ); - prach_len = 2*12288+Ncp; - } - } - - break; - - case 75: - if (prach_fmt == 4) { - idft3072(prachF,prach2); - //TODO: account for repeated format in dft output - memmove( prach, prach+6144, Ncp<<2 ); - prach_len = 3072+Ncp; - } else { - idft18432(prachF,prach2); - memmove( prach, prach+36864, Ncp<<2 ); - prach_len = 18432+Ncp; - - if (prach_fmt>1) { - memmove( prach2+36834, prach2, 73728 ); - prach_len = 2*18432+Ncp; - } - } - - break; - - case 100: - if (ue->frame_parms.threequarter_fs == 0) { - if (prach_fmt == 4) { - idft4096(prachF,prach2,1); - memmove( prach, prach+8192, Ncp<<2 ); - prach_len = 4096+Ncp; - } else { - idft24576(prachF,prach2); - memmove( prach, prach+49152, Ncp<<2 ); - prach_len = 24576+Ncp; - - if (prach_fmt>1) { - memmove( prach2+49152, prach2, 98304 ); - prach_len = 2* 24576+Ncp; - } - } - } - else { - if (prach_fmt == 4) { - idft3072(prachF,prach2); - //TODO: account for repeated format in dft output - memmove( prach, prach+6144, Ncp<<2 ); - prach_len = 3072+Ncp; - } else { - idft18432(prachF,prach2); - memmove( prach, prach+36864, Ncp<<2 ); - prach_len = 18432+Ncp; - printf("Generated prach for 100 PRB, 3/4 sampling\n"); - if (prach_fmt>1) { - memmove( prach2+36834, prach2, 73728 ); - prach_len = 2*18432+Ncp; - } - } - } - - break; - } - - //LOG_I(PHY,"prach_len=%d\n",prach_len); - - AssertFatal(prach_fmt<4, - "prach_fmt4 not fully implemented" ); -#if defined(EXMIMO) || defined(OAI_USRP) - int j; - int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti; - LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow ); - - for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) { - ((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4; - ((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4; - } - - for (i=0; i<overflow; i++,j++) { - ((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4; - ((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4; - } -#if defined(EXMIMO) - // handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on - for (k=prach_start - (ue->frame_parms.samples_per_tti>>1) ; k<prach_start ; k++) { - if (k<0) - ue->common_vars.txdata[0][k+ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; - else if (k>(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) - ue->common_vars.txdata[0][k-ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; - else - ue->common_vars.txdata[0][k] &= 0xFFFEFFFE; - } -#endif -#else - - for (i=0; i<prach_len; i++) { - ((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i] = prach[2*i]; - ((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i+1] = prach[2*i+1]; - } - -#endif - - - -#if defined(PRACH_WRITE_OUTPUT_DEBUG) - write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1); - write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1); - write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1); - exit(-1); -#endif - - return signal_energy( (int*)prach, 256 ); -} -//__m128i mmtmpX0,mmtmpX1,mmtmpX2,mmtmpX3; #ifndef Rel14 #define rx_prach0 rx_prach @@ -1766,8 +721,6 @@ void rx_prach0(PHY_VARS_eNB *eNB, } - - #ifdef Rel14 void rx_prach(PHY_VARS_eNB *eNB, @@ -1812,189 +765,4 @@ void rx_prach(PHY_VARS_eNB *eNB, #endif /* Rel14 */ -void init_prach_tables(int N_ZC) -{ - - int i,m; - - // Compute the modular multiplicative inverse 'iu' of u s.t. iu*u = 1 mod N_ZC - ZC_inv[0] = 0; - ZC_inv[1] = 1; - - for (i=2; i<N_ZC; i++) { - for (m=2; m<N_ZC; m++) - if (((i*m)%N_ZC) == 1) { - ZC_inv[i] = m; - break; - } - -#ifdef PRACH_DEBUG - - if (i<16) - printf("i %d : inv %d\n",i,ZC_inv[i]); -#endif - } - - // Compute quantized roots of unity - for (i=0; i<N_ZC; i++) { - ru[i<<1] = (int16_t)(floor(32767.0*cos(2*M_PI*(double)i/N_ZC))); - ru[1+(i<<1)] = (int16_t)(floor(32767.0*sin(2*M_PI*(double)i/N_ZC))); -#ifdef PRACH_DEBUG - - if (i<16) - printf("i %d : runity %d,%d\n",i,ru[i<<1],ru[1+(i<<1)]); - -#endif - } -} - -void compute_prach_seq(uint16_t rootSequenceIndex, - uint8_t prach_ConfigIndex, - uint8_t zeroCorrelationZoneConfig, - uint8_t highSpeedFlag, - lte_frame_type_t frame_type, - uint32_t X_u[64][839]) -{ - - // Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC) - unsigned int k,inv_u,i,NCS=0,num_preambles; - int N_ZC; - uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type); - uint16_t *prach_root_sequence_map; - uint16_t u, preamble_offset; - uint16_t n_shift_ra,n_shift_ra_bar, d_start,numshift; - uint8_t not_found; - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_IN); - -#ifdef PRACH_DEBUG - LOG_I(PHY,"compute_prach_seq: NCS_config %d, prach_fmt %d\n",zeroCorrelationZoneConfig, prach_fmt); -#endif - - AssertFatal(prach_fmt<4, - "PRACH sequence is only precomputed for prach_fmt<4 (have %"PRIu8")\n", prach_fmt ); - N_ZC = (prach_fmt < 4) ? 839 : 139; - //init_prach_tables(N_ZC); //moved to phy_init_lte_ue/eNB, since it takes to long in real-time - - if (prach_fmt < 4) { - prach_root_sequence_map = prach_root_sequence_map0_3; - } else { - // FIXME cannot be reached - prach_root_sequence_map = prach_root_sequence_map4; - } - - -#ifdef PRACH_DEBUG - LOG_I( PHY, "compute_prach_seq: done init prach_tables\n" ); -#endif - - if (highSpeedFlag== 0) { - -#ifdef PRACH_DEBUG - LOG_I(PHY,"Low speed prach : NCS_config %d\n",zeroCorrelationZoneConfig); -#endif - - AssertFatal(zeroCorrelationZoneConfig<=15, - "FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", zeroCorrelationZoneConfig ); - NCS = NCS_unrestricted[zeroCorrelationZoneConfig]; - - num_preambles = (NCS==0) ? 64 : ((64*NCS)/N_ZC); - - if (NCS>0) num_preambles++; - - preamble_offset = 0; - } else { - -#ifdef PRACH_DEBUG - LOG_I( PHY, "high speed prach : NCS_config %"PRIu8"\n", zeroCorrelationZoneConfig ); -#endif - - AssertFatal(zeroCorrelationZoneConfig<=14, - "FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", zeroCorrelationZoneConfig ); - NCS = NCS_restricted[zeroCorrelationZoneConfig]; - fill_du(prach_fmt); - - num_preambles = 64; // compute ZC sequence for 64 possible roots - // find first non-zero shift root (stored in preamble_offset) - not_found = 1; - preamble_offset = 0; - - while (not_found == 1) { - // current root depending on rootSequenceIndex - int index = (rootSequenceIndex + preamble_offset) % N_ZC; - - if (prach_fmt<4) { - // prach_root_sequence_map points to prach_root_sequence_map0_3 - DevAssert( index < sizeof(prach_root_sequence_map0_3) / sizeof(prach_root_sequence_map0_3[0]) ); - } else { - // prach_root_sequence_map points to prach_root_sequence_map4 - DevAssert( index < sizeof(prach_root_sequence_map4) / sizeof(prach_root_sequence_map4[0]) ); - } - - u = prach_root_sequence_map[index]; - - uint16_t n_group_ra = 0; - - if ( (du[u]<(N_ZC/3)) && (du[u]>=NCS) ) { - n_shift_ra = du[u]/NCS; - d_start = (du[u]<<1) + (n_shift_ra * NCS); - n_group_ra = N_ZC/d_start; - n_shift_ra_bar = max(0,(N_ZC-(du[u]<<1)-(n_group_ra*d_start))/N_ZC); - } else if ( (du[u]>=(N_ZC/3)) && (du[u]<=((N_ZC - NCS)>>1)) ) { - n_shift_ra = (N_ZC - (du[u]<<1))/NCS; - d_start = N_ZC - (du[u]<<1) + (n_shift_ra * NCS); - n_group_ra = du[u]/d_start; - n_shift_ra_bar = min(n_shift_ra,max(0,(du[u]- (n_group_ra*d_start))/NCS)); - } else { - n_shift_ra = 0; - n_shift_ra_bar = 0; - } - - // This is the number of cyclic shifts for the current root u - numshift = (n_shift_ra*n_group_ra) + n_shift_ra_bar; - - // skip to next root and recompute parameters if numshift==0 - if (numshift>0) - not_found = 0; - else - preamble_offset++; - } - } - -#ifdef PRACH_DEBUG - - if (NCS>0) - LOG_I( PHY, "Initializing %u preambles for PRACH (NCS_config %"PRIu8", NCS %u, N_ZC/NCS %u)\n", - num_preambles, zeroCorrelationZoneConfig, NCS, N_ZC/NCS ); - -#endif - - for (i=0; i<num_preambles; i++) { - int index = (rootSequenceIndex+i+preamble_offset) % N_ZC; - - if (prach_fmt<4) { - // prach_root_sequence_map points to prach_root_sequence_map0_3 - DevAssert( index < sizeof(prach_root_sequence_map0_3) / sizeof(prach_root_sequence_map0_3[0]) ); - } else { - // prach_root_sequence_map points to prach_root_sequence_map4 - DevAssert( index < sizeof(prach_root_sequence_map4) / sizeof(prach_root_sequence_map4[0]) ); - } - - u = prach_root_sequence_map[index]; - - inv_u = ZC_inv[u]; // multiplicative inverse of u - - - // X_u[0] stores the first ZC sequence where the root u has a non-zero number of shifts - // for the unrestricted case X_u[0] is the first root indicated by the rootSequenceIndex - - for (k=0; k<N_ZC; k++) { - // 420 is the multiplicative inverse of 2 (required since ru is exp[j 2\pi n]) - X_u[i][k] = ((uint32_t*)ru)[(((k*(1+(inv_u*k)))%N_ZC)*420)%N_ZC]; - } - } - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_OUT); - -} diff --git a/openair1/PHY/LTE_TRANSPORT/prach.h b/openair1/PHY/LTE_TRANSPORT/prach.h deleted file mode 100644 index f135af6d81..0000000000 --- a/openair1/PHY/LTE_TRANSPORT/prach.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -short __attribute__((aligned(16))) X_u839[4][2*839] = {{25792,20209,24697,21533,21208,24977,14453,29407,3673,32560,-10603,31004,-25018,21161,-32697,2145,-25717,-20307,-2330,-32685,24778,-21441,31178,10078,4403,32469,-28990,15273,-22038,-24250,20546,-25526,26673,19030,-20065,25905,-22930,-23408,28086,-16877,6820,32049,-31985,-7121,22218,-24084,6580,32099,-28459,-16242,31873,-7599,-20642,25448,4038,-32518,10834,30923,-21115,-25058,26955,18629,-29699,-13845,30607,11698,-30291,-12497,28519,16134,-24291,-21993,16188,28488,-3308,-32600,-13118,30026,27959,-17087,-32353,-5193,18679,26921,9552,-31344,-31534,8904,22308,24000,14122,-29568,-32314,-5435,490,32763,32605,-3247,-2819,-32646,-32758,-798,-7539,31887,28149,16771,26458,-19330,-4283,-32487,-29271,-14729,-30052,13061,-12213,30405,9669,31307,25331,20784,32111,6520,32182,-6160,29046,-15165,25563,-20499,23450,-22887,23450,-22887,25563,-20499,29046,-15165,32182,-6160,32111,6520,25331,20784,9669,31307,-12213,30405,-30052,13061,-29271,-14729,-4283,-32487,26458,-19330,28149,16771,-7539,31887,-32758,-798,-2819,-32646,32605,-3247,490,32763,-32314,-5435,14122,-29568,22308,24000,-31534,8904,9552,-31344,18679,26921,-32353,-5193,27959,-17087,-13118,30026,-3308,-32600,16188,28488,-24291,-21993,28519,16134,-30291,-12497,30607,11698,-29699,-13845,26955,18629,-21115,-25058,10834,30923,4038,-32518,-20642,25448,31873,-7599,-28459,-16242,6580,32099,22218,-24084,-31985,-7121,6820,32049,28086,-16877,-22930,-23408,-20065,25905,26673,19030,20546,-25526,-22038,-24250,-28990,15273,4403,32469,31178,10078,24778,-21441,-2330,-32685,-25717,-20307,-32697,2145,-25018,21161,-10603,31004,3673,32560,14453,29407,21208,24977,24697,21533,25792,20209,24858,21348,21579,24657,15110,29074,4646,32435,-9435,31379,-24042,22263,-32540,3855,-26887,-18731,-4526,-32454,23104,-23235,31902,7479,7299,31943,-27368,18019,-24455,-21810,17555,-27668,28757,15705,-16614,28243,-25868,-20114,25409,-20690,11526,30672,-32705,-2024,17967,-27402,11984,30496,-30904,-10893,29902,-13399,-15328,28960,-2574,-32666,17034,27991,-26018,-19919,30428,12155,-32088,-6641,32509,4099,-32428,-4708,31663,8431,-29160,-14947,23191,23148,-12099,-30452,-4161,32501,21855,-24414,-32445,4585,25942,20016,-614,-32762,-27095,18426,28874,15490,3551,-32575,-32251,5797,11756,30585,29379,-14509,-14344,-29461,-30780,11238,4889,32400,32409,4828,16929,-28055,-16719,-28181,-32719,-1779,-22129,24166,1471,32733,21946,24331,31786,7956,31756,-8076,26166,-19724,19180,-26567,13454,-29878,10253,-31122,10020,-31198,12779,-30173,18172,-27267,25096,-21068,31140,-10196,32333,5313,24207,22082,5131,32362,-18881,26780,-32641,2879,-20927,-25215,11870,-30542,32741,-1288,11296,30758,-27635,17607,-20737,-25371,24938,-21255,19279,26494,-29435,14398,-5979,-32218,32205,6038,-19871,26054,-11412,-30716,31253,9845,-28640,15920,11181,-30801,8727,31583,-23278,-23062,30694,11469,-32751,-1043,32135,-6401,-31024,10544,30651,-11585,-31326,9610,32461,-4465,-32525,-3978,29103,15056,-19577,-26277,2940,32634,17347,-27799,-31600,8668,27501,17813,-1840,-32716,-27232,18223,28023,16981,6700,-32075,-32747,1165,5857,32239,31929,-7360,-5737,-32261,-32755,920,-7061,31997,27765,17399,27568,-17711,-1105,-32749,-27026,-18529,-31846,7717,-18275,27197,1716,32721,18477,27060,28397,16348,32292,5555,32650,-2758,31815,-7838,31289,-9729,31631,-8550,32493,-4222,32593,3368,29750,13733,21394,24818,6098,32194,-13790,29724,-29953,13286,-30196,-12724,-8373,-31680,22398,-23917,31396,9375,2451,32675,-30863,11008,-16082,-28550,27300,-18122,17451,27732,-29647,13955,-7181,-31971,32617,3123,-15975,28609,-17140,-27928,32711,1900,-22666,23663,-123,-32767,20450,25601,-31064,-10429,32390,-4951,-28275,16560,22576,-23748,-17866,27468,15436,-28904,-15760,28728,18780,-26851,-23875,22443,29487,-14289,-32726,1655,29541,14177,-16508,-28306,-5375,32323,26745,-18931,-31567,-8787,10137,31159,22754,-23579,-30475,-12042,-2697,32655,32553,-3735,-6941,-32024,-32011,7000,3916,32532,32679,2390,11641,-30630,-23959,-22354,-30945,10776,-8016,31771,19674,26202,32477,4342,27700,-17504,13005,-30076,-3063,-32624,-15653,-28787,-23621,-22710,-27831,-17296,-29594,-14067,-29802,-13623,-28580,-16029,-25254,-20879,-18579,-26991,-7420,-31916,7896,-31802,23790,-22533,32629,-3002,25640,20402,1226,32744,-26092,19821,-30100,-12950,-369,-32765,30984,-10661,17243,27862,-25487,20593,-21302,-24899,26312,-19527,14892,29187,-32062,6760,5010,-32382,26815,18830,-30149,12836,8134,-31742,17658,27601,-31501,-9023,30821,-11124,-21021,25135,8609,-31616,2206,32692,-9787,-31272,14011,29620,-15220,-29019,13566,29826,-8846,-31551,736,32758,10486,-31044,-22843,23492,31695,-8313,-30384,-12270,14232,29514,12326,-30361,-31726,8193,23364,22973,10718,-30965,-32765,429,8490,31647,30001,-13175,-14783,-29243,-29853,13510,9199,31449,32731,-1534,9317,-31415,-24617,-21626,-31103,10312,-9904,31234,16824,28117,31466,9140,30563,-11814,19772,-26130,6219,-32172,-5496,-32303,-13678,-29776,-18377,-27130,-20162,-25830,-19379,-26423,-15868,-28669,-9082,-31484,1349,-32740,14563,-29353,27163,-18326,32760,674,24372,21901,981,32752,-25176,20973,-31216,-9963,-5254,-32344,28212,-16667,23705,22621,-18071,27333,-28699,-15814,16294,-28429,26385,19428,-24536,21717,-13231,-29978,32765,-307,-15545,28845,-15002,-29132,31957,7240,-27896,17191,10950,-30884,7777,31830,-21672,-24577,29325,14618,-32272,-5677,32762,-553,-32568,3612,32580,-3491,-32767,184,32159,6279,-28933,-15382,20831,25292,-6461,-32124,-12441,30313,28816,-15599,-31432,-9259,12892,30123,17762,-27536,-32671,-2513,10370,31082,26602,-19131,-24125,-22174,-19478,26349,26530,19230,21487,-24739,-20355,-25679,-30337,12383,245,32766,29215,14837,28336,-16455,4768,-32419,-19968,-25981,-32037,-6881,-30244,12610,-20259,25754,-8254,31710,1961,32708,8963,31517,12666,30219,13342,29927,11065,30841,5616,32282,-3186,32611,-14674,29297,-26240,19625,-32661,2635,-27435,-17917,-7659,-31860,18980,-26710,32766,-62,16401,28366,-19081,26638,-31362,-9494,2084,-32701,32688,-2269,3429,32587,-32737,1410,3794,-32547,30518,11927,-21764,24495,-12554,-30267,32372,5071,-23536,22798,-859,-32756,22487,23832,-32229,-5919,30736,-11355,-23018,23321,13900,-29673,-6340,32147,1594,-32729,0,32767,1594,-32729,-6340,32147,13900,-29673,-23018,23321,30736,-11355,-32229,-5919,22487,23832,-859,-32756,-23536,22798,32372,5071,-12554,-30267,-21764,24495,30518,11927,3794,-32547,-32737,1410,3429,32587,32688,-2269,2084,-32701,-31362,-9494,-19081,26638,16401,28366,32766,-62,18980,-26710,-7659,-31860,-27435,-17917,-32661,2635,-26240,19625,-14674,29297,-3186,32611,5616,32282,11065,30841,13342,29927,12666,30219,8963,31517,1961,32708,-8254,31710,-20259,25754,-30244,12610,-32037,-6881,-19968,-25981,4768,-32419,28336,-16455,29215,14837,245,32766,-30337,12383,-20355,-25679,21487,-24739,26530,19230,-19478,26349,-24125,-22174,26602,-19131,10370,31082,-32671,-2513,17762,-27536,12892,30123,-31432,-9259,28816,-15599,-12441,30313,-6461,-32124,20831,25292,-28933,-15382,32159,6279,-32767,184,32580,-3491,-32568,3612,32762,-553,-32272,-5677,29325,14618,-21672,-24577,7777,31830,10950,-30884,-27896,17191,31957,7240,-15002,-29132,-15545,28845,32765,-307,-13231,-29978,-24536,21717,26385,19428,16294,-28429,-28699,-15814,-18071,27333,23705,22621,28212,-16667,-5254,-32344,-31216,-9963,-25176,20973,981,32752,24372,21901,32760,674,27163,-18326,14563,-29353,1349,-32740,-9082,-31484,-15868,-28669,-19379,-26423,-20162,-25830,-18377,-27130,-13678,-29776,-5496,-32303,6219,-32172,19772,-26130,30563,-11814,31466,9140,16824,28117,-9904,31234,-31103,10312,-24617,-21626,9317,-31415,32731,-1534,9199,31449,-29853,13510,-14783,-29243,30001,-13175,8490,31647,-32765,429,10718,-30965,23364,22973,-31726,8193,12326,-30361,14232,29514,-30384,-12270,31695,-8313,-22843,23492,10486,-31044,736,32758,-8846,-31551,13566,29826,-15220,-29019,14011,29620,-9787,-31272,2206,32692,8609,-31616,-21021,25135,30821,-11124,-31501,-9023,17658,27601,8134,-31742,-30149,12836,26815,18830,5010,-32382,-32062,6760,14892,29187,26312,-19527,-21302,-24899,-25487,20593,17243,27862,30984,-10661,-369,-32765,-30100,-12950,-26092,19821,1226,32744,25640,20402,32629,-3002,23790,-22533,7896,-31802,-7420,-31916,-18579,-26991,-25254,-20879,-28580,-16029,-29802,-13623,-29594,-14067,-27831,-17296,-23621,-22710,-15653,-28787,-3063,-32624,13005,-30076,27700,-17504,32477,4342,19674,26202,-8016,31771,-30945,10776,-23959,-22354,11641,-30630,32679,2390,3916,32532,-32011,7000,-6941,-32024,32553,-3735,-2697,32655,-30475,-12042,22754,-23579,10137,31159,-31567,-8787,26745,-18931,-5375,32323,-16508,-28306,29541,14177,-32726,1655,29487,-14289,-23875,22443,18780,-26851,-15760,28728,15436,-28904,-17866,27468,22576,-23748,-28275,16560,32390,-4951,-31064,-10429,20450,25601,-123,-32767,-22666,23663,32711,1900,-17140,-27928,-15975,28609,32617,3123,-7181,-31971,-29647,13955,17451,27732,27300,-18122,-16082,-28550,-30863,11008,2451,32675,31396,9375,22398,-23917,-8373,-31680,-30196,-12724,-29953,13286,-13790,29724,6098,32194,21394,24818,29750,13733,32593,3368,32493,-4222,31631,-8550,31289,-9729,31815,-7838,32650,-2758,32292,5555,28397,16348,18477,27060,1716,32721,-18275,27197,-31846,7717,-27026,-18529,-1105,-32749,27568,-17711,27765,17399,-7061,31997,-32755,920,-5737,-32261,31929,-7360,5857,32239,-32747,1165,6700,-32075,28023,16981,-27232,18223,-1840,-32716,27501,17813,-31600,8668,17347,-27799,2940,32634,-19577,-26277,29103,15056,-32525,-3978,32461,-4465,-31326,9610,30651,-11585,-31024,10544,32135,-6401,-32751,-1043,30694,11469,-23278,-23062,8727,31583,11181,-30801,-28640,15920,31253,9845,-11412,-30716,-19871,26054,32205,6038,-5979,-32218,-29435,14398,19279,26494,24938,-21255,-20737,-25371,-27635,17607,11296,30758,32741,-1288,11870,-30542,-20927,-25215,-32641,2879,-18881,26780,5131,32362,24207,22082,32333,5313,31140,-10196,25096,-21068,18172,-27267,12779,-30173,10020,-31198,10253,-31122,13454,-29878,19180,-26567,26166,-19724,31756,-8076,31786,7956,21946,24331,1471,32733,-22129,24166,-32719,-1779,-16719,-28181,16929,-28055,32409,4828,4889,32400,-30780,11238,-14344,-29461,29379,-14509,11756,30585,-32251,5797,3551,-32575,28874,15490,-27095,18426,-614,-32762,25942,20016,-32445,4585,21855,-24414,-4161,32501,-12099,-30452,23191,23148,-29160,-14947,31663,8431,-32428,-4708,32509,4099,-32088,-6641,30428,12155,-26018,-19919,17034,27991,-2574,-32666,-15328,28960,29902,-13399,-30904,-10893,11984,30496,17967,-27402,-32705,-2024,11526,30672,25409,-20690,-25868,-20114,-16614,28243,28757,15705,17555,-27668,-24455,-21810,-27368,18019,7299,31943,31902,7479,23104,-23235,-4526,-32454,-26887,-18731,-32540,3855,-24042,22263,-9435,31379,4646,32435,15110,29074,21579,24657,24858,21348}, - {25792,-20210,24858,-21349,21579,-24658,15110,-29075,4646,-32436,-9435,-31380,-24042,-22264,-32540,-3856,-26887,18730,-4526,32453,23104,23234,31902,-7480,7299,-31944,-27368,-18020,-24455,21809,17555,27667,28757,-15706,-16614,-28244,-25868,20113,25409,20689,11526,-30673,-32705,2023,17967,27401,11984,-30497,-30904,10892,29902,13398,-15328,-28961,-2574,32665,17034,-27992,-26018,19918,30428,-12156,-32088,6640,32509,-4100,-32428,4707,31663,-8432,-29160,14946,23191,-23149,-12099,30451,-4161,-32502,21855,24413,-32445,-4586,25942,-20017,-614,32761,-27095,-18427,28874,-15491,3551,32574,-32251,-5798,11756,-30586,29379,14508,-14344,29460,-30780,-11239,4889,-32401,32409,-4829,16929,28054,-16719,28180,-32719,1778,-22129,-24167,1471,-32734,21946,-24332,31786,-7957,31756,8075,26166,19723,19180,26566,13454,29877,10253,31121,10020,31197,12779,30172,18172,27266,25096,21067,31140,10195,32333,-5314,24207,-22083,5131,-32363,-18881,-26781,-32641,-2880,-20927,25214,11870,30541,32741,1287,11296,-30759,-27635,-17608,-20737,25370,24938,21254,19279,-26495,-29435,-14399,-5979,32217,32205,-6039,-19871,-26055,-11412,30715,31253,-9846,-28640,-15921,11181,30800,8727,-31584,-23278,23061,30694,-11470,-32751,1042,32135,6400,-31024,-10545,30651,11584,-31326,-9611,32461,4464,-32525,3977,29103,-15057,-19577,26276,2940,-32635,17347,27798,-31600,-8669,27501,-17814,-1840,32715,-27232,-18224,28023,-16982,6700,32074,-32747,-1166,5857,-32240,31929,7359,-5737,32260,-32755,-921,-7061,-31998,27765,-17400,27568,17710,-1105,32748,-27026,18528,-31846,-7718,-18275,-27198,1716,-32722,18477,-27061,28397,-16349,32292,-5556,32650,2757,31815,7837,31289,9728,31631,8549,32493,4221,32593,-3369,29750,-13734,21394,-24819,6098,-32195,-13790,-29725,-29953,-13287,-30196,12723,-8373,31679,22398,23916,31396,-9376,2451,-32676,-30863,-11009,-16082,28549,27300,18121,17451,-27733,-29647,-13956,-7181,31970,32617,-3124,-15975,-28610,-17140,27927,32711,-1901,-22666,-23664,-123,32766,20450,-25602,-31064,10428,32390,4950,-28275,-16561,22576,23747,-17866,-27469,15436,28903,-15760,-28729,18780,26850,-23875,-22444,29487,14288,-32726,-1656,29541,-14178,-16508,28305,-5375,-32324,26745,18930,-31567,8786,10137,-31160,22754,23578,-30475,12041,-2697,-32656,32553,3734,-6941,32023,-32011,-7001,3916,-32533,32679,-2391,11641,30629,-23959,22353,-30945,-10777,-8016,-31772,19674,-26203,32477,-4343,27700,17503,13005,30075,-3063,32623,-15653,28786,-23621,22709,-27831,17295,-29594,14066,-29802,13622,-28580,16028,-25254,20878,-18579,26990,-7420,31915,7896,31801,23790,22532,32629,3001,25640,-20403,1226,-32745,-26092,-19822,-30100,12949,-369,32764,30984,10660,17243,-27863,-25487,-20594,-21302,24898,26312,19526,14892,-29188,-32062,-6761,5010,32381,26815,-18831,-30149,-12837,8134,31741,17658,-27602,-31501,9022,30821,11123,-21021,-25136,8609,31615,2206,-32693,-9787,31271,14011,-29621,-15220,29018,13566,-29827,-8846,31550,736,-32759,10486,31043,-22843,-23493,31695,8312,-30384,12269,14232,-29515,12326,30360,-31726,-8194,23364,-22974,10718,30964,-32765,-430,8490,-31648,30001,13174,-14783,29242,-29853,-13511,9199,-31450,32731,1533,9317,31414,-24617,21625,-31103,-10313,-9904,-31235,16824,-28118,31466,-9141,30563,11813,19772,26129,6219,32171,-5496,32302,-13678,29775,-18377,27129,-20162,25829,-19379,26422,-15868,28668,-9082,31483,1349,32739,14563,29352,27163,18325,32760,-675,24372,-21902,981,-32753,-25176,-20974,-31216,9962,-5254,32343,28212,16666,23705,-22622,-18071,-27334,-28699,15813,16294,28428,26385,-19429,-24536,-21718,-13231,29977,32765,306,-15545,-28846,-15002,29131,31957,-7241,-27896,-17192,10950,30883,7777,-31831,-21672,24576,29325,-14619,-32272,5676,32762,552,-32568,-3613,32580,3490,-32767,-185,32159,-6280,-28933,15381,20831,-25293,-6461,32123,-12441,-30314,28816,15598,-31432,9258,12892,-30124,17762,27535,-32671,2512,10370,-31083,26602,19130,-24125,22173,-19478,-26350,26530,-19231,21487,24738,-20355,25678,-30337,-12384,245,-32767,29215,-14838,28336,16454,4768,32418,-19968,25980,-32037,6880,-30244,-12611,-20259,-25755,-8254,-31711,1961,-32709,8963,-31518,12666,-30220,13342,-29928,11065,-30842,5616,-32283,-3186,-32612,-14674,-29298,-26240,-19626,-32661,-2636,-27435,17916,-7659,31859,18980,26709,32766,61,16401,-28367,-19081,-26639,-31362,9493,2084,32700,32688,2268,3429,-32588,-32737,-1411,3794,32546,30518,-11928,-21764,-24496,-12554,30266,32372,-5072,-23536,-22799,-859,32755,22487,-23833,-32229,5918,30736,11354,-23018,-23322,13900,29672,-6340,-32148,1594,32728,-1,-32767,1594,32728,-6340,-32148,13900,29672,-23018,-23322,30736,11354,-32229,5918,22487,-23833,-859,32755,-23536,-22799,32372,-5072,-12554,30266,-21764,-24496,30518,-11928,3794,32546,-32737,-1411,3429,-32588,32688,2268,2084,32700,-31362,9493,-19081,-26639,16401,-28367,32766,61,18980,26709,-7659,31859,-27435,17916,-32661,-2636,-26240,-19626,-14674,-29298,-3186,-32612,5616,-32283,11065,-30842,13342,-29928,12666,-30220,8963,-31518,1961,-32709,-8254,-31711,-20259,-25755,-30244,-12611,-32037,6880,-19968,25980,4768,32418,28336,16454,29215,-14838,245,-32767,-30337,-12384,-20355,25678,21487,24738,26530,-19231,-19478,-26350,-24125,22173,26602,19130,10370,-31083,-32671,2512,17762,27535,12892,-30124,-31432,9258,28816,15598,-12441,-30314,-6461,32123,20831,-25293,-28933,15381,32159,-6280,-32767,-185,32580,3490,-32568,-3613,32762,552,-32272,5676,29325,-14619,-21672,24576,7777,-31831,10950,30883,-27896,-17192,31957,-7241,-15002,29131,-15545,-28846,32765,306,-13231,29977,-24536,-21718,26385,-19429,16294,28428,-28699,15813,-18071,-27334,23705,-22622,28212,16666,-5254,32343,-31216,9962,-25176,-20974,981,-32753,24372,-21902,32760,-675,27163,18325,14563,29352,1349,32739,-9082,31483,-15868,28668,-19379,26422,-20162,25829,-18377,27129,-13678,29775,-5496,32302,6219,32171,19772,26129,30563,11813,31466,-9141,16824,-28118,-9904,-31235,-31103,-10313,-24617,21625,9317,31414,32731,1533,9199,-31450,-29853,-13511,-14783,29242,30001,13174,8490,-31648,-32765,-430,10718,30964,23364,-22974,-31726,-8194,12326,30360,14232,-29515,-30384,12269,31695,8312,-22843,-23493,10486,31043,736,-32759,-8846,31550,13566,-29827,-15220,29018,14011,-29621,-9787,31271,2206,-32693,8609,31615,-21021,-25136,30821,11123,-31501,9022,17658,-27602,8134,31741,-30149,-12837,26815,-18831,5010,32381,-32062,-6761,14892,-29188,26312,19526,-21302,24898,-25487,-20594,17243,-27863,30984,10660,-369,32764,-30100,12949,-26092,-19822,1226,-32745,25640,-20403,32629,3001,23790,22532,7896,31801,-7420,31915,-18579,26990,-25254,20878,-28580,16028,-29802,13622,-29594,14066,-27831,17295,-23621,22709,-15653,28786,-3063,32623,13005,30075,27700,17503,32477,-4343,19674,-26203,-8016,-31772,-30945,-10777,-23959,22353,11641,30629,32679,-2391,3916,-32533,-32011,-7001,-6941,32023,32553,3734,-2697,-32656,-30475,12041,22754,23578,10137,-31160,-31567,8786,26745,18930,-5375,-32324,-16508,28305,29541,-14178,-32726,-1656,29487,14288,-23875,-22444,18780,26850,-15760,-28729,15436,28903,-17866,-27469,22576,23747,-28275,-16561,32390,4950,-31064,10428,20450,-25602,-123,32766,-22666,-23664,32711,-1901,-17140,27927,-15975,-28610,32617,-3124,-7181,31970,-29647,-13956,17451,-27733,27300,18121,-16082,28549,-30863,-11009,2451,-32676,31396,-9376,22398,23916,-8373,31679,-30196,12723,-29953,-13287,-13790,-29725,6098,-32195,21394,-24819,29750,-13734,32593,-3369,32493,4221,31631,8549,31289,9728,31815,7837,32650,2757,32292,-5556,28397,-16349,18477,-27061,1716,-32722,-18275,-27198,-31846,-7718,-27026,18528,-1105,32748,27568,17710,27765,-17400,-7061,-31998,-32755,-921,-5737,32260,31929,7359,5857,-32240,-32747,-1166,6700,32074,28023,-16982,-27232,-18224,-1840,32715,27501,-17814,-31600,-8669,17347,27798,2940,-32635,-19577,26276,29103,-15057,-32525,3977,32461,4464,-31326,-9611,30651,11584,-31024,-10545,32135,6400,-32751,1042,30694,-11470,-23278,23061,8727,-31584,11181,30800,-28640,-15921,31253,-9846,-11412,30715,-19871,-26055,32205,-6039,-5979,32217,-29435,-14399,19279,-26495,24938,21254,-20737,25370,-27635,-17608,11296,-30759,32741,1287,11870,30541,-20927,25214,-32641,-2880,-18881,-26781,5131,-32363,24207,-22083,32333,-5314,31140,10195,25096,21067,18172,27266,12779,30172,10020,31197,10253,31121,13454,29877,19180,26566,26166,19723,31756,8075,31786,-7957,21946,-24332,1471,-32734,-22129,-24167,-32719,1778,-16719,28180,16929,28054,32409,-4829,4889,-32401,-30780,-11239,-14344,29460,29379,14508,11756,-30586,-32251,-5798,3551,32574,28874,-15491,-27095,-18427,-614,32761,25942,-20017,-32445,-4586,21855,24413,-4161,-32502,-12099,30451,23191,-23149,-29160,14946,31663,-8432,-32428,4707,32509,-4100,-32088,6640,30428,-12156,-26018,19918,17034,-27992,-2574,32665,-15328,-28961,29902,13398,-30904,10892,11984,-30497,17967,27401,-32705,2023,11526,-30673,25409,20689,-25868,20113,-16614,-28244,28757,-15706,17555,27667,-24455,21809,-27368,-18020,7299,-31944,31902,-7480,23104,23234,-4526,32453,-26887,18730,-32540,-3856,-24042,-22264,-9435,-31380,4646,-32436,15110,-29075,21579,-24658,24858,-21349,25792,-20210,24697,-21534,21208,-24978,14453,-29408,3673,-32561,-10603,-31005,-25018,-21162,-32697,-2146,-25717,20306,-2330,32684,24778,21440,31178,-10079,4403,-32470,-28990,-15274,-22038,24249,20546,25525,26673,-19031,-20065,-25906,-22930,23407,28086,16876,6820,-32050,-31985,7120,22218,24083,6580,-32100,-28459,16241,31873,7598,-20642,-25449,4038,32517,10834,-30924,-21115,25057,26955,-18630,-29699,13844,30607,-11699,-30291,12496,28519,-16135,-24291,21992,16188,-28489,-3308,32599,-13118,-30027,27959,17086,-32353,5192,18679,-26922,9552,31343,-31534,-8905,22308,-24001,14122,29567,-32314,5434,490,-32764,32605,3246,-2819,32645,-32758,797,-7539,-31888,28149,-16772,26458,19329,-4283,32486,-29271,14728,-30052,-13062,-12213,-30406,9669,-31308,25331,-20785,32111,-6521,32182,6159,29046,15164,25563,20498,23450,22886,23450,22886,25563,20498,29046,15164,32182,6159,32111,-6521,25331,-20785,9669,-31308,-12213,-30406,-30052,-13062,-29271,14728,-4283,32486,26458,19329,28149,-16772,-7539,-31888,-32758,797,-2819,32645,32605,3246,490,-32764,-32314,5434,14122,29567,22308,-24001,-31534,-8905,9552,31343,18679,-26922,-32353,5192,27959,17086,-13118,-30027,-3308,32599,16188,-28489,-24291,21992,28519,-16135,-30291,12496,30607,-11699,-29699,13844,26955,-18630,-21115,25057,10834,-30924,4038,32517,-20642,-25449,31873,7598,-28459,16241,6580,-32100,22218,24083,-31985,7120,6820,-32050,28086,16876,-22930,23407,-20065,-25906,26673,-19031,20546,25525,-22038,24249,-28990,-15274,4403,-32470,31178,-10079,24778,21440,-2330,32684,-25717,20306,-32697,-2146,-25018,-21162,-10603,-31005,3673,-32561,14453,-29408,21208,-24978,24697,-21534}, - {-4283,-32487,4889,32400,-6941,-32024,10370,31082,-15002,-29132,20450,25601,-26018,-19919,30607,11698,-32751,-1043,30821,-11124,-23536,22798,10718,-30965,5857,32239,-22038,-24250,31902,7479,-29953,13286,14563,-29353,8963,31517,-28580,-16029,31140,-10196,-12213,30405,-16719,-28181,32679,2390,-19478,26349,-13231,-29978,32711,1900,-15328,28960,-21115,-25058,30651,-11585,2206,32692,-32229,-5919,12326,-30361,28023,16981,-20065,25905,-24455,-21810,22398,-23917,24372,21901,-20259,25754,-27831,-17296,12779,-30173,32111,6520,1471,32733,-30945,10776,-20355,-25679,16294,-28429,32617,3123,11984,30496,-20642,25448,-32525,-3978,-15220,-29019,13900,-29673,31695,-8313,27501,17813,6820,32049,-16614,28243,-30863,11008,-31216,-9963,-19968,-25981,-3063,-32624,13454,-29878,25563,-20499,31756,-8076,32477,4342,29215,14837,23705,22621,17451,27732,11526,30672,6580,32099,2940,32634,736,32758,0,32767,736,32758,2940,32634,6580,32099,11526,30672,17451,27732,23705,22621,29215,14837,32477,4342,31756,-8076,25563,-20499,13454,-29878,-3063,-32624,-19968,-25981,-31216,-9963,-30863,11008,-16614,28243,6820,32049,27501,17813,31695,-8313,13900,-29673,-15220,-29019,-32525,-3978,-20642,25448,11984,30496,32617,3123,16294,-28429,-20355,-25679,-30945,10776,1471,32733,32111,6520,12779,-30173,-27831,-17296,-20259,25754,24372,21901,22398,-23917,-24455,-21810,-20065,25905,28023,16981,12326,-30361,-32229,-5919,2206,32692,30651,-11585,-21115,-25058,-15328,28960,32711,1900,-13231,-29978,-19478,26349,32679,2390,-16719,-28181,-12213,30405,31140,-10196,-28580,-16029,8963,31517,14563,-29353,-29953,13286,31902,7479,-22038,-24250,5857,32239,10718,-30965,-23536,22798,30821,-11124,-32751,-1043,30607,11698,-26018,-19919,20450,25601,-15002,-29132,10370,31082,-6941,-32024,4889,32400,-4283,-32487,5131,32362,-7420,-31916,11065,30841,-15868,-28669,21394,24818,-26887,-18731,31178,10078,-32755,920,30001,-13175,-21764,24495,8134,-31742,8727,31583,-24291,-21993,32509,4099,-28275,16560,10950,-30884,12892,30123,-30475,-12042,29379,-14509,-7539,31887,-20927,-25215,32629,-3002,-14674,29297,-18377,-27130,32493,-4222,-9435,31379,-25717,-20307,27568,-17711,9199,31449,-32737,1410,5010,-32382,31253,9845,-13118,30026,-29160,-14947,15436,-28904,29325,14618,-12441,30313,-31567,-8787,3551,-32575,32605,-3247,11296,30758,-26092,19821,-27435,-17917,6219,-32172,31815,-7838,21579,24657,-10603,31004,-31846,7717,-24617,-21626,2084,-32701,26312,-19527,32205,6038,18679,26921,-4161,32501,-23875,22443,-32568,3612,-28933,-15382,-16508,-28306,-614,-32762,14122,-29568,24938,-21255,30984,-10661,32766,-62,31466,9140,28397,16348,24697,21533,21208,24977,18477,27060,16824,28117,16401,28366,17243,27862,19279,26494,22308,24000,25942,20016,29541,14177,32159,6279,32580,-3491,29487,-14289,21855,-24414,9552,-31344,-5979,-32218,-21302,-24899,-31362,-9494,-31103,10312,-18275,27197,3673,32560,24858,21348,32650,-2758,19772,-26130,-7659,-31860,-30100,-12950,-27635,17607,490,32763,28874,15490,26745,-18931,-6461,-32124,-32272,-5677,-15760,28728,23191,23148,27959,-17087,-11412,-30716,-32062,6760,3429,32587,32731,-1534,-1105,-32749,-32697,2145,4646,32435,31631,-8550,-13678,-29776,-26240,19625,25640,20402,11870,-30542,-32758,-798,11756,30585,22754,-23579,-31432,-9259,7777,31830,22576,-23748,-32428,-4708,16188,28488,11181,-30801,-30149,12836,30518,11927,-14783,-29243,-7061,31997,24778,-21441,-32540,3855,29750,13733,-19379,-26423,5616,32282,7896,-31802,-18881,26780,26458,-19330,-30780,11238,32553,-3735,-32671,-2513,31957,7240,-31064,-10429,30428,12155,-30291,-12497,30694,11469,-31501,-9023,32372,5071,-32765,429,31929,-7360,-28990,15273,23104,-23235,-13790,29724,1349,-32740,12666,30219,-25254,-20879,32333,5313,-30052,13061,16929,-28055,3916,32532,-24125,-22174,32765,-307,-22666,23663,-2574,-32666,26955,18629,-31024,10544,8609,-31616,22487,23832,-31726,8193,6700,-32075,26673,19030,-27368,18019,-8373,-31680,32760,674,-8254,31710,-29594,-14067,18172,-27267,25331,20784,-22129,24166,-23959,-22354,21487,-24739,26385,19428,-15975,28609,-30904,-10893,4038,-32518,32461,-4465,14011,29620,-23018,23321,-30384,-12270,-1840,-32716,28086,-16877,28757,15705,2451,32675,-25176,20973,-32037,-6881,-15653,-28787,10253,-31122,29046,-15165,31786,7956,19674,26202,245,32766,-18071,27333,-29647,13955,-32705,-2024,-28459,-16242,-19577,-26277,-8846,-31551,1594,-32729,10486,-31044,17347,-27799,22218,-24084,25409,-20690,27300,-18122,28212,-16667,28336,-16455,27700,-17504,26166,-19724,23450,-22887,19180,-26567,13005,-30076,4768,-32419,-5254,-32344,-16082,-28550,-25868,-20114,-31985,-7121,-31600,8668,-22843,23492,-6340,32147,13566,29826,29103,15056,31873,-7599,17967,-27402,-7181,-31971,-28699,-15814,-30337,12383,-8016,31771,21946,24331,32182,-6160,10020,-31198,-23621,-22710,-30244,12610,981,32752,31396,9375,17555,-27668,-22930,-23408,-27232,18223,14232,29514,30736,-11355,-9787,-31272,-31326,9610,10834,30923,29902,-13399,-17140,-27928,-24536,21717,26530,19230,11641,-30630,-32719,-1779,9669,31307,25096,-21068,-29802,-13623,1961,32708,27163,-18326,-30196,-12724,7299,31943,20546,-25526,-32747,1165,23364,22973,-859,-32756,-21021,25135,32135,-6401,-29699,-13845,17034,27991,-123,-32767,-15545,28845,26602,-19131,-32011,7000,32409,4828,-29271,-14729,24207,22082,-18579,-26991,13342,29927,-9082,-31484,6098,32194,-4526,-32454,4403,32469,-5737,-32261,8490,31647,-12554,-30267,17658,27601,-23278,-23062,28519,16134,-32088,-6641,32390,-4951,-27896,17191,17762,-27536,-2697,32655,-14344,-29461,28149,16771,-32641,2879,23790,-22533,-3186,32611,-20162,-25830,32593,3368,-24042,22263,-2330,-32685,27765,17399,-29853,13510,3794,-32547,26815,18830,-28640,15920,-3308,-32600,31663,8431,-17866,27468,-21672,-24577,28816,-15599,10137,31159,-32251,5797,-2819,-32646,32741,-1288,1226,32744,-32661,2635,-5496,-32303,31289,-9729,15110,29074,-25018,21161,-27026,-18529,9317,-31415,32688,-2269,14892,29187,-19871,26054,-32353,-5193,-12099,-30452,18780,-26851,32762,-553,20831,25292,-5375,32323,-27095,18426,-32314,-5435,-20737,-25371,-369,-32765,18980,-26710,30563,-11814,32292,5555,25792,20209,14453,29407,1716,32721,-9904,31234,-19081,26638,-25487,20593,-29435,14398,-31534,8904,-32445,4585,-32726,1655,-32767,184,-32767,184,-32726,1655,-32445,4585,-31534,8904,-29435,14398,-25487,20593,-19081,26638,-9904,31234,1716,32721,14453,29407,25792,20209,32292,5555,30563,-11814,18980,-26710,-369,-32765,-20737,-25371,-32314,-5435,-27095,18426,-5375,32323,20831,25292,32762,-553,18780,-26851,-12099,-30452,-32353,-5193,-19871,26054,14892,29187,32688,-2269,9317,-31415,-27026,-18529,-25018,21161,15110,29074,31289,-9729,-5496,-32303,-32661,2635,1226,32744,32741,-1288,-2819,-32646,-32251,5797,10137,31159,28816,-15599,-21672,-24577,-17866,27468,31663,8431,-3308,-32600,-28640,15920,26815,18830,3794,-32547,-29853,13510,27765,17399,-2330,-32685,-24042,22263,32593,3368,-20162,-25830,-3186,32611,23790,-22533,-32641,2879,28149,16771,-14344,-29461,-2697,32655,17762,-27536,-27896,17191,32390,-4951,-32088,-6641,28519,16134,-23278,-23062,17658,27601,-12554,-30267,8490,31647,-5737,-32261,4403,32469,-4526,-32454,6098,32194,-9082,-31484,13342,29927,-18579,-26991,24207,22082,-29271,-14729,32409,4828,-32011,7000,26602,-19131,-15545,28845,-123,-32767,17034,27991,-29699,-13845,32135,-6401,-21021,25135,-859,-32756,23364,22973,-32747,1165,20546,-25526,7299,31943,-30196,-12724,27163,-18326,1961,32708,-29802,-13623,25096,-21068,9669,31307,-32719,-1779,11641,-30630,26530,19230,-24536,21717,-17140,-27928,29902,-13399,10834,30923,-31326,9610,-9787,-31272,30736,-11355,14232,29514,-27232,18223,-22930,-23408,17555,-27668,31396,9375,981,32752,-30244,12610,-23621,-22710,10020,-31198,32182,-6160,21946,24331,-8016,31771,-30337,12383,-28699,-15814,-7181,-31971,17967,-27402,31873,-7599,29103,15056,13566,29826,-6340,32147,-22843,23492,-31600,8668,-31985,-7121,-25868,-20114,-16082,-28550,-5254,-32344,4768,-32419,13005,-30076,19180,-26567,23450,-22887,26166,-19724,27700,-17504,28336,-16455,28212,-16667,27300,-18122,25409,-20690,22218,-24084,17347,-27799,10486,-31044,1594,-32729,-8846,-31551,-19577,-26277,-28459,-16242,-32705,-2024,-29647,13955,-18071,27333,245,32766,19674,26202,31786,7956,29046,-15165,10253,-31122,-15653,-28787,-32037,-6881,-25176,20973,2451,32675,28757,15705,28086,-16877,-1840,-32716,-30384,-12270,-23018,23321,14011,29620,32461,-4465,4038,-32518,-30904,-10893,-15975,28609,26385,19428,21487,-24739,-23959,-22354,-22129,24166,25331,20784,18172,-27267,-29594,-14067,-8254,31710,32760,674,-8373,-31680,-27368,18019,26673,19030,6700,-32075,-31726,8193,22487,23832,8609,-31616,-31024,10544,26955,18629,-2574,-32666,-22666,23663,32765,-307,-24125,-22174,3916,32532,16929,-28055,-30052,13061,32333,5313,-25254,-20879,12666,30219,1349,-32740,-13790,29724,23104,-23235,-28990,15273,31929,-7360,-32765,429,32372,5071,-31501,-9023,30694,11469,-30291,-12497,30428,12155,-31064,-10429,31957,7240,-32671,-2513,32553,-3735,-30780,11238,26458,-19330,-18881,26780,7896,-31802,5616,32282,-19379,-26423,29750,13733,-32540,3855,24778,-21441,-7061,31997,-14783,-29243,30518,11927,-30149,12836,11181,-30801,16188,28488,-32428,-4708,22576,-23748,7777,31830,-31432,-9259,22754,-23579,11756,30585,-32758,-798,11870,-30542,25640,20402,-26240,19625,-13678,-29776,31631,-8550,4646,32435,-32697,2145,-1105,-32749,32731,-1534,3429,32587,-32062,6760,-11412,-30716,27959,-17087,23191,23148,-15760,28728,-32272,-5677,-6461,-32124,26745,-18931,28874,15490,490,32763,-27635,17607,-30100,-12950,-7659,-31860,19772,-26130,32650,-2758,24858,21348,3673,32560,-18275,27197,-31103,10312,-31362,-9494,-21302,-24899,-5979,-32218,9552,-31344,21855,-24414,29487,-14289,32580,-3491,32159,6279,29541,14177,25942,20016,22308,24000,19279,26494,17243,27862,16401,28366,16824,28117,18477,27060,21208,24977,24697,21533,28397,16348,31466,9140,32766,-62,30984,-10661,24938,-21255,14122,-29568,-614,-32762,-16508,-28306,-28933,-15382,-32568,3612,-23875,22443,-4161,32501,18679,26921,32205,6038,26312,-19527,2084,-32701,-24617,-21626,-31846,7717,-10603,31004,21579,24657,31815,-7838,6219,-32172,-27435,-17917,-26092,19821,11296,30758,32605,-3247,3551,-32575,-31567,-8787,-12441,30313,29325,14618,15436,-28904,-29160,-14947,-13118,30026,31253,9845,5010,-32382,-32737,1410,9199,31449,27568,-17711,-25717,-20307,-9435,31379,32493,-4222,-18377,-27130,-14674,29297,32629,-3002,-20927,-25215,-7539,31887,29379,-14509,-30475,-12042,12892,30123,10950,-30884,-28275,16560,32509,4099,-24291,-21993,8727,31583,8134,-31742,-21764,24495,30001,-13175,-32755,920,31178,10078,-26887,-18731,21394,24818,-15868,-28669,11065,30841,-7420,-31916,5131,32362}, - {-4283,32486,5131,-32363,-7420,31915,11065,-30842,-15868,28668,21394,-24819,-26887,18730,31178,-10079,-32755,-921,30001,13174,-21764,-24496,8134,31741,8727,-31584,-24291,21992,32509,-4100,-28275,-16561,10950,30883,12892,-30124,-30475,12041,29379,14508,-7539,-31888,-20927,25214,32629,3001,-14674,-29298,-18377,27129,32493,4221,-9435,-31380,-25717,20306,27568,17710,9199,-31450,-32737,-1411,5010,32381,31253,-9846,-13118,-30027,-29160,14946,15436,28903,29325,-14619,-12441,-30314,-31567,8786,3551,32574,32605,3246,11296,-30759,-26092,-19822,-27435,17916,6219,32171,31815,7837,21579,-24658,-10603,-31005,-31846,-7718,-24617,21625,2084,32700,26312,19526,32205,-6039,18679,-26922,-4161,-32502,-23875,-22444,-32568,-3613,-28933,15381,-16508,28305,-614,32761,14122,29567,24938,21254,30984,10660,32766,61,31466,-9141,28397,-16349,24697,-21534,21208,-24978,18477,-27061,16824,-28118,16401,-28367,17243,-27863,19279,-26495,22308,-24001,25942,-20017,29541,-14178,32159,-6280,32580,3490,29487,14288,21855,24413,9552,31343,-5979,32217,-21302,24898,-31362,9493,-31103,-10313,-18275,-27198,3673,-32561,24858,-21349,32650,2757,19772,26129,-7659,31859,-30100,12949,-27635,-17608,490,-32764,28874,-15491,26745,18930,-6461,32123,-32272,5676,-15760,-28729,23191,-23149,27959,17086,-11412,30715,-32062,-6761,3429,-32588,32731,1533,-1105,32748,-32697,-2146,4646,-32436,31631,8549,-13678,29775,-26240,-19626,25640,-20403,11870,30541,-32758,797,11756,-30586,22754,23578,-31432,9258,7777,-31831,22576,23747,-32428,4707,16188,-28489,11181,30800,-30149,-12837,30518,-11928,-14783,29242,-7061,-31998,24778,21440,-32540,-3856,29750,-13734,-19379,26422,5616,-32283,7896,31801,-18881,-26781,26458,19329,-30780,-11239,32553,3734,-32671,2512,31957,-7241,-31064,10428,30428,-12156,-30291,12496,30694,-11470,-31501,9022,32372,-5072,-32765,-430,31929,7359,-28990,-15274,23104,23234,-13790,-29725,1349,32739,12666,-30220,-25254,20878,32333,-5314,-30052,-13062,16929,28054,3916,-32533,-24125,22173,32765,306,-22666,-23664,-2574,32665,26955,-18630,-31024,-10545,8609,31615,22487,-23833,-31726,-8194,6700,32074,26673,-19031,-27368,-18020,-8373,31679,32760,-675,-8254,-31711,-29594,14066,18172,27266,25331,-20785,-22129,-24167,-23959,22353,21487,24738,26385,-19429,-15975,-28610,-30904,10892,4038,32517,32461,4464,14011,-29621,-23018,-23322,-30384,12269,-1840,32715,28086,16876,28757,-15706,2451,-32676,-25176,-20974,-32037,6880,-15653,28786,10253,31121,29046,15164,31786,-7957,19674,-26203,245,-32767,-18071,-27334,-29647,-13956,-32705,2023,-28459,16241,-19577,26276,-8846,31550,1594,32728,10486,31043,17347,27798,22218,24083,25409,20689,27300,18121,28212,16666,28336,16454,27700,17503,26166,19723,23450,22886,19180,26566,13005,30075,4768,32418,-5254,32343,-16082,28549,-25868,20113,-31985,7120,-31600,-8669,-22843,-23493,-6340,-32148,13566,-29827,29103,-15057,31873,7598,17967,27401,-7181,31970,-28699,15813,-30337,-12384,-8016,-31772,21946,-24332,32182,6159,10020,31197,-23621,22709,-30244,-12611,981,-32753,31396,-9376,17555,27667,-22930,23407,-27232,-18224,14232,-29515,30736,11354,-9787,31271,-31326,-9611,10834,-30924,29902,13398,-17140,27927,-24536,-21718,26530,-19231,11641,30629,-32719,1778,9669,-31308,25096,21067,-29802,13622,1961,-32709,27163,18325,-30196,12723,7299,-31944,20546,25525,-32747,-1166,23364,-22974,-859,32755,-21021,-25136,32135,6400,-29699,13844,17034,-27992,-123,32766,-15545,-28846,26602,19130,-32011,-7001,32409,-4829,-29271,14728,24207,-22083,-18579,26990,13342,-29928,-9082,31483,6098,-32195,-4526,32453,4403,-32470,-5737,32260,8490,-31648,-12554,30266,17658,-27602,-23278,23061,28519,-16135,-32088,6640,32390,4950,-27896,-17192,17762,27535,-2697,-32656,-14344,29460,28149,-16772,-32641,-2880,23790,22532,-3186,-32612,-20162,25829,32593,-3369,-24042,-22264,-2330,32684,27765,-17400,-29853,-13511,3794,32546,26815,-18831,-28640,-15921,-3308,32599,31663,-8432,-17866,-27469,-21672,24576,28816,15598,10137,-31160,-32251,-5798,-2819,32645,32741,1287,1226,-32745,-32661,-2636,-5496,32302,31289,9728,15110,-29075,-25018,-21162,-27026,18528,9317,31414,32688,2268,14892,-29188,-19871,-26055,-32353,5192,-12099,30451,18780,26850,32762,552,20831,-25293,-5375,-32324,-27095,-18427,-32314,5434,-20737,25370,-369,32764,18980,26709,30563,11813,32292,-5556,25792,-20210,14453,-29408,1716,-32722,-9904,-31235,-19081,-26639,-25487,-20594,-29435,-14399,-31534,-8905,-32445,-4586,-32726,-1656,-32767,-185,-32767,-185,-32726,-1656,-32445,-4586,-31534,-8905,-29435,-14399,-25487,-20594,-19081,-26639,-9904,-31235,1716,-32722,14453,-29408,25792,-20210,32292,-5556,30563,11813,18980,26709,-369,32764,-20737,25370,-32314,5434,-27095,-18427,-5375,-32324,20831,-25293,32762,552,18780,26850,-12099,30451,-32353,5192,-19871,-26055,14892,-29188,32688,2268,9317,31414,-27026,18528,-25018,-21162,15110,-29075,31289,9728,-5496,32302,-32661,-2636,1226,-32745,32741,1287,-2819,32645,-32251,-5798,10137,-31160,28816,15598,-21672,24576,-17866,-27469,31663,-8432,-3308,32599,-28640,-15921,26815,-18831,3794,32546,-29853,-13511,27765,-17400,-2330,32684,-24042,-22264,32593,-3369,-20162,25829,-3186,-32612,23790,22532,-32641,-2880,28149,-16772,-14344,29460,-2697,-32656,17762,27535,-27896,-17192,32390,4950,-32088,6640,28519,-16135,-23278,23061,17658,-27602,-12554,30266,8490,-31648,-5737,32260,4403,-32470,-4526,32453,6098,-32195,-9082,31483,13342,-29928,-18579,26990,24207,-22083,-29271,14728,32409,-4829,-32011,-7001,26602,19130,-15545,-28846,-123,32766,17034,-27992,-29699,13844,32135,6400,-21021,-25136,-859,32755,23364,-22974,-32747,-1166,20546,25525,7299,-31944,-30196,12723,27163,18325,1961,-32709,-29802,13622,25096,21067,9669,-31308,-32719,1778,11641,30629,26530,-19231,-24536,-21718,-17140,27927,29902,13398,10834,-30924,-31326,-9611,-9787,31271,30736,11354,14232,-29515,-27232,-18224,-22930,23407,17555,27667,31396,-9376,981,-32753,-30244,-12611,-23621,22709,10020,31197,32182,6159,21946,-24332,-8016,-31772,-30337,-12384,-28699,15813,-7181,31970,17967,27401,31873,7598,29103,-15057,13566,-29827,-6340,-32148,-22843,-23493,-31600,-8669,-31985,7120,-25868,20113,-16082,28549,-5254,32343,4768,32418,13005,30075,19180,26566,23450,22886,26166,19723,27700,17503,28336,16454,28212,16666,27300,18121,25409,20689,22218,24083,17347,27798,10486,31043,1594,32728,-8846,31550,-19577,26276,-28459,16241,-32705,2023,-29647,-13956,-18071,-27334,245,-32767,19674,-26203,31786,-7957,29046,15164,10253,31121,-15653,28786,-32037,6880,-25176,-20974,2451,-32676,28757,-15706,28086,16876,-1840,32715,-30384,12269,-23018,-23322,14011,-29621,32461,4464,4038,32517,-30904,10892,-15975,-28610,26385,-19429,21487,24738,-23959,22353,-22129,-24167,25331,-20785,18172,27266,-29594,14066,-8254,-31711,32760,-675,-8373,31679,-27368,-18020,26673,-19031,6700,32074,-31726,-8194,22487,-23833,8609,31615,-31024,-10545,26955,-18630,-2574,32665,-22666,-23664,32765,306,-24125,22173,3916,-32533,16929,28054,-30052,-13062,32333,-5314,-25254,20878,12666,-30220,1349,32739,-13790,-29725,23104,23234,-28990,-15274,31929,7359,-32765,-430,32372,-5072,-31501,9022,30694,-11470,-30291,12496,30428,-12156,-31064,10428,31957,-7241,-32671,2512,32553,3734,-30780,-11239,26458,19329,-18881,-26781,7896,31801,5616,-32283,-19379,26422,29750,-13734,-32540,-3856,24778,21440,-7061,-31998,-14783,29242,30518,-11928,-30149,-12837,11181,30800,16188,-28489,-32428,4707,22576,23747,7777,-31831,-31432,9258,22754,23578,11756,-30586,-32758,797,11870,30541,25640,-20403,-26240,-19626,-13678,29775,31631,8549,4646,-32436,-32697,-2146,-1105,32748,32731,1533,3429,-32588,-32062,-6761,-11412,30715,27959,17086,23191,-23149,-15760,-28729,-32272,5676,-6461,32123,26745,18930,28874,-15491,490,-32764,-27635,-17608,-30100,12949,-7659,31859,19772,26129,32650,2757,24858,-21349,3673,-32561,-18275,-27198,-31103,-10313,-31362,9493,-21302,24898,-5979,32217,9552,31343,21855,24413,29487,14288,32580,3490,32159,-6280,29541,-14178,25942,-20017,22308,-24001,19279,-26495,17243,-27863,16401,-28367,16824,-28118,18477,-27061,21208,-24978,24697,-21534,28397,-16349,31466,-9141,32766,61,30984,10660,24938,21254,14122,29567,-614,32761,-16508,28305,-28933,15381,-32568,-3613,-23875,-22444,-4161,-32502,18679,-26922,32205,-6039,26312,19526,2084,32700,-24617,21625,-31846,-7718,-10603,-31005,21579,-24658,31815,7837,6219,32171,-27435,17916,-26092,-19822,11296,-30759,32605,3246,3551,32574,-31567,8786,-12441,-30314,29325,-14619,15436,28903,-29160,14946,-13118,-30027,31253,-9846,5010,32381,-32737,-1411,9199,-31450,27568,17710,-25717,20306,-9435,-31380,32493,4221,-18377,27129,-14674,-29298,32629,3001,-20927,25214,-7539,-31888,29379,14508,-30475,12041,12892,-30124,10950,30883,-28275,-16561,32509,-4100,-24291,21992,8727,-31584,8134,31741,-21764,-24496,30001,13174,-32755,-921,31178,-10079,-26887,18730,21394,-24819,-15868,28668,11065,-30842,-7420,31915,5131,-32363,-4283,32486,4889,-32401,-6941,32023,10370,-31083,-15002,29131,20450,-25602,-26018,19918,30607,-11699,-32751,1042,30821,11123,-23536,-22799,10718,30964,5857,-32240,-22038,24249,31902,-7480,-29953,-13287,14563,29352,8963,-31518,-28580,16028,31140,10195,-12213,-30406,-16719,28180,32679,-2391,-19478,-26350,-13231,29977,32711,-1901,-15328,-28961,-21115,25057,30651,11584,2206,-32693,-32229,5918,12326,30360,28023,-16982,-20065,-25906,-24455,21809,22398,23916,24372,-21902,-20259,-25755,-27831,17295,12779,30172,32111,-6521,1471,-32734,-30945,-10777,-20355,25678,16294,28428,32617,-3124,11984,-30497,-20642,-25449,-32525,3977,-15220,29018,13900,29672,31695,8312,27501,-17814,6820,-32050,-16614,-28244,-30863,-11009,-31216,9962,-19968,25980,-3063,32623,13454,29877,25563,20498,31756,8075,32477,-4343,29215,-14838,23705,-22622,17451,-27733,11526,-30673,6580,-32100,2940,-32635,736,-32759,-1,-32767,736,-32759,2940,-32635,6580,-32100,11526,-30673,17451,-27733,23705,-22622,29215,-14838,32477,-4343,31756,8075,25563,20498,13454,29877,-3063,32623,-19968,25980,-31216,9962,-30863,-11009,-16614,-28244,6820,-32050,27501,-17814,31695,8312,13900,29672,-15220,29018,-32525,3977,-20642,-25449,11984,-30497,32617,-3124,16294,28428,-20355,25678,-30945,-10777,1471,-32734,32111,-6521,12779,30172,-27831,17295,-20259,-25755,24372,-21902,22398,23916,-24455,21809,-20065,-25906,28023,-16982,12326,30360,-32229,5918,2206,-32693,30651,11584,-21115,25057,-15328,-28961,32711,-1901,-13231,29977,-19478,-26350,32679,-2391,-16719,28180,-12213,-30406,31140,10195,-28580,16028,8963,-31518,14563,29352,-29953,-13287,31902,-7480,-22038,24249,5857,-32240,10718,30964,-23536,-22799,30821,11123,-32751,1042,30607,-11699,-26018,19918,20450,-25602,-15002,29131,10370,-31083,-6941,32023,4889,-32401} -}; -short __attribute__((aligned(16))) X_u139[4][2*139] = {{23300,23038,23300,23038,24317,21962,26201,19676,28620,15954,31023,10547,32597,3326,32297,-5528,28973,-15304,21685,-24565,10195,-31141,-4430,-32467,-19380,-26422,-30238,-12625,-32165,6256,-22236,24067,-2221,32691,19971,25977,32414,4796,25749,-20265,1480,-32734,-24808,-21407,-31849,7703,-10898,30901,21125,25048,32014,-6982,7342,-31934,-26640,-19080,-27064,18472,9489,31362,32748,-1111,5892,-32233,-30777,-11246,-14975,29145,27870,17231,18165,-27271,-27474,-17857,-16277,28438,29944,13304,8778,-31570,-32665,-2590,5162,32357,29635,-13979,-22774,-23560,-13643,29791,32764,370,-14313,-29476,-18778,26852,32714,1850,-16916,-28064,-12283,30377,31253,-9844,-28253,-16597,8062,31759,15629,-28800,-30515,11938,31468,9134,-20554,-25520,3695,32557,12965,-30093,-25286,20840,31666,-8422,-32515,-4063,29312,14644,-23816,-22507,17544,27674,-11593,-30648,6619,32091,-2959,-32634,740,32758,-1,-32767,740,32758,-2959,-32634,6619,32091,-11593,-30648,17544,27674,-23816,-22507,29312,14644,-32515,-4063,31666,-8422,-25286,20840,12965,-30093,3695,32557,-20554,-25520,31468,9134,-30515,11938,15629,-28800,8062,31759,-28253,-16597,31253,-9844,-12283,30377,-16916,-28064,32714,1850,-18778,26852,-14313,-29476,32764,370,-13643,29791,-22774,-23560,29635,-13979,5162,32357,-32665,-2590,8778,-31570,29944,13304,-16277,28438,-27474,-17857,18165,-27271,27870,17231,-14975,29145,-30777,-11246,5892,-32233,32748,-1111,9489,31362,-27064,18472,-26640,-19080,7342,-31934,32014,-6982,21125,25048,-10898,30901,-31849,7703,-24808,-21407,1480,-32734,25749,-20265,32414,4796,19971,25977,-2221,32691,-22236,24067,-32165,6256,-30238,-12625,-19380,-26422,-4430,-32467,10195,-31141,21685,-24565,28973,-15304,32297,-5528,32597,3326,31023,10547,28620,15954,26201,19676,24317,21962}, - {23300,-23039,24317,-21963,26201,-19677,28620,-15955,31023,-10548,32597,-3327,32297,5527,28973,15303,21685,24564,10195,31140,-4430,32466,-19380,26421,-30238,12624,-32165,-6257,-22236,-24068,-2221,-32692,19971,-25978,32414,-4797,25749,20264,1480,32733,-24808,21406,-31849,-7704,-10898,-30902,21125,-25049,32014,6981,7342,31933,-26640,19079,-27064,-18473,9489,-31363,32748,1110,5892,32232,-30777,11245,-14975,-29146,27870,-17232,18165,27270,-27474,17856,-16277,-28439,29944,-13305,8778,31569,-32665,2589,5162,-32358,29635,13978,-22774,23559,-13643,-29792,32764,-371,-14313,29475,-18778,-26853,32714,-1851,-16916,28063,-12283,-30378,31253,9843,-28253,16596,8062,-31760,15629,28799,-30515,-11939,31468,-9135,-20554,25519,3695,-32558,12965,30092,-25286,-20841,31666,8421,-32515,4062,29312,-14645,-23816,22506,17544,-27675,-11593,30647,6619,-32092,-2959,32633,740,-32759,0,32767,740,-32759,-2959,32633,6619,-32092,-11593,30647,17544,-27675,-23816,22506,29312,-14645,-32515,4062,31666,8421,-25286,-20841,12965,30092,3695,-32558,-20554,25519,31468,-9135,-30515,-11939,15629,28799,8062,-31760,-28253,16596,31253,9843,-12283,-30378,-16916,28063,32714,-1851,-18778,-26853,-14313,29475,32764,-371,-13643,-29792,-22774,23559,29635,13978,5162,-32358,-32665,2589,8778,31569,29944,-13305,-16277,-28439,-27474,17856,18165,27270,27870,-17232,-14975,-29146,-30777,11245,5892,32232,32748,1110,9489,-31363,-27064,-18473,-26640,19079,7342,31933,32014,6981,21125,-25049,-10898,-30902,-31849,-7704,-24808,21406,1480,32733,25749,20264,32414,-4797,19971,-25978,-2221,-32692,-22236,-24068,-32165,-6257,-30238,12624,-19380,26421,-4430,32466,10195,31140,21685,24564,28973,15303,32297,5527,32597,-3327,31023,-10548,28620,-15955,26201,-19677,24317,-21963,23300,-23039}, - {32764,-371,0,32767,32764,-371,1480,32733,32597,-3327,5892,32232,31468,-9135,12965,30092,27870,-17232,21685,24564,19971,-25978,29635,13978,6619,-32092,32714,-1851,-10898,-30902,26201,-19677,-27064,-18473,8062,-31760,-32515,4062,-16277,-28439,-19380,26421,-32165,-6257,8778,31569,-23816,22506,31253,9843,7342,31933,23300,-23039,32014,6981,-12283,-30378,17544,-27675,-32665,2589,-22236,-24068,-4430,32466,-27474,17856,31666,8421,15629,28799,9489,-31363,28620,-15955,-31849,-7704,-18778,-26853,-2959,32633,-22774,23559,32414,-4797,28973,15303,-14975,-29146,3695,-32558,-20554,25519,-30777,11245,32297,5527,25749,20264,-13643,-29792,740,-32759,-14313,29475,-24808,21406,31023,-10548,32748,1110,-30515,-11939,-25286,-20841,18165,27270,10195,31140,-2221,-32692,5162,-32358,-11593,30647,-16916,28063,21125,-25049,24317,-21963,-26640,19079,-28253,16596,29312,-14645,29944,-13305,-30238,12624,-30238,12624,29944,-13305,29312,-14645,-28253,16596,-26640,19079,24317,-21963,21125,-25049,-16916,28063,-11593,30647,5162,-32358,-2221,-32692,10195,31140,18165,27270,-25286,-20841,-30515,-11939,32748,1110,31023,-10548,-24808,21406,-14313,29475,740,-32759,-13643,-29792,25749,20264,32297,5527,-30777,11245,-20554,25519,3695,-32558,-14975,-29146,28973,15303,32414,-4797,-22774,23559,-2959,32633,-18778,-26853,-31849,-7704,28620,-15955,9489,-31363,15629,28799,31666,8421,-27474,17856,-4430,32466,-22236,-24068,-32665,2589,17544,-27675,-12283,-30378,32014,6981,23300,-23039,7342,31933,31253,9843,-23816,22506,8778,31569,-32165,-6257,-19380,26421,-16277,-28439,-32515,4062,8062,-31760,-27064,-18473,26201,-19677,-10898,-30902,32714,-1851,6619,-32092,29635,13978,19971,-25978,21685,24564,27870,-17232,12965,30092,31468,-9135,5892,32232,32597,-3327,1480,32733}, - {32764,370,1480,-32734,32597,3326,5892,-32233,31468,9134,12965,-30093,27870,17231,21685,-24565,19971,25977,29635,-13979,6619,32091,32714,1850,-10898,30901,26201,19676,-27064,18472,8062,31759,-32515,-4063,-16277,28438,-19380,-26422,-32165,6256,8778,-31570,-23816,-22507,31253,-9844,7342,-31934,23300,23038,32014,-6982,-12283,30377,17544,27674,-32665,-2590,-22236,24067,-4430,-32467,-27474,-17857,31666,-8422,15629,-28800,9489,31362,28620,15954,-31849,7703,-18778,26852,-2959,-32634,-22774,-23560,32414,4796,28973,-15304,-14975,29145,3695,32557,-20554,-25520,-30777,-11246,32297,-5528,25749,-20265,-13643,29791,740,32758,-14313,-29476,-24808,-21407,31023,10547,32748,-1111,-30515,11938,-25286,20840,18165,-27271,10195,-31141,-2221,32691,5162,32357,-11593,-30648,-16916,-28064,21125,25048,24317,21962,-26640,-19080,-28253,-16597,29312,14644,29944,13304,-30238,-12625,-30238,-12625,29944,13304,29312,14644,-28253,-16597,-26640,-19080,24317,21962,21125,25048,-16916,-28064,-11593,-30648,5162,32357,-2221,32691,10195,-31141,18165,-27271,-25286,20840,-30515,11938,32748,-1111,31023,10547,-24808,-21407,-14313,-29476,740,32758,-13643,29791,25749,-20265,32297,-5528,-30777,-11246,-20554,-25520,3695,32557,-14975,29145,28973,-15304,32414,4796,-22774,-23560,-2959,-32634,-18778,26852,-31849,7703,28620,15954,9489,31362,15629,-28800,31666,-8422,-27474,-17857,-4430,-32467,-22236,24067,-32665,-2590,17544,27674,-12283,30377,32014,-6982,23300,23038,7342,-31934,31253,-9844,-23816,-22507,8778,-31570,-32165,6256,-19380,-26422,-16277,28438,-32515,-4063,8062,31759,-27064,18472,26201,19676,-10898,30901,32714,1850,6619,32091,29635,-13979,19971,25977,21685,-24565,27870,17231,12965,-30093,31468,9134,5892,-32233,32597,3326,1480,-32734,32764,370,0,-32768} -}; - -int16_t e839[839*2] = {32767,0,32766,245,32763,490,32758,736,32752,981,32744,1226,32733,1471,32721,1716,32708,1961,32692,2206,32675,2451,32655,2696,32634,2940,32611,3185,32587,3429,32560,3673,32532,3916,32501,4160,32469,4403,32435,4646,32400,4889,32362,5131,32323,5374,32282,5616,32239,5857,32194,6098,32147,6339,32099,6580,32049,6820,31997,7060,31943,7299,31887,7538,31830,7777,31771,8015,31710,8253,31647,8490,31583,8727,31517,8963,31449,9199,31379,9434,31307,9669,31234,9903,31159,10137,31082,10370,31004,10602,30923,10834,30841,11065,30758,11296,30672,11526,30585,11756,30496,11984,30405,12212,30313,12440,30219,12666,30123,12892,30026,13117,29927,13342,29826,13566,29724,13789,29620,14011,29514,14232,29407,14453,29297,14673,29187,14892,29074,15110,28960,15327,28845,15544,28728,15759,28609,15974,28488,16188,28366,16401,28243,16613,28117,16824,27991,17034,27862,17243,27732,17451,27601,17658,27468,17865,27333,18070,27197,18274,27060,18477,26921,18679,26780,18880,26638,19080,26494,19279,26349,19477,26202,19674,26054,19870,25905,20064,25754,20258,25601,20450,25448,20641,25292,20831,25135,21020,24977,21208,24818,21394,24657,21579,24495,21763,24331,21946,24166,22128,24000,22308,23832,22487,23663,22665,23492,22842,23321,23017,23148,23191,22973,23364,22798,23535,22621,23705,22443,23874,22263,24041,22082,24207,21901,24372,21717,24535,21533,24697,21348,24858,21161,25017,20973,25175,20784,25331,20593,25486,20402,25640,20209,25792,20016,25942,19821,26091,19625,26239,19428,26385,19230,26530,19030,26673,18830,26815,18629,26955,18426,27094,18223,27231,18019,27367,17813,27501,17607,27634,17399,27765,17191,27895,16981,28023,16771,28149,16560,28274,16348,28397,16134,28519,15920,28639,15705,28757,15490,28874,15273,28989,15056,29103,14837,29215,14618,29325,14398,29434,14177,29541,13955,29646,13733,29750,13510,29852,13286,29952,13061,30051,12836,30148,12610,30243,12383,30336,12155,30428,11927,30518,11698,30607,11469,30694,11238,30779,11008,30862,10776,30944,10544,31023,10312,31102,10078,31178,9845,31253,9610,31325,9375,31396,9140,31466,8904,31533,8668,31599,8431,31663,8193,31725,7956,31786,7717,31845,7479,31902,7240,31957,7000,32010,6760,32061,6520,32111,6279,32159,6038,32205,5797,32250,5555,32292,5313,32333,5071,32372,4828,32409,4585,32444,4342,32477,4099,32509,3855,32539,3612,32567,3368,32593,3123,32617,2879,32640,2635,32660,2390,32679,2145,32696,1900,32711,1655,32725,1410,32736,1165,32746,920,32754,674,32760,429,32764,184,32766,-62,32766,-307,32765,-553,32762,-798,32757,-1043,32750,-1288,32741,-1534,32731,-1779,32718,-2024,32704,-2269,32688,-2513,32670,-2758,32650,-3002,32629,-3247,32605,-3491,32580,-3735,32553,-3978,32524,-4222,32493,-4465,32461,-4708,32427,-4951,32390,-5193,32352,-5435,32313,-5677,32271,-5919,32228,-6160,32182,-6401,32135,-6641,32087,-6881,32036,-7121,31984,-7360,31929,-7599,31873,-7838,31815,-8076,31756,-8313,31695,-8550,31631,-8787,31566,-9023,31500,-9259,31431,-9494,31361,-9729,31289,-9963,31215,-10196,31140,-10429,31063,-10661,30984,-10893,30903,-11124,30821,-11355,30736,-11585,30651,-11814,30563,-12042,30474,-12270,30383,-12497,30290,-12724,30195,-12950,30099,-13175,30001,-13399,29902,-13623,29801,-13845,29698,-14067,29593,-14289,29487,-14509,29379,-14729,29270,-14947,29159,-15165,29046,-15382,28932,-15599,28816,-15814,28698,-16029,28579,-16242,28458,-16455,28336,-16667,28212,-16877,28086,-17087,27959,-17296,27830,-17504,27700,-17711,27568,-17917,27434,-18122,27300,-18326,27163,-18529,27025,-18731,26886,-18931,26745,-19131,26602,-19330,26458,-19527,26312,-19724,26166,-19919,26017,-20114,25867,-20307,25716,-20499,25563,-20690,25409,-20879,25253,-21068,25096,-21255,24938,-21441,24778,-21626,24616,-21810,24454,-21993,24290,-22174,24124,-22354,23958,-22533,23790,-22710,23620,-22887,23450,-23062,23277,-23235,23104,-23408,22929,-23579,22754,-23748,22576,-23917,22398,-24084,22218,-24250,22037,-24414,21855,-24577,21671,-24739,21487,-24899,21301,-25058,21114,-25215,20926,-25371,20736,-25526,20546,-25679,20354,-25830,20161,-25981,19967,-26130,19772,-26277,19576,-26423,19378,-26567,19180,-26710,18980,-26851,18780,-26991,18578,-27130,18376,-27267,18172,-27402,17967,-27536,17762,-27668,17555,-27799,17347,-27928,17139,-28055,16929,-28181,16718,-28306,16507,-28429,16294,-28550,16081,-28669,15867,-28787,15652,-28904,15436,-29019,15219,-29132,15001,-29243,14782,-29353,14563,-29461,14343,-29568,14122,-29673,13900,-29776,13677,-29878,13454,-29978,13230,-30076,13005,-30173,12779,-30267,12553,-30361,12326,-30452,12098,-30542,11870,-30630,11641,-30716,11411,-30801,11181,-30884,10950,-30965,10718,-31044,10486,-31122,10253,-31198,10020,-31272,9786,-31344,9552,-31415,9317,-31484,9081,-31551,8845,-31616,8609,-31680,8372,-31742,8134,-31802,7896,-31860,7658,-31916,7419,-31971,7180,-32024,6940,-32075,6700,-32124,6460,-32172,6219,-32218,5978,-32261,5736,-32303,5495,-32344,5253,-32382,5010,-32419,4768,-32454,4525,-32487,4282,-32518,4038,-32547,3794,-32575,3551,-32600,3307,-32624,3062,-32646,2818,-32666,2573,-32685,2329,-32701,2084,-32716,1839,-32729,1594,-32740,1349,-32749,1104,-32756,858,-32762,613,-32765,368,-32767,122,-32767,-123,-32765,-369,-32762,-614,-32756,-859,-32749,-1105,-32740,-1350,-32729,-1595,-32716,-1840,-32701,-2085,-32685,-2330,-32666,-2574,-32646,-2819,-32624,-3063,-32600,-3308,-32575,-3552,-32547,-3795,-32518,-4039,-32487,-4283,-32454,-4526,-32419,-4769,-32382,-5011,-32344,-5254,-32303,-5496,-32261,-5737,-32218,-5979,-32172,-6220,-32124,-6461,-32075,-6701,-32024,-6941,-31971,-7181,-31916,-7420,-31860,-7659,-31802,-7897,-31742,-8135,-31680,-8373,-31616,-8610,-31551,-8846,-31484,-9082,-31415,-9318,-31344,-9553,-31272,-9787,-31198,-10021,-31122,-10254,-31044,-10487,-30965,-10719,-30884,-10951,-30801,-11182,-30716,-11412,-30630,-11642,-30542,-11871,-30452,-12099,-30361,-12327,-30267,-12554,-30173,-12780,-30076,-13006,-29978,-13231,-29878,-13455,-29776,-13678,-29673,-13901,-29568,-14123,-29461,-14344,-29353,-14564,-29243,-14783,-29132,-15002,-29019,-15220,-28904,-15437,-28787,-15653,-28669,-15868,-28550,-16082,-28429,-16295,-28306,-16508,-28181,-16719,-28055,-16930,-27928,-17140,-27799,-17348,-27668,-17556,-27536,-17763,-27402,-17968,-27267,-18173,-27130,-18377,-26991,-18579,-26851,-18781,-26710,-18981,-26567,-19181,-26423,-19379,-26277,-19577,-26130,-19773,-25981,-19968,-25830,-20162,-25679,-20355,-25526,-20547,-25371,-20737,-25215,-20927,-25058,-21115,-24899,-21302,-24739,-21488,-24577,-21672,-24414,-21856,-24250,-22038,-24084,-22219,-23917,-22399,-23748,-22577,-23579,-22755,-23408,-22930,-23235,-23105,-23062,-23278,-22887,-23451,-22710,-23621,-22533,-23791,-22354,-23959,-22174,-24125,-21993,-24291,-21810,-24455,-21626,-24617,-21441,-24779,-21255,-24939,-21068,-25097,-20879,-25254,-20690,-25410,-20499,-25564,-20307,-25717,-20114,-25868,-19919,-26018,-19724,-26167,-19527,-26313,-19330,-26459,-19131,-26603,-18931,-26746,-18731,-26887,-18529,-27026,-18326,-27164,-18122,-27301,-17917,-27435,-17711,-27569,-17504,-27701,-17296,-27831,-17087,-27960,-16877,-28087,-16667,-28213,-16455,-28337,-16242,-28459,-16029,-28580,-15814,-28699,-15599,-28817,-15382,-28933,-15165,-29047,-14947,-29160,-14729,-29271,-14509,-29380,-14289,-29488,-14067,-29594,-13845,-29699,-13623,-29802,-13399,-29903,-13175,-30002,-12950,-30100,-12724,-30196,-12497,-30291,-12270,-30384,-12042,-30475,-11814,-30564,-11585,-30652,-11355,-30737,-11124,-30822,-10893,-30904,-10661,-30985,-10429,-31064,-10196,-31141,-9963,-31216,-9729,-31290,-9494,-31362,-9259,-31432,-9023,-31501,-8787,-31567,-8550,-31632,-8313,-31696,-8076,-31757,-7838,-31816,-7599,-31874,-7360,-31930,-7121,-31985,-6881,-32037,-6641,-32088,-6401,-32136,-6160,-32183,-5919,-32229,-5677,-32272,-5435,-32314,-5193,-32353,-4951,-32391,-4708,-32428,-4465,-32462,-4222,-32494,-3978,-32525,-3735,-32554,-3491,-32581,-3247,-32606,-3002,-32630,-2758,-32651,-2513,-32671,-2269,-32689,-2024,-32705,-1779,-32719,-1534,-32732,-1288,-32742,-1043,-32751,-798,-32758,-553,-32763,-307,-32766,-62,-32767,184,-32767,429,-32765,674,-32761,920,-32755,1165,-32747,1410,-32737,1655,-32726,1900,-32712,2145,-32697,2390,-32680,2635,-32661,2879,-32641,3123,-32618,3368,-32594,3612,-32568,3855,-32540,4099,-32510,4342,-32478,4585,-32445,4828,-32410,5071,-32373,5313,-32334,5555,-32293,5797,-32251,6038,-32206,6279,-32160,6520,-32112,6760,-32062,7000,-32011,7240,-31958,7479,-31903,7717,-31846,7956,-31787,8193,-31726,8431,-31664,8668,-31600,8904,-31534,9140,-31467,9375,-31397,9610,-31326,9845,-31254,10078,-31179,10312,-31103,10544,-31024,10776,-30945,11008,-30863,11238,-30780,11469,-30695,11698,-30608,11927,-30519,12155,-30429,12383,-30337,12610,-30244,12836,-30149,13061,-30052,13286,-29953,13510,-29853,13733,-29751,13955,-29647,14177,-29542,14398,-29435,14618,-29326,14837,-29216,15056,-29104,15273,-28990,15490,-28875,15705,-28758,15920,-28640,16134,-28520,16348,-28398,16560,-28275,16771,-28150,16981,-28024,17191,-27896,17399,-27766,17607,-27635,17813,-27502,18019,-27368,18223,-27232,18426,-27095,18629,-26956,18830,-26816,19030,-26674,19230,-26531,19428,-26386,19625,-26240,19821,-26092,20016,-25943,20209,-25793,20402,-25641,20593,-25487,20784,-25332,20973,-25176,21161,-25018,21348,-24859,21533,-24698,21717,-24536,21901,-24373,22082,-24208,22263,-24042,22443,-23875,22621,-23706,22798,-23536,22973,-23365,23148,-23192,23321,-23018,23492,-22843,23663,-22666,23832,-22488,24000,-22309,24166,-22129,24331,-21947,24495,-21764,24657,-21580,24818,-21395,24977,-21209,25135,-21021,25292,-20832,25448,-20642,25601,-20451,25754,-20259,25905,-20065,26054,-19871,26202,-19675,26349,-19478,26494,-19280,26638,-19081,26780,-18881,26921,-18680,27060,-18478,27197,-18275,27333,-18071,27468,-17866,27601,-17659,27732,-17452,27862,-17244,27991,-17035,28117,-16825,28243,-16614,28366,-16402,28488,-16189,28609,-15975,28728,-15760,28845,-15545,28960,-15328,29074,-15111,29187,-14893,29297,-14674,29407,-14454,29514,-14233,29620,-14012,29724,-13790,29826,-13567,29927,-13343,30026,-13118,30123,-12893,30219,-12667,30313,-12441,30405,-12213,30496,-11985,30585,-11757,30672,-11527,30758,-11297,30841,-11066,30923,-10835,31004,-10603,31082,-10371,31159,-10138,31234,-9904,31307,-9670,31379,-9435,31449,-9200,31517,-8964,31583,-8728,31647,-8491,31710,-8254,31771,-8016,31830,-7778,31887,-7539,31943,-7300,31997,-7061,32049,-6821,32099,-6581,32147,-6340,32194,-6099,32239,-5858,32282,-5617,32323,-5375,32362,-5132,32400,-4890,32435,-4647,32469,-4404,32501,-4161,32532,-3917,32560,-3674,32587,-3430,32611,-3186,32634,-2941,32655,-2697,32675,-2452,32692,-2207,32708,-1962,32721,-1717,32733,-1472,32744,-1227,32752,-982,32758,-737,32763,-491,32766,-246}; - -int16_t e139[139*2] = {32767,0,32733,1480,32633,2958,32466,4429,32232,5892,31933,7342,31569,8778,31140,10195,30647,11592,30092,12965,29475,14312,28799,15629,28063,16915,27270,18165,26421,19379,25519,20553,24564,21685,23559,22773,22506,23815,21406,24807,20264,25749,19079,26639,17856,27473,16596,28252,15303,28973,13978,29635,12624,30237,11245,30776,9843,31253,8421,31666,6981,32014,5527,32297,4062,32514,2589,32664,1110,32748,-371,32764,-1851,32714,-3327,32597,-4797,32414,-6257,32164,-7704,31848,-9135,31468,-10548,31023,-11939,30514,-13305,29944,-14645,29312,-15955,28620,-17232,27870,-18473,27063,-19677,26201,-20841,25285,-21963,24317,-23039,23300,-24068,22235,-25049,21125,-25978,19971,-26853,18777,-27675,17544,-28439,16276,-29146,14974,-29792,13642,-30378,12282,-30902,10897,-31363,9489,-31760,8062,-32092,6619,-32358,5162,-32558,3695,-32692,2220,-32759,740,-32759,-741,-32692,-2221,-32558,-3696,-32358,-5163,-32092,-6620,-31760,-8063,-31363,-9490,-30902,-10898,-30378,-12283,-29792,-13643,-29146,-14975,-28439,-16277,-27675,-17545,-26853,-18778,-25978,-19972,-25049,-21126,-24068,-22236,-23039,-23301,-21963,-24318,-20841,-25286,-19677,-26202,-18473,-27064,-17232,-27871,-15955,-28621,-14645,-29313,-13305,-29945,-11939,-30515,-10548,-31024,-9135,-31469,-7704,-31849,-6257,-32165,-4797,-32415,-3327,-32598,-1851,-32715,-371,-32765,1110,-32749,2589,-32665,4062,-32515,5527,-32298,6981,-32015,8421,-31667,9843,-31254,11245,-30777,12624,-30238,13978,-29636,15303,-28974,16596,-28253,17856,-27474,19079,-26640,20264,-25750,21406,-24808,22506,-23816,23559,-22774,24564,-21686,25519,-20554,26421,-19380,27270,-18166,28063,-16916,28799,-15630,29475,-14313,30092,-12966,30647,-11593,31140,-10196,31569,-8779,31933,-7343,32232,-5893,32466,-4430,32633,-2959,32733,-1481}; diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c new file mode 100644 index 0000000000..97de04a630 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c @@ -0,0 +1,749 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/prach_common.c + * \brief Common routines for UE/eNB PRACH physical channel V8.6 2009-03 + * \author R. Knopp + * \date 2011 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr + * \note + * \warning + */ +#include "PHY/sse_intrin.h" +#include "PHY/defs.h" +#include "PHY/extern.h" +//#include "prach.h" +#include "PHY/LTE_TRANSPORT/if4_tools.h" +#include "SCHED/defs.h" +#include "SCHED/extern.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + +//#define PRACH_DEBUG 1 +//#define PRACH_WRITE_OUTPUT_DEBUG 1 + +uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419}; +uint16_t NCS_restricted[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case +uint16_t NCS_4[7] = {2,4,6,8,10,12,15}; + +int16_t ru[2*839]; // quantized roots of unity +uint32_t ZC_inv[839]; // multiplicative inverse for roots u +uint16_t du[838]; + +typedef struct { + uint8_t f_ra; + uint8_t t0_ra; + uint8_t t1_ra; + uint8_t t2_ra; +} PRACH_TDD_PREAMBLE_MAP_elem; +typedef struct { + uint8_t num_prach; + PRACH_TDD_PREAMBLE_MAP_elem map[6]; +} PRACH_TDD_PREAMBLE_MAP; + +// This is table 5.7.1-4 from 36.211 +PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = { + // TDD Configuration Index 0 + { {1,{{0,1,0,2}}},{1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}}, + // TDD Configuration Index 1 + { {1,{{0,2,0,2}}},{1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}}, + // TDD Configuration Index 2 + { {1,{{0,1,1,2}}},{1,{{0,1,1,1}}}, {1,{{0,1,1,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,1}}}}, + // TDD Configuration Index 3 + { {1,{{0,0,0,2}}},{1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}}, + // TDD Configuration Index 4 + { {1,{{0,0,1,2}}},{1,{{0,0,1,1}}}, {1,{{0,0,1,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,1}}}}, + // TDD Configuration Index 5 + { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}}, + // TDD Configuration Index 6 + { {2,{{0,0,0,2},{0,0,1,2}}}, {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {2,{{0,0,0,1},{0,0,0,2}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {2,{{0,0,0,2},{0,0,1,1}}}}, + // TDD Configuration Index 7 + { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,2}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}}, + // TDD Configuration Index 8 + { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,1,1}}}}, + // TDD Configuration Index 9 + { {3,{{0,0,0,1},{0,0,0,2},{0,0,1,2}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,0,2}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {3,{{0,0,0,1},{0,0,0,2},{0,0,1,1}}}}, + // TDD Configuration Index 10 + { {3,{{0,0,0,0},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,2},{0,0,1,0}}}}, + // TDD Configuration Index 11 + { {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,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},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}}, + // TDD Configuration Index 12 + { {4,{{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, + {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, + {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,2}}}, + {4,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1}}}, + {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}, + {4,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}} + }, + // TDD Configuration Index 13 + { {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {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,0,0}}}, + {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1}}}, + {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,0,0}}}, + {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1}}} + }, + // TDD Configuration Index 14 + { {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {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,0,0}}}, + {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,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,0},{0,0,0,0}}}, + {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,1}}} + }, + // TDD Configuration Index 15 + { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1}}}, + {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1},{1,0,0,2}}}, + {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,1}}}, {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, + {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}} + }, + // TDD Configuration Index 16 + { {5,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,1,1}}}, + {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,1,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,2}}}, + {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,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,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}} + }, + // TDD Configuration Index 17 + { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1}}}, + {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,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}}} + }, + // TDD Configuration Index 18 + { {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, + {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, + {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}}, + {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1},{1,0,0,2}}}, + {6,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0},{2,0,0,1}}}, + {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}}, + {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,0,2}}} + }, + // TDD Configuration Index 19 + { {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}}}, + {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0},{1,0,1,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,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},{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,0},{0,0,0,0}}}, + {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,1,1}}} + }, + // TDD Configuration Index 20 + { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}}, + // TDD Configuration Index 21 + { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}}, + + // TDD Configuration Index 22 + { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}}, + + // TDD Configuration Index 23 + { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}}, + + // TDD Configuration Index 24 + { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}}, + + // TDD Configuration Index 25 + { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}}, + + // TDD Configuration Index 26 + { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}}, + + // TDD Configuration Index 27 + { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}}, + {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}} + }, + + // TDD Configuration Index 28 + { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}}, + {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{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}}}, + {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}} + }, + + // TDD Configuration Index 29 + { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}}, + {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,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}}}, + {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}}, + {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,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}}}, + {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}} + }, + + + // TDD Configuration Index 30 + { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}}, + + // TDD Configuration Index 31 + { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}}, + + // TDD Configuration Index 32 + { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}}, + + // TDD Configuration Index 33 + { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}}, + + // TDD Configuration Index 34 + { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}}, + + // TDD Configuration Index 35 + { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}}, + + // TDD Configuration Index 36 + { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}}, + + // TDD Configuration Index 37 + { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}}, + {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}} + }, + + // TDD Configuration Index 38 + { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}}, + {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{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}}}, + {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}} + }, + + // TDD Configuration Index 39 + { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}}, + {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,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}}}, + {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}}, + {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,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}}}, + {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}} + }, + + // TDD Configuration Index 40 + { {1,{{0,1,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}}, + // TDD Configuration Index 41 + { {1,{{0,2,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}}, + + // TDD Configuration Index 42 + { {1,{{0,1,1,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}}}}, + + // TDD Configuration Index 43 + { {1,{{0,0,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}}, + + // TDD Configuration Index 44 + { {1,{{0,0,1,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}}}}, + + // TDD Configuration Index 45 + { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}}, + + // TDD Configuration Index 46 + { {3,{{0,0,0,0},{0,0,1,0},{1,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}}}, {3,{{0,0,0,0},{1,0,0,0},{2,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}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}}, + + // TDD Configuration Index 47 + { {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,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,0,0,0}}}, + {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,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,0},{0,0,0,0}}}, + {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}} + } +}; + + + +uint16_t prach_root_sequence_map0_3[838] = { 129, 710, 140, 699, 120, 719, 210, 629, 168, 671, 84, 755, 105, 734, 93, 746, 70, 769, 60, 779, + 2, 837, 1, 838, + 56, 783, 112, 727, 148, 691, + 80, 759, 42, 797, 40, 799, + 35, 804, 73, 766, 146, 693, + 31, 808, 28, 811, 30, 809, 27, 812, 29, 810, + 24, 815, 48, 791, 68, 771, 74, 765, 178, 661, 136, 703, + 86, 753, 78, 761, 43, 796, 39, 800, 20, 819, 21, 818, + 95, 744, 202, 637, 190, 649, 181, 658, 137, 702, 125, 714, 151, 688, + 217, 622, 128, 711, 142, 697, 122, 717, 203, 636, 118, 721, 110, 729, 89, 750, 103, 736, 61, + 778, 55, 784, 15, 824, 14, 825, + 12, 827, 23, 816, 34, 805, 37, 802, 46, 793, 207, 632, 179, 660, 145, 694, 130, 709, 223, 616, + 228, 611, 227, 612, 132, 707, 133, 706, 143, 696, 135, 704, 161, 678, 201, 638, 173, 666, 106, + 733, 83, 756, 91, 748, 66, 773, 53, 786, 10, 829, 9, 830, + 7, 832, 8, 831, 16, 823, 47, 792, 64, 775, 57, 782, 104, 735, 101, 738, 108, 731, 208, 631, 184, + 655, 197, 642, 191, 648, 121, 718, 141, 698, 149, 690, 216, 623, 218, 621, + 152, 687, 144, 695, 134, 705, 138, 701, 199, 640, 162, 677, 176, 663, 119, 720, 158, 681, 164, + 675, 174, 665, 171, 668, 170, 669, 87, 752, 169, 670, 88, 751, 107, 732, 81, 758, 82, 757, 100, + 739, 98, 741, 71, 768, 59, 780, 65, 774, 50, 789, 49, 790, 26, 813, 17, 822, 13, 826, 6, 833, + 5, 834, 33, 806, 51, 788, 75, 764, 99, 740, 96, 743, 97, 742, 166, 673, 172, 667, 175, 664, 187, + 652, 163, 676, 185, 654, 200, 639, 114, 725, 189, 650, 115, 724, 194, 645, 195, 644, 192, 647, + 182, 657, 157, 682, 156, 683, 211, 628, 154, 685, 123, 716, 139, 700, 212, 627, 153, 686, 213, + 626, 215, 624, 150, 689, + 225, 614, 224, 615, 221, 618, 220, 619, 127, 712, 147, 692, 124, 715, 193, 646, 205, 634, 206, + 633, 116, 723, 160, 679, 186, 653, 167, 672, 79, 760, 85, 754, 77, 762, 92, 747, 58, 781, 62, + 777, 69, 770, 54, 785, 36, 803, 32, 807, 25, 814, 18, 821, 11, 828, 4, 835, + 3, 836, 19, 820, 22, 817, 41, 798, 38, 801, 44, 795, 52, 787, 45, 794, 63, 776, 67, 772, 72, + 767, 76, 763, 94, 745, 102, 737, 90, 749, 109, 730, 165, 674, 111, 728, 209, 630, 204, 635, 117, + 722, 188, 651, 159, 680, 198, 641, 113, 726, 183, 656, 180, 659, 177, 662, 196, 643, 155, 684, + 214, 625, 126, 713, 131, 708, 219, 620, 222, 617, 226, 613, + 230, 609, 232, 607, 262, 577, 252, 587, 418, 421, 416, 423, 413, 426, 411, 428, 376, 463, 395, + 444, 283, 556, 285, 554, 379, 460, 390, 449, 363, 476, 384, 455, 388, 451, 386, 453, 361, 478, + 387, 452, 360, 479, 310, 529, 354, 485, 328, 511, 315, 524, 337, 502, 349, 490, 335, 504, 324, + 515, + 323, 516, 320, 519, 334, 505, 359, 480, 295, 544, 385, 454, 292, 547, 291, 548, 381, 458, 399, + 440, 380, 459, 397, 442, 369, 470, 377, 462, 410, 429, 407, 432, 281, 558, 414, 425, 247, 592, + 277, 562, 271, 568, 272, 567, 264, 575, 259, 580, + 237, 602, 239, 600, 244, 595, 243, 596, 275, 564, 278, 561, 250, 589, 246, 593, 417, 422, 248, + 591, 394, 445, 393, 446, 370, 469, 365, 474, 300, 539, 299, 540, 364, 475, 362, 477, 298, 541, + 312, 527, 313, 526, 314, 525, 353, 486, 352, 487, 343, 496, 327, 512, 350, 489, 326, 513, 319, + 520, 332, 507, 333, 506, 348, 491, 347, 492, 322, 517, + 330, 509, 338, 501, 341, 498, 340, 499, 342, 497, 301, 538, 366, 473, 401, 438, 371, 468, 408, + 431, 375, 464, 249, 590, 269, 570, 238, 601, 234, 605, + 257, 582, 273, 566, 255, 584, 254, 585, 245, 594, 251, 588, 412, 427, 372, 467, 282, 557, 403, + 436, 396, 443, 392, 447, 391, 448, 382, 457, 389, 450, 294, 545, 297, 542, 311, 528, 344, 495, + 345, 494, 318, 521, 331, 508, 325, 514, 321, 518, + 346, 493, 339, 500, 351, 488, 306, 533, 289, 550, 400, 439, 378, 461, 374, 465, 415, 424, 270, + 569, 241, 598, + 231, 608, 260, 579, 268, 571, 276, 563, 409, 430, 398, 441, 290, 549, 304, 535, 308, 531, 358, + 481, 316, 523, + 293, 546, 288, 551, 284, 555, 368, 471, 253, 586, 256, 583, 263, 576, + 242, 597, 274, 565, 402, 437, 383, 456, 357, 482, 329, 510, + 317, 522, 307, 532, 286, 553, 287, 552, 266, 573, 261, 578, + 236, 603, 303, 536, 356, 483, + 355, 484, 405, 434, 404, 435, 406, 433, + 235, 604, 267, 572, 302, 537, + 309, 530, 265, 574, 233, 606, + 367, 472, 296, 543, + 336, 503, 305, 534, 373, 466, 280, 559, 279, 560, 419, 420, 240, 599, 258, 581, 229, 610 + }; + +uint16_t prach_root_sequence_map4[138] = { 1,138,2,137,3,136,4,135,5,134,6,133,7,132,8,131,9,130,10,129, + 11,128,12,127,13,126,14,125,15,124,16,123,17,122,18,121,19,120,20,119, + 21,118,22,117,23,116,24,115,25,114,26,113,27,112,28,111,29,110,30,109, + 31,108,32,107,33,106,34,105,35,104,36,103,37,102,38,101,39,100,40,99, + 41,98,42,97,43,96,44,95,45,94,46,93,47,92,48,91,49,90,50,89, + 51,88,52,87,53,86,54,85,55,84,56,83,57,82,58,81,59,80,60,79, + 61,78,62,77,63,76,64,75,65,74,66,73,67,72,68,71,69,70 + }; + +void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) +{ + + FILE *fd; + + fd = fopen("prach_config.txt","w"); + fprintf(fd,"prach_config: subframe = %d\n",subframe); + fprintf(fd,"prach_config: N_RB_UL = %d\n",frame_parms->N_RB_UL); + fprintf(fd,"prach_config: frame_type = %s\n",(frame_parms->frame_type==1) ? "TDD":"FDD"); + + if(frame_parms->frame_type==1) fprintf(fd,"prach_config: tdd_config = %d\n",frame_parms->tdd_config); + + fprintf(fd,"prach_config: rootSequenceIndex = %d\n",frame_parms->prach_config_common.rootSequenceIndex); + fprintf(fd,"prach_config: prach_ConfigIndex = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex); + fprintf(fd,"prach_config: Ncs_config = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig); + fprintf(fd,"prach_config: highSpeedFlag = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.highSpeedFlag); + fprintf(fd,"prach_config: n_ra_prboffset = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset); + fclose(fd); + +} + +// This function computes the du +void fill_du(uint8_t prach_fmt) +{ + + uint16_t iu,u,p; + uint16_t N_ZC; + uint16_t *prach_root_sequence_map; + + if (prach_fmt<4) { + N_ZC = 839; + prach_root_sequence_map = prach_root_sequence_map0_3; + } else { + N_ZC = 139; + prach_root_sequence_map = prach_root_sequence_map4; + } + + for (iu=0; iu<(N_ZC-1); iu++) { + + u=prach_root_sequence_map[iu]; + p=1; + + while (((u*p)%N_ZC)!=1) + p++; + + du[u] = ((p<(N_ZC>>1)) ? p : (N_ZC-p)); + } + +} + +uint8_t get_num_prach_tdd(module_id_t Mod_id) +{ + LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][0]->frame_parms; + return(tdd_preamble_map[fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex][fp->tdd_config].num_prach); +} + +uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index) +{ + LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][0]->frame_parms; + return(tdd_preamble_map[fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex][fp->tdd_config].map[tdd_map_index].f_ra); +} + +uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type) +{ + + if (frame_type == FDD) // FDD + return(prach_ConfigIndex>>4); + + else { + if (prach_ConfigIndex < 20) + return (0); + + if (prach_ConfigIndex < 30) + return (1); + + if (prach_ConfigIndex < 40) + return (2); + + if (prach_ConfigIndex < 48) + return (3); + else + return (4); + } +} + +uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, + uint8_t prach_ConfigIndex, + uint8_t n_ra_prboffset, + uint8_t tdd_mapindex, uint16_t Nf) +{ + lte_frame_type_t frame_type = frame_parms->frame_type; + uint8_t tdd_config = frame_parms->tdd_config; + + uint8_t n_ra_prb; + uint8_t f_ra,t1_ra; + uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type); + uint8_t Nsp=2; + + if (frame_type == TDD) { // TDD + + if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) { + LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex); + return(-1); + } + + // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211) + f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra; + + if (prach_fmt < 4) { + if ((f_ra&1) == 0) { + n_ra_prb = n_ra_prboffset + 6*(f_ra>>1); + } else { + n_ra_prb = frame_parms->N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1); + } + } else { + if ((tdd_config >2) && (tdd_config<6)) + Nsp = 2; + + t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra; + + if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) { + n_ra_prb = 6*f_ra; + } else { + n_ra_prb = frame_parms->N_RB_UL - 6*(f_ra+1); + } + } + } + else { //FDD + n_ra_prb = n_ra_prboffset; + } + return(n_ra_prb); +} + +int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) +{ + // uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; + uint8_t tdd_config = frame_parms->tdd_config; + uint8_t t0_ra; + uint8_t t1_ra; + uint8_t t2_ra; + + int prach_mask = 0; + + if (frame_parms->frame_type == FDD) { //FDD + //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41) + if ((((frame&1) == 1) && (subframe < 9)) || + (((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames + if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50 + ((prach_ConfigIndex&0x1f)==18) || // 18,50 + ((prach_ConfigIndex&0xf)==15)) // 15,47 + return(0); + + switch (prach_ConfigIndex&0x1f) { + case 0: + case 3: + if (subframe==1) prach_mask = 1; + break; + + case 1: + case 4: + if (subframe==4) prach_mask = 1; + break; + + case 2: + case 5: + if (subframe==7) prach_mask = 1; + break; + + case 6: + if ((subframe==1) || (subframe==6)) prach_mask=1; + break; + + case 7: + if ((subframe==2) || (subframe==7)) prach_mask=1; + break; + + case 8: + if ((subframe==3) || (subframe==8)) prach_mask=1; + break; + + case 9: + if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1; + break; + + case 10: + if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1; + break; + + case 11: + if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1; + break; + + case 12: + if ((subframe&1)==0) prach_mask=1; + break; + + case 13: + if ((subframe&1)==1) prach_mask=1; + break; + + case 14: + prach_mask=1; + break; + + case 15: + if (subframe==9) prach_mask=1; + break; + } + } else { // TDD + + AssertFatal(prach_ConfigIndex<64, + "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex); + AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0, + "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex); + + t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra; + t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra; + t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra; +#ifdef PRACH_DEBUG + LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n", + prach_ConfigIndex, + subframe, + t0_ra,t1_ra,t2_ra); +#endif + + if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames + ((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames + (t0_ra == 0)) && // PRACH is in all frames + (((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame + (((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame + if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe + (((subframe%5)-2)==t2_ra)) prach_mask=1; + else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS + } + } + + return(prach_mask); +} + +int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe) { + + uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; + int prach_mask = is_prach_subframe0(frame_parms,prach_ConfigIndex,frame,subframe); + +#ifdef Rel14 + int i; + + for (i=0;i<4;i++) { + if (frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] == 1) + prach_mask|=(is_prach_subframe0(frame_parms,frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],frame,subframe)<<(i+1)); + } +#endif + return(prach_mask); +} + + +void compute_prach_seq(uint16_t rootSequenceIndex, + uint8_t prach_ConfigIndex, + uint8_t zeroCorrelationZoneConfig, + uint8_t highSpeedFlag, + lte_frame_type_t frame_type, + uint32_t X_u[64][839]) +{ + + // Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC) + unsigned int k,inv_u,i,NCS=0,num_preambles; + int N_ZC; + uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type); + uint16_t *prach_root_sequence_map; + uint16_t u, preamble_offset; + uint16_t n_shift_ra,n_shift_ra_bar, d_start,numshift; + uint8_t not_found; + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_IN); + +#ifdef PRACH_DEBUG + LOG_I(PHY,"compute_prach_seq: NCS_config %d, prach_fmt %d\n",zeroCorrelationZoneConfig, prach_fmt); +#endif + + AssertFatal(prach_fmt<4, + "PRACH sequence is only precomputed for prach_fmt<4 (have %"PRIu8")\n", prach_fmt ); + N_ZC = (prach_fmt < 4) ? 839 : 139; + //init_prach_tables(N_ZC); //moved to phy_init_lte_ue/eNB, since it takes to long in real-time + + if (prach_fmt < 4) { + prach_root_sequence_map = prach_root_sequence_map0_3; + } else { + // FIXME cannot be reached + prach_root_sequence_map = prach_root_sequence_map4; + } + + +#ifdef PRACH_DEBUG + LOG_I( PHY, "compute_prach_seq: done init prach_tables\n" ); +#endif + + if (highSpeedFlag== 0) { + +#ifdef PRACH_DEBUG + LOG_I(PHY,"Low speed prach : NCS_config %d\n",zeroCorrelationZoneConfig); +#endif + + AssertFatal(zeroCorrelationZoneConfig<=15, + "FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", zeroCorrelationZoneConfig ); + NCS = NCS_unrestricted[zeroCorrelationZoneConfig]; + + num_preambles = (NCS==0) ? 64 : ((64*NCS)/N_ZC); + + if (NCS>0) num_preambles++; + + preamble_offset = 0; + } else { + +#ifdef PRACH_DEBUG + LOG_I( PHY, "high speed prach : NCS_config %"PRIu8"\n", zeroCorrelationZoneConfig ); +#endif + + AssertFatal(zeroCorrelationZoneConfig<=14, + "FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", zeroCorrelationZoneConfig ); + NCS = NCS_restricted[zeroCorrelationZoneConfig]; + fill_du(prach_fmt); + + num_preambles = 64; // compute ZC sequence for 64 possible roots + // find first non-zero shift root (stored in preamble_offset) + not_found = 1; + preamble_offset = 0; + + while (not_found == 1) { + // current root depending on rootSequenceIndex + int index = (rootSequenceIndex + preamble_offset) % N_ZC; + + if (prach_fmt<4) { + // prach_root_sequence_map points to prach_root_sequence_map0_3 + DevAssert( index < sizeof(prach_root_sequence_map0_3) / sizeof(prach_root_sequence_map0_3[0]) ); + } else { + // prach_root_sequence_map points to prach_root_sequence_map4 + DevAssert( index < sizeof(prach_root_sequence_map4) / sizeof(prach_root_sequence_map4[0]) ); + } + + u = prach_root_sequence_map[index]; + + uint16_t n_group_ra = 0; + + if ( (du[u]<(N_ZC/3)) && (du[u]>=NCS) ) { + n_shift_ra = du[u]/NCS; + d_start = (du[u]<<1) + (n_shift_ra * NCS); + n_group_ra = N_ZC/d_start; + n_shift_ra_bar = max(0,(N_ZC-(du[u]<<1)-(n_group_ra*d_start))/N_ZC); + } else if ( (du[u]>=(N_ZC/3)) && (du[u]<=((N_ZC - NCS)>>1)) ) { + n_shift_ra = (N_ZC - (du[u]<<1))/NCS; + d_start = N_ZC - (du[u]<<1) + (n_shift_ra * NCS); + n_group_ra = du[u]/d_start; + n_shift_ra_bar = min(n_shift_ra,max(0,(du[u]- (n_group_ra*d_start))/NCS)); + } else { + n_shift_ra = 0; + n_shift_ra_bar = 0; + } + + // This is the number of cyclic shifts for the current root u + numshift = (n_shift_ra*n_group_ra) + n_shift_ra_bar; + + // skip to next root and recompute parameters if numshift==0 + if (numshift>0) + not_found = 0; + else + preamble_offset++; + } + } + +#ifdef PRACH_DEBUG + + if (NCS>0) + LOG_I( PHY, "Initializing %u preambles for PRACH (NCS_config %"PRIu8", NCS %u, N_ZC/NCS %u)\n", + num_preambles, zeroCorrelationZoneConfig, NCS, N_ZC/NCS ); + +#endif + + for (i=0; i<num_preambles; i++) { + int index = (rootSequenceIndex+i+preamble_offset) % N_ZC; + + if (prach_fmt<4) { + // prach_root_sequence_map points to prach_root_sequence_map0_3 + DevAssert( index < sizeof(prach_root_sequence_map0_3) / sizeof(prach_root_sequence_map0_3[0]) ); + } else { + // prach_root_sequence_map points to prach_root_sequence_map4 + DevAssert( index < sizeof(prach_root_sequence_map4) / sizeof(prach_root_sequence_map4[0]) ); + } + + u = prach_root_sequence_map[index]; + + inv_u = ZC_inv[u]; // multiplicative inverse of u + + + // X_u[0] stores the first ZC sequence where the root u has a non-zero number of shifts + // for the unrestricted case X_u[0] is the first root indicated by the rootSequenceIndex + + for (k=0; k<N_ZC; k++) { + // 420 is the multiplicative inverse of 2 (required since ru is exp[j 2\pi n]) + X_u[i][k] = ((uint32_t*)ru)[(((k*(1+(inv_u*k)))%N_ZC)*420)%N_ZC]; + } + } + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_OUT); + +} diff --git a/openair1/PHY/LTE_TRANSPORT/print_stats.c b/openair1/PHY/LTE_TRANSPORT/print_stats.c deleted file mode 100644 index 9e328353a4..0000000000 --- a/openair1/PHY/LTE_TRANSPORT/print_stats.c +++ /dev/null @@ -1,804 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file PHY/LTE_TRANSPORT/print_stats.c -* \brief PHY statstic logging function -* \author R. Knopp, F. Kaltenberger, navid nikaein -* \date 2011 -* \version 0.1 -* \company Eurecom -* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr -* \note -* \warning -*/ - -#include "PHY/LTE_TRANSPORT/proto.h" - -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/extern.h" - -#ifdef OPENAIR2 -#include "../openair2/LAYER2/MAC/proto.h" -#include "../openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#endif - -extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index); -#if defined(OAI_USRP) || defined(EXMIMO) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) -#include "common_lib.h" -extern openair0_config_t openair0_cfg[]; -#endif - -int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length, runmode_t mode, int input_level_dBm) -{ - - uint8_t eNB=0; - uint32_t RRC_status; - int len=length; - int harq_pid,round; - - if (ue==NULL) - return 0; - - if ((mode == normal_txrx) || (mode == no_L2_connect)) { - len += sprintf(&buffer[len], "[UE_PROC] UE %d, RNTI %x\n",ue->Mod_id, ue->pdcch_vars[0][0]->crnti); - len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE, RSSI %.2f dBm, RSRQ[0] %.2f dB, N0 %d dBm/RE (NF %.1f dB)\n", - 10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB, - 10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB, - 10*log10(ue->measurements.rsrq[0]), - ue->measurements.n0_power_tot_dBm, - (double)ue->measurements.n0_power_tot_dBm+132.24); - - /* - len += sprintf(&buffer[len], - "[UE PROC] Frame count: %d\neNB0 RSSI %d dBm/RE (%d dB, %d dB)\neNB1 RSSI %d dBm/RE (%d dB, %d dB)neNB2 RSSI %d dBm/RE (%d dB, %d dB)\nN0 %d dBm/RE, %f dBm/%dPRB (%d dB, %d dB)\n", - proc->frame_rx, - ue->measurements.rx_rssi_dBm[0], - ue->measurements.rx_power_dB[0][0], - ue->measurements.rx_power_dB[0][1], - ue->measurements.rx_rssi_dBm[1], - ue->measurements.rx_power_dB[1][0], - ue->measurements.rx_power_dB[1][1], - ue->measurements.rx_rssi_dBm[2], - ue->measurements.rx_power_dB[2][0], - ue->measurements.rx_power_dB[2][1], - ue->measurements.n0_power_tot_dBm, - ue->measurements.n0_power_tot_dBm+10*log10(12*ue->frame_parms.N_RB_DL), - ue->frame_parms.N_RB_DL, - ue->measurements.n0_power_dB[0], - ue->measurements.n0_power_dB[1]); - */ - -#ifdef EXMIMO - len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]); -#endif -#if defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) - len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",ue->rx_total_gain_dB); -#endif -#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) - len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz, estimated carrier frequency %f Hz\n",ue->common_vars.freq_offset,openair0_cfg[0].rx_freq[0]-ue->common_vars.freq_offset); -#endif - len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[ue->UE_mode[0]],ue->UE_mode[0]); - len += sprintf(&buffer[len], "[UE PROC] timing_advance = %d\n",ue->timing_advance); - if (ue->UE_mode[0]==PUSCH) { - len += sprintf(&buffer[len], "[UE PROC] Po_PUSCH = %d dBm (PL %d dB, Po_NOMINAL_PUSCH %d dBm, PHR %d dB)\n", - ue->ulsch[0]->Po_PUSCH, - get_PL(ue->Mod_id,ue->CC_id,0), - ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH, - ue->ulsch[0]->PHR); - len += sprintf(&buffer[len], "[UE PROC] Po_PUCCH = %d dBm (Po_NOMINAL_PUCCH %d dBm, g_pucch %d dB)\n", - get_PL(ue->Mod_id,ue->CC_id,0)+ - ue->frame_parms.ul_power_control_config_common.p0_NominalPUCCH+ - ue->dlsch[0][0][0]->g_pucch, - ue->frame_parms.ul_power_control_config_common.p0_NominalPUCCH, - ue->dlsch[0][0][0]->g_pucch); - } - //for (eNB=0;eNB<NUMBER_OF_eNB_MAX;eNB++) { - for (eNB=0; eNB<1; eNB++) { - len += sprintf(&buffer[len], "[UE PROC] RX spatial power eNB%d: [%d %d; %d %d] dB\n", - eNB, - ue->measurements.rx_spatial_power_dB[eNB][0][0], - ue->measurements.rx_spatial_power_dB[eNB][0][1], - ue->measurements.rx_spatial_power_dB[eNB][1][0], - ue->measurements.rx_spatial_power_dB[eNB][1][1]); - - len += sprintf(&buffer[len], "[UE PROC] RX total power eNB%d: %d dB, avg: %d dB\n",eNB,ue->measurements.rx_power_tot_dB[eNB],ue->measurements.rx_power_avg_dB[eNB]); - len += sprintf(&buffer[len], "[UE PROC] RX total power lin: %d, avg: %d, RX total noise lin: %d, avg: %d\n",ue->measurements.rx_power_tot[eNB], - ue->measurements.rx_power_avg[eNB], ue->measurements.n0_power_tot, ue->measurements.n0_power_avg); - len += sprintf(&buffer[len], "[UE PROC] effective SINR %.2f dB\n",ue->sinr_eff); - len += sprintf(&buffer[len], "[UE PROC] Wideband CQI eNB %d: %d dB, avg: %d dB\n",eNB,ue->measurements.wideband_cqi_tot[eNB],ue->measurements.wideband_cqi_avg[eNB]); - - switch (ue->frame_parms.N_RB_DL) { - case 6: - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][0][0], - ue->measurements.subband_cqi_dB[eNB][0][1], - ue->measurements.subband_cqi_dB[eNB][0][2], - ue->measurements.subband_cqi_dB[eNB][0][3], - ue->measurements.subband_cqi_dB[eNB][0][4], - ue->measurements.subband_cqi_dB[eNB][0][5]); - - - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][1][0], - ue->measurements.subband_cqi_dB[eNB][1][1], - ue->measurements.subband_cqi_dB[eNB][1][2], - ue->measurements.subband_cqi_dB[eNB][1][3], - ue->measurements.subband_cqi_dB[eNB][1][4], - ue->measurements.subband_cqi_dB[eNB][1][5]); - - - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][0], - ue->measurements.subband_pmi_im[eNB][0][0], - ue->measurements.subband_pmi_re[eNB][1][0], - ue->measurements.subband_pmi_im[eNB][1][0], - ue->measurements.subband_pmi_re[eNB][2][0], - ue->measurements.subband_pmi_im[eNB][2][0], - ue->measurements.subband_pmi_re[eNB][3][0], - ue->measurements.subband_pmi_im[eNB][3][0], - ue->measurements.subband_pmi_re[eNB][4][0], - ue->measurements.subband_pmi_im[eNB][4][0], - ue->measurements.subband_pmi_re[eNB][5][0], - ue->measurements.subband_pmi_im[eNB][5][0]); - - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][1], - ue->measurements.subband_pmi_im[eNB][0][1], - ue->measurements.subband_pmi_re[eNB][1][1], - ue->measurements.subband_pmi_im[eNB][1][1], - ue->measurements.subband_pmi_re[eNB][2][1], - ue->measurements.subband_pmi_im[eNB][2][1], - ue->measurements.subband_pmi_re[eNB][3][1], - ue->measurements.subband_pmi_im[eNB][3][1], - ue->measurements.subband_pmi_re[eNB][4][1], - ue->measurements.subband_pmi_im[eNB][4][1], - ue->measurements.subband_pmi_re[eNB][5][1], - ue->measurements.subband_pmi_im[eNB][5][1]); - - len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d]\n", - eNB, - ue->measurements.selected_rx_antennas[eNB][0], - ue->measurements.selected_rx_antennas[eNB][1], - ue->measurements.selected_rx_antennas[eNB][2], - ue->measurements.selected_rx_antennas[eNB][3], - ue->measurements.selected_rx_antennas[eNB][4], - ue->measurements.selected_rx_antennas[eNB][5]); - - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,6))); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB, - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,6)), - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,6))); - break; - - case 25: - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][0][0], - ue->measurements.subband_cqi_dB[eNB][0][1], - ue->measurements.subband_cqi_dB[eNB][0][2], - ue->measurements.subband_cqi_dB[eNB][0][3], - ue->measurements.subband_cqi_dB[eNB][0][4], - ue->measurements.subband_cqi_dB[eNB][0][5], - ue->measurements.subband_cqi_dB[eNB][0][6]); - - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][1][0], - ue->measurements.subband_cqi_dB[eNB][1][1], - ue->measurements.subband_cqi_dB[eNB][1][2], - ue->measurements.subband_cqi_dB[eNB][1][3], - ue->measurements.subband_cqi_dB[eNB][1][4], - ue->measurements.subband_cqi_dB[eNB][1][5], - ue->measurements.subband_cqi_dB[eNB][1][6]); - - - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][0], - ue->measurements.subband_pmi_im[eNB][0][0], - ue->measurements.subband_pmi_re[eNB][1][0], - ue->measurements.subband_pmi_im[eNB][1][0], - ue->measurements.subband_pmi_re[eNB][2][0], - ue->measurements.subband_pmi_im[eNB][2][0], - ue->measurements.subband_pmi_re[eNB][3][0], - ue->measurements.subband_pmi_im[eNB][3][0], - ue->measurements.subband_pmi_re[eNB][4][0], - ue->measurements.subband_pmi_im[eNB][4][0], - ue->measurements.subband_pmi_re[eNB][5][0], - ue->measurements.subband_pmi_im[eNB][5][0], - ue->measurements.subband_pmi_re[eNB][6][0], - ue->measurements.subband_pmi_im[eNB][6][0]); - - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][1], - ue->measurements.subband_pmi_im[eNB][0][1], - ue->measurements.subband_pmi_re[eNB][1][1], - ue->measurements.subband_pmi_im[eNB][1][1], - ue->measurements.subband_pmi_re[eNB][2][1], - ue->measurements.subband_pmi_im[eNB][2][1], - ue->measurements.subband_pmi_re[eNB][3][1], - ue->measurements.subband_pmi_im[eNB][3][1], - ue->measurements.subband_pmi_re[eNB][4][1], - ue->measurements.subband_pmi_im[eNB][4][1], - ue->measurements.subband_pmi_re[eNB][5][1], - ue->measurements.subband_pmi_im[eNB][5][1], - ue->measurements.subband_pmi_re[eNB][6][1], - ue->measurements.subband_pmi_im[eNB][6][1]); - - len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d]\n", - eNB, - ue->measurements.selected_rx_antennas[eNB][0], - ue->measurements.selected_rx_antennas[eNB][1], - ue->measurements.selected_rx_antennas[eNB][2], - ue->measurements.selected_rx_antennas[eNB][3], - ue->measurements.selected_rx_antennas[eNB][4], - ue->measurements.selected_rx_antennas[eNB][5], - ue->measurements.selected_rx_antennas[eNB][6]); - - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,7))); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB, - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,7)), - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,7))); - break; - - case 50: - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][0][0], - ue->measurements.subband_cqi_dB[eNB][0][1], - ue->measurements.subband_cqi_dB[eNB][0][2], - ue->measurements.subband_cqi_dB[eNB][0][3], - ue->measurements.subband_cqi_dB[eNB][0][4], - ue->measurements.subband_cqi_dB[eNB][0][5], - ue->measurements.subband_cqi_dB[eNB][0][6], - ue->measurements.subband_cqi_dB[eNB][0][7], - ue->measurements.subband_cqi_dB[eNB][0][8]); - - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][1][0], - ue->measurements.subband_cqi_dB[eNB][1][1], - ue->measurements.subband_cqi_dB[eNB][1][2], - ue->measurements.subband_cqi_dB[eNB][1][3], - ue->measurements.subband_cqi_dB[eNB][1][4], - ue->measurements.subband_cqi_dB[eNB][1][5], - ue->measurements.subband_cqi_dB[eNB][1][6], - ue->measurements.subband_cqi_dB[eNB][1][7], - ue->measurements.subband_cqi_dB[eNB][1][8]); - - - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][0], - ue->measurements.subband_pmi_im[eNB][0][0], - ue->measurements.subband_pmi_re[eNB][1][0], - ue->measurements.subband_pmi_im[eNB][1][0], - ue->measurements.subband_pmi_re[eNB][2][0], - ue->measurements.subband_pmi_im[eNB][2][0], - ue->measurements.subband_pmi_re[eNB][3][0], - ue->measurements.subband_pmi_im[eNB][3][0], - ue->measurements.subband_pmi_re[eNB][4][0], - ue->measurements.subband_pmi_im[eNB][4][0], - ue->measurements.subband_pmi_re[eNB][5][0], - ue->measurements.subband_pmi_im[eNB][5][0], - ue->measurements.subband_pmi_re[eNB][6][0], - ue->measurements.subband_pmi_im[eNB][6][0], - ue->measurements.subband_pmi_re[eNB][7][0], - ue->measurements.subband_pmi_im[eNB][7][0], - ue->measurements.subband_pmi_re[eNB][8][0], - ue->measurements.subband_pmi_im[eNB][8][0]); - - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][1], - ue->measurements.subband_pmi_im[eNB][0][1], - ue->measurements.subband_pmi_re[eNB][1][1], - ue->measurements.subband_pmi_im[eNB][1][1], - ue->measurements.subband_pmi_re[eNB][2][1], - ue->measurements.subband_pmi_im[eNB][2][1], - ue->measurements.subband_pmi_re[eNB][3][1], - ue->measurements.subband_pmi_im[eNB][3][1], - ue->measurements.subband_pmi_re[eNB][4][1], - ue->measurements.subband_pmi_im[eNB][4][1], - ue->measurements.subband_pmi_re[eNB][5][1], - ue->measurements.subband_pmi_im[eNB][5][1], - ue->measurements.subband_pmi_re[eNB][6][1], - ue->measurements.subband_pmi_im[eNB][6][1], - ue->measurements.subband_pmi_re[eNB][7][1], - ue->measurements.subband_pmi_im[eNB][7][1], - ue->measurements.subband_pmi_re[eNB][8][1], - ue->measurements.subband_pmi_im[eNB][8][1]); - - len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d %d %d]\n", - eNB, - ue->measurements.selected_rx_antennas[eNB][0], - ue->measurements.selected_rx_antennas[eNB][1], - ue->measurements.selected_rx_antennas[eNB][2], - ue->measurements.selected_rx_antennas[eNB][3], - ue->measurements.selected_rx_antennas[eNB][4], - ue->measurements.selected_rx_antennas[eNB][5], - ue->measurements.selected_rx_antennas[eNB][6], - ue->measurements.selected_rx_antennas[eNB][7], - ue->measurements.selected_rx_antennas[eNB][8]); - - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,9))); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB, - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,9)), - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,9))); - break; - - case 100: - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][0][0], - ue->measurements.subband_cqi_dB[eNB][0][1], - ue->measurements.subband_cqi_dB[eNB][0][2], - ue->measurements.subband_cqi_dB[eNB][0][3], - ue->measurements.subband_cqi_dB[eNB][0][4], - ue->measurements.subband_cqi_dB[eNB][0][5], - ue->measurements.subband_cqi_dB[eNB][0][6], - ue->measurements.subband_cqi_dB[eNB][0][7], - ue->measurements.subband_cqi_dB[eNB][0][8], - ue->measurements.subband_cqi_dB[eNB][0][9], - ue->measurements.subband_cqi_dB[eNB][0][10], - ue->measurements.subband_cqi_dB[eNB][0][11], - ue->measurements.subband_cqi_dB[eNB][0][12]); - - len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d %d %d %d %d %d %d] dB\n", - eNB, - ue->measurements.subband_cqi_dB[eNB][1][0], - ue->measurements.subband_cqi_dB[eNB][1][1], - ue->measurements.subband_cqi_dB[eNB][1][2], - ue->measurements.subband_cqi_dB[eNB][1][3], - ue->measurements.subband_cqi_dB[eNB][1][4], - ue->measurements.subband_cqi_dB[eNB][1][5], - ue->measurements.subband_cqi_dB[eNB][1][6], - ue->measurements.subband_cqi_dB[eNB][1][7], - ue->measurements.subband_cqi_dB[eNB][1][8], - ue->measurements.subband_cqi_dB[eNB][1][9], - ue->measurements.subband_cqi_dB[eNB][1][10], - ue->measurements.subband_cqi_dB[eNB][1][11], - ue->measurements.subband_cqi_dB[eNB][1][12]); - - - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][0], - ue->measurements.subband_pmi_im[eNB][0][0], - ue->measurements.subband_pmi_re[eNB][1][0], - ue->measurements.subband_pmi_im[eNB][1][0], - ue->measurements.subband_pmi_re[eNB][2][0], - ue->measurements.subband_pmi_im[eNB][2][0], - ue->measurements.subband_pmi_re[eNB][3][0], - ue->measurements.subband_pmi_im[eNB][3][0], - ue->measurements.subband_pmi_re[eNB][4][0], - ue->measurements.subband_pmi_im[eNB][4][0], - ue->measurements.subband_pmi_re[eNB][5][0], - ue->measurements.subband_pmi_im[eNB][5][0], - ue->measurements.subband_pmi_re[eNB][6][0], - ue->measurements.subband_pmi_im[eNB][6][0], - ue->measurements.subband_pmi_re[eNB][7][0], - ue->measurements.subband_pmi_im[eNB][7][0], - ue->measurements.subband_pmi_re[eNB][8][0], - ue->measurements.subband_pmi_im[eNB][8][0], - ue->measurements.subband_pmi_re[eNB][9][0], - ue->measurements.subband_pmi_im[eNB][9][0], - ue->measurements.subband_pmi_re[eNB][10][0], - ue->measurements.subband_pmi_im[eNB][10][0], - ue->measurements.subband_pmi_re[eNB][11][0], - ue->measurements.subband_pmi_im[eNB][11][0], - ue->measurements.subband_pmi_re[eNB][12][0], - ue->measurements.subband_pmi_im[eNB][12][0]); - - len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n", - eNB, - ue->measurements.subband_pmi_re[eNB][0][1], - ue->measurements.subband_pmi_im[eNB][0][1], - ue->measurements.subband_pmi_re[eNB][1][1], - ue->measurements.subband_pmi_im[eNB][1][1], - ue->measurements.subband_pmi_re[eNB][2][1], - ue->measurements.subband_pmi_im[eNB][2][1], - ue->measurements.subband_pmi_re[eNB][3][1], - ue->measurements.subband_pmi_im[eNB][3][1], - ue->measurements.subband_pmi_re[eNB][4][1], - ue->measurements.subband_pmi_im[eNB][4][1], - ue->measurements.subband_pmi_re[eNB][5][1], - ue->measurements.subband_pmi_im[eNB][5][1], - ue->measurements.subband_pmi_re[eNB][6][1], - ue->measurements.subband_pmi_im[eNB][6][1], - ue->measurements.subband_pmi_re[eNB][7][1], - ue->measurements.subband_pmi_im[eNB][7][1], - ue->measurements.subband_pmi_re[eNB][8][1], - ue->measurements.subband_pmi_im[eNB][8][1], - ue->measurements.subband_pmi_re[eNB][9][1], - ue->measurements.subband_pmi_im[eNB][9][1], - ue->measurements.subband_pmi_re[eNB][10][1], - ue->measurements.subband_pmi_im[eNB][10][1], - ue->measurements.subband_pmi_re[eNB][11][1], - ue->measurements.subband_pmi_im[eNB][11][1], - ue->measurements.subband_pmi_re[eNB][12][1], - ue->measurements.subband_pmi_im[eNB][12][1]); - - len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d %d %d %d %d %d %d]\n", - eNB, - ue->measurements.selected_rx_antennas[eNB][0], - ue->measurements.selected_rx_antennas[eNB][1], - ue->measurements.selected_rx_antennas[eNB][2], - ue->measurements.selected_rx_antennas[eNB][3], - ue->measurements.selected_rx_antennas[eNB][4], - ue->measurements.selected_rx_antennas[eNB][5], - ue->measurements.selected_rx_antennas[eNB][6], - ue->measurements.selected_rx_antennas[eNB][7], - ue->measurements.selected_rx_antennas[eNB][8], - ue->measurements.selected_rx_antennas[eNB][9], - ue->measurements.selected_rx_antennas[eNB][10], - ue->measurements.selected_rx_antennas[eNB][11], - ue->measurements.selected_rx_antennas[eNB][12]); - - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,13))); - len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB, - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,13)), - pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,13))); - break; - } - -#ifdef OPENAIR2 - RRC_status = mac_UE_get_rrc_status(ue->Mod_id, 0); - len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status); -#endif - - - len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d \n",ue->transmission_mode[eNB]); - len += sprintf(&buffer[len], "[UE PROC] PBCH err conseq %d, PBCH error total %d, PBCH FER %d\n", - ue->pbch_vars[eNB]->pdu_errors_conseq, - ue->pbch_vars[eNB]->pdu_errors, - ue->pbch_vars[eNB]->pdu_fer); - - if (ue->transmission_mode[eNB] == 6) - len += sprintf(&buffer[len], "[UE PROC] Mode 6 Wideband CQI eNB %d : %d dB\n",eNB,ue->measurements.precoded_cqi_dB[eNB][0]); - - for (harq_pid=0;harq_pid<8;harq_pid++) { - len+=sprintf(&buffer[len],"[UE PROC] eNB %d: CW 0 harq_pid %d, mcs %d:",eNB,harq_pid,ue->dlsch[0][0][0]->harq_processes[harq_pid]->mcs); - for (round=0;round<8;round++) - len+=sprintf(&buffer[len],"%d/%d ", - ue->dlsch[0][0][0]->harq_processes[harq_pid]->errors[round], - ue->dlsch[0][0][0]->harq_processes[harq_pid]->trials[round]); - len+=sprintf(&buffer[len],"\n"); - } - if (ue->dlsch[0][0] && ue->dlsch[0][0][0] && ue->dlsch[0][0][1]) { - len += sprintf(&buffer[len], "[UE PROC] Saved PMI for DLSCH eNB %d : %jx (%p)\n",eNB,pmi2hex_2Ar1(ue->dlsch[0][0][0]->pmi_alloc),ue->dlsch[0][0][0]); - - len += sprintf(&buffer[len], "[UE PROC] eNB %d: dl_power_off = %d\n",eNB,ue->dlsch[0][0][0]->harq_processes[0]->dl_power_off); - - for (harq_pid=0;harq_pid<8;harq_pid++) { - len+=sprintf(&buffer[len],"[UE PROC] eNB %d: CW 1 harq_pid %d, mcs %d:",eNB,harq_pid,ue->dlsch[0][0][1]->harq_processes[0]->mcs); - for (round=0;round<8;round++) - len+=sprintf(&buffer[len],"%d/%d ", - ue->dlsch[0][0][1]->harq_processes[harq_pid]->errors[round], - ue->dlsch[0][0][1]->harq_processes[harq_pid]->trials[round]); - len+=sprintf(&buffer[len],"\n"); - } - } - - len += sprintf(&buffer[len], "[UE PROC] DLSCH Total %d, Error %d, FER %d\n",ue->dlsch_received[0],ue->dlsch_errors[0],ue->dlsch_fer[0]); - len += sprintf(&buffer[len], "[UE PROC] DLSCH (SI) Total %d, Error %d\n",ue->dlsch_SI_received[0],ue->dlsch_SI_errors[0]); - len += sprintf(&buffer[len], "[UE PROC] DLSCH (RA) Total %d, Error %d\n",ue->dlsch_ra_received[0],ue->dlsch_ra_errors[0]); -#if defined(Rel10) || defined(Rel14) - int i=0; - - //len += sprintf(&buffer[len], "[UE PROC] MCH Total %d\n", ue->dlsch_mch_received[0]); - for(i=0; i <ue->frame_parms.num_MBSFN_config; i++ ) { - len += sprintf(&buffer[len], "[UE PROC] MCH (MCCH MBSFN %d) Total %d, Error %d, Trials %d\n", - i, ue->dlsch_mcch_received[i][0],ue->dlsch_mcch_errors[i][0],ue->dlsch_mcch_trials[i][0]); - len += sprintf(&buffer[len], "[UE PROC] MCH (MTCH MBSFN %d) Total %d, Error %d, Trials %d\n", - i, ue->dlsch_mtch_received[i][0],ue->dlsch_mtch_errors[i][0],ue->dlsch_mtch_trials[i][0]); - } - -#endif - len += sprintf(&buffer[len], "[UE PROC] DLSCH Bitrate %dkbps\n",(ue->bitrate[0]/1000)); - len += sprintf(&buffer[len], "[UE PROC] Total Received Bits %dkbits\n",(ue->total_received_bits[0]/1000)); - len += sprintf(&buffer[len], "[UE PROC] IA receiver %d\n",ue->use_ia_receiver); - - } - - } else { - len += sprintf(&buffer[len], "[UE PROC] Frame count: %d, RSSI %3.2f dB (%d dB, %d dB), N0 %3.2f dB (%d dB, %d dB)\n", - proc->frame_rx, - 10*log10(ue->measurements.rssi), - ue->measurements.rx_power_dB[0][0], - ue->measurements.rx_power_dB[0][1], - 10*log10(ue->measurements.n0_power_tot), - ue->measurements.n0_power_dB[0], - ue->measurements.n0_power_dB[1]); -#ifdef EXMIMO - ue->rx_total_gain_dB = ((int)(10*log10(ue->measurements.rssi)))-input_level_dBm; - len += sprintf(&buffer[len], "[UE PROC] rxg_mode %d, input level (set by user) %d dBm, VGA gain %d dB ==> total gain %3.2f dB, noise figure %3.2f dB\n", - openair0_cfg[0].rxg_mode[0], - input_level_dBm, - (int)openair0_cfg[0].rx_gain[0], - 10*log10(ue->measurements.rssi)-input_level_dBm, - 10*log10(ue->measurements.n0_power_tot)-ue->rx_total_gain_dB+105); -#endif - } - - len += sprintf(&buffer[len],"EOF\n"); - - return len; -} // is_clusterhead - -/* -int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length) -{ - - unsigned int success=0; - uint8_t eNB_id,UE_id,i,j,number_of_cards_l=1; - uint32_t ulsch_errors=0,dlsch_errors=0; - uint32_t ulsch_round_attempts[4]= {0,0,0,0},ulsch_round_errors[4]= {0,0,0,0}; - uint32_t dlsch_round_attempts[4]= {0,0,0,0},dlsch_round_errors[4]= {0,0,0,0}; - uint32_t UE_id_mac, RRC_status; - eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0]; - if (eNB==NULL) - return 0; - - int len = length; - - // if(eNB->frame==0){ - eNB->total_dlsch_bitrate = 0;//eNB->UE_stats[UE_id].dlsch_bitrate + eNB->total_dlsch_bitrate; - eNB->total_transmitted_bits = 0;// eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_transmitted_bits; - eNB->total_system_throughput = 0;//eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_system_throughput; - // } - - for (eNB_id=0; eNB_id<number_of_cards_l; eNB_id++) { - len += sprintf(&buffer[len],"eNB %d/%d Frame %d: RX Gain %d dB, I0 %d dBm (%d,%d) dB \n", - eNB_id,number_of_cards_l, - proc->frame_tx, - eNB->rx_total_gain_dB, - eNB->measurements.n0_power_tot_dBm, - eNB->measurements.n0_power_dB[0], - eNB->measurements.n0_power_dB[1]); - - len += sprintf(&buffer[len],"PRB I0 (%X.%X.%X.%X): ", - eNB->rb_mask_ul[0], - eNB->rb_mask_ul[1],eNB->rb_mask_ul[2],eNB->rb_mask_ul[3]); - - for (i=0; i<eNB->frame_parms.N_RB_UL; i++) { - len += sprintf(&buffer[len],"%4d ", - eNB->measurements.n0_subband_power_tot_dBm[i]); - if ((i>0) && ((i%25) == 0)) - len += sprintf(&buffer[len],"\n"); - } - len += sprintf(&buffer[len],"\n"); - len += sprintf(&buffer[len],"\nPERFORMANCE PARAMETERS\n"); - - for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { - if (eNB && - (eNB->dlsch!=NULL) && - (eNB->dlsch[(uint8_t)UE_id]!=NULL) && - (eNB->dlsch[(uint8_t)UE_id][0]->rnti>0)&& - (eNB->UE_stats[UE_id].mode == PUSCH)) { - - eNB->total_dlsch_bitrate = eNB->UE_stats[UE_id].dlsch_bitrate + eNB->total_dlsch_bitrate; - eNB->total_transmitted_bits = eNB->UE_stats[UE_id].total_TBS + eNB->total_transmitted_bits; - - //eNB->total_system_throughput = eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_system_throughput; - - for (i=0; i<8; i++) - success = success + (eNB->UE_stats[UE_id].dlsch_trials[i][0] - eNB->UE_stats[UE_id].dlsch_l2_errors[i]); - - - - len += sprintf(&buffer[len],"Total DLSCH %d kbits / %d frames ",(eNB->total_transmitted_bits/1000),proc->frame_tx+1); - len += sprintf(&buffer[len],"Total DLSCH throughput %d kbps ",(eNB->total_dlsch_bitrate/1000)); - len += sprintf(&buffer[len],"Total DLSCH trans %d / %d frames\n",success,proc->frame_tx+1); - //len += sprintf(&buffer[len],"[eNB PROC] FULL MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->FULL_MUMIMO_transmissions,eNB->check_for_total_transmissions); - //len += sprintf(&buffer[len],"[eNB PROC] MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_MUMIMO_transmissions,eNB->check_for_total_transmissions); - //len += sprintf(&buffer[len],"[eNB PROC] SU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_SUMIMO_transmissions,eNB->check_for_total_transmissions); - - len += sprintf(&buffer[len],"UE %d (%x) Power: (%d,%d) dB, Po_PUSCH: (%d,%d) dBm, Po_PUCCH (%d/%d) dBm, Po_PUCCH1 (%d,%d) dBm, PUCCH1 Thres %d dBm \n", - UE_id, - eNB->UE_stats[UE_id].crnti, - dB_fixed(eNB->pusch_vars[UE_id]->ulsch_power[0]), - dB_fixed(eNB->pusch_vars[UE_id]->ulsch_power[1]), - eNB->UE_stats[UE_id].UL_rssi[0], - eNB->UE_stats[UE_id].UL_rssi[1], - dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB, - eNB->frame_parms.ul_power_control_config_common.p0_NominalPUCCH, - dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH1_below/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB, - dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH1_above/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB, - PUCCH1_THRES+eNB->measurements.n0_power_tot_dBm-dB_fixed(eNB->frame_parms.N_RB_UL)); - - len+= sprintf(&buffer[len],"DL mcs %d, UL mcs %d, UL rb %d, delta_TF %d, ", - eNB->dlsch[(uint8_t)UE_id][0]->harq_processes[0]->mcs, - eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->mcs, - eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->nb_rb, - eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->delta_TF); - - len += sprintf(&buffer[len],"Wideband CQI: (%d,%d) dB\n", - eNB->measurements.wideband_cqi_dB[UE_id][0], - eNB->measurements.wideband_cqi_dB[UE_id][1]); - - len += sprintf(&buffer[len],"DL TM %d, DL_cqi %d, DL_pmi_single %jx ", - eNB->transmission_mode[UE_id], - eNB->UE_stats[UE_id].DL_cqi[0], - pmi2hex_2Ar1(eNB->UE_stats[UE_id].DL_pmi_single)); - - len += sprintf(&buffer[len],"Timing advance %d samples (%d 16Ts), update %d ", - eNB->UE_stats[UE_id].UE_timing_offset, - eNB->UE_stats[UE_id].UE_timing_offset>>2, - eNB->UE_stats[UE_id].timing_advance_update); - - len += sprintf(&buffer[len],"Mode = %s(%d) ", - mode_string[eNB->UE_stats[UE_id].mode], - eNB->UE_stats[UE_id].mode); - UE_id_mac = find_UE_id(eNB->Mod_id,eNB->dlsch[(uint8_t)UE_id][0]->rnti); - - if (UE_id_mac != -1) { - RRC_status = mac_eNB_get_rrc_status(eNB->Mod_id,eNB->dlsch[(uint8_t)UE_id][0]->rnti); - len += sprintf(&buffer[len],"UE_id_mac = %d, RRC status = %d\n",UE_id_mac,RRC_status); - } else - len += sprintf(&buffer[len],"UE_id_mac = -1\n"); - - len += sprintf(&buffer[len],"SR received/total: %d/%d (diff %d)\n", - eNB->UE_stats[UE_id].sr_received, - eNB->UE_stats[UE_id].sr_total, - eNB->UE_stats[UE_id].sr_total-eNB->UE_stats[UE_id].sr_received); - - len += sprintf(&buffer[len],"DL Subband CQI: "); - - int nb_sb; - switch (eNB->frame_parms.N_RB_DL) { - case 6: - nb_sb=0; - break; - case 15: - nb_sb = 4; - case 25: - nb_sb = 7; - break; - case 50: - nb_sb = 9; - break; - case 75: - nb_sb = 10; - break; - case 100: - nb_sb = 13; - break; - default: - nb_sb=0; - break; - } - for (i=0; i<nb_sb; i++) - len += sprintf(&buffer[len],"%2d ", - eNB->UE_stats[UE_id].DL_subband_cqi[0][i]); - len += sprintf(&buffer[len],"\n"); - - - - ulsch_errors = 0; - - for (j=0; j<4; j++) { - ulsch_round_attempts[j]=0; - ulsch_round_errors[j]=0; - } - - len += sprintf(&buffer[len],"ULSCH errors/attempts per harq (per round): \n"); - - for (i=0; i<8; i++) { - len += sprintf(&buffer[len]," harq %d: %d/%d (fer %d) (%d/%d, %d/%d, %d/%d, %d/%d) ", - i, - eNB->UE_stats[UE_id].ulsch_errors[i], - eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][0], - eNB->UE_stats[UE_id].ulsch_round_fer[i][0], - eNB->UE_stats[UE_id].ulsch_round_errors[i][0], - eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][0], - eNB->UE_stats[UE_id].ulsch_round_errors[i][1], - eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][1], - eNB->UE_stats[UE_id].ulsch_round_errors[i][2], - eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][2], - eNB->UE_stats[UE_id].ulsch_round_errors[i][3], - eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][3]); - if ((i&1) == 1) - len += sprintf(&buffer[len],"\n"); - - ulsch_errors+=eNB->UE_stats[UE_id].ulsch_errors[i]; - - for (j=0; j<4; j++) { - ulsch_round_attempts[j]+=eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][j]; - ulsch_round_errors[j]+=eNB->UE_stats[UE_id].ulsch_round_errors[i][j]; - } - } - - len += sprintf(&buffer[len],"ULSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d)\n", - ulsch_errors,ulsch_round_attempts[0], - - ulsch_round_errors[0],ulsch_round_attempts[0], - ulsch_round_errors[1],ulsch_round_attempts[1], - ulsch_round_errors[2],ulsch_round_attempts[2], - ulsch_round_errors[3],ulsch_round_attempts[3]); - - dlsch_errors = 0; - - for (j=0; j<4; j++) { - dlsch_round_attempts[j]=0; - dlsch_round_errors[j]=0; - } - - len += sprintf(&buffer[len],"DLSCH errors/attempts per harq (per round): \n"); - - for (i=0; i<8; i++) { - len += sprintf(&buffer[len]," harq %d: %d/%d (%d/%d/%d, %d/%d/%d, %d/%d/%d, %d/%d/%d) ", - i, - eNB->UE_stats[UE_id].dlsch_l2_errors[i], - eNB->UE_stats[UE_id].dlsch_trials[i][0], - eNB->UE_stats[UE_id].dlsch_ACK[i][0], - eNB->UE_stats[UE_id].dlsch_NAK[i][0], - eNB->UE_stats[UE_id].dlsch_trials[i][0], - eNB->UE_stats[UE_id].dlsch_ACK[i][1], - eNB->UE_stats[UE_id].dlsch_NAK[i][1], - eNB->UE_stats[UE_id].dlsch_trials[i][1], - eNB->UE_stats[UE_id].dlsch_ACK[i][2], - eNB->UE_stats[UE_id].dlsch_NAK[i][2], - eNB->UE_stats[UE_id].dlsch_trials[i][2], - eNB->UE_stats[UE_id].dlsch_ACK[i][3], - eNB->UE_stats[UE_id].dlsch_NAK[i][3], - eNB->UE_stats[UE_id].dlsch_trials[i][3]); - if ((i&1) == 1) - len += sprintf(&buffer[len],"\n"); - - - dlsch_errors+=eNB->UE_stats[UE_id].dlsch_l2_errors[i]; - - for (j=0; j<4; j++) { - dlsch_round_attempts[j]+=eNB->UE_stats[UE_id].dlsch_trials[i][j]; - dlsch_round_errors[j]+=eNB->UE_stats[UE_id].dlsch_NAK[i][j]; - } - } - - len += sprintf(&buffer[len],"DLSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d): \n", - dlsch_errors,dlsch_round_attempts[0], - dlsch_round_errors[0],dlsch_round_attempts[0], - dlsch_round_errors[1],dlsch_round_attempts[1], - dlsch_round_errors[2],dlsch_round_attempts[2], - dlsch_round_errors[3],dlsch_round_attempts[3]); - - - len += sprintf(&buffer[len],"DLSCH total bits from MAC: %dkbit ",(eNB->UE_stats[UE_id].total_TBS_MAC)/1000); - len += sprintf(&buffer[len],"DLSCH total bits ack'ed: %dkbit ",(eNB->UE_stats[UE_id].total_TBS)/1000); - len += sprintf(&buffer[len],"DLSCH Average throughput (100 frames): %dkbps\n",(eNB->UE_stats[UE_id].dlsch_bitrate/1000)); - // len += sprintf(&buffer[len],"[eNB PROC] Transmission Mode %d\n",eNB->transmission_mode[UE_id]); - } - } - - len += sprintf(&buffer[len],"\n"); - } - - len += sprintf(&buffer[len],"EOF\n"); - - return len; -} -*/ diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h deleted file mode 100644 index 0e1a60c0b9..0000000000 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ /dev/null @@ -1,2275 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file PHY/LTE_TRANSPORT/proto.h - * \brief Function prototypes for PHY physical/transport channel processing and generation V8.6 2009-03 - * \author R. Knopp, F. Kaltenberger - * \date 2011 - * \version 0.1 - * \company Eurecom - * \email: knopp@eurecom.fr - * \note - * \warning - */ -#ifndef __LTE_TRANSPORT_PROTO__H__ -#define __LTE_TRANSPORT_PROTO__H__ -#include "PHY/defs.h" -#include <math.h> -#include "nfapi_interface.h" - -// Functions below implement 36-211 and 36-212 - -/** @addtogroup _PHY_TRANSPORT_ - * @{ - */ - -/** \fn free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch,unsigned char N_RB_DL) - \brief This function frees memory allocated for a particular DLSCH at eNB - @param dlsch Pointer to DLSCH to be removed -*/ -void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch); - -void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch); - -/** \fn new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms) - \brief This function allocates structures for a particular DLSCH at eNB - @returns Pointer to DLSCH to be removed - @param Kmimo Kmimo factor from 36-212/36-213 - @param Mdlharq Maximum number of HARQ rounds (36-212/36-213) - @param Nsoft Soft-LLR buffer size from UE-Category - @params N_RB_DL total number of resource blocks (determine the operating BW) - @param abstraction_flag Flag to indicate abstracted interface - @param frame_parms Pointer to frame descriptor structure -*/ -LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms); - -/** \fn free_ue_dlsch(LTE_UE_DLSCH_t *dlsch) - \brief This function frees memory allocated for a particular DLSCH at UE - @param dlsch Pointer to DLSCH to be removed -*/ -void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch); - -/** \fn new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag) - \brief This function allocates structures for a particular DLSCH at eNB - @returns Pointer to DLSCH to be removed - @param Kmimo Kmimo factor from 36-212/36-213 - @param Mdlharq Maximum number of HARQ rounds (36-212/36-213) - @param Nsoft Soft-LLR buffer size from UE-Category - @params N_RB_DL total number of resource blocks (determine the operating BW) - @param abstraction_flag Flag to indicate abstracted interface -*/ -LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag); - - -void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch); - -void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch); - -/** \fn free_eNB_ulsch(LTE_eNB_DLSCH_t *dlsch) - \brief This function frees memory allocated for a particular ULSCH at eNB - @param ulsch Pointer to ULSCH to be removed -*/ -void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch); - -LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag); - -LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag); - -/** \fn dlsch_encoding(PHY_VARS_eNB *eNB, - uint8_t *input_buffer, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t num_pdcch_symbols, - LTE_eNB_DLSCH_t *dlsch, - int frame, - uint8_t subframe) - \brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). The implemented functions are: - - CRC computation and addition - - Code block segmentation and sub-block CRC addition - - Channel coding (Turbo coding) - - Rate matching (sub-block interleaving, bit collection, selection and transmission - - Code block concatenation - @param eNB Pointer to eNB PHY context - @param input_buffer Pointer to input buffer for sub-frame - @param frame_parms Pointer to frame descriptor structure - @param num_pdcch_symbols Number of PDCCH symbols in this subframe - @param dlsch Pointer to dlsch to be encoded - @param frame Frame number - @param subframe Subframe number - @param rm_stats Time statistics for rate-matching - @param te_stats Time statistics for turbo-encoding - @param i_stats Time statistics for interleaving - @returns status -*/ -int32_t dlsch_encoding(PHY_VARS_eNB *eNB, - uint8_t *a, - uint8_t num_pdcch_symbols, - LTE_eNB_DLSCH_t *dlsch, - int frame, - uint8_t subframe, - time_stats_t *rm_stats, - time_stats_t *te_stats, - time_stats_t *i_stats); - -int32_t dlsch_encoding_SIC(PHY_VARS_UE *ue, - uint8_t *a, - uint8_t num_pdcch_symbols, - LTE_eNB_DLSCH_t *dlsch, - int frame, - uint8_t subframe, - time_stats_t *rm_stats, - time_stats_t *te_stats, - time_stats_t *i_stats); - - - -/** \fn dlsch_encoding_2threads(PHY_VARS_eNB *eNB, - uint8_t *input_buffer, - uint8_t num_pdcch_symbols, - LTE_eNB_DLSCH_t *dlsch, - int frame, - uint8_t subframe) - \brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). This version spawns 1 worker thread. The implemented functions are: - - CRC computation and addition - - Code block segmentation and sub-block CRC addition - - Channel coding (Turbo coding) - - Rate matching (sub-block interleaving, bit collection, selection and transmission - - Code block concatenation - @param eNB Pointer to eNB PHY context - @param input_buffer Pointer to input buffer for sub-frame - @param num_pdcch_symbols Number of PDCCH symbols in this subframe - @param dlsch Pointer to dlsch to be encoded - @param frame Frame number - @param subframe Subframe number - @param rm_stats Time statistics for rate-matching - @param te_stats Time statistics for turbo-encoding - @param i_stats Time statistics for interleaving - @returns status -*/ -int32_t dlsch_encoding_2threads(PHY_VARS_eNB *eNB, - uint8_t *a, - uint8_t num_pdcch_symbols, - LTE_eNB_DLSCH_t *dlsch, - int frame, - uint8_t subframe, - time_stats_t *rm_stats, - time_stats_t *te_stats, - time_stats_t *i_stats); - -void dlsch_encoding_emul(PHY_VARS_eNB *phy_vars_eNB, - uint8_t *DLSCH_pdu, - LTE_eNB_DLSCH_t *dlsch); - - -// Functions below implement 36-211 - -/** \fn allocate_REs_in_RB(int32_t **txdataF, - uint32_t *jj, - uint32_t *jj2, - uint16_t re_offset, - uint32_t symbol_offset, - LTE_DL_eNB_HARQ_t *dlsch0_harq, - LTE_DL_eNB_HARQ_t *dlsch1_harq, - uint8_t pilots, - int16_t amp, - int16_t *qam_table_s, - uint32_t *re_allocated, - uint8_t skip_dc, - uint8_t skip_half, - uint8_t use2ndpilots, - LTE_DL_FRAME_PARMS *frame_parms); - - \brief Fills RB with data - \param txdataF pointer to output data (frequency domain signal) - \param jj index to output (from CW 1) - \param jj2 index to output (from CW 2) - \param re_offset index of the first RE of the RB - \param symbol_offset index to the OFDM symbol - \param dlsch0_harq Pointer to Transport block 0 HARQ structure - \param dlsch0_harq Pointer to Transport block 1 HARQ structure - \param pilots =1 if symbol_offset is an OFDM symbol that contains pilots, 0 otherwise - \param amp Amplitude for symbols - \param qam_table_s0 pointer to scaled QAM table for Transport Block 0 (by rho_a or rho_b) - \param qam_table_s1 pointer to scaled QAM table for Transport Block 1 (by rho_a or rho_b) - \param re_allocated pointer to allocation counter - \param skip_dc offset for positive RBs - \param skip_half indicate that first or second half of RB must be skipped for PBCH/PSS/SSS - \param ue_spec_rs UE specific RS indicator - \param nb_antennas_tx_phy Physical antenna elements which can be different with antenna port number, especially in beamforming case - \param use2ndpilots Set to use the pilots from antenna port 1 for PDSCH - \param frame_parms Frame parameter descriptor -*/ - -// Functions below implement 36-211 - -/** \fn allocate_REs_in_RB(int32_t **txdataF, - uint32_t *jj, - uint32_t *jj2, - uint16_t re_offset, - uint32_t symbol_offset, - LTE_DL_eNB_HARQ_t *dlsch0_harq, - LTE_DL_eNB_HARQ_t *dlsch1_harq, - uint8_t pilots, - int16_t amp, - int16_t *qam_table_s, - uint32_t *re_allocated, - uint8_t skip_dc, - uint8_t skip_half, - uint8_t use2ndpilots, - LTE_DL_FRAME_PARMS *frame_parms); - - \brief Fills RB with data - \param txdataF pointer to output data (frequency domain signal) - \param jj index to output (from CW 1) - \param jj index to output (from CW 2) - \param re_offset index of the first RE of the RB - \param symbol_offset index to the OFDM symbol - \param dlsch0_harq Pointer to Transport block 0 HARQ structure - \param dlsch0_harq Pointer to Transport block 1 HARQ structure - \param pilots =1 if symbol_offset is an OFDM symbol that contains pilots, 0 otherwise - \param amp Amplitude for symbols - \param qam_table_s0 pointer to scaled QAM table for Transport Block 0 (by rho_a or rho_b) - \param qam_table_s1 pointer to scaled QAM table for Transport Block 1 (by rho_a or rho_b) - \param re_allocated pointer to allocation counter - \param skip_dc offset for positive RBs - \param skip_half indicate that first or second half of RB must be skipped for PBCH/PSS/SSS - \param use2ndpilots Set to use the pilots from antenna port 1 for PDSCH - \param frame_parms Frame parameter descriptor -*/ - -int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB, - int32_t **txdataF, - uint32_t *jj, - uint32_t *jj2, - uint16_t re_offset, - uint32_t symbol_offset, - LTE_DL_eNB_HARQ_t *dlsch0_harq, - LTE_DL_eNB_HARQ_t *dlsch1_harq, - uint8_t pilots, - int16_t amp, - uint8_t precoder_index, - int16_t *qam_table_s0, - int16_t *qam_table_s1, - uint32_t *re_allocated, - uint8_t skip_dc, - uint8_t skip_half, - uint8_t lprime, - uint8_t mprime, - uint8_t Ns, - int *P1_SHIFT, - int *P2_SHIFT); - - -/** \fn int32_t dlsch_modulation(int32_t **txdataF, - int16_t amp, - uint32_t sub_frame_offset, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t num_pdcch_symbols, - LTE_eNB_DLSCH_t *dlsch); - - \brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for DLSCH. - @param txdataF Table of pointers for frequency-domain TX signals - @param amp Amplitude of signal - @param sub_frame_offset Offset of this subframe in units of subframes (usually 0) - @param frame_parms Pointer to frame descriptor - @param num_pdcch_symbols Number of PDCCH symbols in this subframe - @param dlsch0 Pointer to Transport Block 0 DLSCH descriptor for this allocation - @param dlsch1 Pointer to Transport Block 0 DLSCH descriptor for this allocation -*/ -int32_t dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, - int32_t **txdataF, - int16_t amp, - uint32_t sub_frame_offset, - uint8_t num_pdcch_symbols, - LTE_eNB_DLSCH_t *dlsch0, - LTE_eNB_DLSCH_t *dlsch1); - -int32_t dlsch_modulation_SIC(int32_t **sic_buffer, - uint32_t sub_frame_offset, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t num_pdcch_symbols, - LTE_eNB_DLSCH_t *dlsch0, - int G); -/* - \brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for MCH. - @param txdataF Table of pointers for frequency-domain TX signals - @param amp Amplitude of signal - @param subframe_offset Offset of this subframe in units of subframes (usually 0) - @param frame_parms Pointer to frame descriptor - @param dlsch Pointer to DLSCH descriptor for this allocation -*/ -int mch_modulation(int32_t **txdataF, - int16_t amp, - uint32_t subframe_offset, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_eNB_DLSCH_t *dlsch); - -/** \brief Top-level generation function for eNB TX of MBSFN - @param phy_vars_eNB Pointer to eNB variables - @param a Pointer to transport block - @param abstraction_flag - -*/ -void generate_mch(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t *a); - -/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) - @param phy_vars_eNB Pointer to eNB variables - @param proc Pointer to RXn-TXnp4 proc information - @param mcs MCS for MBSFN - @param ndi new data indicator - @param rdvix -*/ -void fill_eNB_dlsch_MCH(PHY_VARS_eNB *phy_vars_eNB,int mcs,int ndi,int rvidx); - -/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) - @param phy_vars_ue Pointer to UE variables - @param mcs MCS for MBSFN - @param eNB_id index of eNB in ue variables -*/ -void fill_UE_dlsch_MCH(PHY_VARS_UE *phy_vars_ue,int mcs,int ndi,int rvidx,int eNB_id); - -/** \brief Receiver processing for MBSFN, symbols can be done separately for time/CPU-scheduling purposes - @param phy_vars_ue Pointer to UE variables - @param eNB_id index of eNB in ue variables - @param subframe Subframe index of PMCH - @param symbol Symbol index on which to act -*/ -int rx_pmch(PHY_VARS_UE *phy_vars_ue, - unsigned char eNB_id, - uint8_t subframe, - unsigned char symbol); - -/** \brief Dump OCTAVE/MATLAB files for PMCH debugging - @param phy_vars_ue Pointer to UE variables - @param eNB_id index of eNB in ue variables - @param coded_bits_per_codeword G from 36.211 - @param subframe Index of subframe - @returns 0 on success -*/ -void dump_mch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe); - - -/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) - for N subframes. - @param phy_vars_eNB Pointer to eNB variables - @param txdataF Table of pointers for frequency-domain TX signals - @param amp Amplitude of signal - @param N Number of sub-frames to generate -*/ -void generate_pilots(PHY_VARS_eNB *phy_vars_eNB, - int32_t **txdataF, - int16_t amp, - uint16_t N); - -/** - \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) for one slot only - @param phy_vars_eNB Pointer to eNB variables - @param txdataF Table of pointers for frequency-domain TX signals - @param amp Amplitude of signal - @param slot index (0..19) - @param first_pilot_only (0 no) -*/ -int32_t generate_pilots_slot(PHY_VARS_eNB *phy_vars_eNB, - int32_t **txdataF, - int16_t amp, - uint16_t slot, - int first_pilot_only); - -int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB, - eNB_rxtx_proc_t *proc, - int32_t **txdataF, - int16_t amp); - -void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, - uint8_t UE_id, - int32_t **txdataF, - int16_t amp, - uint16_t Ntti, - uint8_t beamforming_mode); - -int32_t generate_pss(int32_t **txdataF, - int16_t amp, - LTE_DL_FRAME_PARMS *frame_parms, - uint16_t l, - uint16_t Ns); - -int32_t generate_pss_emul(PHY_VARS_eNB *phy_vars_eNB,uint8_t sect_id); - -int32_t generate_sss(int32_t **txdataF, - short amp, - LTE_DL_FRAME_PARMS *frame_parms, - unsigned short symbol, - unsigned short slot_offset); - -int32_t generate_pbch(LTE_eNB_PBCH *eNB_pbch, - int32_t **txdataF, - int32_t amp, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t *pbch_pdu, - uint8_t frame_mod4); - -int32_t generate_pbch_emul(PHY_VARS_eNB *phy_vars_eNB,uint8_t *pbch_pdu); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qpsk_qpsk(int16_t *stream0_in, - int16_t *stream1_in, - int16_t *stream0_out, - int16_t *rho01, - int32_t length); - -/** \brief This function perform LLR computation for dual-stream (QPSK/QPSK) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr128p pointer to pointer to symbol in dlsch_llr*/ -int32_t dlsch_qpsk_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho_i, - int16_t *dlsch_llr, - uint8_t symbol, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint16_t pbch_pss_sss_adj, - int16_t **llr128p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/16QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qpsk_qam16(int16_t *stream0_in, - int16_t *stream1_in, - short *ch_mag_i, - int16_t *stream0_out, - int16_t *rho01, - int32_t length); - -/** \brief This function perform LLR computation for dual-stream (QPSK/16QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr128p pointer to pointer to symbol in dlsch_llr*/ -int32_t dlsch_qpsk_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) - int32_t **rho_i, - int16_t *dlsch_llr, - uint8_t symbol, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint16_t pbch_pss_sss_adj, - int16_t **llr128p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/64QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qpsk_qam64(int16_t *stream0_in, - int16_t *stream1_in, - short *ch_mag_i, - int16_t *stream0_out, - int16_t *rho01, - int32_t length); - -/** \brief This function perform LLR computation for dual-stream (QPSK/64QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr128p pointer to pointer to symbol in dlsch_llr*/ -int32_t dlsch_qpsk_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) - int32_t **rho_i, - int16_t *dlsch_llr, - uint8_t symbol, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint16_t pbch_pss_sss_adj, - int16_t **llr128p); - - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 16QAM/QPSK reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam16_qpsk(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *stream0_out, - short *rho01, - int length); -/** \brief This function perform LLR computation for dual-stream (16QAM/QPSK) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int dlsch_16qam_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, //|h_0|^2*(2/sqrt{10}) - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - short **llr16p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 16QAM/16QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam16_qam16(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *ch_mag_i, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function perform LLR computation for dual-stream (16QAM/16QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int dlsch_16qam_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, //|h_0|^2*(2/sqrt{10}) - int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - short **llr16p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 16QAM/64QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam16_qam64(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *ch_mag_i, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function perform LLR computation for dual-stream (16QAM/64QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int dlsch_16qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, //|h_0|^2*(2/sqrt{10}) - int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - short **llr16p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/64QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam64_qpsk(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function perform LLR computation for dual-stream (64QAM/64QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int dlsch_64qam_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - short **llr16p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/16QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam64_qam16(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *ch_mag_i, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/16QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam64_qam16_avx2(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *ch_mag_i, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function perform LLR computation for dual-stream (64QAM/16QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int dlsch_64qam_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, - int **dl_ch_mag_i, - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - short **llr16p); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/64QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam64_qam64(short *stream0_in, - short *stream1_in, - short *ch_mag, - short *ch_mag_i, - short *stream0_out, - short *rho01, - int length); - -/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/64QAM reception. - @param stream0_in Input from channel compensated (MR combined) stream 0 - @param stream1_in Input from channel compensated (MR combined) stream 1 - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param stream0_out Output from LLR unit for stream0 - @param rho01 Cross-correlation between channels (MR combined) - @param length in complex channel outputs*/ -void qam64_qam64_avx2(int32_t *stream0_in, - int32_t *stream1_in, - int32_t *ch_mag, - int32_t *ch_mag_i, - int16_t *stream0_out, - int32_t *rho01, - int length); - -/** \brief This function perform LLR computation for dual-stream (64QAM/64QAM) transmission. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param ch_mag Input from scaled channel magnitude square of h0'*g0 - @param ch_mag_i Input from scaled channel magnitude square of h0'*g1 - @param rho_i Correlation between channel of signal and inteference - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag flag to indicate this is the first symbol of the dlsch - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr16p pointer to pointer to symbol in dlsch_llr*/ -int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **dl_ch_mag, - int **dl_ch_mag_i, - int **rho_i, - short *dlsch_llr, - unsigned char symbol, - unsigned char first_symbol_flag, - unsigned short nb_rb, - uint16_t pbch_pss_sss_adjust, - //short **llr16p, - uint32_t llr_offset); - - -/** \brief This function generates log-likelihood ratios (decoder input) for single-stream QPSK received waveforms. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dlsch_llr llr output - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS - @param llr128p pointer to pointer to symbol in dlsch_llr - @param beamforming_mode beamforming mode -*/ -int32_t dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int16_t *dlsch_llr, - uint8_t symbol, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint16_t pbch_pss_sss_adj, - //int16_t **llr128p, - uint8_t beamforming_mode); - -/** - \brief This function generates log-likelihood ratios (decoder input) for single-stream 16QAM received waveforms - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dlsch_llr llr output - @param dl_ch_mag Squared-magnitude of channel in each resource element position corresponding to allocation and weighted for mid-point in 16QAM constellation - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adjust Adjustment factor in RE for PBCH/PSS/SSS allocations - @param llr128p pointer to pointer to symbol in dlsch_llr - @param beamforming_mode beamforming mode -*/ - -int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int32_t **sic_buffer, - int **rho_i, - short *dlsch_llr, - uint8_t num_pdcch_symbols, - uint16_t nb_rb, - uint8_t subframe, - uint16_t mod_order_0, - uint32_t rb_alloc); - -void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int16_t *dlsch_llr, - int32_t **dl_ch_mag, - uint8_t symbol, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint16_t pbch_pss_sss_adjust, - int16_t **llr128p, - uint8_t beamforming_mode); -/** - \brief This function generates log-likelihood ratios (decoder input) for single-stream 16QAM received waveforms - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dlsch_llr llr output - @param dl_ch_mag Squared-magnitude of channel in each resource element position corresponding to allocation, weighted by first mid-point of 64-QAM constellation - @param dl_ch_magb Squared-magnitude of channel in each resource element position corresponding to allocation, weighted by second mid-point of 64-QAM constellation - @param symbol OFDM symbol index in sub-frame - @param first_symbol_flag - @param nb_rb number of RBs for this allocation - @param pbch_pss_sss_adjust PBCH/PSS/SSS RE adjustment (in REs) - @param beamforming_mode beamforming mode -*/ -void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **sic_buffer, //Q15 - int32_t **rho_i, - int16_t *dlsch_llr, - uint8_t num_pdcch_symbols, - int32_t **dl_ch_mag, - uint16_t nb_rb, - uint8_t subframe, - uint16_t mod_order_0, - uint32_t rb_alloc); - -void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **sic_buffer, //Q15 - int32_t **rho_i, - int16_t *dlsch_llr, - uint8_t num_pdcch_symbols, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint16_t nb_rb, - uint8_t subframe, - uint16_t mod_order_0, - uint32_t rb_alloc); - - -void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int16_t *dlsch_llr, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint8_t first_symbol_flag, - uint16_t nb_rb, - uint16_t pbch_pss_sss_adjust, - //int16_t **llr_save, - uint32_t llr_offset, - uint8_t beamforming_mode); - - -/** \fn dlsch_siso(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - uint8_t l, - uint16_t nb_rb) - \brief This function does the first stage of llr computation for SISO, by just extracting the pilots, PBCH and primary/secondary synchronization sequences. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param l symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ - -void dlsch_siso(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - uint8_t l, - uint16_t nb_rb); - -/** \fn dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb) - \brief This function does Alamouti combining on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary synchronization signals. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ -void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb); - -/** \fn dlsch_antcyc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb) - \brief This function does antenna selection (based on antenna cycling pattern) on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary synchronization signals. Note that this is not LTE, it is just included for comparison purposes. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ -void dlsch_antcyc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb); - -/** \fn dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho, - int32_t **rho_i, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb, - uint8_t dual_stream_UE) - - \brief This function does maximal-ratio combining for dual-antenna receivers. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param rho Cross correlation between spatial channels - @param rho_i Cross correlation between signal and inteference channels - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation - @param dual_stream_UE Flag to indicate dual-stream detection -*/ -void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho, - int32_t **rho_i, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - int32_t **dl_ch_mag_i, - int32_t **dl_ch_magb_i, - uint8_t symbol, - uint16_t nb_rb, - uint8_t dual_stream_UE); - -void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *lte_ue_pdsch_vars, - int harq_pid, - int round, - unsigned char symbol, - unsigned short nb_rb, - unsigned char dual_stream_UE); - -/** \fn dlsch_extract_rbs_single(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - LTE_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for single antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_ch_estimates Channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_ch_estimates_ext Channel estimates for RBs in this allocation - @param pmi subband Precoding matrix indicator - @param pmi_ext Extracted PMI for chosen RBs - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe number - @param vrb_type Flag to indicate distributed VRB type - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -uint16_t dlsch_extract_rbs_single(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms); - -/** \fn dlsch_extract_rbs_dual(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - LTE_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for dual antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_ch_estimates Channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_ch_estimates_ext Channel estimates for RBs in this allocation - @param pmi subband Precoding matrix indicator - @param pmi_ext Extracted PMI for chosen RBs - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe index - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -uint16_t dlsch_extract_rbs_dual(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms, - MIMO_mode_t mimo_mode); - -/** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF, - int32_t **dl_bf_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_bf_ch_estimates_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for single antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_bf_ch_estimates Beamforming channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_bf_ch_estimates_ext Beamforming channel estimates for RBs in this allocation - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe number - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, - int32_t **dl_bf_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_bf_ch_estimates_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms); - -/** \brief This function performs channel compensation (matched filtering) on the received RBs for this allocation. In addition, it computes the squared-magnitude of the channel with weightings for 16QAM/64QAM detection as well as dual-stream detection (cross-correlation) - @param rxdataF_ext Frequency-domain received signal in RBs to be demodulated - @param dl_ch_estimates_ext Frequency-domain channel estimates in RBs to be demodulated - @param dl_ch_mag First Channel magnitudes (16QAM/64QAM) - @param dl_ch_magb Second weighted Channel magnitudes (64QAM) - @param rxdataF_comp Compensated received waveform - @param rho Cross-correlation between two spatial channels on each RX antenna - @param frame_parms Pointer to frame descriptor - @param symbol Symbol on which to operate - @param first_symbol_flag set to 1 on first DLSCH symbol - @param mod_order Modulation order of allocation - @param nb_rb Number of RBs in allocation - @param output_shift Rescaling for compensated output (should be energy-normalizing) - @param phy_measurements Pointer to UE PHY measurements -*/ -void dlsch_channel_compensation(int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - int32_t **rxdataF_comp, - int32_t **rho, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t symbol, - uint8_t first_symbol_flag, - uint8_t mod_order, - uint16_t nb_rb, - uint8_t output_shift, - PHY_MEASUREMENTS *phy_measurements); - -void dlsch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned short nb_rb, - int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char output_shift); - -void dlsch_dual_stream_correlationTM34(LTE_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned short nb_rb, - int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char output_shift0, - unsigned char output_shift1); -//This function is used to compute multiplications in Hhermitian * H matrix -void conjch0_mult_ch1(int *ch0, - int *ch1, - int32_t *ch0conj_ch1, - unsigned short nb_rb, - unsigned char output_shift0); - -void construct_HhH_elements(int *ch0conj_ch0, - int *ch1conj_ch1, - int *ch2conj_ch2, - int *ch3conj_ch3, - int *ch0conj_ch1, - int *ch1conj_ch0, - int *ch2conj_ch3, - int *ch3conj_ch2, - int32_t *after_mf_00, - int32_t *after_mf_01, - int32_t *after_mf_10, - int32_t *after_mf_11, - unsigned short nb_rb); - -void squared_matrix_element(int32_t *Hh_h_00, - int32_t *Hh_h_00_sq, - unsigned short nb_rb); - -void dlsch_channel_level_TM34_meas(int *ch00, - int *ch01, - int *ch10, - int *ch11, - int *avg_0, - int *avg_1, - unsigned short nb_rb); - -void det_HhH(int32_t *after_mf_00, - int32_t *after_mf_01, - int32_t *after_mf_10, - int32_t *after_mf_11, - int32_t *det_fin_128, - unsigned short nb_rb); - -void numer(int32_t *Hh_h_00_sq, - int32_t *Hh_h_01_sq, - int32_t *Hh_h_10_sq, - int32_t *Hh_h_11_sq, - int32_t *num_fin, - unsigned short nb_rb); - -uint8_t rank_estimation_tm3_tm4(int *dl_ch_estimates_00, - int *dl_ch_estimates_01, - int *dl_ch_estimates_10, - int *dl_ch_estimates_11, - unsigned short nb_rb); - -void dlsch_channel_compensation_TM56(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - unsigned char *pmi_ext, - LTE_DL_FRAME_PARMS *frame_parms, - PHY_MEASUREMENTS *phy_measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order, - unsigned short nb_rb, - unsigned char output_shift, - unsigned char dl_power_off); - - -void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *lte_ue_pdsch_vars, - PHY_MEASUREMENTS *phy_measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order0, - unsigned char mod_order1, - int harq_pid, - int round, - MIMO_mode_t mimo_mode, - unsigned short nb_rb, - unsigned char output_shift0, - unsigned char output_shift1); - - -/** \brief This function computes the average channel level over all allocated RBs and antennas (TX/RX) in order to compute output shift for compensated signal - @param dl_ch_estimates_ext Channel estimates in allocated RBs - @param frame_parms Pointer to frame descriptor - @param avg Pointer to average signal strength - @param pilots_flag Flag to indicate pilots in symbol - @param nb_rb Number of allocated RBs -*/ -void dlsch_channel_level(int32_t **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t *avg, - uint8_t pilots_flag, - uint16_t nb_rb); - - -void dlsch_channel_level_TM34(int **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - unsigned char *pmi_ext, - int *avg_0, - int *avg_1, - uint8_t symbol, - unsigned short nb_rb, - MIMO_mode_t mimo_mode); - - -void dlsch_channel_level_TM56(int32_t **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - unsigned char *pmi_ext, - int32_t *avg, - uint8_t symbol_mod, - uint16_t nb_rb); - -void dlsch_channel_level_TM7(int32_t **dl_bf_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t *avg, - uint8_t pilots_flag, - uint16_t nb_rb); - -void dlsch_scale_channel(int32_t **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_DLSCH_t **dlsch_ue, - uint8_t symbol_mod, - uint16_t nb_rb); - -/** \brief This is the top-level entry point for DLSCH decoding in UE. It should be replicated on several - threads (on multi-core machines) corresponding to different HARQ processes. The routine first - computes the segmentation information, followed by rate dematching and sub-block deinterleaving the of the - received LLRs computed by dlsch_demodulation for each transport block segment. It then calls the - turbo-decoding algorithm for each segment and stops after either after unsuccesful decoding of at least - one segment or correct decoding of all segments. Only the segment CRCs are check for the moment, the - overall CRC is ignored. Finally transport block reassembly is performed. - @param phy_vars_ue Pointer to ue variables - @param dlsch_llr Pointer to LLR values computed by dlsch_demodulation - @param lte_frame_parms Pointer to frame descriptor - @param dlsch Pointer to DLSCH descriptor - @param frame Frame number - @param subframe Subframe number - @param num_pdcch_symbols Number of PDCCH symbols - @param is_crnti indicates if PDSCH belongs to a CRNTI (necessary for parallelizing decoding threads) - @param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used - @returns 0 on success, 1 on unsuccessful decoding -*/ -uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, - int16_t *dlsch_llr, - LTE_DL_FRAME_PARMS *lte_frame_parms, - LTE_UE_DLSCH_t *dlsch, - LTE_DL_UE_HARQ_t *harq_process, - uint32_t frame, - uint8_t subframe, - uint8_t harq_pid, - uint8_t is_crnti, - uint8_t llr8_flag); - -uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue, - uint8_t subframe, - PDSCH_t dlsch_id, - uint8_t eNB_id); - -/** \brief This function is the top-level entry point to PDSCH demodulation, after frequency-domain transformation and channel estimation. It performs - - RB extraction (signal and channel estimates) - - channel compensation (matched filtering) - - RE extraction (pilot, PBCH, synch. signals) - - antenna combining (MRC, Alamouti, cycling) - - LLR computation - This function supports TM1, 2, 3, 5, and 6. - @param phy_vars_ue Pointer to PHY variables - @param type Type of PDSCH (SI_PDSCH,RA_PDSCH,PDSCH,PMCH) - @param eNB_id eNb index (Nid1) 0,1,2 - @param eNB_id_i Interfering eNB index (Nid1) 0,1,2, or 3 in case of MU-MIMO IC receiver - @param subframe Subframe number - @param symbol Symbol on which to act (within sub-frame) - @param first_symbol_flag set to 1 on first DLSCH symbol - @param rx_type. rx_type=RX_IC_single_stream will enable interference cancellation of a second stream when decoding the first stream. In case of TM1, 2, 5, and this can cancel interference from a neighbouring cell given by eNB_id_i. In case of TM5, eNB_id_i should be set to n_connected_eNB to perform multi-user interference cancellation. In case of TM3, eNB_id_i should be set to eNB_id to perform co-channel interference cancellation; this option should be used together with an interference cancellation step [...]. In case of TM3, if rx_type=RX_IC_dual_stream, both streams will be decoded by applying the IC single stream receiver twice. - @param i_mod Modulation order of the interfering stream -*/ -int32_t rx_pdsch(PHY_VARS_UE *phy_vars_ue, - PDSCH_t type, - uint8_t eNB_id, - uint8_t eNB_id_i, - uint32_t frame, - uint8_t subframe, - uint8_t symbol, - uint8_t first_symbol_flag, - RX_type_t rx_type, - uint8_t i_mod, - uint8_t harq_pid); - -int32_t rx_pdcch(PHY_VARS_UE *ue, - uint32_t frame, - uint8_t subframe, - uint8_t eNB_id, - MIMO_mode_t mimo_mode, - uint32_t high_speed_flag, - uint8_t is_secondary_ue); - -/*! \brief Extract PSS and SSS resource elements - @param phy_vars_ue Pointer to UE variables - @param[out] pss_ext contain the PSS signals after the extraction - @param[out] sss_ext contain the SSS signals after the extraction - @returns 0 on success -*/ -int pss_sss_extract(PHY_VARS_UE *phy_vars_ue, - int32_t pss_ext[4][72], - int32_t sss_ext[4][72], - uint8_t subframe); - -/*! \brief Extract only PSS resource elements - @param phy_vars_ue Pointer to UE variables - @param[out] pss_ext contain the PSS signals after the extraction - @returns 0 on success -*/ -int pss_only_extract(PHY_VARS_UE *phy_vars_ue, - int32_t pss_ext[4][72], - uint8_t subframe); - -/*! \brief Extract only SSS resource elements - @param phy_vars_ue Pointer to UE variables - @param[out] sss_ext contain the SSS signals after the extraction - @returns 0 on success -*/ -int sss_only_extract(PHY_VARS_UE *phy_vars_ue, - int32_t sss_ext[4][72], - uint8_t subframe); - -/*! \brief Performs detection of SSS to find cell ID and other framing parameters (FDD/TDD, normal/extended prefix) - @param phy_vars_ue Pointer to UE variables - @param tot_metric Pointer to variable containing maximum metric under framing hypothesis (to be compared to other hypotheses - @param flip_max Pointer to variable indicating if start of frame is in second have of RX buffer (i.e. PSS/SSS is flipped) - @param phase_max Pointer to variable (0 ... 6) containing rought phase offset between PSS and SSS (can be used for carrier - frequency adjustment. 0 means -pi/3, 6 means pi/3. - @returns 0 on success -*/ -int rx_sss(PHY_VARS_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uint8_t *phase_max); - -/*! \brief receiver for the PBCH - \returns number of tx antennas or -1 if error -*/ -uint16_t rx_pbch(LTE_UE_COMMON *lte_ue_common_vars, - LTE_UE_PBCH *lte_ue_pbch_vars, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t eNB_id, - MIMO_mode_t mimo_mode, - uint32_t high_speed_flag, - uint8_t frame_mod4); - -uint16_t rx_pbch_emul(PHY_VARS_UE *phy_vars_ue, - uint8_t eNB_id, - uint8_t pbch_phase); - -/*! \brief PBCH scrambling. Applies 36.211 PBCH scrambling procedure. - \param frame_parms Pointer to frame descriptor - \param coded_data Output of the coding and rate matching - \param length Length of the sequence*/ -void pbch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t* coded_data, - uint32_t length); - -/*! \brief PBCH unscrambling - This is similar to pbch_scrabling with the difference that inputs are signed s16s (llr values) and instead of flipping bits we change signs. - \param frame_parms Pointer to frame descriptor - \param llr Output of the demodulator - \param length Length of the sequence - \param frame_mod4 Frame number modulo 4*/ -void pbch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, - int8_t* llr, - uint32_t length, - uint8_t frame_mod4); - -/*! \brief DCI Encoding. This routine codes an arbitrary DCI PDU after appending the 8-bit 3GPP CRC. It then applied sub-block interleaving and rate matching. - \param a Pointer to DCI PDU (coded in bytes) - \param A Length of DCI PDU in bits - \param E Length of DCI PDU in coded bits - \param e Pointer to sequence - \param rnti RNTI for CRC scrambling*/ -void dci_encoding(uint8_t *a, - uint8_t A, - uint16_t E, - uint8_t *e, - uint16_t rnti); - -/*! \brief Top-level DCI entry point. This routine codes an set of DCI PDUs and performs PDCCH modulation, interleaving and mapping. - \param num_dci Number of pdcch symbols - \param num_dci Number of DCI pdus to encode - \param dci_alloc Allocation vectors for each DCI pdu - \param n_rnti n_RNTI (see ) - \param amp Amplitude of QPSK symbols - \param frame_parms Pointer to DL Frame parameter structure - \param txdataF Pointer to tx signal buffers - \param sub_frame_offset subframe offset in frame - @returns Number of PDCCH symbols -*/ - -uint8_t generate_dci_top(uint8_t num_pdcch_symbols, - uint8_t num_dci, - DCI_ALLOC_t *dci_alloc, - uint32_t n_rnti, - int16_t amp, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t **txdataF, - uint32_t sub_frame_offset); - -uint8_t generate_dci_top_emul(PHY_VARS_eNB *phy_vars_eNB, - int num_dci, - DCI_ALLOC_t *dci_alloc, - uint8_t subframe); - - -void generate_64qam_table(void); -void generate_16qam_table(void); - -uint16_t extract_crc(uint8_t *dci,uint8_t DCI_LENGTH); - -/*! \brief LLR from two streams. This function takes two streams (qpsk modulated) and calculates the LLR, considering one stream as interference. - \param stream0_in pointer to first stream0 - \param stream1_in pointer to first stream1 - \param stream0_out pointer to output stream - \param rho01 pointer to correlation matrix - \param length*/ -void qpsk_qpsk_TM3456(short *stream0_in, - short *stream1_in, - short *stream0_out, - short *rho01, - int length - ); - -/** \brief Attempt decoding of a particular DCI with given length and format. - @param DCI_LENGTH length of DCI in bits - @param DCI_FMT Format of DCI - @param e e-sequence (soft bits) - @param decoded_output Output of Viterbi decoder -*/ -void dci_decoding(uint8_t DCI_LENGTH, - uint8_t DCI_FMT, - int8_t *e, - uint8_t *decoded_output); - -/** \brief Do 36.213 DCI decoding procedure by searching different RNTI options and aggregation levels. Currently does - not employ the complexity reducing procedure based on RNTI. - @param phy_vars_ue UE variables - @param dci_alloc Pointer to DCI_ALLOC_t array to store results for DLSCH/ULSCH programming - @param do_common If 1 perform search in common search-space else ue-specific search-space - @param eNB_id eNB Index on which to act - @param subframe Index of subframe - @returns bitmap of occupied CCE positions (i.e. those detected) -*/ -uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, - DCI_ALLOC_t *dci_alloc, - int do_common, - int16_t eNB_id, - uint8_t subframe); - -uint16_t dci_CRNTI_decoding_procedure(PHY_VARS_UE *ue, - DCI_ALLOC_t *dci_alloc, - uint8_t DCIFormat, - uint8_t agregationLevel, - int16_t eNB_id, - uint8_t subframe); - -uint16_t dci_decoding_procedure_emul(LTE_UE_PDCCH **lte_ue_pdcch_vars, - uint8_t num_ue_spec_dci, - uint8_t num_common_dci, - DCI_ALLOC_t *dci_alloc_tx, - DCI_ALLOC_t *dci_alloc_rx, - int16_t eNB_id); - -/** \brief Compute Q (modulation order) based on I_MCS PDSCH. Implements table 7.1.7.1-1 from 36.213. - @param I_MCS */ -uint8_t get_Qm(uint8_t I_MCS); - -/** \brief Compute Q (modulation order) based on I_MCS for PUSCH. Implements table 8.6.1-1 from 36.213. - @param I_MCS */ -uint8_t get_Qm_ul(uint8_t I_MCS); - -/** \brief Compute I_TBS (transport-block size) based on I_MCS for PDSCH. Implements table 7.1.7.1-1 from 36.213. - @param I_MCS */ -uint8_t get_I_TBS(uint8_t I_MCS); - -/** \brief Compute I_TBS (transport-block size) based on I_MCS for PUSCH. Implements table 8.6.1-1 from 36.213. - @param I_MCS */ -unsigned char get_I_TBS_UL(unsigned char I_MCS); - -/** \brief Compute Q (modulation order) based on downlink I_MCS. Implements table 7.1.7.1-1 from 36.213. - @param I_MCS - @param nb_rb - @return Transport block size */ -uint32_t get_TBS_DL(uint8_t mcs, uint16_t nb_rb); - -/** \brief Compute Q (modulation order) based on uplink I_MCS. Implements table 7.1.7.1-1 from 36.213. - @param I_MCS - @param nb_rb - @return Transport block size */ -uint32_t get_TBS_UL(uint8_t mcs, uint16_t nb_rb); - -/* \brief Return bit-map of resource allocation for a given DCI rballoc (RIV format) and vrb type - @param N_RB_DL number of PRB on DL - @param indicator for even/odd slot - @param vrb vrb index - @param Ngap Gap indicator -*/ -uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap); - -/* \brief Return prb for a given vrb index - @param vrb_type VRB type (0=localized,1=distributed) - @param rb_alloc_dci rballoc field from DCI -*/ -uint32_t get_rballoc(vrb_t vrb_type,uint16_t rb_alloc_dci); - - -/* \brief Return bit-map of resource allocation for a given DCI rballoc (RIV format) and vrb type - @returns Transmission mode (1-7) -*/ -uint8_t get_transmission_mode(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti); - - -/* \brief - @param ra_header Header of resource allocation (0,1) (See sections 7.1.6.1/7.1.6.2 of 36.213 Rel8.6) - @param rb_alloc Bitmap allocation from DCI (format 1,2) - @returns number of physical resource blocks -*/ -uint32_t conv_nprb(uint8_t ra_header,uint32_t rb_alloc,int N_RB_DL); - -int get_G(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint8_t mod_order,uint8_t Nl,uint8_t num_pdcch_symbols,int frame,uint8_t subframe, uint8_t beamforming_mode); - -int adjust_G(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_order,uint8_t subframe); -int adjust_G2(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_order,uint8_t subframe,uint8_t symbol); - - -#ifndef modOrder -#define modOrder(I_MCS,I_TBS) ((I_MCS-I_TBS)*2+2) // Find modulation order from I_TBS and I_MCS -#endif - -/** \fn uint8_t I_TBS2I_MCS(uint8_t I_TBS); - \brief This function maps I_tbs to I_mcs according to Table 7.1.7.1-1 in 3GPP TS 36.213 V8.6.0. Where there is two supported modulation orders for the same I_TBS then either high or low modulation is chosen by changing the equality of the two first comparisons in the if-else statement. - \param I_TBS Index of Transport Block Size - \return I_MCS given I_TBS -*/ -uint8_t I_TBS2I_MCS(uint8_t I_TBS); - -/** \fn uint8_t SE2I_TBS(float SE, - uint8_t N_PRB, - uint8_t symbPerRB); - \brief This function maps a requested throughput in number of bits to I_tbs. The throughput is calculated as a function of modulation order, RB allocation and number of symbols per RB. The mapping orginates in the "Transport block size table" (Table 7.1.7.2.1-1 in 3GPP TS 36.213 V8.6.0) - \param SE Spectral Efficiency (before casting to integer, multiply by 1024, remember to divide result by 1024!) - \param N_PRB Number of PhysicalResourceBlocks allocated \sa lte_frame_parms->N_RB_DL - \param symbPerRB Number of symbols per resource block allocated to this channel - \return I_TBS given an SE and an N_PRB -*/ -uint8_t SE2I_TBS(float SE, - uint8_t N_PRB, - uint8_t symbPerRB); -/** \brief This function generates the sounding reference symbol (SRS) for the uplink according to 36.211 v8.6.0. If IFFT_FPGA is defined, the SRS is quantized to a QPSK sequence. - @param frame_parms LTE DL Frame Parameters - @param soundingrs_ul_config_dedicated Dynamic configuration from RRC during Connection Establishment - @param txdataF pointer to the frequency domain TX signal - @returns 0 on success*/ -int generate_srs(LTE_DL_FRAME_PARMS *frame_parms, - SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated, - int *txdataF, - int16_t amp, - uint32_t subframe); - -int32_t generate_srs_tx_emul(PHY_VARS_UE *phy_vars_ue, - uint8_t subframe); - -/*! - \brief This function is similar to generate_srs_tx but generates a conjugate sequence for channel estimation. If IFFT_FPGA is defined, the SRS is quantized to a QPSK sequence. - @param phy_vars_ue Pointer to PHY_VARS structure - @param eNB_id Index of destination eNB for this SRS - @param amp Linear amplitude of SRS - @param subframe Index of subframe on which to act - @returns 0 on success, -1 on error with message -*/ - -int32_t generate_srs_tx(PHY_VARS_UE *phy_vars_ue, - uint8_t eNB_id, - int16_t amp, - uint32_t subframe); - -/*! - \brief This function generates the downlink reference signal for the PUSCH according to 36.211 v8.6.0. The DRS occuies the RS defined by rb_alloc and the symbols 2 and 8 for extended CP and 3 and 10 for normal CP. -*/ - -int32_t generate_drs_pusch(PHY_VARS_UE *phy_vars_ue, - UE_rxtx_proc_t *proc, - uint8_t eNB_id, - int16_t amp, - uint32_t subframe, - uint32_t first_rb, - uint32_t nb_rb, - uint8_t ant); - -/*! - \brief This function initializes the Group Hopping, Sequence Hopping and nPRS sequences for PUCCH/PUSCH according to 36.211 v8.6.0. It should be called after configuration of UE (reception of SIB2/3) and initial configuration of eNB (or after reconfiguration of cell-specific parameters). - @param frame_parms Pointer to a LTE_DL_FRAME_PARMS structure (eNB or UE)*/ -void init_ul_hopping(LTE_DL_FRAME_PARMS *frame_parms); - - -/*! - \brief This function implements the initialization of paging parameters for UE (See Section 7, 36.304).It must be called after setting IMSImod1024 during UE startup and after receiving SIB2 - @param ue Pointer to UE context - @param defaultPagingCycle T from 36.304 (0=32,1=64,2=128,3=256) - @param nB nB from 36.304 (0=4T,1=2T,2=T,3=T/2,4=T/4,5=T/8,6=T/16,7=T/32*/ -int init_ue_paging_info(PHY_VARS_UE *ue, long defaultPagingCycle, long nB); - -int32_t compareints (const void * a, const void * b); - - -void ulsch_modulation(int32_t **txdataF, - int16_t amp, - frame_t frame, - uint32_t subframe, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_ULSCH_t *ulsch); - - -void ulsch_extract_rbs_single(int32_t **rxdataF, - int32_t **rxdataF_ext, - uint32_t first_rb, - uint32_t nb_rb, - uint8_t l, - uint8_t Ns, - LTE_DL_FRAME_PARMS *frame_parms); - -uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe); -uint8_t subframe2harq_pid_eNBrx(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); - -int generate_ue_dlsch_params_from_dci(int frame, - uint8_t subframe, - void *dci_pdu, - rnti_t rnti, - DCI_format_t dci_format, - LTE_UE_PDCCH *pdcch_vars, - LTE_UE_PDSCH *pdsch_vars, - LTE_UE_DLSCH_t **dlsch, - LTE_DL_FRAME_PARMS *frame_parms, - PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, - uint16_t si_rnti, - uint16_t ra_rnti, - uint16_t p_rnti, - uint8_t beamforming_mode, - uint16_t tc_rnti); - -void fill_dci_and_dlsch(PHY_VARS_eNB *eNB, - int frame, - int subframe, - eNB_rxtx_proc_t *proc, - DCI_ALLOC_t *dci_alloc, - nfapi_dl_config_dci_dl_pdu *pdu); - -void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *dci_alloc,nfapi_dl_config_mpdcch_pdu *pdu); - -void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc, - nfapi_hi_dci0_dci_pdu *pdu); - -void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe); - -int32_t generate_eNB_dlsch_params_from_dci(int frame, - uint8_t subframe, - void *dci_pdu, - rnti_t rnti, - DCI_format_t dci_format, - LTE_eNB_DLSCH_t **dlsch_eNB, - LTE_DL_FRAME_PARMS *frame_parms, - PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, - uint16_t si_rnti, - uint16_t ra_rnti, - uint16_t p_rnti, - uint16_t DL_pmi_single, - uint8_t beamforming_mode); - -int generate_eNB_ulsch_params_from_rar(PHY_VARS_eNB *eNB, - unsigned char *rar_pdu, - uint32_t frame, - unsigned char subframe); - -int generate_ue_ulsch_params_from_dci(void *dci_pdu, - rnti_t rnti, - uint8_t subframe, - DCI_format_t dci_format, - PHY_VARS_UE *phy_vars_ue, - UE_rxtx_proc_t *proc, - uint16_t si_rnti, - uint16_t ra_rnti, - uint16_t p_rnti, - uint16_t cba_rnti, - uint8_t eNB_id, - uint8_t use_srs); - -int32_t generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue, - UE_rxtx_proc_t *proc, - uint8_t eNB_id); -double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, - uint8_t eNB_id, - uint8_t subframe); - -uint8_t sinr2cqi(double sinr,uint8_t trans_mode); - -int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB, - eNB_rxtx_proc_t *proc, - void *dci_pdu, - rnti_t rnti, - DCI_format_t dci_format, - uint8_t UE_id, - uint16_t si_rnti, - uint16_t ra_rnti, - uint16_t p_rnti, - uint16_t cba_rnti, - uint8_t use_srs); - - -void dump_ulsch(PHY_VARS_eNB *phy_vars_eNB,int frame, int subframe, uint8_t UE_id,int round); - -int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci); - -int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, UE_rxtx_proc_t *proc, char* buffer, int length, runmode_t mode, int input_level_dBm); -int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length); - - - -void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms); - -void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t subframe, - uint8_t *b, - uint8_t *bt); - -void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t subframe, - int16_t *d); - -void generate_pcfich(uint8_t num_pdcch_symbols, - int16_t amp, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t **txdataF, - uint8_t subframe); - -uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t subframe, - LTE_UE_PDCCH *lte_ue_pdcch_vars, - MIMO_mode_t mimo_mode); - -void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms); - - -void init_transport_channels(uint8_t); - -void generate_RIV_tables(void); - -/*! - \brief This function performs the initial cell search procedure - PSS detection, SSS detection and PBCH detection. At the - end, the basic frame parameters are known (Frame configuration - TDD/FDD and cyclic prefix length, - N_RB_DL, PHICH_CONFIG and Nid_cell) and the UE can begin decoding PDCCH and DLSCH SI to retrieve the rest. Once these - parameters are know, the routine calls some basic initialization routines (cell-specific reference signals, etc.) - @param phy_vars_ue Pointer to UE variables -*/ -int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode); - -void rx_ulsch(PHY_VARS_eNB *eNB, - eNB_rxtx_proc_t *proc, - uint8_t UE_id); - - -void rx_ulsch_emul(PHY_VARS_eNB *eNB, - eNB_rxtx_proc_t *proc, - uint8_t UE_index); - -/*! - \brief Encoding of PUSCH/ACK/RI/ACK from 36-212. - @param a Pointer to ulsch SDU - @param frame_parms Pointer to Frame parameters - @param ulsch Pointer to ulsch descriptor - @param harq_pid HARQ process ID - @param tmode Transmission mode (1-7) - @param control_only_flag Generate PUSCH with control information only - @param Nbundled Parameter for ACK/NAK bundling (36.213 Section 7.3) -*/ -uint32_t ulsch_encoding(uint8_t *a, - PHY_VARS_UE *phy_vars_ue, - uint8_t harq_pid, - uint8_t eNB_id, - uint8_t subframe_rx, - uint8_t tmode, - uint8_t control_only_flag, - uint8_t Nbundled); - -/*! - \brief Encoding of PUSCH/ACK/RI/ACK from 36-212 for emulation - @param ulsch_buffer Pointer to ulsch SDU - @param phy_vars_ue Pointer to UE top-level descriptor - @param eNB_id ID of eNB receiving this PUSCH - @param harq_pid HARQ process ID - @param control_only_flag Generate PUSCH with control information only -*/ -int32_t ulsch_encoding_emul(uint8_t *ulsch_buffer, - PHY_VARS_UE *phy_vars_ue, - uint8_t eNB_id, - uint8_t subframe_rx, - uint8_t harq_pid, - uint8_t control_only_flag); - -/*! - \brief Decoding of PUSCH/ACK/RI/ACK from 36-212. - @param phy_vars_eNB Pointer to eNB top-level descriptor - @param proc Pointer to RXTX proc variables - @param UE_id ID of UE transmitting this PUSCH - @param subframe Index of subframe for PUSCH - @param control_only_flag Receive PUSCH with control information only - @param Nbundled Nbundled parameter for ACK/NAK scrambling from 36-212/36-213 - @param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used - @returns 0 on success -*/ -unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, - eNB_rxtx_proc_t *proc, - uint8_t UE_id, - uint8_t control_only_flag, - uint8_t Nbundled, - uint8_t llr8_flag); - -/*! - \brief Decoding of ULSCH data component from 36-212. This one spawns 1 worker thread in parallel,half of the segments in each thread. - @param phy_vars_eNB Pointer to eNB top-level descriptor - @param UE_id ID of UE transmitting this PUSCH - @param harq_pid HARQ process ID - @param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used - @returns 0 on success -*/ -int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB, - int UE_id, - int harq_pid, - int llr8_flag); - -/*! - \brief Decoding of ULSCH data component from 36-212. This one is single thread. - @param phy_vars_eNB Pointer to eNB top-level descriptor - @param UE_id ID of UE transmitting this PUSCH - @param harq_pid HARQ process ID - @param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used - @returns 0 on success -*/ -int ulsch_decoding_data(PHY_VARS_eNB *eNB, - int UE_id, - int harq_pid, - int llr8_flag); - -uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB, - eNB_rxtx_proc_t *proc, - uint8_t UE_index, - uint16_t *crnti); - -void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB, - eNB_rxtx_proc_t *proc, - int16_t amp); - -/* \brief This routine demodulates the PHICH and updates PUSCH/ULSCH parameters. - @param phy_vars_ue Pointer to UE variables - @param proc Pointer to RXN_TXNp4 proc - @param subframe Subframe of received PDCCH/PHICH - @param eNB_id Index of eNB -*/ - -void rx_phich(PHY_VARS_UE *phy_vars_ue, - UE_rxtx_proc_t *proc, - uint8_t subframe, - uint8_t eNB_id); - - -/** \brief This routine provides the relationship between a PHICH TXOp and its corresponding PUSCH subframe (Table 8.3.-1 from 36.213). - @param frame_parms Pointer to DL frame configuration parameters - @param subframe Subframe of received/transmitted PHICH - @returns subframe of PUSCH transmission -*/ -uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); - -/** \brief This routine provides the relationship between a PHICH TXOp and its corresponding PUSCH frame (Table 8.3.-1 from 36.213). - @param frame_parms Pointer to DL frame configuration parameters - @param frame Frame of received/transmitted PHICH - @param subframe Subframe of received/transmitted PHICH - @returns frame of PUSCH transmission -*/ -int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int subframe); - -void print_CQI(void *o,UCI_format_t uci_format,uint8_t eNB_id,int N_RB_DL); - -void extract_CQI(void *o,UCI_format_t uci_format,LTE_eNB_UE_stats *stats,uint8_t N_RB_DL, uint16_t * crnti, uint8_t * access_mode); - -void fill_CQI(LTE_UE_ULSCH_t *ulsch,PHY_MEASUREMENTS *meas,uint8_t eNB_id, uint8_t harq_pid,int N_RB_DL, rnti_t rnti, uint8_t trans_mode,double sinr_eff); - -void reset_cba_uci(void *o); - -/** \brief This routine computes the subband PMI bitmap based on measurements (0,1,2,3 for rank 0 and 0,1 for rank 1) in the format needed for UCI - @param meas pointer to measurements - @param eNB_id eNB_id - @param nb_subbands number of subbands - @returns subband PMI bitmap -*/ -uint16_t quantize_subband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id,int nb_subbands); - -int32_t pmi_convert_rank1_from_rank2(uint16_t pmi_alloc, int tpmi, int nb_rb); - -uint16_t quantize_subband_pmi2(PHY_MEASUREMENTS *meas,uint8_t eNB_id,uint8_t a_id,int nb_subbands); - -uint64_t pmi2hex_2Ar1(uint32_t pmi); - -uint64_t pmi2hex_2Ar2(uint32_t pmi); - -uint64_t cqi2hex(uint32_t cqi); - -uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs); - -/** \brief This routine expands a single (wideband) PMI to subband PMI bitmap similar to the one used in the UCI and in the dlsch_modulation routine - @param frame_parms Pointer to DL frame configuration parameters - @param wideband_pmi (0,1,2,3 for rank 0 and 0,1 for rank 1) - @param rank (0 or 1) - @returns subband PMI bitmap -*/ -uint32_t pmi_extend(LTE_DL_FRAME_PARMS *frame_parms,uint8_t wideband_pmi, uint8_t rank); - -/** \brief This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function - @param N_RB_DL number of resource blocks - @param mimo_mode - @param pmi_alloc subband PMI bitmap - @param rb resource block for which to extract PMI - @returns subband PMI -*/ -uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb); - -int get_nCCE_offset_l1(int *CCE_table, - const unsigned char L, - const int nCCE, - const int common_dci, - const unsigned short rnti, - const unsigned char subframe); - -uint16_t get_nCCE(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi); - -uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint8_t mi); - -uint8_t get_mi(LTE_DL_FRAME_PARMS *frame,uint8_t subframe); - -uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe); - -uint8_t get_num_pdcch_symbols(uint8_t num_dci,DCI_ALLOC_t *dci_alloc,LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); - -void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi); - -void pdcch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t subframe, - int8_t* llr, - uint32_t length); - -void pdcch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t subframe, - uint8_t *e, - uint32_t length); - -void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, - int mbsfn_flag, - LTE_eNB_DLSCH_t *dlsch, - int hard_pid, - int G, - uint8_t q, - uint16_t frame, - uint8_t Ns); - -void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, - int mbsfn_flag, - LTE_UE_DLSCH_t *dlsch, - int G, - int16_t* llr, - uint8_t q, - uint8_t Ns); - -void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7]); - -void generate_pucch1x(int32_t **txdataF, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t ncs_cell[20][7], - PUCCH_FMT_t fmt, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, - uint16_t n1_pucch, - uint8_t shortened_format, - uint8_t *payload, - int16_t amp, - uint8_t subframe); - -void generate_pucch2x(int32_t **txdataF, - LTE_DL_FRAME_PARMS *fp, - uint8_t ncs_cell[20][7], - PUCCH_FMT_t fmt, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, - uint16_t n2_pucch, - uint8_t *payload, - int A, - int B2, - int16_t amp, - uint8_t subframe, - uint16_t rnti); - -void generate_pucch3x(int32_t **txdataF, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t ncs_cell[20][7], - PUCCH_FMT_t fmt, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, - uint16_t n3_pucch, - uint8_t shortened_format, - uint8_t *payload, - int16_t amp, - uint8_t subframe, - uint16_t rnti); - -void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue, - UE_rxtx_proc_t *proc, - PUCCH_FMT_t format, - uint8_t ncs1, - uint8_t *pucch_ack_payload, - uint8_t sr); - - - -uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB, - PUCCH_FMT_t fmt, - uint8_t UE_id, - uint16_t n1_pucch, - uint16_t n2_pucch, - uint8_t shortened_format, - uint8_t *payload, - int frame, - uint8_t subframe, - uint8_t pucch1_thres); - -int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB, - eNB_rxtx_proc_t *proc, - uint8_t UE_index, - PUCCH_FMT_t fmt, - uint8_t n1_pucch_sel, - uint8_t *payload); - - -void init_ulsch_power_LUT(void); - -/*! - \brief Check for PRACH TXop in subframe - @param frame_parms Pointer to LTE_DL_FRAME_PARMS - @param frame frame index to check - @param subframe subframe index to check - @returns 0 on success -*/ -int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame, uint8_t subframe); - -/*! - \brief Generate PRACH waveform - @param phy_vars_ue Pointer to ue top-level descriptor - @param eNB_id Index of destination eNB - @param subframe subframe index to operate on - @param index of preamble (0-63) - @param Nf System frame number - @returns 0 on success - -*/ -int32_t generate_prach(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,uint16_t Nf); - -/*! - \brief Process PRACH waveform - @param phy_vars_eNB Pointer to eNB top-level descriptor. If NULL, then this is an RRU - @param ru Pointer to RU top-level descriptor. If NULL, then this is an eNB and we make use of the RU_list - @param max_preamble most likely preamble - @param max_preamble_energy Estimated Energy of most likely preamble - @param max_preamble_delay Estimated Delay of most likely preamble - @param Nf System frame number - @param tdd_mapindex Index of PRACH resource in Table 5.7.1-4 (TDD) - @param br_flag indicator to act on eMTC PRACH - @returns 0 on success - -*/ -void rx_prach(PHY_VARS_eNB *phy_vars_eNB,RU_t *ru, - uint16_t *max_preamble, - uint16_t *max_preamble_energy, - uint16_t *max_preamble_delay, - uint16_t Nf, uint8_t tdd_mapindex -#ifdef Rel14 - , - uint8_t br_flag -#endif - ); -/*! - \brief Helper for MAC, returns number of available PRACH in TDD for a particular configuration index - @param frame_parms Pointer to LTE_DL_FRAME_PARMS structure - @returns 0-5 depending on number of available prach -*/ -uint8_t get_num_prach_tdd(module_id_t Mod_id); - -/*! - \brief Return the PRACH format as a function of the Configuration Index and Frame type. - @param prach_ConfigIndex PRACH Configuration Index - @param frame_type 0-FDD, 1-TDD - @returns 0-1 accordingly -*/ -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); - -/*! - \brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index - @param frame_parms Pointer to LTE_DL_FRAME_PARMS structure - @returns 0-5 depending on number of available prach -*/ -uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index); - -/*! - \brief Comp ute DFT of PRACH ZC sequences. Used for generation of prach in UE and reception of PRACH in eNB. - @param rootSequenceIndex PRACH root sequence - #param prach_ConfigIndex PRACH Configuration Index - @param zeroCorrelationZoneConfig PRACH ncs_config - @param highSpeedFlat PRACH High-Speed Flag - @param frame_type TDD/FDD flag - @param Xu DFT output -*/ -void compute_prach_seq(uint16_t rootSequenceIndex, - uint8_t prach_ConfigIndex, - uint8_t zeroCorrelationZoneConfig, - uint8_t highSpeedFlag, - lte_frame_type_t frame_type, - uint32_t X_u[64][839]); - - -void init_prach_tables(int N_ZC); - -void init_unscrambling_lut(void); -void init_scrambling_lut(void); - -/*! - \brief Return the status of MBSFN in this frame/subframe - @param frame Frame index - @param subframe Subframe index - @param frame_parms Pointer to frame parameters - @returns 1 if subframe is for MBSFN -*/ -int is_pmch_subframe(frame_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms); - -uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2ndpilots); - -uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode); - -uint32_t dlsch_decoding_abstraction(double *dlsch_MIPB, - LTE_DL_FRAME_PARMS *lte_frame_parms, - LTE_UE_DLSCH_t *dlsch, - uint8_t subframe, - uint8_t num_pdcch_symbols); - -// DL power control functions -double get_pa_dB(uint8_t pa); - -double computeRhoA_eNB(uint8_t pa, - LTE_eNB_DLSCH_t *dlsch_eNB, - int dl_power_off, - uint8_t n_antenna_port); - -double computeRhoB_eNB(uint8_t pa, - uint8_t pb, - uint8_t n_antenna_port, - LTE_eNB_DLSCH_t *dlsch_eNB, - int dl_power_off); - -double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, - LTE_UE_DLSCH_t *dlsch_ue, - uint8_t dl_power_off, - uint8_t n_antenna_port); - -double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, - PDSCH_CONFIG_COMMON *pdsch_config_common, - uint8_t n_antenna_port, - LTE_UE_DLSCH_t *dlsch_ue, - uint8_t dl_power_off); - -/*void compute_sqrt_RhoAoRhoB(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, - PDSCH_CONFIG_COMMON *pdsch_config_common, - uint8_t n_antenna_port, - LTE_UE_DLSCH_t *dlsch_ue); -*/ - -uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t prach_ConfigIndex, - uint8_t n_ra_prboffset, - uint8_t tdd_mapindex, uint16_t Nf); - -uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n); - - -int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); - -int8_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); - -int8_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type); - -/**@}*/ -#endif diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index 9a19b0ddaf..6d6eff8c59 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -42,6 +42,8 @@ //#define DEBUG_PUCCH_TXS //#define DEBUG_PUCCH_RX +#include "pucch_common.c" + int16_t cfo_pucch_np[24*7] = {20787,-25330,27244,-18205,31356,-9512,32767,0,31356,9511,27244,18204,20787,25329, 27244,-18205,30272,-12540,32137,-6393,32767,0,32137,6392,30272,12539,27244,18204, 31356,-9512,32137,-6393,32609,-3212,32767,0,32609,3211,32137,6392,31356,9511, @@ -61,1083 +63,6 @@ int16_t cfo_pucch_ep[24*6] = {24278,-22005,29621,-14010,32412,-4808,32412,4807,2 }; -void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7]) -{ - - uint8_t ns,l,reset=1,i,N_UL_symb; - uint32_t x1,x2,j=0,s=0; - - N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6; - x2 = frame_parms->Nid_cell; - - for (ns=0; ns<20; ns++) { - - for (l=0; l<N_UL_symb; l++) { - ncs_cell[ns][l]=0; - - for (i=0; i<8; i++) { - if ((j%32) == 0) { - s = lte_gold_generic(&x1,&x2,reset); - // printf("s %x\n",s); - reset=0; - } - - if (((s>>(j%32))&1)==1) - ncs_cell[ns][l] += (1<<i); - - j++; - } - -#ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH ncs_cell init (j %d): Ns %d, l %d => ncs_cell %d\n",j,ns,l,ncs_cell[ns][l]); -#endif - } - - } -} - -int16_t alpha_re[12] = {32767, 28377, 16383, 0,-16384, -28378,-32768,-28378,-16384, -1, 16383, 28377}; -int16_t alpha_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0,-16384,-28378,-32768,-28378,-16384}; - -int16_t W4[3][4] = {{32767, 32767, 32767, 32767}, - {32767,-32768, 32767,-32768}, - {32767,-32768,-32768, 32767} -}; -int16_t W3_re[3][6] = {{32767, 32767, 32767}, - {32767,-16384,-16384}, - {32767,-16384,-16384} -}; - -int16_t W3_im[3][6] = {{0 ,0 ,0 }, - {0 , 28377,-28378}, - {0 ,-28378, 28377} -}; - -char *pucch_format_string[] = { - "format 1", - "format 1a", - "format 1b", - "pucch_format1b_csA2", - "pucch_format1b_csA3", - "pucch_format1b_csA4", - "format 2", - "format 2a", - "format 2b", - "pucch_format3" -}; - -/* PUCCH format3 >> */ -#define D_I 0 -#define D_Q 1 -#define D_IQDATA 2 -#define D_NSLT1SF 2 -#define D_NSYM1SLT 7 -#define D_NSYM1SF 2*7 -#define D_NSC1RB 12 -#define D_NRB1PUCCH 2 -#define D_NPUCCH_SF5 5 -#define D_NPUCCH_SF4 4 - -uint8_t chcod_tbl[128][48] = { {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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1}, - {0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0}, - {0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0}, - {1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1}, - {1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1}, - {0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}, - {0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0}, - {1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1}, - {1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1}, - {0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0}, - {0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0}, - {1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1}, - {1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1}, - {0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0}, - {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1}, - {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0}, - {1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0}, - {0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1}, - {0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1}, - {1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0}, - {1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0}, - {0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1}, - {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1}, - {1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, - {1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0}, - {0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1}, - {0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1}, - {1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, - {1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0}, - {0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, - {1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0}, - {0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1}, - {0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1}, - {1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0}, - {1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0}, - {0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1}, - {0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1}, - {1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0}, - {1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0}, - {0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1}, - {0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1}, - {1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0}, - {1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0}, - {0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1}, - {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, - {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, - {1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1}, - {0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0}, - {0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0}, - {1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1}, - {1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1}, - {0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0}, - {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0}, - {1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1}, - {1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1}, - {0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0}, - {0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, - {1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1}, - {1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1}, - {0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0}, - {0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1}, - {1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0}, - {1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0}, - {0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1}, - {0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, - {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, - {1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0}, - {0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1}, - {0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1}, - {1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0}, - {1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0}, - {0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1}, - {0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1}, - {1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0}, - {1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0}, - {0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1}, - {0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0}, - {1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1}, - {1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1}, - {0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0}, - {0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0}, - {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1}, - {1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1}, - {0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0}, - {0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0}, - {1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1}, - {1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1}, - {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0}, - {0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0}, - {1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1}, - {1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1}, - {0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0}, - {0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0}, - {1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1}, - {1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1}, - {0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0}, - {0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0}, - {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1}, - {1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1}, - {0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0}, - {0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0}, - {1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1}, - {1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1}, - {0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0}, - {0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0}, - {1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1}, - {1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1}, - {0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0}, - {0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1}, - {1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0}, - {1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0}, - {0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1}, - {0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, - {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, - {1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0}, - {0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1}, - {0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1}, - {1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0}, - {1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0}, - {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1}, - {0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1}, - {1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0}, - {1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0}, - {0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1} }; - -// W5_TBL -int16_t W5_fmt3_re[5][5] = { {32767, 32767, 32767, 32767, 32767}, - {32767, 10125, -26509, -26509, 10125}, - {32767, -26509, 10125, 10125, -26509}, - {32767, -26509, 10125, 10125, -26509}, - {32767, 10125, -26509, -26509, 10125} }; - -int16_t W5_fmt3_im[5][5] = { {0, 0, 0, 0, 0}, - {0, 31163, 19259, -19259, -31163}, - {0, 19259, -31163, 31163, -19259}, - {0, -19259, 31163, -31163, 19259}, - {0, -31163, -19259, 19259, 31163} }; - -int16_t W4_fmt3[4][4] = { {32767, 32767, 32767, 32767}, - {32767, -32767, 32767, -32767}, - {32767, 32767, -32767, -32767}, - {32767, -32767, -32767, 32767} }; - -// W2 TBL -int16_t W2[2] = {32767, 32767}; - -// e^j*pai*floor (ncs_cell(ns,l)/64)/2 -int16_t RotTBL_re[4] = {32767, 0, -32767, 0}; -int16_t RotTBL_im[4] = {0, 32767, 0, -32767}; - -//np4_tbl, np5_tbl -uint8_t Np5_TBL[5] = {0, 3, 6, 8, 10}; -uint8_t Np4_TBL[4] = {0, 3, 6, 9}; - -// alpha_TBL -int16_t alphaTBL_re[12] = {32767, 28377, 16383, 0, -16383, -28377, -32767, -28377, -16383, 0, 16383, 28377}; -int16_t alphaTBL_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0, -16383, -28377, -32767, -28377, -16383}; - -/* PUCCH format3 << */ - -void generate_pucch1x(int32_t **txdataF, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t ncs_cell[20][7], - PUCCH_FMT_t fmt, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, - uint16_t n1_pucch, - uint8_t shortened_format, - uint8_t *payload, - int16_t amp, - uint8_t subframe) -{ - - uint32_t u,v,n; - uint32_t z[12*14],*zptr; - int16_t d0; - uint8_t ns,N_UL_symb,nsymb,n_oc,n_oc0,n_oc1; - uint8_t c = (frame_parms->Ncp==0) ? 3 : 2; - uint16_t nprime,nprime0,nprime1; - uint16_t i,j,re_offset,thres,h; - uint8_t Nprime_div_deltaPUCCH_Shift,Nprime,d; - uint8_t m,l,refs; - uint8_t n_cs,S,alpha_ind,rem; - int16_t tmp_re,tmp_im,ref_re,ref_im,W_re=0,W_im=0; - int32_t *txptr; - uint32_t symbol_offset; - - uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift; - uint8_t NRB2 = frame_parms->pucch_config_common.nRB_CQI; - uint8_t Ncs1 = frame_parms->pucch_config_common.nCS_AN; - uint8_t Ncs1_div_deltaPUCCH_Shift = Ncs1/deltaPUCCH_Shift; - - LOG_D(PHY,"generate_pucch Start [deltaPUCCH_Shift %d, NRB2 %d, Ncs1_div_deltaPUCCH_Shift %d, n1_pucch %d]\n", deltaPUCCH_Shift, NRB2, Ncs1_div_deltaPUCCH_Shift,n1_pucch); - - - uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30; - uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30; - uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; - uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; - - if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) { - printf("[PHY] generate_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift); - return; - } - - if (Ncs1_div_deltaPUCCH_Shift > 7) { - printf("[PHY] generate_pucch: Illegal Ncs1_div_deltaPUCCH_Shift %d (should be 0...7)\n",Ncs1_div_deltaPUCCH_Shift); - return; - } - - zptr = z; - thres = (c*Ncs1_div_deltaPUCCH_Shift); - Nprime_div_deltaPUCCH_Shift = (n1_pucch < thres) ? Ncs1_div_deltaPUCCH_Shift : (12/deltaPUCCH_Shift); - Nprime = Nprime_div_deltaPUCCH_Shift * deltaPUCCH_Shift; - -#ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH: cNcs1/deltaPUCCH_Shift %d, Nprime %d, n1_pucch %d\n",thres,Nprime,n1_pucch); -#endif - - LOG_D(PHY,"[PHY] PUCCH: n1_pucch %d, thres %d Ncs1_div_deltaPUCCH_Shift %d (12/deltaPUCCH_Shift) %d Nprime_div_deltaPUCCH_Shift %d \n", - n1_pucch, thres, Ncs1_div_deltaPUCCH_Shift, (int)(12/deltaPUCCH_Shift), Nprime_div_deltaPUCCH_Shift); - LOG_D(PHY,"[PHY] PUCCH: deltaPUCCH_Shift %d, Nprime %d\n",deltaPUCCH_Shift,Nprime); - - - N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6; - - if (n1_pucch < thres) - nprime0=n1_pucch; - else - nprime0 = (n1_pucch - thres)%(12*c/deltaPUCCH_Shift); - - if (n1_pucch >= thres) - nprime1= ((c*(nprime0+1))%((12*c/deltaPUCCH_Shift)+1))-1; - else { - d = (frame_parms->Ncp==0) ? 2 : 0; - h= (nprime0+d)%(c*Nprime_div_deltaPUCCH_Shift); -#ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH: h %d, d %d\n",h,d); -#endif - nprime1 = (h/c) + (h%c)*Nprime_div_deltaPUCCH_Shift; - } - -#ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH: nprime0 %d nprime1 %d, %s, payload (%d,%d)\n",nprime0,nprime1,pucch_format_string[fmt],payload[0],payload[1]); -#endif - - n_oc0 = nprime0/Nprime_div_deltaPUCCH_Shift; - - if (frame_parms->Ncp==1) - n_oc0<<=1; - - n_oc1 = nprime1/Nprime_div_deltaPUCCH_Shift; - - if (frame_parms->Ncp==1) // extended CP - n_oc1<<=1; - -#ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH: noc0 %d noc1 %d\n",n_oc0,n_oc1); -#endif - - nprime=nprime0; - n_oc =n_oc0; - - // loop over 2 slots - for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) { - - if ((nprime&1) == 0) - S=0; // 1 - else - S=1; // j - - //loop over symbols in slot - for (l=0; l<N_UL_symb; l++) { - // Compute n_cs (36.211 p. 18) - n_cs = ncs_cell[ns][l]; - - if (frame_parms->Ncp==0) { // normal CP - n_cs = ((uint16_t)n_cs + (nprime*deltaPUCCH_Shift + (n_oc%deltaPUCCH_Shift))%Nprime)%12; - } else { - n_cs = ((uint16_t)n_cs + (nprime*deltaPUCCH_Shift + (n_oc>>1))%Nprime)%12; - } - - - refs=0; - - // Comput W_noc(m) (36.211 p. 19) - if ((ns==(1+(subframe<<1))) && (shortened_format==1)) { // second slot and shortened format - - if (l<2) { // data - W_re=W3_re[n_oc][l]; - W_im=W3_im[n_oc][l]; - } else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==0)) { // reference and normal CP - W_re=W3_re[n_oc][l-2]; - W_im=W3_im[n_oc][l-2]; - refs=1; - } else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==1)) { // reference and extended CP - W_re=W4[n_oc][l-2]; - W_im=0; - refs=1; - } else if ((l>=N_UL_symb-2)) { // data - W_re=W3_re[n_oc][l-N_UL_symb+4]; - W_im=W3_im[n_oc][l-N_UL_symb+4]; - } - } else { - if (l<2) { // data - W_re=W4[n_oc][l]; - W_im=0; - } else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==0)) { // reference and normal CP - W_re=W3_re[n_oc][l-2]; - W_im=W3_im[n_oc][l-2]; - refs=1; - } else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==1)) { // reference and extended CP - W_re=W4[n_oc][l-2]; - W_im=0; - refs=1; - } else if ((l>=N_UL_symb-2)) { // data - W_re=W4[n_oc][l-N_UL_symb+4]; - W_im=0; - } - } - - // multiply W by S(ns) (36.211 p.17). only for data, reference symbols do not have this factor - if ((S==1)&&(refs==0)) { - tmp_re = W_re; - W_re = -W_im; - W_im = tmp_re; - } - -#ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH: ncs[%d][%d]=%d, W_re %d, W_im %d, S %d, refs %d\n",ns,l,n_cs,W_re,W_im,S,refs); -#endif - alpha_ind=0; - // compute output sequence - - for (n=0; n<12; n++) { - - // this is r_uv^alpha(n) - tmp_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15); - tmp_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15); - - // this is S(ns)*w_noc(m)*r_uv^alpha(n) - ref_re = (tmp_re*W_re - tmp_im*W_im)>>15; - ref_im = (tmp_re*W_im + tmp_im*W_re)>>15; - - if ((l<2)||(l>=(N_UL_symb-2))) { //these are PUCCH data symbols - switch (fmt) { - case pucch_format1: //OOK 1-bit - - ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re)>>15; - ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im)>>15; - - break; - - case pucch_format1a: //BPSK 1-bit - d0 = (payload[0]&1)==0 ? amp : -amp; - ((int16_t *)&zptr[n])[0] = ((int32_t)d0*ref_re)>>15; - ((int16_t *)&zptr[n])[1] = ((int32_t)d0*ref_im)>>15; - // printf("d0 %d\n",d0); - break; - - case pucch_format1b: //QPSK 2-bits (Table 5.4.1-1 from 36.211, pg. 18) - if (((payload[0]&1)==0) && ((payload[1]&1)==0)) {// 1 - ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re)>>15; - ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im)>>15; - } else if (((payload[0]&1)==0) && ((payload[1]&1)==1)) { // -j - ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_im)>>15; - ((int16_t *)&zptr[n])[1] = (-(int32_t)amp*ref_re)>>15; - } else if (((payload[0]&1)==1) && ((payload[1]&1)==0)) { // j - ((int16_t *)&zptr[n])[0] = (-(int32_t)amp*ref_im)>>15; - ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_re)>>15; - } else { // -1 - ((int16_t *)&zptr[n])[0] = (-(int32_t)amp*ref_re)>>15; - ((int16_t *)&zptr[n])[1] = (-(int32_t)amp*ref_im)>>15; - } - - break; - case pucch_format1b_csA2: - case pucch_format1b_csA3: - case pucch_format1b_csA4: - AssertFatal(1==0,"PUCCH format 1b_csX not supported yet\n"); - break; - case pucch_format2: - case pucch_format2a: - case pucch_format2b: - AssertFatal(1==0,"should not go here\n"); - break; - - case pucch_format3: - fprintf(stderr, "PUCCH format 3 not handled\n"); - abort(); - } // switch fmt - } else { // These are PUCCH reference symbols - - ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re)>>15; - ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im)>>15; - // printf("ref\n"); - } - -#ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH subframe %d z(%d,%d) => %d,%d, alpha(%d) => %d,%d\n",subframe,l,n,((int16_t *)&zptr[n])[0],((int16_t *)&zptr[n])[1], - alpha_ind,alpha_re[alpha_ind],alpha_im[alpha_ind]); -#endif - alpha_ind = (alpha_ind + n_cs)%12; - } // n - - zptr+=12; - } // l - - nprime=nprime1; - n_oc =n_oc1; - } // ns - - rem = ((((12*Ncs1_div_deltaPUCCH_Shift)>>3)&7)>0) ? 1 : 0; - - m = (n1_pucch < thres) ? NRB2 : (((n1_pucch-thres)/(12*c/deltaPUCCH_Shift))+NRB2+((deltaPUCCH_Shift*Ncs1_div_deltaPUCCH_Shift)>>3)+rem); - -#ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH: m %d\n",m); -#endif - nsymb = N_UL_symb<<1; - - //for (j=0,l=0;l<(nsymb-1);l++) { - for (j=0,l=0; l<(nsymb); l++) { - if ((l<(nsymb>>1)) && ((m&1) == 0)) - re_offset = (m*6) + frame_parms->first_carrier_offset; - else if ((l<(nsymb>>1)) && ((m&1) == 1)) - re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; - else if ((m&1) == 0) - re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; - else - re_offset = ((m-1)*6) + frame_parms->first_carrier_offset; - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size); - - symbol_offset = (unsigned int)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb)); - txptr = &txdataF[0][symbol_offset]; - - for (i=0; i<12; i++,j++) { - txptr[re_offset++] = z[j]; - - if (re_offset==frame_parms->ofdm_symbol_size) - re_offset = 0; - -#ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]); -#endif - } - } - -} - -void generate_pucch_emul(PHY_VARS_UE *ue, - UE_rxtx_proc_t *proc, - PUCCH_FMT_t format, - uint8_t ncs1, - uint8_t *pucch_payload, - uint8_t sr) - -{ - - int subframe = proc->subframe_tx; - - UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_flag = format; - UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_Ncs1 = ncs1; - - - UE_transport_info[ue->Mod_id][ue->CC_id].cntl.sr = sr; - // the value of ue->pucch_sel[subframe] is set by get_n1_pucch - UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_sel = ue->pucch_sel[subframe]; - - // LOG_I(PHY,"subframe %d emu tx pucch_sel is %d sr is %d \n", subframe, UE_transport_info[ue->Mod_id].cntl.pucch_sel, sr); - - if (format == pucch_format1a) { - - ue->pucch_payload[0] = pucch_payload[0]; - UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_payload = pucch_payload[0]; - } else if (format == pucch_format1b) { - ue->pucch_payload[0] = pucch_payload[0] + (pucch_payload[1]<<1); - UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_payload = pucch_payload[0] + (pucch_payload[1]<<1); - } else if (format == pucch_format1) { - // LOG_D(PHY,"[UE %d] Frame %d subframe %d Generating PUCCH for SR %d\n",ue->Mod_id,proc->frame_tx,subframe,sr); - } - - ue->sr[subframe] = sr; - -} - - -inline void pucch2x_scrambling(LTE_DL_FRAME_PARMS *fp,int subframe,uint16_t rnti,uint32_t B,uint8_t *btilde) __attribute__((always_inline)); -inline void pucch2x_scrambling(LTE_DL_FRAME_PARMS *fp,int subframe,uint16_t rnti,uint32_t B,uint8_t *btilde) { - - uint32_t x1, x2, s=0; - int i; - uint8_t c; - - x2 = (rnti) + ((uint32_t)(1+subframe)<<16)*(1+(fp->Nid_cell<<1)); //this is c_init in 36.211 Sec 6.3.1 - s = lte_gold_generic(&x1, &x2, 1); - for (i=0;i<19;i++) { - c = (uint8_t)((s>>i)&1); - btilde[i] = (((B>>i)&1) ^ c); - } -} - -inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) __attribute__((always_inline)); -inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) { - - int i; - - for (i=0;i<20;i++) - d[i] = btilde[i] == 1 ? -amp : amp; - -} - - - -uint32_t pucch_code[13] = {0xFFFFF,0x5A933,0x10E5A,0x6339C,0x73CE0, - 0xFFC00,0xD8E64,0x4F6B0,0x218EC,0x1B746, - 0x0FFFF,0x33FFF,0x3FFFC}; - - -void generate_pucch2x(int32_t **txdataF, - LTE_DL_FRAME_PARMS *fp, - uint8_t ncs_cell[20][7], - PUCCH_FMT_t fmt, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, - uint16_t n2_pucch, - uint8_t *payload, - int A, - int B2, - int16_t amp, - uint8_t subframe, - uint16_t rnti) { - - int i,j; - uint32_t B=0; - uint8_t btilde[20]; - int16_t d[22]; - uint8_t deltaPUCCH_Shift = fp->pucch_config_common.deltaPUCCH_Shift; - uint8_t NRB2 = fp->pucch_config_common.nRB_CQI; - uint8_t Ncs1 = fp->pucch_config_common.nCS_AN; - - uint32_t u0 = fp->pucch_config_common.grouphop[subframe<<1]; - uint32_t u1 = fp->pucch_config_common.grouphop[1+(subframe<<1)]; - uint32_t v0 = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; - uint32_t v1 = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; - - uint32_t z[12*14],*zptr; - uint32_t u,v,n; - uint8_t ns,N_UL_symb,nsymb_slot0,nsymb_pertti; - uint32_t nprime,l,n_cs; - int alpha_ind,data_ind; - int16_t ref_re,ref_im; - int m,re_offset,symbol_offset; - int32_t *txptr; - - if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) { - printf("[PHY] generate_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift); - return; - } - - if (Ncs1 > 7) { - printf("[PHY] generate_pucch: Illegal Ncs1 %d (should be 0...7)\n",Ncs1); - return; - } - - // pucch2x_encoding - for (i=0;i<A;i++) - if ((*payload & (1<<i)) > 0) - B=B^pucch_code[i]; - - // scrambling - pucch2x_scrambling(fp,subframe,rnti,B,btilde); - // modulation - pucch2x_modulation(btilde,d,amp); - - // add extra symbol for 2a/2b - d[20]=0; - d[21]=0; - if (fmt==pucch_format2a) - d[20] = (B2 == 0) ? amp : -amp; - else if (fmt==pucch_format2b) { - switch (B2) { - case 0: - d[20] = amp; - break; - case 1: - d[21] = -amp; - break; - case 2: - d[21] = amp; - break; - case 3: - d[20] = -amp; - break; - default: - AssertFatal(1==0,"Illegal modulation symbol %d for PUCCH %s\n",B2,pucch_format_string[fmt]); - break; - } - } - - -#ifdef DEBUG_PUCCH_TX - printf("[PHY] PUCCH2x: n2_pucch %d\n",n2_pucch); -#endif - - N_UL_symb = (fp->Ncp==0) ? 7 : 6; - data_ind = 0; - zptr = z; - nprime = 0; - for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) { - - if ((ns&1) == 0) - nprime = (n2_pucch < 12*NRB2) ? - n2_pucch % 12 : - (n2_pucch+Ncs1 + 1)%12; - else { - nprime = (n2_pucch < 12*NRB2) ? - ((12*(nprime+1)) % 13)-1 : - (10-n2_pucch)%12; - } - //loop over symbols in slot - for (l=0; l<N_UL_symb; l++) { - // Compute n_cs (36.211 p. 18) - n_cs = (ncs_cell[ns][l]+nprime)%12; - - alpha_ind = 0; - for (n=0; n<12; n++) - { - // this is r_uv^alpha(n) - ref_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15); - ref_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15); - - if ((l!=1)&&(l!=5)) { //these are PUCCH data symbols - ((int16_t *)&zptr[n])[0] = ((int32_t)d[data_ind]*ref_re - (int32_t)d[data_ind+1]*ref_im)>>15; - ((int16_t *)&zptr[n])[1] = ((int32_t)d[data_ind]*ref_im + (int32_t)d[data_ind+1]*ref_re)>>15; - //LOG_I(PHY,"slot %d ofdm# %d ==> d[%d,%d] \n",ns,l,data_ind,n); - } - else { - if ((l==1) || ( (l==5) && (fmt==pucch_format2) )) - { - ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re>>15); - ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im>>15); - } - // l == 5 && pucch format 2a - else if (fmt==pucch_format2a) - { - ((int16_t *)&zptr[n])[0] = ((int32_t)d[20]*ref_re>>15); - ((int16_t *)&zptr[n])[1] = ((int32_t)d[21]*ref_im>>15); - } - // l == 5 && pucch format 2b - else if (fmt==pucch_format2b) - { - ((int16_t *)&zptr[n])[0] = ((int32_t)d[20]*ref_re>>15); - ((int16_t *)&zptr[n])[1] = ((int32_t)d[21]*ref_im>>15); - } - } // l==1 || l==5 - alpha_ind = (alpha_ind + n_cs)%12; - } // n - zptr+=12; - - if ((l!=1)&&(l!=5)) //these are PUCCH data symbols so increment data index - data_ind+=2; - } // l - } //ns - - m = n2_pucch/12; - -#ifdef DEBUG_PUCCH_TX - LOG_D(PHY,"[PHY] PUCCH: n2_pucch %d m %d\n",n2_pucch,m); -#endif - - nsymb_slot0 = ((fp->Ncp==0) ? 7 : 6); - nsymb_pertti = nsymb_slot0 << 1; - - //nsymb = nsymb_slot0<<1; - - //for (j=0,l=0;l<(nsymb-1);l++) { - for (j=0,l=0; l<(nsymb_pertti); l++) { - - if ((l<nsymb_slot0) && ((m&1) == 0)) - re_offset = (m*6) + fp->first_carrier_offset; - else if ((l<nsymb_slot0) && ((m&1) == 1)) - re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12; - else if ((m&1) == 0) - re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12; - else - re_offset = ((m-1)*6) + fp->first_carrier_offset; - - if (re_offset > fp->ofdm_symbol_size) - re_offset -= (fp->ofdm_symbol_size); - - - - symbol_offset = (unsigned int)fp->ofdm_symbol_size*(l+(subframe*nsymb_pertti)); - txptr = &txdataF[0][symbol_offset]; - - //LOG_I(PHY,"ofdmSymb %d/%d, firstCarrierOffset %d, symbolOffset[sfn %d] %d, reOffset %d, &txptr: %x \n", l, nsymb, fp->first_carrier_offset, subframe, symbol_offset, re_offset, &txptr[0]); - - for (i=0; i<12; i++,j++) { - txptr[re_offset] = z[j]; - - re_offset++; - - if (re_offset==fp->ofdm_symbol_size) - re_offset -= (fp->ofdm_symbol_size); - -#ifdef DEBUG_PUCCH_TX - LOG_D(PHY,"[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]); -#endif - } - } -} - -/* PUCCH format3 >> */ -/* DFT */ -void pucchfmt3_Dft( int16_t *x, int16_t *y ) -{ - int16_t i, k; - int16_t tmp[2]; - int16_t calctmp[D_NSC1RB*2]={0}; - - for (i=0; i<D_NSC1RB; i++) { - for(k=0; k<D_NSC1RB; k++) { - tmp[0] = alphaTBL_re[(12-((i*k)%12))%12]; - tmp[1] = alphaTBL_im[(12-((i*k)%12))%12]; - - calctmp[2*i] += (((int32_t)x[2*k] * tmp[0] - (int32_t)x[2*k+1] * tmp[1])>>15); - calctmp[2*i+1] += (((int32_t)x[2*k+1] * tmp[0] + (int32_t)x[2*k] * tmp[1])>>15); - } - y[2*i] = (int16_t)( (double) calctmp[2*i] / sqrt(D_NSC1RB)); - y[2*i+1] = (int16_t)((double) calctmp[2*i+1] / sqrt(D_NSC1RB)); - } -} - -void generate_pucch3x(int32_t **txdataF, - LTE_DL_FRAME_PARMS *frame_parms, - uint8_t ncs_cell[20][7], - PUCCH_FMT_t fmt, - PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, - uint16_t n3_pucch, - uint8_t shortened_format, - uint8_t *payload, - int16_t amp, - uint8_t subframe, - uint16_t rnti) -{ - - uint32_t u, v; - uint16_t i, j, re_offset; - uint32_t z[12*14], *zptr; - uint32_t y_tilda[12*14]={}, *y_tilda_ptr; - uint8_t ns, nsymb, n_oc, n_oc0, n_oc1; - uint8_t N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6; - uint8_t m, l; - uint8_t n_cs; - int16_t tmp_re, tmp_im, W_re=0, W_im=0; - int32_t *txptr; - uint32_t symbol_offset; - - uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30; - uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30; - uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; - uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; - - // variables for channel coding - uint8_t chcod_tbl_idx = 0; - //uint8_t chcod_dt[48] = {}; - - // variables for Scrambling - uint32_t cinit = 0; - uint32_t x1; - uint32_t s,s0,s1; - uint8_t C[48] ={}; - uint8_t scr_dt[48]={}; - - // variables for Modulation - int16_t d_re[24]={}; - int16_t d_im[24]={}; - - // variables for orthogonal sequence selection - uint8_t N_PUCCH_SF0 = 5; - uint8_t N_PUCCH_SF1 = (shortened_format==0)? 5:4; - uint8_t first_slot = 0; - int16_t rot_re=0; - int16_t rot_im=0; - - uint8_t dt_offset; - uint8_t sym_offset; - int16_t y_re[14][12]; //={0}; - int16_t y_im[14][12]; //={0}; - - // DMRS - uint8_t alpha_idx=0; - uint8_t m_alpha_idx=0; - - // TODO - // "SR+ACK/NACK" length is only 7 bits. - // This restriction will be lifted in the future. - // "CQI/PMI/RI+ACK/NACK" will be supported in the future. - - // Channel Coding - for (uint8_t i=0; i<7; i++) { - chcod_tbl_idx += (payload[i]<<i); - } - - // Scrambling - cinit = (subframe + 1) * ((2 * frame_parms->Nid_cell + 1)<<16) + rnti; - s0 = lte_gold_generic(&x1,&cinit,1); - s1 = lte_gold_generic(&x1,&cinit,0); - - for (i=0; i<48; i++) { - s = (i<32)? s0:s1; - j = (i<32)? i:(i-32); - C[i] = ((s>>j)&1); - } - - for (i=0; i<48; i++) { - scr_dt[i] = chcod_tbl[chcod_tbl_idx][i] ^ C[i]; - } - - // Modulation - for (uint8_t i=0; i<48; i+=2){ - if (scr_dt[i]==0 && scr_dt[i+1]==0){ - d_re[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp) >>15); - d_im[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp) >>15); - } else if (scr_dt[i]==0 && scr_dt[i+1]==1) { - d_re[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp) >>15); - d_im[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp) >>15); - } else if (scr_dt[i]==1 && scr_dt[i+1]==0) { - d_re[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp)>>15); - d_im[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp)>>15); - } else if (scr_dt[i]==1 && scr_dt[i+1]==1) { - d_re[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp)>>15); - d_im[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp)>>15); - } else { - //***log Modulation Error! - } - } - - // Calculate Orthogonal Sequence index - n_oc0 = n3_pucch % N_PUCCH_SF1; - if (N_PUCCH_SF1 == 5) { - n_oc1 = (3 * n_oc0) % N_PUCCH_SF1; - } else { - n_oc1 = n_oc0 % N_PUCCH_SF1; - } - - y_tilda_ptr = y_tilda; - zptr = z; - - // loop over 2 slots - for (ns=(subframe<<1), u=u0, v=v0; ns<(2+(subframe<<1)); ns++, u=u1, v=v1) { - first_slot = (ns==(subframe<<1))?1:0; - - //loop over symbols in slot - for (l=0; l<N_UL_symb; l++) { - rot_re = RotTBL_re[(uint8_t) ncs_cell[ns][l]/64] ; - rot_im = RotTBL_im[(uint8_t) ncs_cell[ns][l]/64] ; - - // Comput W_noc(m) (36.211 p. 19) - if ( first_slot == 0 && shortened_format==1) { // second slot and shortened format - n_oc = n_oc1; - - if (l<1) { // data - W_re=W4_fmt3[n_oc][l]; - W_im=0; - } else if (l==1) { // DMRS - W_re=W2[0]; - W_im=0; - } else if (l>=2 && l<5) { // data - W_re=W4_fmt3[n_oc][l-1]; - W_im=0; - } else if (l==5) { // DMRS - W_re=W2[1]; - W_im=0; - } else if ((l>=N_UL_symb-2)) { // data - ; - } else { - //***log W Select Error! - } - } else { - if (first_slot == 1) { // 1st slot or 2nd slot and not shortened - n_oc=n_oc0; - } else { - n_oc=n_oc1; - } - - if (l<1) { // data - W_re=W5_fmt3_re[n_oc][l]; - W_im=W5_fmt3_im[n_oc][l]; - } else if (l==1) { // DMRS - W_re=W2[0]; - W_im=0; - } else if (l>=2 && l<5) { // data - W_re=W5_fmt3_re[n_oc][l-1]; - W_im=W5_fmt3_im[n_oc][l-1]; - } else if (l==5) { // DMRS - W_re=W2[1]; - W_im=0; - } else if ((l>=N_UL_symb-1)) { // data - W_re=W5_fmt3_re[n_oc][l-N_UL_symb+5]; - W_im=W5_fmt3_im[n_oc][l-N_UL_symb+5]; - } else { - //***log W Select Error! - } - } // W Selection end - - // Compute n_cs (36.211 p. 18) - n_cs = ncs_cell[ns][l]; - if (N_PUCCH_SF1 == 5) { - alpha_idx = (n_cs + Np5_TBL[n_oc]) % 12; - } else { - alpha_idx = (n_cs + Np4_TBL[n_oc]) % 12; - } - - // generate pucch data - dt_offset = (first_slot == 1) ? 0:12; - sym_offset = (first_slot == 1) ? 0:7; - - for (i=0; i<12; i++) { - // Calculate yn(i) - tmp_re = (((int32_t) (W_re*rot_re - W_im*rot_im)) >>15); - tmp_im = (((int32_t) (W_re*rot_im + W_im*rot_re)) >>15); - y_re[l+sym_offset][i] = (((int32_t) (tmp_re*d_re[i+dt_offset] - tmp_im*d_im[i+dt_offset]))>>15); - y_im[l+sym_offset][i] = (((int32_t) (tmp_re*d_im[i+dt_offset] + tmp_im*d_re[i+dt_offset]))>>15); - - // cyclic shift - ((int16_t *)&y_tilda_ptr[(l+sym_offset)*12+(i-(ncs_cell[ns][l]%12)+12)%12])[0] = y_re[l+sym_offset][i]; - ((int16_t *)&y_tilda_ptr[(l+sym_offset)*12+(i-(ncs_cell[ns][l]%12)+12)%12])[1] = y_im[l+sym_offset][i]; - - // DMRS - m_alpha_idx = (alpha_idx * i) % 12; - if (l==1 || l==5) { - ((int16_t *)&zptr[(l+sym_offset)*12+i])[0] =(((((int32_t) alphaTBL_re[m_alpha_idx]*ul_ref_sigs[u][v][0][i<<1] - (int32_t) alphaTBL_im[m_alpha_idx] * ul_ref_sigs[u][v][0][1+(i<<1)])>>15) * (int32_t)amp)>>15); - ((int16_t *)&zptr[(l+sym_offset)*12+i])[1] =(((((int32_t) alphaTBL_re[m_alpha_idx]*ul_ref_sigs[u][v][0][1+(i<<1)] + (int32_t) alphaTBL_im[m_alpha_idx] * ul_ref_sigs[u][v][0][i<<1])>>15) * (int32_t)amp)>>15); - } - } - - } // l loop - } // ns - - // DFT for pucch-data - for (l=0; l<14; l++) { - if (l==1 || l==5 || l==8 || l==12) { - ; - } else { - pucchfmt3_Dft((int16_t*)&y_tilda_ptr[l*12],(int16_t*)&zptr[l*12]); - } - } - - - // Mapping - m = n3_pucch / N_PUCCH_SF0; - - if (shortened_format == 1) { - nsymb = (N_UL_symb<<1) - 1; - } else { - nsymb = (N_UL_symb<<1); - } - - for (j=0,l=0; l<(nsymb); l++) { - - if ((l<7) && ((m&1) == 0)) - re_offset = (m*6) + frame_parms->first_carrier_offset; - else if ((l<7) && ((m&1) == 1)) - re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; - else if ((m&1) == 0) - re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; - else - re_offset = ((m-1)*6) + frame_parms->first_carrier_offset; - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size); - - symbol_offset = (unsigned int)frame_parms->ofdm_symbol_size*(l+(subframe*14)); - txptr = &txdataF[0][symbol_offset]; - - for (i=0; i<12; i++,j++) { - txptr[re_offset++] = z[j]; - - if (re_offset==frame_parms->ofdm_symbol_size) - re_offset = 0; - -#ifdef DEBUG_PUCCH_TX - msg("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]); -#endif - } - } - -} - -/* PUCCH format3 << */ - - -//#define Amax 13 -//void init_pucch2x_rx() {}; /* PUCCH format3 >> */ diff --git a/openair1/PHY/LTE_TRANSPORT/pucch_common.c b/openair1/PHY/LTE_TRANSPORT/pucch_common.c new file mode 100644 index 0000000000..3000af97e6 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/pucch_common.c @@ -0,0 +1,276 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/pucch_common.c +* \brief Top-level routines common to eNB/UE for the PUCCH physical channel V8.6 2009-03 +* \author R. Knopp +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr +* \note +* \warning +*/ +#include "PHY/defs.h" +#include "PHY/extern.h" +#include "LAYER2/MAC/extern.h" + +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + +#include "T.h" + +void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7]) +{ + + uint8_t ns,l,reset=1,i,N_UL_symb; + uint32_t x1,x2,j=0,s=0; + + N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6; + x2 = frame_parms->Nid_cell; + + for (ns=0; ns<20; ns++) { + + for (l=0; l<N_UL_symb; l++) { + ncs_cell[ns][l]=0; + + for (i=0; i<8; i++) { + if ((j%32) == 0) { + s = lte_gold_generic(&x1,&x2,reset); + // printf("s %x\n",s); + reset=0; + } + + if (((s>>(j%32))&1)==1) + ncs_cell[ns][l] += (1<<i); + + j++; + } + +#ifdef DEBUG_PUCCH_TX + printf("[PHY] PUCCH ncs_cell init (j %d): Ns %d, l %d => ncs_cell %d\n",j,ns,l,ncs_cell[ns][l]); +#endif + } + + } +} + +int16_t W4[3][4] = {{32767, 32767, 32767, 32767}, + {32767,-32768, 32767,-32768}, + {32767,-32768,-32768, 32767} +}; +int16_t W3_re[3][6] = {{32767, 32767, 32767}, + {32767,-16384,-16384}, + {32767,-16384,-16384} +}; + +int16_t W3_im[3][6] = {{0 ,0 ,0 }, + {0 , 28377,-28378}, + {0 ,-28378, 28377} +}; + +char *pucch_format_string[] = { + "format 1", + "format 1a", + "format 1b", + "pucch_format1b_csA2", + "pucch_format1b_csA3", + "pucch_format1b_csA4", + "format 2", + "format 2a", + "format 2b", + "pucch_format3" +}; + +/* PUCCH format3 >> */ +#define D_I 0 +#define D_Q 1 +#define D_IQDATA 2 +#define D_NSLT1SF 2 +#define D_NSYM1SLT 7 +#define D_NSYM1SF 2*7 +#define D_NSC1RB 12 +#define D_NRB1PUCCH 2 +#define D_NPUCCH_SF5 5 +#define D_NPUCCH_SF4 4 + +uint8_t chcod_tbl[128][48] = { {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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1}, + {0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0}, + {0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0}, + {1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1}, + {1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1}, + {0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}, + {0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0}, + {1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1}, + {1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1}, + {0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0}, + {0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0}, + {1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1}, + {1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1}, + {0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0}, + {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1}, + {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0}, + {1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0}, + {0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1}, + {0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1}, + {1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0}, + {1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0}, + {0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1}, + {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1}, + {1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}, + {1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0}, + {0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1}, + {0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1}, + {1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}, + {1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0}, + {0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, + {1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0}, + {0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1}, + {0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1}, + {1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0}, + {1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0}, + {0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1}, + {0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1}, + {1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0}, + {1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0}, + {0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1}, + {0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1}, + {1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0}, + {1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0}, + {0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1}, + {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, + {1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1}, + {0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0}, + {0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0}, + {1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1}, + {1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1}, + {0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0}, + {0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0}, + {1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1}, + {1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1}, + {0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0}, + {0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}, + {1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1}, + {1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1}, + {0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0}, + {0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1}, + {1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0}, + {1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0}, + {0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1}, + {0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, + {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}, + {1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0}, + {0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1}, + {1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0}, + {1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0}, + {0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1}, + {0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1}, + {1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0}, + {0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1}, + {0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0}, + {1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1}, + {1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1}, + {0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0}, + {0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0}, + {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1}, + {1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1}, + {0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0}, + {0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0}, + {1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1}, + {1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1}, + {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0}, + {0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0}, + {1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1}, + {1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1}, + {0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0}, + {0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0}, + {1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1}, + {1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1}, + {0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0}, + {0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0}, + {1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1}, + {1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1}, + {0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0}, + {0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0}, + {1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1}, + {1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1}, + {0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0}, + {0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0}, + {1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1}, + {1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1}, + {0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0}, + {0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1}, + {1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0}, + {1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0}, + {0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1}, + {0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, + {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, + {1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0}, + {0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1}, + {0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1}, + {1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0}, + {1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0}, + {0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1}, + {0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1}, + {1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0}, + {1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0}, + {0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1} }; + +// W5_TBL +int16_t W5_fmt3_re[5][5] = { {32767, 32767, 32767, 32767, 32767}, + {32767, 10125, -26509, -26509, 10125}, + {32767, -26509, 10125, 10125, -26509}, + {32767, -26509, 10125, 10125, -26509}, + {32767, 10125, -26509, -26509, 10125} }; + +int16_t W5_fmt3_im[5][5] = { {0, 0, 0, 0, 0}, + {0, 31163, 19259, -19259, -31163}, + {0, 19259, -31163, 31163, -19259}, + {0, -19259, 31163, -31163, 19259}, + {0, -31163, -19259, 19259, 31163} }; + +int16_t W4_fmt3[4][4] = { {32767, 32767, 32767, 32767}, + {32767, -32767, 32767, -32767}, + {32767, 32767, -32767, -32767}, + {32767, -32767, -32767, 32767} }; + +// W2 TBL +int16_t W2[2] = {32767, 32767}; + +// e^j*pai*floor (ncs_cell(ns,l)/64)/2 +int16_t RotTBL_re[4] = {32767, 0, -32767, 0}; +int16_t RotTBL_im[4] = {0, 32767, 0, -32767}; + +//np4_tbl, np5_tbl +uint8_t Np5_TBL[5] = {0, 3, 6, 8, 10}; +uint8_t Np4_TBL[4] = {0, 3, 6, 9}; + +// alpha_TBL +int16_t alphaTBL_re[12] = {32767, 28377, 16383, 0, -16383, -28377, -32767, -28377, -16383, 0, 16383, 28377}; +int16_t alphaTBL_im[12] = {0, 16383, 28377, 32767, 28377, 16383, 0, -16383, -28377, -32767, -28377, -16383}; + diff --git a/openair1/PHY/LTE_TRANSPORT/sss.c b/openair1/PHY/LTE_TRANSPORT/sss.c index 17a4680c54..6ca393c0f2 100644 --- a/openair1/PHY/LTE_TRANSPORT/sss.c +++ b/openair1/PHY/LTE_TRANSPORT/sss.c @@ -82,383 +82,3 @@ int generate_sss(int32_t **txdataF, return(0); } -int pss_ch_est(PHY_VARS_UE *ue, - int32_t pss_ext[4][72], - int32_t sss_ext[4][72]) -{ - - int16_t *pss; - int16_t *pss_ext2,*sss_ext2,*sss_ext3,tmp_re,tmp_im,tmp_re2,tmp_im2; - uint8_t aarx,i; - LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - - switch (ue->common_vars.eNb_id) { - - case 0: - pss = &primary_synch0[10]; - break; - - case 1: - pss = &primary_synch1[10]; - break; - - case 2: - pss = &primary_synch2[10]; - break; - - default: - pss = &primary_synch0[10]; - break; - } - - sss_ext3 = (int16_t*)&sss_ext[0][5]; - - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - - sss_ext2 = (int16_t*)&sss_ext[aarx][5]; - pss_ext2 = (int16_t*)&pss_ext[aarx][5]; - - for (i=0; i<62; i++) { - - // This is H*(PSS) = R* \cdot PSS - tmp_re = (int16_t)(((pss_ext2[i<<1] * (int32_t)pss[i<<1])>>15) + ((pss_ext2[1+(i<<1)] * (int32_t)pss[1+(i<<1)])>>15)); - tmp_im = (int16_t)(((pss_ext2[i<<1] * (int32_t)pss[1+(i<<1)])>>15) - ((pss_ext2[1+(i<<1)] * (int32_t)pss[(i<<1)])>>15)); - // printf("H*(%d,%d) : (%d,%d)\n",aarx,i,tmp_re,tmp_im); - // This is R(SSS) \cdot H*(PSS) - tmp_re2 = (int16_t)(((tmp_re * (int32_t)sss_ext2[i<<1])>>15) - ((tmp_im * (int32_t)sss_ext2[1+(i<<1)]>>15))); - tmp_im2 = (int16_t)(((tmp_re * (int32_t)sss_ext2[1+(i<<1)])>>15) + ((tmp_im * (int32_t)sss_ext2[(i<<1)]>>15))); - - // printf("SSSi(%d,%d) : (%d,%d)\n",aarx,i,sss_ext2[i<<1],sss_ext2[1+(i<<1)]); - // printf("SSSo(%d,%d) : (%d,%d)\n",aarx,i,tmp_re2,tmp_im2); - // MRC on RX antennas - if (aarx==0) { - sss_ext3[i<<1] = tmp_re2; - sss_ext3[1+(i<<1)] = tmp_im2; - } else { - sss_ext3[i<<1] += tmp_re2; - sss_ext3[1+(i<<1)] += tmp_im2; - } - } - } - - // sss_ext now contains the compensated SSS - return(0); -} - - -int _do_pss_sss_extract(PHY_VARS_UE *ue, - int32_t pss_ext[4][72], - int32_t sss_ext[4][72], - uint8_t doPss, uint8_t doSss, - uint8_t subframe) // add flag to indicate extracting only PSS, only SSS, or both -{ - - - - uint16_t rb,nb_rb=6; - uint8_t i,aarx; - int32_t *pss_rxF,*pss_rxF_ext; - int32_t *sss_rxF,*sss_rxF_ext; - LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; - uint8_t next_thread_id = ue->current_thread_id[subframe]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[subframe]+1); - - int rx_offset = frame_parms->ofdm_symbol_size-3*12; - uint8_t pss_symb,sss_symb; - - int32_t **rxdataF; - - //LOG_I(PHY,"do_pss_sss_extract subframe %d \n",subframe); - for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { - - if (frame_parms->frame_type == FDD) { - pss_symb = 6-frame_parms->Ncp; - sss_symb = pss_symb-1; - - rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF; - pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; - sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; - - } else { - pss_symb = 2; - sss_symb = frame_parms->symbols_per_tti-1; - - if(subframe==5 || subframe==0) - { - rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF; - sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; - - rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF; - pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; - } - else if(subframe==6 || subframe==1) - { - rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF; - pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; - - rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF; - sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; - } - else - { - AssertFatal(0,""); - } - - } - //printf("extract_rbs: symbol_mod=%d, rx_offset=%d, ch_offset=%d\n",symbol_mod, - // (rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))*2, - // LTE_CE_OFFSET+ch_offset+(symbol_mod*(frame_parms->ofdm_symbol_size))); - - pss_rxF_ext = &pss_ext[aarx][0]; - sss_rxF_ext = &sss_ext[aarx][0]; - - for (rb=0; rb<nb_rb; rb++) { - // skip DC carrier - if (rb==3) { - if(frame_parms->frame_type == FDD) - { - sss_rxF = &rxdataF[aarx][(1 + (sss_symb*(frame_parms->ofdm_symbol_size)))]; - pss_rxF = &rxdataF[aarx][(1 + (pss_symb*(frame_parms->ofdm_symbol_size)))]; - } - else - { - if(subframe==5 || subframe==0) - { - rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF; - sss_rxF = &rxdataF[aarx][(1 + (sss_symb*(frame_parms->ofdm_symbol_size)))]; - - rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF; - pss_rxF = &rxdataF[aarx][(1 + (pss_symb*(frame_parms->ofdm_symbol_size)))]; - } - else if(subframe==6 || subframe==1) - { - rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF; - pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; - - rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF; - sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; - } - else - { - AssertFatal(0,""); - } - } - } - - for (i=0; i<12; i++) { - if (doPss) {pss_rxF_ext[i]=pss_rxF[i];} - if (doSss) {sss_rxF_ext[i]=sss_rxF[i];} - } - - pss_rxF+=12; - sss_rxF+=12; - pss_rxF_ext+=12; - sss_rxF_ext+=12; - } - - } - - return(0); -} - -int pss_sss_extract(PHY_VARS_UE *phy_vars_ue, - int32_t pss_ext[4][72], - int32_t sss_ext[4][72], - uint8_t subframe) -{ - return _do_pss_sss_extract(phy_vars_ue, pss_ext, sss_ext, 1 /* doPss */, 1 /* doSss */, subframe); -} - -int pss_only_extract(PHY_VARS_UE *phy_vars_ue, - int32_t pss_ext[4][72], - uint8_t subframe) -{ - static int32_t dummy[4][72]; - return _do_pss_sss_extract(phy_vars_ue, pss_ext, dummy, 1 /* doPss */, 0 /* doSss */, subframe); -} - - -int sss_only_extract(PHY_VARS_UE *phy_vars_ue, - int32_t sss_ext[4][72], - uint8_t subframe) -{ - static int32_t dummy[4][72]; - return _do_pss_sss_extract(phy_vars_ue, dummy, sss_ext, 0 /* doPss */, 1 /* doSss */, subframe); -} - - -int16_t phase_re[7] = {16383, 25101, 30791, 32767, 30791, 25101, 16383}; -int16_t phase_im[7] = {-28378, -21063, -11208, 0, 11207, 21062, 28377}; - - -int rx_sss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *flip_max,uint8_t *phase_max) -{ - - uint8_t i; - int32_t pss_ext[4][72]; - int32_t sss0_ext[4][72],sss5_ext[4][72]; - uint8_t Nid2 = ue->common_vars.eNb_id; - uint8_t flip,phase; - uint16_t Nid1; - int16_t *sss0,*sss5; - LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; - int32_t metric; - int16_t *d0,*d5; - - if (frame_parms->frame_type == FDD) { -#ifdef DEBUG_SSS - - if (frame_parms->Ncp == NORMAL) - msg("[PHY][UE%d] Doing SSS for FDD Normal Prefix\n",ue->Mod_id); - else - msg("[PHY][UE%d] Doing SSS for FDD Extended Prefix\n",ue->Mod_id); - -#endif - // Do FFTs for SSS/PSS - // SSS - slot_fep(ue, - (frame_parms->symbols_per_tti/2)-2, // second to last symbol of - 0, // slot 0 - ue->rx_offset, - 0, - 1); - // PSS - slot_fep(ue, - (frame_parms->symbols_per_tti/2)-1, // last symbol of - 0, // slot 0 - ue->rx_offset, - 0, - 1); - } else { // TDD -#ifdef DEBUG_SSS - if (ue->frame_parms->Ncp == NORMAL) - msg("[PHY][UE%d] Doing SSS for TDD Normal Prefix\n",ue->Mod_id); - else - msg("[PHY][UE%d] Doing SSS for TDD Extended Prefix\n",ue->Mod_id); - -#endif - // SSS - slot_fep(ue, - (frame_parms->symbols_per_tti>>1)-1, // last symbol of - 1, // slot 1 - ue->rx_offset, - 0, - 1); - // PSS - slot_fep(ue, - 2, // symbol 2 of - 2, // slot 2 - ue->rx_offset, - 0, - 1); - } - // pss sss extract for subframe 0 - pss_sss_extract(ue, - pss_ext, - sss0_ext,0); - /* - write_output("rxsig0.m","rxs0",&ue->common_vars.rxdata[0][0],ue->frame_parms.samples_per_tti,1,1); - write_output("rxdataF0.m","rxF0",&ue->common_vars.rxdataF[0][0],2*14*ue->frame_parms.ofdm_symbol_size,2,1); - write_output("pss_ext0.m","pssext0",pss_ext,72,1,1); - write_output("sss0_ext0.m","sss0ext0",sss0_ext,72,1,1); - */ - - // get conjugated channel estimate from PSS (symbol 6), H* = R* \cdot PSS - // and do channel estimation and compensation based on PSS - - pss_ch_est(ue, - pss_ext, - sss0_ext); - - // write_output("sss0_comp0.m","sss0comp0",sss0_ext,72,1,1); - - if (ue->frame_parms.frame_type == FDD) { // FDD - - // SSS - slot_fep(ue, - (frame_parms->symbols_per_tti/2)-2, - 10, - ue->rx_offset, - 0,1); - // PSS - slot_fep(ue, - (frame_parms->symbols_per_tti/2)-1, - 10, - ue->rx_offset, - 0,1); - } else { // TDD - // SSS - slot_fep(ue, - (frame_parms->symbols_per_tti>>1)-1, - 11, - ue->rx_offset, - 0, - 1); - // PSS - slot_fep(ue, - 2, - 12, - ue->rx_offset, - 0, - 1); - } - - // pss sss extract for subframe 5 - pss_sss_extract(ue, - pss_ext, - sss5_ext,5); - - // write_output("sss5_ext0.m","sss5ext0",sss5_ext,72,1,1); - // get conjugated channel estimate from PSS (symbol 6), H* = R* \cdot PSS - // and do channel estimation and compensation based on PSS - - pss_ch_est(ue, - pss_ext, - sss5_ext); - - - - // now do the SSS detection based on the precomputed sequences in PHY/LTE_TRANSPORT/sss.h - - *tot_metric = -99999999; - - - sss0 = (int16_t*)&sss0_ext[0][5]; - sss5 = (int16_t*)&sss5_ext[0][5]; - - for (flip=0; flip<2; flip++) { // d0/d5 flip in RX frame - for (phase=0; phase<7; phase++) { // phase offset between PSS and SSS - for (Nid1 = 0 ; Nid1 <= 167; Nid1++) { // 168 possible Nid1 values - metric = 0; - - if (flip==0) { - d0 = &d0_sss[62*(Nid2 + (Nid1*3))]; - d5 = &d5_sss[62*(Nid2 + (Nid1*3))]; - } else { - d5 = &d0_sss[62*(Nid2 + (Nid1*3))]; - d0 = &d5_sss[62*(Nid2 + (Nid1*3))]; - } - - // This is the inner product using one particular value of each unknown parameter - for (i=0; i<62; i++) { - metric += (int16_t)(((d0[i]*((((phase_re[phase]*(int32_t)sss0[i<<1])>>19)-((phase_im[phase]*(int32_t)sss0[1+(i<<1)])>>19)))) + - (d5[i]*((((phase_re[phase]*(int32_t)sss5[i<<1])>>19)-((phase_im[phase]*(int32_t)sss5[1+(i<<1)])>>19)))))); - } - - // if the current metric is better than the last save it - if (metric > *tot_metric) { - *tot_metric = metric; - ue->frame_parms.Nid_cell = Nid2+(3*Nid1); - *phase_max = phase; - *flip_max=flip; -#ifdef DEBUG_SSS - msg("(flip,phase,Nid1) (%d,%d,%d), metric_phase %d tot_metric %d, phase_max %d, flip_max %d\n",flip,phase,Nid1,metric,*tot_metric,*phase_max,*flip_max); -#endif - - } - } - } - } - - return(0); -} - diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common.h b/openair1/PHY/LTE_TRANSPORT/transport_common.h new file mode 100644 index 0000000000..0f8a9889ed --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/transport_common.h @@ -0,0 +1,177 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/transport_commont.h +* \brief data structures for PDSCH/DLSCH/PUSCH/ULSCH physical and transport channel descriptors (TX/RX) common to both eNB/UE +* \author R. Knopp +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it +* \note +* \warning +*/ +#ifndef __TRANSPORT_COMMON__H__ +#define __TRANSPORT_COMMON__H__ +#include "PHY/defs_common.h" +#include "PHY/impl_defs_lte.h" +#include "dci.h" +#include "mdci.h" +//#include "uci.h" +#ifndef STANDALONE_COMPILE +#include "UTIL/LISTS/list.h" +#endif + +#define MOD_TABLE_QPSK_OFFSET 1 +#define MOD_TABLE_16QAM_OFFSET 5 +#define MOD_TABLE_64QAM_OFFSET 21 +#define MOD_TABLE_PSS_OFFSET 85 + +// structures below implement 36-211 and 36-212 + +/** @addtogroup _PHY_TRANSPORT_ + * @{ + */ + + + +#define NSOFT 1827072 +#define LTE_NULL 2 + +// maximum of 3 segments before each coding block if data length exceeds 6144 bits. + +#define MAX_NUM_DLSCH_SEGMENTS 16 +#define MAX_NUM_ULSCH_SEGMENTS MAX_NUM_DLSCH_SEGMENTS +#define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768) +#define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768) + +#define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE +#define MAX_NUM_RE (14*1200) + +#if !defined(SI_RNTI) +#define SI_RNTI (rnti_t)0xffff +#endif +#if !defined(M_RNTI) +#define M_RNTI (rnti_t)0xfffd +#endif +#if !defined(P_RNTI) +#define P_RNTI (rnti_t)0xfffe +#endif +#if !defined(CBA_RNTI) +#define CBA_RNTI (rnti_t)0xfff4 +#endif +#if !defined(C_RNTI) +#define C_RNTI (rnti_t)0x1234 +#endif +// These are the codebook indexes according to Table 6.3.4.2.3-1 of 36.211 +//1 layer +#define PMI_2A_11 0 +#define PMI_2A_1m1 1 +#define PMI_2A_1j 2 +#define PMI_2A_1mj 3 +//2 layers +#define PMI_2A_R1_10 0 +#define PMI_2A_R1_11 1 +#define PMI_2A_R1_1j 2 + +typedef enum { SEARCH_EXIST=0, + SEARCH_EXIST_OR_FREE} find_type_t; + +typedef enum { + SCH_IDLE=0, + ACTIVE, + CBA_ACTIVE, + DISABLED +} SCH_status_t; + + + + +#ifdef Rel14 +typedef enum { + CEmodeA = 0, + CEmodeB = 1 +} CEmode_t; +#endif + +#define PUSCH_x 2 +#define PUSCH_y 3 + +typedef enum { + pucch_format1=0, + pucch_format1a, + pucch_format1b, + pucch_format1b_csA2, + pucch_format1b_csA3, + pucch_format1b_csA4, + pucch_format2, + pucch_format2a, + pucch_format2b, + pucch_format3 // PUCCH format3 +} PUCCH_FMT_t; + +typedef enum { + SR, + HARQ, + CQI, + HARQ_SR, + HARQ_CQI, + SR_CQI, + HARQ_SR_CQI +} UCI_type_t; + +#ifdef Rel14 +typedef enum { + NOCE, + CEMODEA, + CEMODEB +} UE_type_t; +#endif + + + + + +typedef enum { + SI_PDSCH=0, + RA_PDSCH, + P_PDSCH, + PDSCH, + PDSCH1, + PMCH +} PDSCH_t; + +typedef enum { + rx_standard=0, + rx_IC_single_stream, + rx_IC_dual_stream, + rx_SIC_dual_stream +} RX_type_t; + + +typedef enum { + DCI_COMMON_SPACE, + DCI_UE_SPACE +} dci_space_t; + + +/**@}*/ +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h similarity index 55% rename from openair1/PHY/LTE_TRANSPORT/defs.h rename to openair1/PHY/LTE_TRANSPORT/transport_eNB.h index f1f4be3072..be89f0c13c 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h @@ -29,21 +29,18 @@ * \note * \warning */ -#ifndef __LTE_TRANSPORT_DEFS__H__ -#define __LTE_TRANSPORT_DEFS__H__ -#include "PHY/defs.h" +#ifndef __TRANSPORT_ENB__H__ +#define __TRANSPORT_ENB__H__ +#include "transport_common.h" +#include "PHY/defs_eNB.h" #include "PHY/impl_defs_lte.h" #include "dci.h" #include "mdci.h" -#include "uci.h" +#include "uci_common.h" #ifndef STANDALONE_COMPILE #include "UTIL/LISTS/list.h" #endif -#define MOD_TABLE_QPSK_OFFSET 1 -#define MOD_TABLE_16QAM_OFFSET 5 -#define MOD_TABLE_64QAM_OFFSET 21 -#define MOD_TABLE_PSS_OFFSET 85 // structures below implement 36-211 and 36-212 @@ -53,56 +50,6 @@ -#define NSOFT 1827072 -#define LTE_NULL 2 - -// maximum of 3 segments before each coding block if data length exceeds 6144 bits. - -#define MAX_NUM_DLSCH_SEGMENTS 16 -#define MAX_NUM_ULSCH_SEGMENTS MAX_NUM_DLSCH_SEGMENTS -#define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768) -#define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768) - -#define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE -#define MAX_NUM_RE (14*1200) - -#if !defined(SI_RNTI) -#define SI_RNTI (rnti_t)0xffff -#endif -#if !defined(M_RNTI) -#define M_RNTI (rnti_t)0xfffd -#endif -#if !defined(P_RNTI) -#define P_RNTI (rnti_t)0xfffe -#endif -#if !defined(CBA_RNTI) -#define CBA_RNTI (rnti_t)0xfff4 -#endif -#if !defined(C_RNTI) -#define C_RNTI (rnti_t)0x1234 -#endif -// These are the codebook indexes according to Table 6.3.4.2.3-1 of 36.211 -//1 layer -#define PMI_2A_11 0 -#define PMI_2A_1m1 1 -#define PMI_2A_1j 2 -#define PMI_2A_1mj 3 -//2 layers -#define PMI_2A_R1_10 0 -#define PMI_2A_R1_11 1 -#define PMI_2A_R1_1j 2 - -typedef enum { SEARCH_EXIST=0, - SEARCH_EXIST_OR_FREE} find_type_t; - -typedef enum { - SCH_IDLE=0, - ACTIVE, - CBA_ACTIVE, - DISABLED -} SCH_status_t; - - typedef struct { /// Status Flag indicating for this DLSCH (idle,active,disabled) SCH_status_t status; @@ -180,86 +127,6 @@ typedef struct { uint8_t codeword; } LTE_DL_eNB_HARQ_t; -typedef struct { - /// Indicator of first transmission - uint8_t first_tx; - /// Last Ndi received for this process on DCI (used for C-RNTI only) - uint8_t DCINdi; - /// Flag indicating that this ULSCH has a new packet (start of new round) - // uint8_t Ndi; - /// Status Flag indicating for this ULSCH (idle,active,disabled) - SCH_status_t status; - /// Subframe scheduling indicator (i.e. Transmission opportunity indicator) - uint8_t subframe_scheduling_flag; - /// Subframe cba scheduling indicator (i.e. Transmission opportunity indicator) - uint8_t subframe_cba_scheduling_flag; - /// First Allocated RB - uint16_t first_rb; - /// Current Number of RBs - uint16_t nb_rb; - /// Last TPC command - uint8_t TPC; - /// Transport block size - uint32_t TBS; - /// The payload + CRC size in bits, "B" from 36-212 - uint32_t B; - /// Length of ACK information (bits) - uint8_t O_ACK; - /// Pointer to the payload - uint8_t *b; - /// Pointers to transport block segments - uint8_t *c[MAX_NUM_ULSCH_SEGMENTS]; - /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15) - uint32_t RTC[MAX_NUM_ULSCH_SEGMENTS]; - /// Index of current HARQ round for this ULSCH - uint8_t round; - /// MCS format of this ULSCH - uint8_t mcs; - /// Redundancy-version of the current sub-frame - uint8_t rvidx; - /// Turbo-code outputs (36-212 V8.6 2009-03, p.12 - uint8_t d[MAX_NUM_ULSCH_SEGMENTS][(96+3+(3*6144))]; - /// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17) - uint8_t w[MAX_NUM_ULSCH_SEGMENTS][3*6144]; - /// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) - uint32_t C; - /// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Cminus; - /// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Cplus; - /// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Kminus; - /// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Kplus; - /// Total number of bits across all segments - uint32_t sumKr; - /// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t F; - /// Msc_initial, Initial number of subcarriers for ULSCH (36-212, v8.6 2009-03, p.26-27) - uint16_t Msc_initial; - /// Nsymb_initial, Initial number of symbols for ULSCH (36-212, v8.6 2009-03, p.26-27) - uint8_t Nsymb_initial; - /// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2) - uint8_t n_DMRS; - /// n_DMRS2 for cyclic shift of DMRS (36.211 Table 5.5.1.1.-1) - uint8_t n_DMRS2; - /// Flag to indicate that this is a control only ULSCH (i.e. no MAC SDU) - uint8_t control_only; - /// Flag to indicate that this is a calibration ULSCH (i.e. no MAC SDU and filled with TDD calibration information) - // int calibration_flag; - /// Number of soft channel bits - uint32_t G; - - // decode phich - uint8_t decode_phich; -} LTE_UL_UE_HARQ_t; - -#ifdef Rel14 -typedef enum { - CEmodeA = 0, - CEmodeB = 1 -} CEmode_t; -#endif typedef struct { /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) @@ -311,81 +178,7 @@ typedef struct { #endif } LTE_eNB_DLSCH_t; -#define PUSCH_x 2 -#define PUSCH_y 3 -typedef struct { - /// Current Number of Symbols - uint8_t Nsymb_pusch; - /// SRS active flag - uint8_t srs_active; - /// Pointers to 8 HARQ processes for the ULSCH - LTE_UL_UE_HARQ_t *harq_processes[8]; - /// Pointer to CQI data (+1 for 8 bits crc) - uint8_t o[1+MAX_CQI_BYTES]; - /// Length of CQI data (bits) - uint8_t O; - /// Format of CQI data - UCI_format_t uci_format; - /// Rank information - uint8_t o_RI[2]; - /// Length of rank information (bits) - uint8_t O_RI; - /// Pointer to ACK - uint8_t o_ACK[4]; - /// Minimum number of CQI bits for PUSCH (36-212 r8.6, Sec 5.2.4.1 p. 37) - uint8_t O_CQI_MIN; - /// ACK/NAK Bundling flag - uint8_t bundling; - /// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) - uint8_t e[MAX_NUM_CHANNEL_BITS]; - /// Interleaved "h"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) - uint8_t h[MAX_NUM_CHANNEL_BITS]; - /// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14) - uint8_t b_tilde[MAX_NUM_CHANNEL_BITS]; - /// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14) - int32_t d[MAX_NUM_RE]; - /// Transform-coded "z"-sequences (for definition see 36-211 V8.6 2009-03, p.14-15) - int32_t z[MAX_NUM_RE]; - /// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27) - uint8_t q[MAX_CQI_PAYLOAD]; - /// coded and interleaved CQI bits - uint8_t o_w[(MAX_CQI_BITS+8)*3]; - /// coded CQI bits - uint8_t o_d[96+((MAX_CQI_BITS+8)*3)]; - /// coded ACK bits - uint8_t q_ACK[MAX_ACK_PAYLOAD]; - /// coded RI bits - uint8_t q_RI[MAX_RI_PAYLOAD]; - /// beta_offset_cqi times 8 - uint16_t beta_offset_cqi_times8; - /// beta_offset_ri times 8 - uint16_t beta_offset_ri_times8; - /// beta_offset_harqack times 8 - uint16_t beta_offset_harqack_times8; - /// power_offset - uint8_t power_offset; - // for cooperative communication - uint8_t cooperation_flag; - /// RNTI attributed to this ULSCH - uint16_t rnti; - /// f_PUSCH parameter for PUSCH power control - int16_t f_pusch; - /// Po_PUSCH - target output power for PUSCH - int16_t Po_PUSCH; - /// PHR - current power headroom (based on last PUSCH transmission) - int16_t PHR; - /// Po_SRS - target output power for SRS - int16_t Po_SRS; - /// num active cba group - uint8_t num_active_cba_groups; - /// num dci found for cba - uint8_t num_cba_dci[10]; - /// allocated CBA RNTI - uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP]; - /// UL max-harq-retransmission - uint8_t Mlimit; -} LTE_UE_ULSCH_t; typedef struct { /// Flag indicating that this ULSCH has been allocated by a DCI (otherwise it is a retransmission based on PHICH NAK) @@ -510,38 +303,6 @@ typedef struct { int32_t delta_TF; } LTE_UL_eNB_HARQ_t; - -typedef enum { - pucch_format1=0, - pucch_format1a, - pucch_format1b, - pucch_format1b_csA2, - pucch_format1b_csA3, - pucch_format1b_csA4, - pucch_format2, - pucch_format2a, - pucch_format2b, - pucch_format3 // PUCCH format3 -} PUCCH_FMT_t; - -typedef enum { - SR, - HARQ, - CQI, - HARQ_SR, - HARQ_CQI, - SR_CQI, - HARQ_SR_CQI -} UCI_type_t; - -#ifdef Rel14 -typedef enum { - NOCE, - CEMODEA, - CEMODEB -} UE_type_t; -#endif - typedef struct { uint8_t active; /// Absolute frame for this UCI @@ -556,7 +317,7 @@ typedef struct { uint8_t srs_active; /// PUCCH format to use PUCCH_FMT_t pucch_fmt; - /// number of PUCCH antenna ports + /// number of PUCCH antenna ports uint8_t num_antenna_ports; /// number of PUCCH resources uint8_t num_pucch_resources; @@ -592,124 +353,6 @@ typedef struct { #endif } LTE_eNB_UCI; -typedef struct { - /// HARQ process mask, indicates which processes are currently active - uint16_t harq_mask; - /// Pointers to 8 HARQ processes for the ULSCH - LTE_UL_eNB_HARQ_t *harq_processes[8]; - /// Maximum number of HARQ rounds - uint8_t Mlimit; - /// Maximum number of iterations used in eNB turbo decoder - uint8_t max_turbo_iterations; - /// ACK/NAK Bundling flag - uint8_t bundling; - /// beta_offset_cqi times 8 - uint16_t beta_offset_cqi_times8; - /// beta_offset_ri times 8 - uint16_t beta_offset_ri_times8; - /// beta_offset_harqack times 8 - uint16_t beta_offset_harqack_times8; - /// Flag to indicate that eNB awaits UE Msg3 - uint8_t Msg3_active; - /// RNTI attributed to this ULSCH - uint16_t rnti; - /// cyclic shift for DM RS - uint8_t cyclicShift; - /// cooperation flag - uint8_t cooperation_flag; - /// num active cba group - uint8_t num_active_cba_groups; - /// allocated CBA RNTI for this ulsch - uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP]; -#ifdef LOCALIZATION - /// epoch timestamp in millisecond - int32_t reference_timestamp_ms; - /// aggregate physical states every n millisecond - int32_t aggregation_period_ms; - /// a set of lists used for localization - struct list loc_rss_list[10], loc_rssi_list[10], loc_subcarrier_rss_list[10], loc_timing_advance_list[10], loc_timing_update_list[10]; - struct list tot_loc_rss_list, tot_loc_rssi_list, tot_loc_subcarrier_rss_list, tot_loc_timing_advance_list, tot_loc_timing_update_list; -#endif -} LTE_eNB_ULSCH_t; - -typedef struct { - /// Indicator of first transmission - uint8_t first_tx; - /// Last Ndi received for this process on DCI (used for C-RNTI only) - uint8_t DCINdi; - /// DLSCH status flag indicating - SCH_status_t status; - /// Transport block size - uint32_t TBS; - /// The payload + CRC size in bits - uint32_t B; - /// Pointer to the payload - uint8_t *b; - /// Pointers to transport block segments - uint8_t *c[MAX_NUM_DLSCH_SEGMENTS]; - /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15) - uint32_t RTC[MAX_NUM_DLSCH_SEGMENTS]; - /// Index of current HARQ round for this DLSCH - uint8_t round; - /// MCS format for this DLSCH - uint8_t mcs; - /// Qm (modulation order) for this DLSCH - uint8_t Qm; - /// Redundancy-version of the current sub-frame - uint8_t rvidx; - /// MIMO mode for this DLSCH - MIMO_mode_t mimo_mode; - /// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - int16_t w[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)]; - /// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - double w_abs[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)]; - /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) - int16_t *d[MAX_NUM_DLSCH_SEGMENTS]; - /// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) - uint32_t C; - /// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Cminus; - /// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Cplus; - /// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Kminus; - /// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t Kplus; - /// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10) - uint32_t F; - /// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17) - uint8_t Nl; - /// current delta_pucch - int8_t delta_PUCCH; - /// Number of soft channel bits - uint32_t G; - /// Current Number of RBs - uint16_t nb_rb; - /// Current subband PMI allocation - uint16_t pmi_alloc; - /// Current RB allocation (even slots) - uint32_t rb_alloc_even[4]; - /// Current RB allocation (odd slots) - uint32_t rb_alloc_odd[4]; - /// distributed/localized flag - vrb_t vrb_type; - /// downlink power offset field - uint8_t dl_power_off; - /// trials per round statistics - uint32_t trials[8]; - /// error statistics per round - uint32_t errors[8]; - /// codeword this transport block is mapped to - uint8_t codeword; -} LTE_DL_UE_HARQ_t; - -typedef struct { - /// time-based localization, relying on TA and TOA - double time_based; - /// power-based localization, relying on RSS and RSSI - double power_based; -} eNB_UE_estimated_distances; - typedef struct { /// UL RSSI per receive antenna int32_t UL_rssi[NB_ANTENNAS_RX]; @@ -782,92 +425,40 @@ typedef struct { int total_TBS_last; /// Bitrate on the PDSCH [bps] unsigned int dlsch_bitrate; - // unsigned int total_transmitted_bits; -#ifdef LOCALIZATION - eNB_UE_estimated_distances distance; - int32_t *subcarrier_rssi; -#endif } LTE_eNB_UE_stats; typedef struct { - /// HARQ process id - uint8_t harq_id; - /// ACK bits (after decoding) 0:NACK / 1:ACK / 2:DTX - uint8_t ack; - /// send status (for PUCCH) - uint8_t send_harq_status; - /// nCCE (for PUCCH) - uint8_t nCCE; - /// DAI value detected from DCI1/1a/1b/1d/2/2a/2b/2c. 0xff indicates not touched - uint8_t vDAI_DL; - /// DAI value detected from DCI0/4. 0xff indicates not touched - uint8_t vDAI_UL; -} harq_status_t; - -typedef struct { - /// RNTI - uint16_t rnti; - /// Active flag for DLSCH demodulation - uint8_t active; - /// Transmission mode - uint8_t mode1_flag; - /// amplitude of PDSCH (compared to RS) in symbols without pilots - int16_t sqrt_rho_a; - /// amplitude of PDSCH (compared to RS) in symbols containing pilots - int16_t sqrt_rho_b; - /// Current HARQ process id threadRx Odd and threadRx Even - uint8_t current_harq_pid; - /// Current subband antenna selection - uint32_t antenna_alloc; - /// Current subband RI allocation - uint32_t ri_alloc; - /// Current subband CQI1 allocation - uint32_t cqi_alloc1; - /// Current subband CQI2 allocation - uint32_t cqi_alloc2; - /// saved subband PMI allocation from last PUSCH/PUCCH report - uint16_t pmi_alloc; - /// HARQ-ACKs - harq_status_t harq_ack[10]; - /// Pointers to up to 8 HARQ processes - LTE_DL_UE_HARQ_t *harq_processes[8]; - /// Maximum number of HARQ processes(for definition see 36-212 V8.6 2009-03, p.17 - uint8_t Mdlharq; - /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17) - uint8_t Kmimo; - /// Nsoft parameter related to UE Category - uint32_t Nsoft; - /// Maximum number of Turbo iterations + /// HARQ process mask, indicates which processes are currently active + uint16_t harq_mask; + /// Pointers to 8 HARQ processes for the ULSCH + LTE_UL_eNB_HARQ_t *harq_processes[8]; + /// Maximum number of HARQ rounds + uint8_t Mlimit; + /// Maximum number of iterations used in eNB turbo decoder uint8_t max_turbo_iterations; - /// number of iterations used in last turbo decoding - uint8_t last_iteration_cnt; - /// accumulated tx power adjustment for PUCCH - int8_t g_pucch; -} LTE_UE_DLSCH_t; - - - -typedef enum { - SI_PDSCH=0, - RA_PDSCH, - P_PDSCH, - PDSCH, - PDSCH1, - PMCH -} PDSCH_t; - -typedef enum { - rx_standard=0, - rx_IC_single_stream, - rx_IC_dual_stream, - rx_SIC_dual_stream -} RX_type_t; + /// ACK/NAK Bundling flag + uint8_t bundling; + /// beta_offset_cqi times 8 + uint16_t beta_offset_cqi_times8; + /// beta_offset_ri times 8 + uint16_t beta_offset_ri_times8; + /// beta_offset_harqack times 8 + uint16_t beta_offset_harqack_times8; + /// Flag to indicate that eNB awaits UE Msg3 + uint8_t Msg3_active; + /// RNTI attributed to this ULSCH + uint16_t rnti; + /// cyclic shift for DM RS + uint8_t cyclicShift; + /// cooperation flag + uint8_t cooperation_flag; + /// num active cba group + uint8_t num_active_cba_groups; + /// allocated CBA RNTI for this ulsch + uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP]; +} LTE_eNB_ULSCH_t; -typedef enum { - DCI_COMMON_SPACE, - DCI_UE_SPACE -} dci_space_t; /**@}*/ diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h new file mode 100644 index 0000000000..2e7d63bab7 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h @@ -0,0 +1,601 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/transport_proto.h + * \brief Function prototypes for eNB PHY physical/transport channel processing and generation V8.6 2009-03 + * \author R. Knopp, F. Kaltenberger + * \date 2011 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr + * \note + * \warning + */ +#ifndef __LTE_TRANSPORT_PROTO__H__ +#define __LTE_TRANSPORT_PROTO__H__ +#include "PHY/defs.h" +#include <math.h> +#include "nfapi_interface.h" + +// Functions below implement 36-211 and 36-212 + +/** @addtogroup _PHY_TRANSPORT_ + * @{ + */ + +/** \fn free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch,unsigned char N_RB_DL) + \brief This function frees memory allocated for a particular DLSCH at eNB + @param dlsch Pointer to DLSCH to be removed +*/ +void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch); + +void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch); + +/** \fn new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms) + \brief This function allocates structures for a particular DLSCH at eNB + @returns Pointer to DLSCH to be removed + @param Kmimo Kmimo factor from 36-212/36-213 + @param Mdlharq Maximum number of HARQ rounds (36-212/36-213) + @param Nsoft Soft-LLR buffer size from UE-Category + @params N_RB_DL total number of resource blocks (determine the operating BW) + @param abstraction_flag Flag to indicate abstracted interface + @param frame_parms Pointer to frame descriptor structure +*/ +LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms); + +void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch); + +/** \fn free_eNB_ulsch(LTE_eNB_DLSCH_t *dlsch) + \brief This function frees memory allocated for a particular ULSCH at eNB + @param ulsch Pointer to ULSCH to be removed +*/ +void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch); + +LTE_eNB_ULSCH_t *new_eNB_ulsch(uint8_t max_turbo_iterations,uint8_t N_RB_UL, uint8_t abstraction_flag); + +/** \fn dlsch_encoding(PHY_VARS_eNB *eNB, + uint8_t *input_buffer, + LTE_DL_FRAME_PARMS *frame_parms, + uint8_t num_pdcch_symbols, + LTE_eNB_DLSCH_t *dlsch, + int frame, + uint8_t subframe) + \brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). The implemented functions are: + - CRC computation and addition + - Code block segmentation and sub-block CRC addition + - Channel coding (Turbo coding) + - Rate matching (sub-block interleaving, bit collection, selection and transmission + - Code block concatenation + @param eNB Pointer to eNB PHY context + @param input_buffer Pointer to input buffer for sub-frame + @param frame_parms Pointer to frame descriptor structure + @param num_pdcch_symbols Number of PDCCH symbols in this subframe + @param dlsch Pointer to dlsch to be encoded + @param frame Frame number + @param subframe Subframe number + @param rm_stats Time statistics for rate-matching + @param te_stats Time statistics for turbo-encoding + @param i_stats Time statistics for interleaving + @returns status +*/ +int32_t dlsch_encoding(PHY_VARS_eNB *eNB, + uint8_t *a, + uint8_t num_pdcch_symbols, + LTE_eNB_DLSCH_t *dlsch, + int frame, + uint8_t subframe, + time_stats_t *rm_stats, + time_stats_t *te_stats, + time_stats_t *i_stats); + +int32_t dlsch_encoding_SIC(PHY_VARS_UE *ue, + uint8_t *a, + uint8_t num_pdcch_symbols, + LTE_eNB_DLSCH_t *dlsch, + int frame, + uint8_t subframe, + time_stats_t *rm_stats, + time_stats_t *te_stats, + time_stats_t *i_stats); + + + +/** \fn dlsch_encoding_2threads(PHY_VARS_eNB *eNB, + uint8_t *input_buffer, + uint8_t num_pdcch_symbols, + LTE_eNB_DLSCH_t *dlsch, + int frame, + uint8_t subframe) + \brief This function performs a subset of the bit-coding functions for LTE as described in 36-212, Release 8.Support is limited to turbo-coded channels (DLSCH/ULSCH). This version spawns 1 worker thread. The implemented functions are: + - CRC computation and addition + - Code block segmentation and sub-block CRC addition + - Channel coding (Turbo coding) + - Rate matching (sub-block interleaving, bit collection, selection and transmission + - Code block concatenation + @param eNB Pointer to eNB PHY context + @param input_buffer Pointer to input buffer for sub-frame + @param num_pdcch_symbols Number of PDCCH symbols in this subframe + @param dlsch Pointer to dlsch to be encoded + @param frame Frame number + @param subframe Subframe number + @param rm_stats Time statistics for rate-matching + @param te_stats Time statistics for turbo-encoding + @param i_stats Time statistics for interleaving + @returns status +*/ +int32_t dlsch_encoding_2threads(PHY_VARS_eNB *eNB, + uint8_t *a, + uint8_t num_pdcch_symbols, + LTE_eNB_DLSCH_t *dlsch, + int frame, + uint8_t subframe, + time_stats_t *rm_stats, + time_stats_t *te_stats, + time_stats_t *i_stats); + +// Functions below implement 36-211 + +/** \fn allocate_REs_in_RB(int32_t **txdataF, + uint32_t *jj, + uint32_t *jj2, + uint16_t re_offset, + uint32_t symbol_offset, + LTE_DL_eNB_HARQ_t *dlsch0_harq, + LTE_DL_eNB_HARQ_t *dlsch1_harq, + uint8_t pilots, + int16_t amp, + int16_t *qam_table_s, + uint32_t *re_allocated, + uint8_t skip_dc, + uint8_t skip_half, + uint8_t use2ndpilots, + LTE_DL_FRAME_PARMS *frame_parms); + + \brief Fills RB with data + \param txdataF pointer to output data (frequency domain signal) + \param jj index to output (from CW 1) + \param jj index to output (from CW 2) + \param re_offset index of the first RE of the RB + \param symbol_offset index to the OFDM symbol + \param dlsch0_harq Pointer to Transport block 0 HARQ structure + \param dlsch0_harq Pointer to Transport block 1 HARQ structure + \param pilots =1 if symbol_offset is an OFDM symbol that contains pilots, 0 otherwise + \param amp Amplitude for symbols + \param qam_table_s0 pointer to scaled QAM table for Transport Block 0 (by rho_a or rho_b) + \param qam_table_s1 pointer to scaled QAM table for Transport Block 1 (by rho_a or rho_b) + \param re_allocated pointer to allocation counter + \param skip_dc offset for positive RBs + \param skip_half indicate that first or second half of RB must be skipped for PBCH/PSS/SSS + \param use2ndpilots Set to use the pilots from antenna port 1 for PDSCH + \param frame_parms Frame parameter descriptor +*/ + +int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB, + int32_t **txdataF, + uint32_t *jj, + uint32_t *jj2, + uint16_t re_offset, + uint32_t symbol_offset, + LTE_DL_eNB_HARQ_t *dlsch0_harq, + LTE_DL_eNB_HARQ_t *dlsch1_harq, + uint8_t pilots, + int16_t amp, + uint8_t precoder_index, + int16_t *qam_table_s0, + int16_t *qam_table_s1, + uint32_t *re_allocated, + uint8_t skip_dc, + uint8_t skip_half, + uint8_t lprime, + uint8_t mprime, + uint8_t Ns, + int *P1_SHIFT, + int *P2_SHIFT); + + +/** \fn int32_t dlsch_modulation(int32_t **txdataF, + int16_t amp, + uint32_t sub_frame_offset, + LTE_DL_FRAME_PARMS *frame_parms, + uint8_t num_pdcch_symbols, + LTE_eNB_DLSCH_t *dlsch); + + \brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for DLSCH. + @param txdataF Table of pointers for frequency-domain TX signals + @param amp Amplitude of signal + @param sub_frame_offset Offset of this subframe in units of subframes (usually 0) + @param frame_parms Pointer to frame descriptor + @param num_pdcch_symbols Number of PDCCH symbols in this subframe + @param dlsch0 Pointer to Transport Block 0 DLSCH descriptor for this allocation + @param dlsch1 Pointer to Transport Block 0 DLSCH descriptor for this allocation +*/ +int32_t dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, + int32_t **txdataF, + int16_t amp, + uint32_t sub_frame_offset, + uint8_t num_pdcch_symbols, + LTE_eNB_DLSCH_t *dlsch0, + LTE_eNB_DLSCH_t *dlsch1); + +int32_t dlsch_modulation_SIC(int32_t **sic_buffer, + uint32_t sub_frame_offset, + LTE_DL_FRAME_PARMS *frame_parms, + uint8_t num_pdcch_symbols, + LTE_eNB_DLSCH_t *dlsch0, + int G); +/* + \brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for MCH. + @param txdataF Table of pointers for frequency-domain TX signals + @param amp Amplitude of signal + @param subframe_offset Offset of this subframe in units of subframes (usually 0) + @param frame_parms Pointer to frame descriptor + @param dlsch Pointer to DLSCH descriptor for this allocation +*/ +int mch_modulation(int32_t **txdataF, + int16_t amp, + uint32_t subframe_offset, + LTE_DL_FRAME_PARMS *frame_parms, + LTE_eNB_DLSCH_t *dlsch); + +/** \brief Top-level generation function for eNB TX of MBSFN + @param phy_vars_eNB Pointer to eNB variables + @param a Pointer to transport block + @param abstraction_flag + +*/ +void generate_mch(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t *a); + +/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) + @param phy_vars_eNB Pointer to eNB variables + @param proc Pointer to RXn-TXnp4 proc information + @param mcs MCS for MBSFN + @param ndi new data indicator + @param rdvix +*/ +void fill_eNB_dlsch_MCH(PHY_VARS_eNB *phy_vars_eNB,int mcs,int ndi,int rvidx); + +/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) + @param phy_vars_ue Pointer to UE variables + @param mcs MCS for MBSFN + @param eNB_id index of eNB in ue variables +*/ + +/** \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) + for N subframes. + @param phy_vars_eNB Pointer to eNB variables + @param txdataF Table of pointers for frequency-domain TX signals + @param amp Amplitude of signal + @param N Number of sub-frames to generate +*/ +void generate_pilots(PHY_VARS_eNB *phy_vars_eNB, + int32_t **txdataF, + int16_t amp, + uint16_t N); + +/** + \brief This function generates the frequency-domain pilots (cell-specific downlink reference signals) for one slot only + @param phy_vars_eNB Pointer to eNB variables + @param txdataF Table of pointers for frequency-domain TX signals + @param amp Amplitude of signal + @param slot index (0..19) + @param first_pilot_only (0 no) +*/ +int32_t generate_pilots_slot(PHY_VARS_eNB *phy_vars_eNB, + int32_t **txdataF, + int16_t amp, + uint16_t slot, + int first_pilot_only); + +int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB, + eNB_rxtx_proc_t *proc, + int32_t **txdataF, + int16_t amp); + +void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, + uint8_t UE_id, + int32_t **txdataF, + int16_t amp, + uint16_t Ntti, + uint8_t beamforming_mode); + +int32_t generate_pss(int32_t **txdataF, + int16_t amp, + LTE_DL_FRAME_PARMS *frame_parms, + uint16_t l, + uint16_t Ns); + + +int32_t generate_sss(int32_t **txdataF, + short amp, + LTE_DL_FRAME_PARMS *frame_parms, + unsigned short symbol, + unsigned short slot_offset); + +int32_t generate_pbch(LTE_eNB_PBCH *eNB_pbch, + int32_t **txdataF, + int32_t amp, + LTE_DL_FRAME_PARMS *frame_parms, + uint8_t *pbch_pdu, + uint8_t frame_mod4); + + + + +/*! \brief DCI Encoding. This routine codes an arbitrary DCI PDU after appending the 8-bit 3GPP CRC. It then applied sub-block interleaving and rate matching. + \param a Pointer to DCI PDU (coded in bytes) + \param A Length of DCI PDU in bits + \param E Length of DCI PDU in coded bits + \param e Pointer to sequence + \param rnti RNTI for CRC scrambling*/ +void dci_encoding(uint8_t *a, + uint8_t A, + uint16_t E, + uint8_t *e, + uint16_t rnti); + +/*! \brief Top-level DCI entry point. This routine codes an set of DCI PDUs and performs PDCCH modulation, interleaving and mapping. + \param num_dci Number of pdcch symbols + \param num_dci Number of DCI pdus to encode + \param dci_alloc Allocation vectors for each DCI pdu + \param n_rnti n_RNTI (see ) + \param amp Amplitude of QPSK symbols + \param frame_parms Pointer to DL Frame parameter structure + \param txdataF Pointer to tx signal buffers + \param sub_frame_offset subframe offset in frame + @returns Number of PDCCH symbols +*/ + +uint8_t generate_dci_top(uint8_t num_pdcch_symbols, + uint8_t num_dci, + DCI_ALLOC_t *dci_alloc, + uint32_t n_rnti, + int16_t amp, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t **txdataF, + uint32_t sub_frame_offset); + + +void generate_64qam_table(void); +void generate_16qam_table(void); + + + + + + + + +void ulsch_extract_rbs_single(int32_t **rxdataF, + int32_t **rxdataF_ext, + uint32_t first_rb, + uint32_t nb_rb, + uint8_t l, + uint8_t Ns, + LTE_DL_FRAME_PARMS *frame_parms); + + + + + +void fill_dci_and_dlsch(PHY_VARS_eNB *eNB, + int frame, + int subframe, + eNB_rxtx_proc_t *proc, + DCI_ALLOC_t *dci_alloc, + nfapi_dl_config_dci_dl_pdu *pdu); + +void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,mDCI_ALLOC_t *dci_alloc,nfapi_dl_config_mpdcch_pdu *pdu); + +void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_alloc, + nfapi_hi_dci0_dci_pdu *pdu); + +void fill_ulsch(PHY_VARS_eNB *eNB,nfapi_ul_config_ulsch_pdu *ulsch_pdu,int frame,int subframe); + +int generate_eNB_ulsch_params_from_rar(PHY_VARS_eNB *eNB, + unsigned char *rar_pdu, + uint32_t frame, + unsigned char subframe); + +int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB, + eNB_rxtx_proc_t *proc, + void *dci_pdu, + rnti_t rnti, + DCI_format_t dci_format, + uint8_t UE_id, + uint16_t si_rnti, + uint16_t ra_rnti, + uint16_t p_rnti, + uint16_t cba_rnti, + uint8_t use_srs); + + +void dump_ulsch(PHY_VARS_eNB *phy_vars_eNB,int frame, int subframe, uint8_t UE_id,int round); + + + + + +void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms, + uint8_t subframe, + uint8_t *b, + uint8_t *bt); + + +void generate_pcfich(uint8_t num_pdcch_symbols, + int16_t amp, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t **txdataF, + uint8_t subframe); + + + + + +void init_transport_channels(uint8_t); + + + +void rx_ulsch(PHY_VARS_eNB *eNB, + eNB_rxtx_proc_t *proc, + uint8_t UE_id); + + +/*! + \brief Decoding of PUSCH/ACK/RI/ACK from 36-212. + @param phy_vars_eNB Pointer to eNB top-level descriptor + @param proc Pointer to RXTX proc variables + @param UE_id ID of UE transmitting this PUSCH + @param subframe Index of subframe for PUSCH + @param control_only_flag Receive PUSCH with control information only + @param Nbundled Nbundled parameter for ACK/NAK scrambling from 36-212/36-213 + @param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used + @returns 0 on success +*/ +unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB, + eNB_rxtx_proc_t *proc, + uint8_t UE_id, + uint8_t control_only_flag, + uint8_t Nbundled, + uint8_t llr8_flag); + +/*! + \brief Decoding of ULSCH data component from 36-212. This one spawns 1 worker thread in parallel,half of the segments in each thread. + @param phy_vars_eNB Pointer to eNB top-level descriptor + @param UE_id ID of UE transmitting this PUSCH + @param harq_pid HARQ process ID + @param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used + @returns 0 on success +*/ +int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB, + int UE_id, + int harq_pid, + int llr8_flag); + +/*! + \brief Decoding of ULSCH data component from 36-212. This one is single thread. + @param phy_vars_eNB Pointer to eNB top-level descriptor + @param UE_id ID of UE transmitting this PUSCH + @param harq_pid HARQ process ID + @param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used + @returns 0 on success +*/ +int ulsch_decoding_data(PHY_VARS_eNB *eNB, + int UE_id, + int harq_pid, + int llr8_flag); + +void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB, + eNB_rxtx_proc_t *proc, + int16_t amp); + + + + + + + +void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi); + +void pdcch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, + uint8_t subframe, + int8_t* llr, + uint32_t length); + +void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, + int mbsfn_flag, + LTE_eNB_DLSCH_t *dlsch, + int hard_pid, + int G, + uint8_t q, + uint16_t frame, + uint8_t Ns); + + + +uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB, + PUCCH_FMT_t fmt, + uint8_t UE_id, + uint16_t n1_pucch, + uint16_t n2_pucch, + uint8_t shortened_format, + uint8_t *payload, + int frame, + uint8_t subframe, + uint8_t pucch1_thres); + + +/*! + \brief Process PRACH waveform + @param phy_vars_eNB Pointer to eNB top-level descriptor. If NULL, then this is an RRU + @param ru Pointer to RU top-level descriptor. If NULL, then this is an eNB and we make use of the RU_list + @param max_preamble most likely preamble + @param max_preamble_energy Estimated Energy of most likely preamble + @param max_preamble_delay Estimated Delay of most likely preamble + @param Nf System frame number + @param tdd_mapindex Index of PRACH resource in Table 5.7.1-4 (TDD) + @param br_flag indicator to act on eMTC PRACH + @returns 0 on success + +*/ +void rx_prach(PHY_VARS_eNB *phy_vars_eNB,RU_t *ru, + uint16_t *max_preamble, + uint16_t *max_preamble_energy, + uint16_t *max_preamble_delay, + uint16_t Nf, uint8_t tdd_mapindex +#ifdef Rel14 + , + uint8_t br_flag +#endif + ); + + +void init_unscrambling_lut(void); + + + +uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2ndpilots); + +uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode); + + + +double computeRhoA_eNB(uint8_t pa, + LTE_eNB_DLSCH_t *dlsch_eNB, + int dl_power_off, + uint8_t n_antenna_port); + +double computeRhoB_eNB(uint8_t pa, + uint8_t pb, + uint8_t n_antenna_port, + LTE_eNB_DLSCH_t *dlsch_eNB, + int dl_power_off); + + + + +int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); + +int8_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); + +int8_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type); + +/**@}*/ +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/uci.h b/openair1/PHY/LTE_TRANSPORT/uci_common.h similarity index 100% rename from openair1/PHY/LTE_TRANSPORT/uci.h rename to openair1/PHY/LTE_TRANSPORT/uci_common.h diff --git a/openair1/PHY/LTE_TRANSPORT/uci_tools.c b/openair1/PHY/LTE_TRANSPORT/uci_tools.c index 65640e2ec7..ef06386002 100644 --- a/openair1/PHY/LTE_TRANSPORT/uci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/uci_tools.c @@ -37,757 +37,6 @@ //#define DEBUG_UCI 1 -uint64_t pmi2hex_2Ar1(uint32_t pmi) -{ - - uint64_t pmil = (uint64_t)pmi; - - return ((pmil&3) + (((pmil>>2)&3)<<4) + (((pmil>>4)&3)<<8) + (((pmil>>6)&3)<<12) + - (((pmil>>8)&3)<<16) + (((pmil>>10)&3)<<20) + (((pmil>>12)&3)<<24) + - (((pmil>>14)&3)<<28) + (((pmil>>16)&3)<<32) + (((pmil>>18)&3)<<36) + - (((pmil>>20)&3)<<40) + (((pmil>>22)&3)<<44) + (((pmil>>24)&3)<<48)); -} - -uint64_t pmi2hex_2Ar2(uint32_t pmi) -{ - - uint64_t pmil = (uint64_t)pmi; - return ((pmil&1) + (((pmil>>1)&1)<<4) + (((pmil>>2)&1)<<8) + (((pmil>>3)&1)<<12) + - (((pmil>>4)&1)<<16) + (((pmil>>5)&1)<<20) + (((pmil>>6)&1)<<24) + - (((pmil>>7)&1)<<28) + (((pmil>>8)&1)<<32) + (((pmil>>9)&1)<<36) + - (((pmil>>10)&1)<<40) + (((pmil>>11)&1)<<44) + (((pmil>>12)&1)<<48)); -} - -uint64_t cqi2hex(uint32_t cqi) -{ - - uint64_t cqil = (uint64_t)cqi; - return ((cqil&3) + (((cqil>>2)&3)<<4) + (((cqil>>4)&3)<<8) + (((cqil>>6)&3)<<12) + - (((cqil>>8)&3)<<16) + (((cqil>>10)&3)<<20) + (((cqil>>12)&3)<<24) + - (((cqil>>14)&3)<<28) + (((cqil>>16)&3)<<32) + (((cqil>>18)&3)<<36) + - (((cqil>>20)&3)<<40) + (((cqil>>22)&3)<<44) + (((cqil>>24)&3)<<48)); -} - -//void do_diff_cqi(uint8_t N_RB_DL, -// uint8_t *DL_subband_cqi, -// uint8_t DL_cqi, -// uint32_t diffcqi1) { -// -// uint8_t nb_sb,i,offset; -// -// // This is table 7.2.1-3 from 36.213 (with k replaced by the number of subbands, nb_sb) -// switch (N_RB_DL) { -// case 6: -// nb_sb=0; -// break; -// case 15: -// nb_sb = 4; -// case 25: -// nb_sb = 7; -// break; -// case 50: -// nb_sb = 9; -// break; -// case 75: -// nb_sb = 10; -// break; -// case 100: -// nb_sb = 13; -// break; -// default: -// nb_sb=0; -// break; -// } -// -// memset(DL_subband_cqi,0,13); -// -// for (i=0;i<nb_sb;i++) { -// offset = (DL_cqi>>(2*i))&3; -// if (offset == 3) -// DL_subband_cqi[i] = DL_cqi - 1; -// else -// DL_subband_cqi[i] = DL_cqi + offset; -// } -//} - - -void do_diff_cqi(uint8_t N_RB_DL, - uint8_t *DL_subband_cqi, - uint8_t DL_cqi, - uint32_t diffcqi1) -{ - - uint8_t nb_sb,i,offset; - - // This is table 7.2.1-3 from 36.213 (with k replaced by the number of subbands, nb_sb) - switch (N_RB_DL) { - case 6: - nb_sb=1; - break; - - case 15: - nb_sb = 4; - break; - - case 25: - nb_sb = 7; - break; - - case 50: - nb_sb = 9; - break; - - case 75: - nb_sb = 10; - break; - - case 100: - nb_sb = 13; - break; - - default: - nb_sb=0; - break; - } - - memset(DL_subband_cqi,0,13); - - for (i=0; i<nb_sb; i++) { - offset = (diffcqi1>>(2*i))&3; - - if (offset == 3) - DL_subband_cqi[i] = DL_cqi - 1; - else - DL_subband_cqi[i] = DL_cqi + offset; - } -} - -void extract_CQI(void *o,UCI_format_t uci_format,LTE_eNB_UE_stats *stats, uint8_t N_RB_DL, uint16_t * crnti, uint8_t * access_mode) -{ - - //unsigned char rank; - //UCI_format fmt; - //uint8_t N_RB_DL = 25; - uint8_t i; - LOG_D(PHY,"[eNB][UCI] N_RB_DL %d uci format %d\n", N_RB_DL,uci_format); - - switch(N_RB_DL) { - case 6: - switch(uci_format) { - case wideband_cqi_rank1_2A: - stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_1_5MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_pmi_single = ((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi; - break; - - case wideband_cqi_rank2_2A: - stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi2); - - if (stats->DL_cqi[1] > 24) - stats->DL_cqi[1] = 24; - - stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_1_5MHz *)o)->pmi; - break; - - case HLC_subband_cqi_nopmi: - stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_1_5MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_1_5MHz *)o)->diffcqi1); - break; - - case HLC_subband_cqi_rank1_2A: - stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->diffcqi1)); - stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->pmi; - break; - - case HLC_subband_cqi_rank2_2A: - stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi2); - - if (stats->DL_cqi[1] > 24) - stats->DL_cqi[1] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi1)); - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi2)); - stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->pmi; - break; - - case unknown_cqi: - default: - LOG_N(PHY,"[eNB][UCI] received unknown uci (rb %d)\n",N_RB_DL); - break; - } - - break; - - case 25: - - switch(uci_format) { - case wideband_cqi_rank1_2A: - stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_5MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_pmi_single = ((wideband_cqi_rank1_2A_5MHz *)o)->pmi; - break; - - case wideband_cqi_rank2_2A: - stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi2); - - if (stats->DL_cqi[1] > 24) - stats->DL_cqi[1] = 24; - - stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_5MHz *)o)->pmi; - //this translates the 2-layer PMI into a single layer PMI for the first codeword - //the PMI for the second codeword will be stats->DL_pmi_single^0x1555 - stats->DL_pmi_single = 0; - for (i=0;i<7;i++) - stats->DL_pmi_single = stats->DL_pmi_single | (((stats->DL_pmi_dual&(1<i))>>i)*2)<<2*i; - break; - - case HLC_subband_cqi_nopmi: - stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_5MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_5MHz *)o)->diffcqi1); - break; - - case HLC_subband_cqi_rank1_2A: - stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); - stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi; - break; - - case HLC_subband_cqi_rank2_2A: - stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2); - - if (stats->DL_cqi[1] > 24) - stats->DL_cqi[1] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1)); - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2)); - stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi; - break; - - case unknown_cqi: - default: - LOG_N(PHY,"[eNB][UCI] received unknown uci (rb %d)\n",N_RB_DL); - break; - } - - break; - - case 50: - switch(uci_format) { - case wideband_cqi_rank1_2A: - stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_10MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_pmi_single = ((wideband_cqi_rank1_2A_10MHz *)o)->pmi; - break; - - case wideband_cqi_rank2_2A: - stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_10MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_10MHz *)o)->cqi2); - - if (stats->DL_cqi[1] > 24) - stats->DL_cqi[1] = 24; - - stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_10MHz *)o)->pmi; - break; - - case HLC_subband_cqi_nopmi: - stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_10MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_10MHz *)o)->diffcqi1); - break; - - case HLC_subband_cqi_rank1_2A: - stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_10MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_10MHz *)o)->diffcqi1)); - stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_10MHz *)o)->pmi; - break; - - case HLC_subband_cqi_rank2_2A: - stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi2); - - if (stats->DL_cqi[1] > 24) - stats->DL_cqi[1] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi1)); - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi2)); - stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_10MHz *)o)->pmi; - break; - - case unknown_cqi: - default: - LOG_N(PHY,"[eNB][UCI] received unknown uci (RB %d)\n",N_RB_DL); - break; - } - - break; - - case 100: - switch(uci_format) { - case wideband_cqi_rank1_2A: - stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_20MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_pmi_single = ((wideband_cqi_rank1_2A_20MHz *)o)->pmi; - break; - - case wideband_cqi_rank2_2A: - stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_20MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_20MHz *)o)->cqi2); - - if (stats->DL_cqi[1] > 24) - stats->DL_cqi[1] = 24; - - stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_20MHz *)o)->pmi; - break; - - case HLC_subband_cqi_nopmi: - stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_20MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_20MHz *)o)->diffcqi1); - break; - - case HLC_subband_cqi_rank1_2A: - stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_20MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_20MHz *)o)->diffcqi1)); - stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_20MHz *)o)->pmi; - break; - - case HLC_subband_cqi_rank2_2A: - stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi1); - - if (stats->DL_cqi[0] > 24) - stats->DL_cqi[0] = 24; - - stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi2); - - if (stats->DL_cqi[1] > 24) - stats->DL_cqi[1] = 24; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi1)); - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi2)); - stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_20MHz *)o)->pmi; - break; - - case unknown_cqi: - default: - LOG_N(PHY,"[eNB][UCI] received unknown uci (RB %d)\n",N_RB_DL); - break; - } - - break; - - default: - LOG_N(PHY,"[eNB][UCI] unknown RB %d\n",N_RB_DL); - break; - } - - /* - switch (tmode) { - - case 1: - case 2: - case 3: - case 5: - case 6: - case 7: - default: - fmt = hlc_cqi; - break; - case 4: - fmt = wideband_cqi; - break; - } - - rank = o_RI[0]; - //printf("extract_CQI: rank = %d\n",rank); - - switch (fmt) { - - case wideband_cqi: //and subband pmi - if (rank == 0) { - stats->DL_cqi[0] = (((wideband_cqi_rank1_2A_5MHz *)o)->cqi1); - if (stats->DL_cqi[0] > 15) - stats->DL_cqi[0] = 15; - stats->DL_pmi_single = ((wideband_cqi_rank1_2A_5MHz *)o)->pmi; - } - else { - stats->DL_cqi[0] = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi1); - if (stats->DL_cqi[0] > 15) - stats->DL_cqi[0] = 15; - stats->DL_cqi[1] = (((wideband_cqi_rank2_2A_5MHz *)o)->cqi2); - if (stats->DL_cqi[1] > 15) - stats->DL_cqi[1] = 15; - stats->DL_pmi_dual = ((wideband_cqi_rank2_2A_5MHz *)o)->pmi; - } - break; - case hlc_cqi: - if (tmode > 2) { - if (rank == 0) { - stats->DL_cqi[0] = (((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); - if (stats->DL_cqi[0] > 15) - stats->DL_cqi[0] = 15; - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); - stats->DL_pmi_single = ((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi; - } - else { - stats->DL_cqi[0] = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1); - if (stats->DL_cqi[0] > 15) - stats->DL_cqi[0] = 15; - stats->DL_cqi[1] = (((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2); - if (stats->DL_cqi[1] > 15) - stats->DL_cqi[1] = 15; - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1)); - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[1],stats->DL_cqi[1],(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2)); - stats->DL_pmi_dual = ((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi; - } - } - else { - stats->DL_cqi[0] = (((HLC_subband_cqi_nopmi_5MHz *)o)->cqi1); - if (stats->DL_cqi[0] > 15) - stats->DL_cqi[0] = 15; - - do_diff_cqi(N_RB_DL,stats->DL_subband_cqi[0],stats->DL_cqi[0],((HLC_subband_cqi_nopmi_5MHz *)o)->diffcqi1); - - } - break; - default: - break; - } - */ - -} - - -void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL) -{ - - - switch(uci_format) { - case wideband_cqi_rank1_2A: -#ifdef DEBUG_UCI - LOG_D(PHY,"[PRINT CQI] flat_LA %d\n", flag_LA); - switch(N_RB_DL) { - case 6: - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id, - ((wideband_cqi_rank1_2A_1_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id, - ((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi, - pmi2hex_2Ar1(((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi)); - break; - - case 25: - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id, - ((wideband_cqi_rank1_2A_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id, - ((wideband_cqi_rank1_2A_5MHz *)o)->pmi, - pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)o)->pmi)); - break; - - case 50: - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id, - ((wideband_cqi_rank1_2A_10MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id, - ((wideband_cqi_rank1_2A_10MHz *)o)->pmi, - pmi2hex_2Ar1(((wideband_cqi_rank1_2A_10MHz *)o)->pmi)); - break; - - case 100: - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id, - ((wideband_cqi_rank1_2A_20MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id, - ((wideband_cqi_rank1_2A_20MHz *)o)->pmi, - pmi2hex_2Ar1(((wideband_cqi_rank1_2A_20MHz *)o)->pmi)); - break; - } - -#endif //DEBUG_UCI - break; - - case wideband_cqi_rank2_2A: -#ifdef DEBUG_UCI - switch(N_RB_DL) { - case 6: - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi2); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_1_5MHz *)o)->pmi)); - break; - - case 25: - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi2); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_5MHz *)o)->pmi)); - break; - - case 50: - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_10MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_10MHz *)o)->cqi2); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_10MHz *)o)->pmi)); - break; - - case 100: - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_20MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_20MHz *)o)->cqi2); - LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_20MHz *)o)->pmi)); - break; - } - -#endif //DEBUG_UCI - break; - - case HLC_subband_cqi_nopmi: -#ifdef DEBUG_UCI - switch(N_RB_DL) { - case 6: - LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->diffcqi1)); - break; - - case 25: - LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); - break; - - case 50: - LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_10MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_10MHz *)o)->diffcqi1)); - break; - - case 100: - LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_20MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_20MHz *)o)->diffcqi1)); - break; - } - -#endif //DEBUG_UCI - break; - - case HLC_subband_cqi_rank1_2A: -#ifdef DEBUG_UCI - switch(N_RB_DL) { - case 6: - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi); - break; - - case 25: - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi); - break; - - case 50: - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi); - break; - - case 100: - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi); - break; - } - -#endif //DEBUG_UCI - break; - - case HLC_subband_cqi_rank2_2A: -#ifdef DEBUG_UCI - switch(N_RB_DL) { - case 6: - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi2); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi1)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi2)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->pmi); - break; - - case 25: - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi); - break; - - case 50: - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi2); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi1)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi2)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->pmi); - break; - - case 100: - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi1); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi2); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi1)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi2)); - LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->pmi); - break; - } - -#endif //DEBUG_UCI - break; - - case ue_selected: -#ifdef DEBUG_UCI - LOG_W(PHY,"[PRINT CQI] ue_selected CQI not supported yet!!!\n"); -#endif //DEBUG_UCI - break; - - default: -#ifdef DEBUG_UCI - LOG_E(PHY,"[PRINT CQI] unsupported CQI mode (%d)!!!\n",uci_format); -#endif //DEBUG_UCI - break; - } - - /* - switch (tmode) { - - case 1: - case 2: - case 3: - case 5: - case 6: - case 7: - default: - fmt = hlc_cqi; - break; - case 4: - fmt = wideband_cqi; - break; - } - - switch (fmt) { - - case wideband_cqi: - if (rank == 0) { - #ifdef DEBUG_UCI - msg("[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,((wideband_cqi_rank1_2A_5MHz *)o)->cqi1); - msg("[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id,((wideband_cqi_rank1_2A_5MHz *)o)->pmi,pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)o)->pmi)); - #endif //DEBUG_UCI - } - else { - #ifdef DEBUG_UCI - msg("[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi1); - msg("[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi2); - msg("[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_5MHz *)o)->pmi)); - #endif //DEBUG_UCI - } - break; - case hlc_cqi: - if (tmode > 2) { - if (rank == 0) { - #ifdef DEBUG_UCI - msg("[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); - msg("[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); - msg("[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi); - #endif //DEBUG_UCI - } - else { - #ifdef DEBUG_UCI - msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1); - msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2); - msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1)); - msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2)); - msg("[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi); - #endif //DEBUG_UCI - } - } - else { - #ifdef DEBUG_UCI - msg("[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); - msg("[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); - #endif //DEBUG_UCI - } - break; - case ue_selected: - #ifdef DEBUG_UCI - msg("dci_tools.c: print_CQI ue_selected CQI not supported yet!!!\n"); - #endif //DEBUG_UCI - break; - } - */ - -} - int8_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) { uint8_t i; diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c similarity index 100% rename from openair1/PHY/LTE_TRANSPORT/initial_sync.c rename to openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c index b7e24cb87d..7176337408 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c @@ -72,29 +72,7 @@ void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) //#endif } -void pcfich_scrambling(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t subframe, - uint8_t *b, - uint8_t *bt) -{ - uint32_t i; - uint8_t reset; - uint32_t x1, x2, s=0; - reset = 1; - // x1 is set in lte_gold_generic - x2 = ((((2*frame_parms->Nid_cell)+1)*(1+subframe))<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.7.1 - - for (i=0; i<32; i++) { - if ((i&0x1f)==0) { - s = lte_gold_generic(&x1, &x2, reset); - //printf("lte_gold[%d]=%x\n",i,s); - reset = 0; - } - - bt[i] = (b[i]&1) ^ ((s>>(i&0x1f))&1); - } -} void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, uint8_t subframe, @@ -122,99 +100,6 @@ void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms, } } -uint8_t pcfich_b[4][32]= {{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}, - {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,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,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} -}; - -void generate_pcfich(uint8_t num_pdcch_symbols, - int16_t amp, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t **txdataF, - uint8_t subframe) -{ - - uint8_t pcfich_bt[32],nsymb,pcfich_quad; - int32_t pcfich_d[2][16]; - uint8_t i; - uint32_t symbol_offset,m,re_offset,reg_offset; - int16_t gain_lin_QPSK; - uint16_t *pcfich_reg = frame_parms->pcfich_reg; - - int nushiftmod3 = frame_parms->nushift%3; -#ifdef DEBUG_PCFICH - LOG_D(PHY,"Generating PCFICH in subfrmae %d for %d PDCCH symbols, AMP %d, p %d, Ncp %d\n", - subframe,num_pdcch_symbols,amp,frame_parms->nb_antenna_ports_eNB,frame_parms->Ncp); -#endif - - // scrambling - if ((num_pdcch_symbols>0) && (num_pdcch_symbols<4)) - pcfich_scrambling(frame_parms,subframe,pcfich_b[num_pdcch_symbols-1],pcfich_bt); - - // modulation - if (frame_parms->nb_antenna_ports_eNB==1) - gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15); - else - gain_lin_QPSK = amp/2; - - if (frame_parms->nb_antenna_ports_eNB==1) { // SISO - - for (i=0; i<16; i++) { - ((int16_t*)(&(pcfich_d[0][i])))[0] = ((pcfich_bt[2*i] == 1) ? -gain_lin_QPSK : gain_lin_QPSK); - ((int16_t*)(&(pcfich_d[1][i])))[0] = ((pcfich_bt[2*i] == 1) ? -gain_lin_QPSK : gain_lin_QPSK); - ((int16_t*)(&(pcfich_d[0][i])))[1] = ((pcfich_bt[2*i+1] == 1) ? -gain_lin_QPSK : gain_lin_QPSK); - ((int16_t*)(&(pcfich_d[1][i])))[1] = ((pcfich_bt[2*i+1] == 1) ? -gain_lin_QPSK : gain_lin_QPSK); - } - } else { // ALAMOUTI - for (i=0; i<16; i+=2) { - // first antenna position n -> x0 - ((int16_t*)(&(pcfich_d[0][i])))[0] = ((pcfich_bt[2*i] == 1) ? -gain_lin_QPSK : gain_lin_QPSK); - ((int16_t*)(&(pcfich_d[0][i])))[1] = ((pcfich_bt[2*i+1] == 1) ? -gain_lin_QPSK : gain_lin_QPSK); - // second antenna position n -> -x1* - ((int16_t*)(&(pcfich_d[1][i])))[0] = ((pcfich_bt[2*i+2] == 1) ? gain_lin_QPSK : -gain_lin_QPSK); - ((int16_t*)(&(pcfich_d[1][i])))[1] = ((pcfich_bt[2*i+3] == 1) ? -gain_lin_QPSK : gain_lin_QPSK); - // fill in the rest of the ALAMOUTI precoding - ((int16_t*)&pcfich_d[0][i+1])[0] = -((int16_t*)&pcfich_d[1][i])[0]; - ((int16_t*)&pcfich_d[0][i+1])[1] = ((int16_t*)&pcfich_d[1][i])[1]; - ((int16_t*)&pcfich_d[1][i+1])[0] = ((int16_t*)&pcfich_d[0][i])[0]; - ((int16_t*)&pcfich_d[1][i+1])[1] = -((int16_t*)&pcfich_d[0][i])[1]; - - - } - } - - - // mapping - nsymb = (frame_parms->Ncp==0) ? 14:12; - - symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(subframe*nsymb); - re_offset = frame_parms->first_carrier_offset; - - // loop over 4 quadruplets and lookup REGs - m=0; - - for (pcfich_quad=0; pcfich_quad<4; pcfich_quad++) { - reg_offset = re_offset+((uint16_t)pcfich_reg[pcfich_quad]*6); - - if (reg_offset>=frame_parms->ofdm_symbol_size) - reg_offset=1 + reg_offset-frame_parms->ofdm_symbol_size; - - for (i=0; i<6; i++) { - if ((i!=nushiftmod3)&&(i!=(nushiftmod3+3))) { - txdataF[0][symbol_offset+reg_offset+i] = pcfich_d[0][m]; - - if (frame_parms->nb_antenna_ports_eNB>1) - txdataF[1][symbol_offset+reg_offset+i] = pcfich_d[1][m]; - - m++; - } - } - } - -} - - uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms, uint8_t subframe, LTE_UE_PDCCH *lte_ue_pdcch_vars, diff --git a/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c index 2bd7140c32..671f158a03 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c @@ -400,671 +400,6 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) } // num_pdcch_symbols loop -void generate_phich_emul(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t HI, - uint8_t subframe) -{ - - -} - -int32_t alam_bpsk_perm1[4] = {2,1,4,3}; // -conj(x) 1 (-1-j) -> 2 (1-j), 2->1, 3 (-1+j) -> (4) 1+j, 4->3 -int32_t alam_bpsk_perm2[4] = {3,4,2,1}; // conj(x) 1 (-1-j) -> 3 (-1+j), 3->1, 2 (1-j) -> 4 (1+j), 4->2 - -// This routine generates the PHICH - -void generate_phich(LTE_DL_FRAME_PARMS *frame_parms, - int16_t amp, - uint8_t nseq_PHICH, - uint8_t ngroup_PHICH, - uint8_t HI, - uint8_t subframe, - int32_t **y) -{ - - int16_t d[24],*dp; - // unsigned int i,aa; - unsigned int re_offset; - int16_t y0_16[8],y1_16[8]; - int16_t *y0,*y1; - // scrambling - uint32_t x1, x2, s=0; - uint8_t reset = 1; - int16_t cs[12]; - uint32_t i,i2,i3,m,j; - int16_t gain_lin_QPSK; - uint32_t subframe_offset=((frame_parms->Ncp==0)?14:12)*frame_parms->ofdm_symbol_size*subframe; - - memset(d,0,24*sizeof(int16_t)); - - if (frame_parms->nb_antenna_ports_eNB==1) - gain_lin_QPSK = (int16_t)(((int32_t)amp*ONE_OVER_SQRT2_Q15)>>15); - else - gain_lin_QPSK = amp/2; - - //printf("PHICH : gain_lin_QPSK %d\n",gain_lin_QPSK); - - // BPSK modulation of HI input (to be repeated 3 times, 36-212 Section 5.3.5, p. 56 in v8.6) - if (HI>0) - HI=1; - - - // c = (1-(2*HI))*SSS_AMP; - // x1 is set in lte_gold_generic - x2 = (((subframe+1)*((frame_parms->Nid_cell<<1)+1))<<9) + frame_parms->Nid_cell; - - s = lte_gold_generic(&x1, &x2, reset); - - // compute scrambling sequence - for (i=0; i<12; i++) { - cs[i] = (uint8_t)((s>>(i&0x1f))&1); - cs[i] = (cs[i] == 0) ? (1-(HI<<1)) : ((HI<<1)-1); - } - - if (frame_parms->Ncp == 0) { // Normal Cyclic Prefix - - // printf("Doing PHICH : Normal CP, subframe %d\n",subframe); - // 12 output symbols (Msymb) - for (i=0,i2=0,i3=0; i<3; i++,i2+=4,i3+=8) { - switch (nseq_PHICH) { - case 0: // +1 +1 +1 +1 - d[i3] = cs[i2]; - d[1+i3] = cs[i2]; - d[2+i3] = cs[1+i2]; - d[3+i3] = cs[1+i2]; - d[4+i3] = cs[2+i2]; - d[5+i3] = cs[2+i2]; - d[6+i3] = cs[3+i2]; - d[7+i3] = cs[3+i2]; - break; - - case 1: // +1 -1 +1 -1 - d[i3] = cs[i2]; - d[1+i3] = cs[i2]; - d[2+i3] = -cs[1+i2]; - d[3+i3] = -cs[1+i2]; - d[4+i3] = cs[2+i2]; - d[5+i3] = cs[2+i2]; - d[6+i3] = -cs[3+i2]; - d[7+i3] = -cs[3+i2]; - break; - - case 2: // +1 +1 -1 -1 - d[i3] = cs[i2]; - d[1+i3] = cs[i2]; - d[2+i3] = cs[1+i2]; - d[3+i3] = cs[1+i2]; - d[4+i3] = -cs[2+i2]; - d[5+i3] = -cs[2+i2]; - d[6+i3] = -cs[3+i2]; - d[7+i3] = -cs[3+i2]; - break; - - case 3: // +1 -1 -1 +1 - d[i3] = cs[i2]; - d[1+i3] = cs[i2]; - d[2+i3] = -cs[1+i2]; - d[3+i3] = -cs[1+i2]; - d[4+i3] = -cs[2+i2]; - d[5+i3] = -cs[2+i2]; - d[6+i3] = cs[3+i2]; - d[7+i3] = cs[3+i2]; - break; - - case 4: // +j +j +j +j - d[i3] = -cs[i2]; - d[1+i3] = cs[i2]; - d[2+i3] = -cs[1+i2]; - d[3+i3] = cs[1+i2]; - d[4+i3] = -cs[2+i2]; - d[5+i3] = cs[2+i2]; - d[6+i3] = -cs[3+i2]; - d[7+i3] = cs[3+i2]; - break; - - case 5: // +j -j +j -j - d[1+i3] = cs[i2]; - d[3+i3] = -cs[1+i2]; - d[5+i3] = cs[2+i2]; - d[7+i3] = -cs[3+i2]; - d[i3] = -cs[i2]; - d[2+i3] = cs[1+i2]; - d[4+i3] = -cs[2+i2]; - d[6+i3] = cs[3+i2]; - break; - - case 6: // +j +j -j -j - d[1+i3] = cs[i2]; - d[3+i3] = cs[1+i2]; - d[5+i3] = -cs[2+i2]; - d[7+i3] = -cs[3+i2]; - d[i3] = -cs[i2]; - d[2+i3] = -cs[1+i2]; - d[4+i3] = cs[2+i2]; - d[6+i3] = cs[3+i2]; - break; - - case 7: // +j -j -j +j - d[1+i3] = cs[i2]; - d[3+i3] = -cs[1+i2]; - d[5+i3] = -cs[2+i2]; - d[7+i3] = cs[3+i2]; - d[i3] = -cs[i2]; - d[2+i3] = cs[1+i2]; - d[4+i3] = cs[2+i2]; - d[6+i3] = -cs[3+i2]; - break; - - default: - AssertFatal(1==0,"phich_coding.c: Illegal PHICH Number\n"); - } // nseq_PHICH - } - -#ifdef DEBUG_PHICH - LOG_D(PHY,"[PUSCH 0]PHICH d = "); - - for (i=0; i<24; i+=2) - LOG_D(PHY,"(%d,%d)",d[i],d[i+1]); - - LOG_D(PHY,"\n"); -#endif - - // modulation here - if (frame_parms->nb_antenna_ports_eNB != 1) { - // do Alamouti precoding here - - // Symbol 0 - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][0]*6); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - y1 = (int16_t*)&y[1][re_offset+subframe_offset]; - - // first antenna position n -> x0 - y0_16[0] = d[0]*gain_lin_QPSK; - y0_16[1] = d[1]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[0] = -d[2]*gain_lin_QPSK; - y1_16[1] = d[3]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[2] = -y1_16[0]; - y0_16[3] = y1_16[1]; - y1_16[2] = y0_16[0]; - y1_16[3] = -y0_16[1]; - - // first antenna position n -> x0 - y0_16[4] = d[4]*gain_lin_QPSK; - y0_16[5] = d[5]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[4] = -d[6]*gain_lin_QPSK; - y1_16[5] = d[7]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[6] = -y1_16[4]; - y0_16[7] = y1_16[5]; - y1_16[6] = y0_16[4]; - y1_16[7] = -y0_16[5]; - - for (i=0,j=0,m=0; i<6; i++,j+=2) { - if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) { - y0[j] += y0_16[m]; - y1[j] += y1_16[m++]; - y0[j+1] += y0_16[m]; - y1[j+1] += y1_16[m++]; - } - } - - // Symbol 1 - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][1]*6); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - y1 = (int16_t*)&y[1][re_offset+subframe_offset]; - - // first antenna position n -> x0 - y0_16[0] = d[8]*gain_lin_QPSK; - y0_16[1] = d[9]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[0] = -d[10]*gain_lin_QPSK; - y1_16[1] = d[11]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[2] = -y1_16[0]; - y0_16[3] = y1_16[1]; - y1_16[2] = y0_16[0]; - y1_16[3] = -y0_16[1]; - - // first antenna position n -> x0 - y0_16[4] = d[12]*gain_lin_QPSK; - y0_16[5] = d[13]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[4] = -d[14]*gain_lin_QPSK; - y1_16[5] = d[15]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[6] = -y1_16[4]; - y0_16[7] = y1_16[5]; - y1_16[6] = y0_16[4]; - y1_16[7] = -y0_16[5]; - - for (i=0,j=0,m=0; i<6; i++,j+=2) { - if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) { - y0[j] += y0_16[m]; - y1[j] += y1_16[m++]; - y0[j+1] += y0_16[m]; - y1[j+1] += y1_16[m++]; - } - } - - // Symbol 2 - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][2]*6); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - y1 = (int16_t*)&y[1][re_offset+subframe_offset]; - - // first antenna position n -> x0 - y0_16[0] = d[16]*gain_lin_QPSK; - y0_16[1] = d[17]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[0] = -d[18]*gain_lin_QPSK; - y1_16[1] = d[19]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[2] = -y1_16[0]; - y0_16[3] = y1_16[1]; - y1_16[2] = y0_16[0]; - y1_16[3] = -y0_16[1]; - - // first antenna position n -> x0 - y0_16[4] = d[20]*gain_lin_QPSK; - y0_16[5] = d[21]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[4] = -d[22]*gain_lin_QPSK; - y1_16[5] = d[23]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[6] = -y1_16[4]; - y0_16[7] = y1_16[5]; - y1_16[6] = y0_16[4]; - y1_16[7] = -y0_16[5]; - - for (i=0,j=0,m=0; i<6; i++,j+=2) { - if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) { - y0[j] += y0_16[m]; - y1[j] += y1_16[m++]; - y0[j+1] += y0_16[m]; - y1[j+1] += y1_16[m++]; - } - } - - } // nb_antenna_ports_eNB - - else { - // Symbol 0 - // printf("[PUSCH 0]PHICH REG %d\n",frame_parms->phich_reg[ngroup_PHICH][0]); - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][0]*6); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - // printf("y0 %p\n",y0); - - y0_16[0] = d[0]*gain_lin_QPSK; - y0_16[1] = d[1]*gain_lin_QPSK; - y0_16[2] = d[2]*gain_lin_QPSK; - y0_16[3] = d[3]*gain_lin_QPSK; - y0_16[4] = d[4]*gain_lin_QPSK; - y0_16[5] = d[5]*gain_lin_QPSK; - y0_16[6] = d[6]*gain_lin_QPSK; - y0_16[7] = d[7]*gain_lin_QPSK; - - for (i=0,j=0,m=0; i<6; i++,j+=2) { - if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) { - y0[j] += y0_16[m++]; - y0[j+1] += y0_16[m++]; - } - } - - // Symbol 1 - // printf("[PUSCH 0]PHICH REG %d\n",frame_parms->phich_reg[ngroup_PHICH][1]); - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][1]*6); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - - y0_16[0] = d[8]*gain_lin_QPSK; - y0_16[1] = d[9]*gain_lin_QPSK; - y0_16[2] = d[10]*gain_lin_QPSK; - y0_16[3] = d[11]*gain_lin_QPSK; - y0_16[4] = d[12]*gain_lin_QPSK; - y0_16[5] = d[13]*gain_lin_QPSK; - y0_16[6] = d[14]*gain_lin_QPSK; - y0_16[7] = d[15]*gain_lin_QPSK; - - for (i=0,j=0,m=0; i<6; i++,j+=2) { - if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) { - y0[j] += y0_16[m++]; - y0[j+1] += y0_16[m++]; - } - } - - // Symbol 2 - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][2]*6); - - // printf("[PUSCH 0]PHICH REG %d\n",frame_parms->phich_reg[ngroup_PHICH][2]); - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - - y0_16[0] = d[16]*gain_lin_QPSK; - y0_16[1] = d[17]*gain_lin_QPSK; - y0_16[2] = d[18]*gain_lin_QPSK; - y0_16[3] = d[19]*gain_lin_QPSK; - y0_16[4] = d[20]*gain_lin_QPSK; - y0_16[5] = d[21]*gain_lin_QPSK; - y0_16[6] = d[22]*gain_lin_QPSK; - y0_16[7] = d[23]*gain_lin_QPSK; - - for (i=0,j=0,m=0; i<6; i++,j+=2) { - if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) { - y0[j] += y0_16[m++]; - y0[j+1] += y0_16[m++]; - } - } - - /* - for (i=0;i<512;i++) - printf("re %d (%d): %d,%d\n",i,subframe_offset+i,((int16_t*)&y[0][subframe_offset+i])[0],((int16_t*)&y[0][subframe_offset+i])[1]); - */ - } // nb_antenna_ports_eNB - } else { // extended prefix - - // 6 output symbols - if ((ngroup_PHICH & 1) == 1) - dp = &d[4]; - else - dp = d; - - switch (nseq_PHICH) { - case 0: // +1 +1 - dp[0] = cs[0]; - dp[2] = cs[1]; - dp[8] = cs[2]; - dp[10] = cs[3]; - dp[16] = cs[4]; - dp[18] = cs[5]; - dp[1] = cs[0]; - dp[3] = cs[1]; - dp[9] = cs[2]; - dp[11] = cs[3]; - dp[17] = cs[4]; - dp[19] = cs[5]; - break; - - case 1: // +1 -1 - dp[0] = cs[0]; - dp[2] = -cs[1]; - dp[8] = cs[2]; - dp[10] = -cs[3]; - dp[16] = cs[4]; - dp[18] = -cs[5]; - dp[1] = cs[0]; - dp[3] = -cs[1]; - dp[9] = cs[2]; - dp[11] = -cs[3]; - dp[17] = cs[4]; - dp[19] = -cs[5]; - break; - - case 2: // +j +j - dp[1] = cs[0]; - dp[3] = cs[1]; - dp[9] = cs[2]; - dp[11] = cs[3]; - dp[17] = cs[4]; - dp[19] = cs[5]; - dp[0] = -cs[0]; - dp[2] = -cs[1]; - dp[8] = -cs[2]; - dp[10] = -cs[3]; - dp[16] = -cs[4]; - dp[18] = -cs[5]; - - break; - - case 3: // +j -j - dp[1] = cs[0]; - dp[3] = -cs[1]; - dp[9] = cs[2]; - dp[11] = -cs[3]; - dp[17] = cs[4]; - dp[19] = -cs[5]; - dp[0] = -cs[0]; - dp[2] = cs[1]; - dp[8] = -cs[2]; - dp[10] = cs[3]; - dp[16] = -cs[4]; - dp[18] = cs[5]; - break; - - default: - AssertFatal(1==0,"phich_coding.c: Illegal PHICH Number\n"); - } - - - - if (frame_parms->nb_antenna_ports_eNB != 1) { - // do Alamouti precoding here - // Symbol 0 - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][0]*6); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - y1 = (int16_t*)&y[1][re_offset+subframe_offset]; - - // first antenna position n -> x0 - y0_16[0] = d[0]*gain_lin_QPSK; - y0_16[1] = d[1]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[0] = -d[2]*gain_lin_QPSK; - y1_16[1] = d[3]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[2] = -y1_16[0]; - y0_16[3] = y1_16[1]; - y1_16[2] = y0_16[0]; - y1_16[3] = -y0_16[1]; - - // first antenna position n -> x0 - y0_16[4] = d[4]*gain_lin_QPSK; - y0_16[5] = d[5]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[4] = -d[6]*gain_lin_QPSK; - y1_16[5] = d[7]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[6] = -y1_16[4]; - y0_16[7] = y1_16[5]; - y1_16[6] = y0_16[4]; - y1_16[7] = -y0_16[5]; - - for (i=0,j=0,m=0; i<6; i++,j+=2) { - if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) { - y0[j] += y0_16[m]; - y1[j] += y1_16[m++]; - y0[j+1] += y0_16[m]; - y1[j+1] += y1_16[m++]; - } - } - - // Symbol 1 - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][1]<<2); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - re_offset += (frame_parms->ofdm_symbol_size); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - y1 = (int16_t*)&y[1][re_offset+subframe_offset]; - - // first antenna position n -> x0 - y0_16[0] = d[8]*gain_lin_QPSK; - y0_16[1] = d[9]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[0] = -d[10]*gain_lin_QPSK; - y1_16[1] = d[11]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[2] = -y1_16[0]; - y0_16[3] = y1_16[1]; - y1_16[2] = y0_16[0]; - y1_16[3] = -y0_16[1]; - - // first antenna position n -> x0 - y0_16[4] = d[12]*gain_lin_QPSK; - y0_16[5] = d[13]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[4] = -d[14]*gain_lin_QPSK; - y1_16[5] = d[15]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[6] = -y1_16[4]; - y0_16[7] = y1_16[5]; - y1_16[6] = y0_16[4]; - y1_16[7] = -y0_16[5]; - - for (i=0,j=0,m=0; i<4; i++,j+=2) { - y0[j] += y0_16[m]; - y1[j] += y1_16[m++]; - y0[j+1] += y0_16[m]; - y1[j+1] += y1_16[m++]; - } - - // Symbol 2 - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][2]<<2); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - re_offset += (frame_parms->ofdm_symbol_size<<1); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - y1 = (int16_t*)&y[1][re_offset+subframe_offset]; - - // first antenna position n -> x0 - y0_16[0] = d[16]*gain_lin_QPSK; - y0_16[1] = d[17]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[0] = -d[18]*gain_lin_QPSK; - y1_16[1] = d[19]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[2] = -y1_16[0]; - y0_16[3] = y1_16[1]; - y1_16[2] = y0_16[0]; - y1_16[3] = -y0_16[1]; - - // first antenna position n -> x0 - y0_16[4] = d[20]*gain_lin_QPSK; - y0_16[5] = d[21]*gain_lin_QPSK; - // second antenna position n -> -x1* - y1_16[4] = -d[22]*gain_lin_QPSK; - y1_16[5] = d[23]*gain_lin_QPSK; - // fill in the rest of the ALAMOUTI precoding - y0_16[6] = -y1_16[4]; - y0_16[7] = y1_16[5]; - y1_16[6] = y0_16[4]; - y1_16[7] = -y0_16[5]; - - for (i=0,j=0,m=0; i<4; i++,j+=2) { - y0[j] += y0_16[m]; - y1[j] += y1_16[m++]; - y0[j+1] += y0_16[m]; - y1[j+1] += y1_16[m++]; - } - } else { - - // Symbol 0 - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][0]*6); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - - y0_16[0] = d[0]*gain_lin_QPSK; - y0_16[1] = d[1]*gain_lin_QPSK; - y0_16[2] = d[2]*gain_lin_QPSK; - y0_16[3] = d[3]*gain_lin_QPSK; - y0_16[4] = d[4]*gain_lin_QPSK; - y0_16[5] = d[5]*gain_lin_QPSK; - y0_16[6] = d[6]*gain_lin_QPSK; - y0_16[7] = d[7]*gain_lin_QPSK; - - for (i=0,j=0,m=0; i<6; i++,j+=2) { - if ((i!=(frame_parms->nushift))&&(i!=(frame_parms->nushift+3))) { - y0[j] += y0_16[m++]; - y0[j+1] += y0_16[m++]; - } - } - - // Symbol 1 - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][1]<<2); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - re_offset += (frame_parms->ofdm_symbol_size); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - - y0_16[0] = d[8]*gain_lin_QPSK; - y0_16[1] = d[9]*gain_lin_QPSK; - y0_16[2] = d[10]*gain_lin_QPSK; - y0_16[3] = d[11]*gain_lin_QPSK; - y0_16[4] = d[12]*gain_lin_QPSK; - y0_16[5] = d[13]*gain_lin_QPSK; - y0_16[6] = d[14]*gain_lin_QPSK; - y0_16[7] = d[15]*gain_lin_QPSK; - - for (i=0,j=0,m=0; i<4; i++,j+=2) { - y0[j] += y0_16[m++]; - y0[j+1] += y0_16[m++]; - } - - - // Symbol 2 - re_offset = frame_parms->first_carrier_offset + (frame_parms->phich_reg[ngroup_PHICH][2]<<2); - - if (re_offset > frame_parms->ofdm_symbol_size) - re_offset -= (frame_parms->ofdm_symbol_size-1); - - re_offset += (frame_parms->ofdm_symbol_size<<1); - - y0 = (int16_t*)&y[0][re_offset+subframe_offset]; - - y0_16[0] = d[16]*gain_lin_QPSK; - y0_16[1] = d[17]*gain_lin_QPSK; - y0_16[2] = d[18]*gain_lin_QPSK; - y0_16[3] = d[19]*gain_lin_QPSK; - y0_16[4] = d[20]*gain_lin_QPSK; - y0_16[5] = d[21]*gain_lin_QPSK; - y0_16[6] = d[22]*gain_lin_QPSK; - y0_16[7] = d[23]*gain_lin_QPSK; - - for (i=0,j=0,m=0; i<4; i++) { - y0[j] += y0_16[m++]; - y0[j+1] += y0_16[m++]; - } - - } // nb_antenna_ports_eNB - } // normal/extended prefix -} - // This routine demodulates the PHICH and updates PUSCH/ULSCH parameters void rx_phich(PHY_VARS_UE *ue, @@ -1496,75 +831,3 @@ void rx_phich(PHY_VARS_UE *ue, } -void generate_phich_top(PHY_VARS_eNB *eNB, - eNB_rxtx_proc_t *proc, - int16_t amp) -{ - - - LTE_DL_FRAME_PARMS *frame_parms=&eNB->frame_parms; - int32_t **txdataF = eNB->common_vars.txdataF; - uint8_t harq_pid; - uint8_t Ngroup_PHICH,ngroup_PHICH,nseq_PHICH; - uint8_t NSF_PHICH = 4; - uint8_t pusch_subframe; - uint8_t i; - uint32_t pusch_frame; - int subframe = proc->subframe_tx; - phich_config_t *phich; - - // compute Ngroup_PHICH (see formula at beginning of Section 6.9 in 36-211 - - Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48; - - if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0) - Ngroup_PHICH++; - - if (frame_parms->Ncp == 1) - NSF_PHICH = 2; - - if (eNB->phich_vars[subframe&1].num_hi > 0) { - pusch_frame = phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe); - pusch_subframe = phich_subframe2_pusch_subframe(frame_parms,subframe); - harq_pid = subframe2harq_pid(frame_parms,pusch_frame,pusch_subframe); - } - - for (i=0; i<eNB->phich_vars[subframe&1].num_hi; i++) { - - phich = &eNB->phich_vars[subframe&1].config[i]; - - ngroup_PHICH = (phich->first_rb + - phich->n_DMRS)%Ngroup_PHICH; - - if ((frame_parms->tdd_config == 0) && (frame_parms->frame_type == TDD) ) { - - if ((pusch_subframe == 4) || (pusch_subframe == 9)) - ngroup_PHICH += Ngroup_PHICH; - } - - nseq_PHICH = ((phich->first_rb/Ngroup_PHICH) + - phich->n_DMRS)%(2*NSF_PHICH); - LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d subframe %d Generating PHICH, AMP %d ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d)\n", - eNB->Mod_id,harq_pid,proc->frame_tx, - subframe,amp,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH, - phich->hi, - phich->first_rb); - - T(T_ENB_PHY_PHICH, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(subframe), - T_INT(-1 /* TODO: rnti */), T_INT(harq_pid), - T_INT(Ngroup_PHICH), T_INT(NSF_PHICH), - T_INT(ngroup_PHICH), T_INT(nseq_PHICH), - T_INT(phich->hi), - T_INT(phich->first_rb), - T_INT(phich->n_DMRS)); - - generate_phich(frame_parms, - amp,//amp*2, - nseq_PHICH, - ngroup_PHICH, - phich->hi, - subframe, - txdataF); - }// for (i=0; i<eNB->phich_vars[subframe&1].num_hi; i++) { - eNB->phich_vars[subframe&1].num_hi=0; -} diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c index e756df1fe1..ad93e18bb9 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c @@ -184,56 +184,6 @@ int is_pmch_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_par return(0); } -void fill_eNB_dlsch_MCH(PHY_VARS_eNB *eNB,int mcs,int ndi,int rvidx) -{ - - LTE_eNB_DLSCH_t *dlsch = eNB->dlsch_MCH; - LTE_DL_FRAME_PARMS *frame_parms=&eNB->frame_parms; - - // dlsch->rnti = M_RNTI; - dlsch->harq_processes[0]->mcs = mcs; - // dlsch->harq_processes[0]->Ndi = ndi; - dlsch->harq_processes[0]->rvidx = rvidx; - dlsch->harq_processes[0]->Nl = 1; - dlsch->harq_processes[0]->TBS = TBStable[get_I_TBS(dlsch->harq_processes[0]->mcs)][frame_parms->N_RB_DL-1]; - // dlsch->harq_ids[subframe] = 0; - dlsch->harq_processes[0]->nb_rb = frame_parms->N_RB_DL; - - switch(frame_parms->N_RB_DL) { - case 6: - dlsch->harq_processes[0]->rb_alloc[0] = 0x3f; - break; - - case 25: - dlsch->harq_processes[0]->rb_alloc[0] = 0x1ffffff; - break; - - case 50: - dlsch->harq_processes[0]->rb_alloc[0] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc[1] = 0x3ffff; - break; - - case 100: - dlsch->harq_processes[0]->rb_alloc[0] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc[1] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc[2] = 0xffffffff; - dlsch->harq_processes[0]->rb_alloc[3] = 0xf; - break; - } - - if (eNB->abstraction_flag) { - eNB_transport_info[eNB->Mod_id][eNB->CC_id].cntl.pmch_flag=1; - eNB_transport_info[eNB->Mod_id][eNB->CC_id].num_pmch=1; // assumption: there is always one pmch in each SF - eNB_transport_info[eNB->Mod_id][eNB->CC_id].num_common_dci=0; - eNB_transport_info[eNB->Mod_id][eNB->CC_id].num_ue_spec_dci=0; - eNB_transport_info[eNB->Mod_id][eNB->CC_id].dlsch_type[0]=5;// put at the reserved position for PMCH - eNB_transport_info[eNB->Mod_id][eNB->CC_id].harq_pid[0]=0; - eNB_transport_info[eNB->Mod_id][eNB->CC_id].ue_id[0]=255;//broadcast - eNB_transport_info[eNB->Mod_id][eNB->CC_id].tbs[0]=dlsch->harq_processes[0]->TBS>>3; - } - -} - void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id) { @@ -280,62 +230,7 @@ void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id) } } -void generate_mch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,uint8_t *a) -{ - - int G; - int subframe = proc->subframe_tx; - int frame = proc->frame_tx; - - if (eNB->abstraction_flag != 0) { - if (eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]!=0) - printf("[PHY][EMU] PMCH transport block position is different than zero %d \n", eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]); - - memcpy(eNB->dlsch_MCH->harq_processes[0]->b, - a, - eNB->dlsch_MCH->harq_processes[0]->TBS>>3); - LOG_D(PHY, "[eNB %d] dlsch_encoding_emul pmch , tbs is %d \n", - eNB->Mod_id, - eNB->dlsch_MCH->harq_processes[0]->TBS>>3); - - memcpy(&eNB_transport_info[eNB->Mod_id][eNB->CC_id].transport_blocks[eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]], - a, - eNB->dlsch_MCH->harq_processes[0]->TBS>>3); - eNB_transport_info_TB_index[eNB->Mod_id][eNB->CC_id]+= eNB->dlsch_MCH->harq_processes[0]->TBS>>3;//=eNB_transport_info[eNB->Mod_id].tbs[0]; - } else { - G = get_G(&eNB->frame_parms, - eNB->frame_parms.N_RB_DL, - eNB->dlsch_MCH->harq_processes[0]->rb_alloc, - get_Qm(eNB->dlsch_MCH->harq_processes[0]->mcs),1, - 2,proc->frame_tx,subframe,0); - - generate_mbsfn_pilot(eNB,proc, - eNB->common_vars.txdataF, - AMP); - - - AssertFatal(dlsch_encoding(eNB, - a, - 1, - eNB->dlsch_MCH, - proc->frame_tx, - subframe, - &eNB->dlsch_rate_matching_stats, - &eNB->dlsch_turbo_encoding_stats, - &eNB->dlsch_interleaving_stats)==0, - "problem in dlsch_encoding"); - - dlsch_scrambling(&eNB->frame_parms,1,eNB->dlsch_MCH,0,G,0,frame,subframe<<1); - - - mch_modulation(eNB->common_vars.txdataF, - AMP, - subframe, - &eNB->frame_parms, - eNB->dlsch_MCH); - } -} void mch_extract_rbs(int **rxdataF, int **dl_ch_estimates, @@ -563,7 +458,7 @@ void mch_channel_compensation(int **rxdataF_ext, mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[1]); // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) - mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + mmtmpD0 = _mpm_srai_epi32(mmtmpD0,output_shift); mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/power_control_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/power_control_ue.c new file mode 100644 index 0000000000..36b2bfbeab --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/power_control_ue.c @@ -0,0 +1,152 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "PHY/defs.h" +#include "PHY/impl_defs_lte.h" + +//#define DEBUG_PC 0 +/* +double ratioPB[2][4]={{ 1.0,4.0/5.0,3.0/5.0,2.0/5.0}, + { 5.0/4.0,1.0,3.0/4.0,1.0/2.0}}; +*/ + +double ratioPB[2][4]={{ 0.00000, -0.96910, -2.21849, -3.97940}, //in db + { 0.96910, 0.00000, -1.24939, -3.01030}}; + +double pa_values[8]={-6.0,-4.77,-3.0,-1.77,0.0,1.0,2.0,3.0}; //reported by higher layers + +double get_pa_dB(uint8_t pa) +{ + AssertFatal(pa<8,"pa %d is not in (0...7)\n",pa); + + return(pa_values[pa]); + +} + +double computeRhoA_eNB(uint8_t pa, + LTE_eNB_DLSCH_t *dlsch_eNB, int dl_power_off, uint8_t n_antenna_port){ + double rho_a_dB; + double sqrt_rho_a_lin; + + rho_a_dB = get_pa_dB(pa); + + if(!dl_power_off) //if dl_power_offset is 0, this is for MU-interference, TM5 + rho_a_dB-=10*log10(2); + + if(n_antenna_port==4) // see TS 36.213 Section 5.2 + rho_a_dB+=10*log10(2); + + sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB)); + + dlsch_eNB->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13)); + +#if DEBUG_PC + printf("eNB: p_a=%d, value=%f, sqrt_rho_a=%d\n",p_a,pa_values[ pdsch_config_dedicated->p_a],dlsch_eNB->sqrt_rho_a); +#endif + + return(rho_a_dB); +} + +double computeRhoB_eNB(uint8_t pa, + uint8_t pb, + uint8_t n_antenna_port, + LTE_eNB_DLSCH_t *dlsch_eNB, + int dl_power_off) +{ + + double rho_a_dB, rho_b_dB; + double sqrt_rho_b_lin; + + AssertFatal(pa<8,"pa %d is not in (0...7)\n",pa); + AssertFatal(pb<4,"pb %d is not in (0...3)\n",pb); + rho_a_dB= computeRhoA_eNB(pa,dlsch_eNB,dl_power_off, n_antenna_port); + + if(n_antenna_port>1) + rho_b_dB= ratioPB[1][pb] + rho_a_dB; + else + rho_b_dB= ratioPB[0][pb] + rho_a_dB; + + sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB)); + + dlsch_eNB->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13)); + +#ifdef DEBUG_PC + printf("eNB: n_ant=%d, p_b=%d -> rho_b/rho_a=%f -> sqrt_rho_b=%d\n",n_antenna_port,pb,ratioPB[1][pb],dlsch_eNB->sqrt_rho_b); +#endif + return(rho_b_dB); +} + + +double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, + LTE_UE_DLSCH_t *dlsch_ue, + unsigned char dl_power_off, + uint8_t n_antenna_port + ){ + + double rho_a_dB; + double sqrt_rho_a_lin; + + rho_a_dB = get_pa_dB(pdsch_config_dedicated->p_a); + + if(!dl_power_off) + rho_a_dB-=10*log10(2); + //if dl_power_offset is 0, this is for MU-interference, TM5. But in practice UE may assume 16 or 64QAM TM4 as multiuser + + if(n_antenna_port==4) // see TS 36.213 Section 5.2 + rho_a_dB=+10*log10(2); + + sqrt_rho_a_lin= pow(10,(0.05*rho_a_dB)); + + dlsch_ue->sqrt_rho_a= (short) (sqrt_rho_a_lin*pow(2,13)); + +#ifdef DEBUG_PC + printf("UE: p_a=%d, value=%f, dl_power_off=%d, sqrt_rho_a=%d\n",pdsch_config_dedicated->p_a,pa_values[ pdsch_config_dedicated->p_a],dl_power_off,dlsch_ue->sqrt_rho_a); +#endif + + return(rho_a_dB); +} + +double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, + PDSCH_CONFIG_COMMON *pdsch_config_common, + uint8_t n_antenna_port, + LTE_UE_DLSCH_t *dlsch_ue, + unsigned char dl_power_off) +{ + + double rho_a_dB, rho_b_dB; + double sqrt_rho_b_lin; + + rho_a_dB= computeRhoA_UE(pdsch_config_dedicated,dlsch_ue,dl_power_off, n_antenna_port); + + if(n_antenna_port>1) + rho_b_dB= ratioPB[1][pdsch_config_common->p_b] + rho_a_dB; + else + rho_b_dB= ratioPB[0][pdsch_config_common->p_b] + rho_a_dB; + + sqrt_rho_b_lin= pow(10,(0.05*rho_b_dB)); + + dlsch_ue->sqrt_rho_b= (short) (sqrt_rho_b_lin*pow(2,13)); + +#ifdef DEBUG_PC + printf("UE: p_b=%d, n_ant=%d -> ratio=%f -> sqrt_rho_b=%d\n",pdsch_config_common->p_b, n_antenna_port,ratioPB[1][pdsch_config_common->p_b],dlsch_ue->sqrt_rho_b); +#endif + return(rho_b_dB); +} diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c new file mode 100644 index 0000000000..ea9074766f --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c @@ -0,0 +1,533 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/prach_ue.c + * \brief Top-level routines for decoding the PRACH physical channel V8.6 2009-03 + * \author R. Knopp + * \date 2011 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr + * \note + * \warning + */ +#include "PHY/sse_intrin.h" +#include "PHY/defs.h" +#include "PHY/extern.h" +//#include "prach.h" +#include "PHY/LTE_TRANSPORT/if4_tools.h" +#include "SCHED/defs.h" +#include "SCHED/extern.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + +#include "../LTE_TRANSPORT/prach_common.c" + +int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint16_t Nf ) +{ + + lte_frame_type_t frame_type = ue->frame_parms.frame_type; + //uint8_t tdd_config = ue->frame_parms.tdd_config; + uint16_t rootSequenceIndex = ue->frame_parms.prach_config_common.rootSequenceIndex; + uint8_t prach_ConfigIndex = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex; + uint8_t Ncs_config = ue->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig; + uint8_t restricted_set = ue->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag; + //uint8_t n_ra_prboffset = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset; + uint8_t preamble_index = ue->prach_resources[eNB_id]->ra_PreambleIndex; + uint8_t tdd_mapindex = ue->prach_resources[eNB_id]->ra_TDD_map_index; + int16_t *prachF = ue->prach_vars[eNB_id]->prachF; + static int16_t prach_tmp[45600*2] __attribute__((aligned(32))); + int16_t *prach = prach_tmp; + int16_t *prach2; + int16_t amp = ue->prach_vars[eNB_id]->amp; + int16_t Ncp; + uint8_t n_ra_prb; + uint16_t NCS; + uint16_t *prach_root_sequence_map; + uint16_t preamble_offset,preamble_shift; + uint16_t preamble_index0,n_shift_ra,n_shift_ra_bar; + uint16_t d_start,numshift; + + uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type); + //uint8_t Nsp=2; + //uint8_t f_ra,t1_ra; + uint16_t N_ZC = (prach_fmt<4)?839:139; + uint8_t not_found; + int k; + int16_t *Xu; + uint16_t u; + int32_t Xu_re,Xu_im; + uint16_t offset,offset2; + int prach_start; + int i, prach_len; + uint16_t first_nonzero_root_idx=0; + +#if defined(EXMIMO) || defined(OAI_USRP) + prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset); +#ifdef PRACH_DEBUG + LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, + prach_start, + ue->rx_offset, + ue->hw_timing_advance, + ue->N_TA_offset); +#endif + + if (prach_start<0) + prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); + + if (prach_start>=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) + prach_start-=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); + +#else //normal case (simulation) + prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset; + LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, + prach_start, + ue->rx_offset, + ue->hw_timing_advance, + ue->N_TA_offset); + +#endif + + + // First compute physical root sequence + if (restricted_set == 0) { + AssertFatal(Ncs_config <= 15, + "[PHY] FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", Ncs_config ); + NCS = NCS_unrestricted[Ncs_config]; + } else { + AssertFatal(Ncs_config <= 14, + "[PHY] FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", Ncs_config ); + NCS = NCS_restricted[Ncs_config]; + } + + n_ra_prb = get_prach_prb_offset(&(ue->frame_parms), + ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex, + ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset, + tdd_mapindex, Nf); + prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4; + + /* + // this code is not part of get_prach_prb_offset + if (frame_type == TDD) { // TDD + + if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) { + LOG_E( PHY, "[PHY][UE %"PRIu8"] Illegal prach_ConfigIndex %"PRIu8" for ", ue->Mod_id, prach_ConfigIndex ); + } + + // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211) + f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra; + + if (prach_fmt < 4) { + if ((f_ra&1) == 0) { + n_ra_prb = n_ra_prboffset + 6*(f_ra>>1); + } else { + n_ra_prb = ue->frame_parms.N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1); + } + } else { + if ((tdd_config >2) && (tdd_config<6)) + Nsp = 2; + + t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra; + + if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) { + n_ra_prb = 6*f_ra; + } else { + n_ra_prb = ue->frame_parms.N_RB_UL - 6*(f_ra+1); + } + } + } + */ + + // This is the relative offset (for unrestricted case) in the root sequence table (5.7.2-4 from 36.211) for the given preamble index + preamble_offset = ((NCS==0)? preamble_index : (preamble_index/(N_ZC/NCS))); + + if (restricted_set == 0) { + // This is the \nu corresponding to the preamble index + preamble_shift = (NCS==0)? 0 : (preamble_index % (N_ZC/NCS)); + preamble_shift *= NCS; + } else { // This is the high-speed case + +#ifdef PRACH_DEBUG + LOG_I(PHY,"[UE %d] High-speed mode, NCS_config %d\n",ue->Mod_id,Ncs_config); +#endif + + not_found = 1; + preamble_index0 = preamble_index; + // set preamble_offset to initial rootSequenceIndex and look if we need more root sequences for this + // preamble index and find the corresponding cyclic shift + preamble_offset = 0; // relative rootSequenceIndex; + + while (not_found == 1) { + // current root depending on rootSequenceIndex and preamble_offset + int index = (rootSequenceIndex + preamble_offset) % N_ZC; + + if (prach_fmt<4) { + // prach_root_sequence_map points to prach_root_sequence_map0_3 + DevAssert( index < sizeof(prach_root_sequence_map0_3) / sizeof(prach_root_sequence_map0_3[0]) ); + } else { + // prach_root_sequence_map points to prach_root_sequence_map4 + DevAssert( index < sizeof(prach_root_sequence_map4) / sizeof(prach_root_sequence_map4[0]) ); + } + + u = prach_root_sequence_map[index]; + + uint16_t n_group_ra = 0; + + if ( (du[u]<(N_ZC/3)) && (du[u]>=NCS) ) { + n_shift_ra = du[u]/NCS; + d_start = (du[u]<<1) + (n_shift_ra * NCS); + n_group_ra = N_ZC/d_start; + n_shift_ra_bar = max(0,(N_ZC-(du[u]<<1)-(n_group_ra*d_start))/N_ZC); + } else if ( (du[u]>=(N_ZC/3)) && (du[u]<=((N_ZC - NCS)>>1)) ) { + n_shift_ra = (N_ZC - (du[u]<<1))/NCS; + d_start = N_ZC - (du[u]<<1) + (n_shift_ra * NCS); + n_group_ra = du[u]/d_start; + n_shift_ra_bar = min(n_shift_ra,max(0,(du[u]- (n_group_ra*d_start))/NCS)); + } else { + n_shift_ra = 0; + n_shift_ra_bar = 0; + } + + // This is the number of cyclic shifts for the current root u + numshift = (n_shift_ra*n_group_ra) + n_shift_ra_bar; + + if (numshift>0 && preamble_index0==preamble_index) + first_nonzero_root_idx = preamble_offset; + + if (preamble_index0 < numshift) { + not_found = 0; + preamble_shift = (d_start * (preamble_index0/n_shift_ra)) + ((preamble_index0%n_shift_ra)*NCS); + + } else { // skip to next rootSequenceIndex and recompute parameters + preamble_offset++; + preamble_index0 -= numshift; + } + } + } + + // now generate PRACH signal +#ifdef PRACH_DEBUG + + if (NCS>0) + LOG_I(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, NCS %d (NCS_config %d, N_ZC/NCS %d) n_ra_prb %d: Preamble_offset %d, Preamble_shift %d\n", + rootSequenceIndex,preamble_index,NCS,Ncs_config,N_ZC/NCS,n_ra_prb, + preamble_offset,preamble_shift); + +#endif + + // nsymb = (frame_parms->Ncp==0) ? 14:12; + // subframe_offset = (unsigned int)frame_parms->ofdm_symbol_size*subframe*nsymb; + + k = (12*n_ra_prb) - 6*ue->frame_parms.N_RB_UL; + + if (k<0) + k+=ue->frame_parms.ofdm_symbol_size; + + k*=12; + k+=13; + + Xu = (int16_t*)ue->X_u[preamble_offset-first_nonzero_root_idx]; + + /* + k+=(12*ue->frame_parms.first_carrier_offset); + if (k>(12*ue->frame_parms.ofdm_symbol_size)) + k-=(12*ue->frame_parms.ofdm_symbol_size); + */ + k*=2; + + switch (ue->frame_parms.N_RB_UL) { + case 6: + memset((void*)prachF,0,4*1536); + break; + + case 15: + memset((void*)prachF,0,4*3072); + break; + + case 25: + memset((void*)prachF,0,4*6144); + break; + + case 50: + memset((void*)prachF,0,4*12288); + break; + + case 75: + memset((void*)prachF,0,4*18432); + break; + + case 100: + if (ue->frame_parms.threequarter_fs == 0) + memset((void*)prachF,0,4*24576); + else + memset((void*)prachF,0,4*18432); + break; + } + + for (offset=0,offset2=0; offset<N_ZC; offset++,offset2+=preamble_shift) { + + if (offset2 >= N_ZC) + offset2 -= N_ZC; + + Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15); + Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15); + prachF[k++]= ((Xu_re*ru[offset2<<1]) - (Xu_im*ru[1+(offset2<<1)]))>>15; + prachF[k++]= ((Xu_im*ru[offset2<<1]) + (Xu_re*ru[1+(offset2<<1)]))>>15; + + if (k==(12*2*ue->frame_parms.ofdm_symbol_size)) + k=0; + } + + switch (prach_fmt) { + case 0: + Ncp = 3168; + break; + + case 1: + case 3: + Ncp = 21024; + break; + + case 2: + Ncp = 6240; + break; + + case 4: + Ncp = 448; + break; + + default: + Ncp = 3168; + break; + } + + switch (ue->frame_parms.N_RB_UL) { + case 6: + Ncp>>=4; + prach+=4; // makes prach2 aligned to 128-bit + break; + + case 15: + Ncp>>=3; + break; + + case 25: + Ncp>>=2; + break; + + case 50: + Ncp>>=1; + break; + + case 75: + Ncp=(Ncp*3)>>2; + break; + } + + if (ue->frame_parms.threequarter_fs == 1) + Ncp=(Ncp*3)>>2; + + prach2 = prach+(Ncp<<1); + + // do IDFT + switch (ue->frame_parms.N_RB_UL) { + case 6: + if (prach_fmt == 4) { + idft256(prachF,prach2,1); + memmove( prach, prach+512, Ncp<<2 ); + prach_len = 256+Ncp; + } else { + idft1536(prachF,prach2,1); + memmove( prach, prach+3072, Ncp<<2 ); + prach_len = 1536+Ncp; + + if (prach_fmt>1) { + memmove( prach2+3072, prach2, 6144 ); + prach_len = 2*1536+Ncp; + } + } + + break; + + case 15: + if (prach_fmt == 4) { + idft512(prachF,prach2,1); + //TODO: account for repeated format in dft output + memmove( prach, prach+1024, Ncp<<2 ); + prach_len = 512+Ncp; + } else { + idft3072(prachF,prach2); + memmove( prach, prach+6144, Ncp<<2 ); + prach_len = 3072+Ncp; + + if (prach_fmt>1) { + memmove( prach2+6144, prach2, 12288 ); + prach_len = 2*3072+Ncp; + } + } + + break; + + case 25: + default: + if (prach_fmt == 4) { + idft1024(prachF,prach2,1); + memmove( prach, prach+2048, Ncp<<2 ); + prach_len = 1024+Ncp; + } else { + idft6144(prachF,prach2); + /*for (i=0;i<6144*2;i++) + prach2[i]<<=1;*/ + memmove( prach, prach+12288, Ncp<<2 ); + prach_len = 6144+Ncp; + + if (prach_fmt>1) { + memmove( prach2+12288, prach2, 24576 ); + prach_len = 2*6144+Ncp; + } + } + + break; + + case 50: + if (prach_fmt == 4) { + idft2048(prachF,prach2,1); + memmove( prach, prach+4096, Ncp<<2 ); + prach_len = 2048+Ncp; + } else { + idft12288(prachF,prach2); + memmove( prach, prach+24576, Ncp<<2 ); + prach_len = 12288+Ncp; + + if (prach_fmt>1) { + memmove( prach2+24576, prach2, 49152 ); + prach_len = 2*12288+Ncp; + } + } + + break; + + case 75: + if (prach_fmt == 4) { + idft3072(prachF,prach2); + //TODO: account for repeated format in dft output + memmove( prach, prach+6144, Ncp<<2 ); + prach_len = 3072+Ncp; + } else { + idft18432(prachF,prach2); + memmove( prach, prach+36864, Ncp<<2 ); + prach_len = 18432+Ncp; + + if (prach_fmt>1) { + memmove( prach2+36834, prach2, 73728 ); + prach_len = 2*18432+Ncp; + } + } + + break; + + case 100: + if (ue->frame_parms.threequarter_fs == 0) { + if (prach_fmt == 4) { + idft4096(prachF,prach2,1); + memmove( prach, prach+8192, Ncp<<2 ); + prach_len = 4096+Ncp; + } else { + idft24576(prachF,prach2); + memmove( prach, prach+49152, Ncp<<2 ); + prach_len = 24576+Ncp; + + if (prach_fmt>1) { + memmove( prach2+49152, prach2, 98304 ); + prach_len = 2* 24576+Ncp; + } + } + } + else { + if (prach_fmt == 4) { + idft3072(prachF,prach2); + //TODO: account for repeated format in dft output + memmove( prach, prach+6144, Ncp<<2 ); + prach_len = 3072+Ncp; + } else { + idft18432(prachF,prach2); + memmove( prach, prach+36864, Ncp<<2 ); + prach_len = 18432+Ncp; + printf("Generated prach for 100 PRB, 3/4 sampling\n"); + if (prach_fmt>1) { + memmove( prach2+36834, prach2, 73728 ); + prach_len = 2*18432+Ncp; + } + } + } + + break; + } + + //LOG_I(PHY,"prach_len=%d\n",prach_len); + + AssertFatal(prach_fmt<4, + "prach_fmt4 not fully implemented" ); +#if defined(EXMIMO) || defined(OAI_USRP) + int j; + int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti; + LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow ); + + for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) { + ((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4; + ((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4; + } + + for (i=0; i<overflow; i++,j++) { + ((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4; + ((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4; + } +#if defined(EXMIMO) + // handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on + for (k=prach_start - (ue->frame_parms.samples_per_tti>>1) ; k<prach_start ; k++) { + if (k<0) + ue->common_vars.txdata[0][k+ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; + else if (k>(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)) + ue->common_vars.txdata[0][k-ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE; + else + ue->common_vars.txdata[0][k] &= 0xFFFEFFFE; + } +#endif +#else + + for (i=0; i<prach_len; i++) { + ((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i] = prach[2*i]; + ((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i+1] = prach[2*i+1]; + } + +#endif + + + +#if defined(PRACH_WRITE_OUTPUT_DEBUG) + write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1); + write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1); + write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1); + exit(-1); +#endif + + return signal_energy( (int*)prach, 256 ); +} + diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c new file mode 100644 index 0000000000..2d022ccbab --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c @@ -0,0 +1,877 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/pucch.c +* \brief Top-level routines for generating and decoding the PUCCH physical channel V8.6 2009-03 +* \author R. Knopp +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr +* \note +* \warning +*/ +#include "PHY/defs.h" +#include "PHY/extern.h" +#include "LAYER2/MAC/extern.h" + +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + +#include "T.h" + +#include "pucch_common.c" + + + +void generate_pucch1x(int32_t **txdataF, + LTE_DL_FRAME_PARMS *frame_parms, + uint8_t ncs_cell[20][7], + PUCCH_FMT_t fmt, + PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, + uint16_t n1_pucch, + uint8_t shortened_format, + uint8_t *payload, + int16_t amp, + uint8_t subframe) +{ + + uint32_t u,v,n; + uint32_t z[12*14],*zptr; + int16_t d0; + uint8_t ns,N_UL_symb,nsymb,n_oc,n_oc0,n_oc1; + uint8_t c = (frame_parms->Ncp==0) ? 3 : 2; + uint16_t nprime,nprime0,nprime1; + uint16_t i,j,re_offset,thres,h; + uint8_t Nprime_div_deltaPUCCH_Shift,Nprime,d; + uint8_t m,l,refs; + uint8_t n_cs,S,alpha_ind,rem; + int16_t tmp_re,tmp_im,ref_re,ref_im,W_re=0,W_im=0; + int32_t *txptr; + uint32_t symbol_offset; + + uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift; + uint8_t NRB2 = frame_parms->pucch_config_common.nRB_CQI; + uint8_t Ncs1 = frame_parms->pucch_config_common.nCS_AN; + uint8_t Ncs1_div_deltaPUCCH_Shift = Ncs1/deltaPUCCH_Shift; + + LOG_D(PHY,"generate_pucch Start [deltaPUCCH_Shift %d, NRB2 %d, Ncs1_div_deltaPUCCH_Shift %d, n1_pucch %d]\n", deltaPUCCH_Shift, NRB2, Ncs1_div_deltaPUCCH_Shift,n1_pucch); + + + uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30; + uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30; + uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; + uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; + + if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) { + printf("[PHY] generate_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift); + return; + } + + if (Ncs1_div_deltaPUCCH_Shift > 7) { + printf("[PHY] generate_pucch: Illegal Ncs1_div_deltaPUCCH_Shift %d (should be 0...7)\n",Ncs1_div_deltaPUCCH_Shift); + return; + } + + zptr = z; + thres = (c*Ncs1_div_deltaPUCCH_Shift); + Nprime_div_deltaPUCCH_Shift = (n1_pucch < thres) ? Ncs1_div_deltaPUCCH_Shift : (12/deltaPUCCH_Shift); + Nprime = Nprime_div_deltaPUCCH_Shift * deltaPUCCH_Shift; + +#ifdef DEBUG_PUCCH_TX + printf("[PHY] PUCCH: cNcs1/deltaPUCCH_Shift %d, Nprime %d, n1_pucch %d\n",thres,Nprime,n1_pucch); +#endif + + LOG_D(PHY,"[PHY] PUCCH: n1_pucch %d, thres %d Ncs1_div_deltaPUCCH_Shift %d (12/deltaPUCCH_Shift) %d Nprime_div_deltaPUCCH_Shift %d \n", + n1_pucch, thres, Ncs1_div_deltaPUCCH_Shift, (int)(12/deltaPUCCH_Shift), Nprime_div_deltaPUCCH_Shift); + LOG_D(PHY,"[PHY] PUCCH: deltaPUCCH_Shift %d, Nprime %d\n",deltaPUCCH_Shift,Nprime); + + + N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6; + + if (n1_pucch < thres) + nprime0=n1_pucch; + else + nprime0 = (n1_pucch - thres)%(12*c/deltaPUCCH_Shift); + + if (n1_pucch >= thres) + nprime1= ((c*(nprime0+1))%((12*c/deltaPUCCH_Shift)+1))-1; + else { + d = (frame_parms->Ncp==0) ? 2 : 0; + h= (nprime0+d)%(c*Nprime_div_deltaPUCCH_Shift); +#ifdef DEBUG_PUCCH_TX + printf("[PHY] PUCCH: h %d, d %d\n",h,d); +#endif + nprime1 = (h/c) + (h%c)*Nprime_div_deltaPUCCH_Shift; + } + +#ifdef DEBUG_PUCCH_TX + printf("[PHY] PUCCH: nprime0 %d nprime1 %d, %s, payload (%d,%d)\n",nprime0,nprime1,pucch_format_string[fmt],payload[0],payload[1]); +#endif + + n_oc0 = nprime0/Nprime_div_deltaPUCCH_Shift; + + if (frame_parms->Ncp==1) + n_oc0<<=1; + + n_oc1 = nprime1/Nprime_div_deltaPUCCH_Shift; + + if (frame_parms->Ncp==1) // extended CP + n_oc1<<=1; + +#ifdef DEBUG_PUCCH_TX + printf("[PHY] PUCCH: noc0 %d noc1 %d\n",n_oc0,n_oc1); +#endif + + nprime=nprime0; + n_oc =n_oc0; + + // loop over 2 slots + for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) { + + if ((nprime&1) == 0) + S=0; // 1 + else + S=1; // j + + //loop over symbols in slot + for (l=0; l<N_UL_symb; l++) { + // Compute n_cs (36.211 p. 18) + n_cs = ncs_cell[ns][l]; + + if (frame_parms->Ncp==0) { // normal CP + n_cs = ((uint16_t)n_cs + (nprime*deltaPUCCH_Shift + (n_oc%deltaPUCCH_Shift))%Nprime)%12; + } else { + n_cs = ((uint16_t)n_cs + (nprime*deltaPUCCH_Shift + (n_oc>>1))%Nprime)%12; + } + + + refs=0; + + // Comput W_noc(m) (36.211 p. 19) + if ((ns==(1+(subframe<<1))) && (shortened_format==1)) { // second slot and shortened format + + if (l<2) { // data + W_re=W3_re[n_oc][l]; + W_im=W3_im[n_oc][l]; + } else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==0)) { // reference and normal CP + W_re=W3_re[n_oc][l-2]; + W_im=W3_im[n_oc][l-2]; + refs=1; + } else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==1)) { // reference and extended CP + W_re=W4[n_oc][l-2]; + W_im=0; + refs=1; + } else if ((l>=N_UL_symb-2)) { // data + W_re=W3_re[n_oc][l-N_UL_symb+4]; + W_im=W3_im[n_oc][l-N_UL_symb+4]; + } + } else { + if (l<2) { // data + W_re=W4[n_oc][l]; + W_im=0; + } else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==0)) { // reference and normal CP + W_re=W3_re[n_oc][l-2]; + W_im=W3_im[n_oc][l-2]; + refs=1; + } else if ((l<N_UL_symb-2)&&(frame_parms->Ncp==1)) { // reference and extended CP + W_re=W4[n_oc][l-2]; + W_im=0; + refs=1; + } else if ((l>=N_UL_symb-2)) { // data + W_re=W4[n_oc][l-N_UL_symb+4]; + W_im=0; + } + } + + // multiply W by S(ns) (36.211 p.17). only for data, reference symbols do not have this factor + if ((S==1)&&(refs==0)) { + tmp_re = W_re; + W_re = -W_im; + W_im = tmp_re; + } + +#ifdef DEBUG_PUCCH_TX + printf("[PHY] PUCCH: ncs[%d][%d]=%d, W_re %d, W_im %d, S %d, refs %d\n",ns,l,n_cs,W_re,W_im,S,refs); +#endif + alpha_ind=0; + // compute output sequence + + for (n=0; n<12; n++) { + + // this is r_uv^alpha(n) + tmp_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15); + tmp_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15); + + // this is S(ns)*w_noc(m)*r_uv^alpha(n) + ref_re = (tmp_re*W_re - tmp_im*W_im)>>15; + ref_im = (tmp_re*W_im + tmp_im*W_re)>>15; + + if ((l<2)||(l>=(N_UL_symb-2))) { //these are PUCCH data symbols + switch (fmt) { + case pucch_format1: //OOK 1-bit + + ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re)>>15; + ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im)>>15; + + break; + + case pucch_format1a: //BPSK 1-bit + d0 = (payload[0]&1)==0 ? amp : -amp; + ((int16_t *)&zptr[n])[0] = ((int32_t)d0*ref_re)>>15; + ((int16_t *)&zptr[n])[1] = ((int32_t)d0*ref_im)>>15; + // printf("d0 %d\n",d0); + break; + + case pucch_format1b: //QPSK 2-bits (Table 5.4.1-1 from 36.211, pg. 18) + if (((payload[0]&1)==0) && ((payload[1]&1)==0)) {// 1 + ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re)>>15; + ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im)>>15; + } else if (((payload[0]&1)==0) && ((payload[1]&1)==1)) { // -j + ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_im)>>15; + ((int16_t *)&zptr[n])[1] = (-(int32_t)amp*ref_re)>>15; + } else if (((payload[0]&1)==1) && ((payload[1]&1)==0)) { // j + ((int16_t *)&zptr[n])[0] = (-(int32_t)amp*ref_im)>>15; + ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_re)>>15; + } else { // -1 + ((int16_t *)&zptr[n])[0] = (-(int32_t)amp*ref_re)>>15; + ((int16_t *)&zptr[n])[1] = (-(int32_t)amp*ref_im)>>15; + } + + break; + case pucch_format1b_csA2: + case pucch_format1b_csA3: + case pucch_format1b_csA4: + AssertFatal(1==0,"PUCCH format 1b_csX not supported yet\n"); + break; + case pucch_format2: + case pucch_format2a: + case pucch_format2b: + AssertFatal(1==0,"should not go here\n"); + break; + + case pucch_format3: + fprintf(stderr, "PUCCH format 3 not handled\n"); + abort(); + } // switch fmt + } else { // These are PUCCH reference symbols + + ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re)>>15; + ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im)>>15; + // printf("ref\n"); + } + +#ifdef DEBUG_PUCCH_TX + printf("[PHY] PUCCH subframe %d z(%d,%d) => %d,%d, alpha(%d) => %d,%d\n",subframe,l,n,((int16_t *)&zptr[n])[0],((int16_t *)&zptr[n])[1], + alpha_ind,alpha_re[alpha_ind],alpha_im[alpha_ind]); +#endif + alpha_ind = (alpha_ind + n_cs)%12; + } // n + + zptr+=12; + } // l + + nprime=nprime1; + n_oc =n_oc1; + } // ns + + rem = ((((12*Ncs1_div_deltaPUCCH_Shift)>>3)&7)>0) ? 1 : 0; + + m = (n1_pucch < thres) ? NRB2 : (((n1_pucch-thres)/(12*c/deltaPUCCH_Shift))+NRB2+((deltaPUCCH_Shift*Ncs1_div_deltaPUCCH_Shift)>>3)+rem); + +#ifdef DEBUG_PUCCH_TX + printf("[PHY] PUCCH: m %d\n",m); +#endif + nsymb = N_UL_symb<<1; + + //for (j=0,l=0;l<(nsymb-1);l++) { + for (j=0,l=0; l<(nsymb); l++) { + if ((l<(nsymb>>1)) && ((m&1) == 0)) + re_offset = (m*6) + frame_parms->first_carrier_offset; + else if ((l<(nsymb>>1)) && ((m&1) == 1)) + re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; + else if ((m&1) == 0) + re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; + else + re_offset = ((m-1)*6) + frame_parms->first_carrier_offset; + + if (re_offset > frame_parms->ofdm_symbol_size) + re_offset -= (frame_parms->ofdm_symbol_size); + + symbol_offset = (unsigned int)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb)); + txptr = &txdataF[0][symbol_offset]; + + for (i=0; i<12; i++,j++) { + txptr[re_offset++] = z[j]; + + if (re_offset==frame_parms->ofdm_symbol_size) + re_offset = 0; + +#ifdef DEBUG_PUCCH_TX + printf("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]); +#endif + } + } + +} + +void generate_pucch_emul(PHY_VARS_UE *ue, + UE_rxtx_proc_t *proc, + PUCCH_FMT_t format, + uint8_t ncs1, + uint8_t *pucch_payload, + uint8_t sr) + +{ + + int subframe = proc->subframe_tx; + + UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_flag = format; + UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_Ncs1 = ncs1; + + + UE_transport_info[ue->Mod_id][ue->CC_id].cntl.sr = sr; + // the value of ue->pucch_sel[subframe] is set by get_n1_pucch + UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_sel = ue->pucch_sel[subframe]; + + // LOG_I(PHY,"subframe %d emu tx pucch_sel is %d sr is %d \n", subframe, UE_transport_info[ue->Mod_id].cntl.pucch_sel, sr); + + if (format == pucch_format1a) { + + ue->pucch_payload[0] = pucch_payload[0]; + UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_payload = pucch_payload[0]; + } else if (format == pucch_format1b) { + ue->pucch_payload[0] = pucch_payload[0] + (pucch_payload[1]<<1); + UE_transport_info[ue->Mod_id][ue->CC_id].cntl.pucch_payload = pucch_payload[0] + (pucch_payload[1]<<1); + } else if (format == pucch_format1) { + // LOG_D(PHY,"[UE %d] Frame %d subframe %d Generating PUCCH for SR %d\n",ue->Mod_id,proc->frame_tx,subframe,sr); + } + + ue->sr[subframe] = sr; + +} + + +inline void pucch2x_scrambling(LTE_DL_FRAME_PARMS *fp,int subframe,uint16_t rnti,uint32_t B,uint8_t *btilde) __attribute__((always_inline)); +inline void pucch2x_scrambling(LTE_DL_FRAME_PARMS *fp,int subframe,uint16_t rnti,uint32_t B,uint8_t *btilde) { + + uint32_t x1, x2, s=0; + int i; + uint8_t c; + + x2 = (rnti) + ((uint32_t)(1+subframe)<<16)*(1+(fp->Nid_cell<<1)); //this is c_init in 36.211 Sec 6.3.1 + s = lte_gold_generic(&x1, &x2, 1); + for (i=0;i<19;i++) { + c = (uint8_t)((s>>i)&1); + btilde[i] = (((B>>i)&1) ^ c); + } +} + +inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) __attribute__((always_inline)); +inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) { + + int i; + + for (i=0;i<20;i++) + d[i] = btilde[i] == 1 ? -amp : amp; + +} + + + +uint32_t pucch_code[13] = {0xFFFFF,0x5A933,0x10E5A,0x6339C,0x73CE0, + 0xFFC00,0xD8E64,0x4F6B0,0x218EC,0x1B746, + 0x0FFFF,0x33FFF,0x3FFFC}; + + +void generate_pucch2x(int32_t **txdataF, + LTE_DL_FRAME_PARMS *fp, + uint8_t ncs_cell[20][7], + PUCCH_FMT_t fmt, + PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, + uint16_t n2_pucch, + uint8_t *payload, + int A, + int B2, + int16_t amp, + uint8_t subframe, + uint16_t rnti) { + + int i,j; + uint32_t B=0; + uint8_t btilde[20]; + int16_t d[22]; + uint8_t deltaPUCCH_Shift = fp->pucch_config_common.deltaPUCCH_Shift; + uint8_t NRB2 = fp->pucch_config_common.nRB_CQI; + uint8_t Ncs1 = fp->pucch_config_common.nCS_AN; + + uint32_t u0 = fp->pucch_config_common.grouphop[subframe<<1]; + uint32_t u1 = fp->pucch_config_common.grouphop[1+(subframe<<1)]; + uint32_t v0 = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; + uint32_t v1 = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; + + uint32_t z[12*14],*zptr; + uint32_t u,v,n; + uint8_t ns,N_UL_symb,nsymb_slot0,nsymb_pertti; + uint32_t nprime,l,n_cs; + int alpha_ind,data_ind; + int16_t ref_re,ref_im; + int m,re_offset,symbol_offset; + int32_t *txptr; + + if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) { + printf("[PHY] generate_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift); + return; + } + + if (Ncs1 > 7) { + printf("[PHY] generate_pucch: Illegal Ncs1 %d (should be 0...7)\n",Ncs1); + return; + } + + // pucch2x_encoding + for (i=0;i<A;i++) + if ((*payload & (1<<i)) > 0) + B=B^pucch_code[i]; + + // scrambling + pucch2x_scrambling(fp,subframe,rnti,B,btilde); + // modulation + pucch2x_modulation(btilde,d,amp); + + // add extra symbol for 2a/2b + d[20]=0; + d[21]=0; + if (fmt==pucch_format2a) + d[20] = (B2 == 0) ? amp : -amp; + else if (fmt==pucch_format2b) { + switch (B2) { + case 0: + d[20] = amp; + break; + case 1: + d[21] = -amp; + break; + case 2: + d[21] = amp; + break; + case 3: + d[20] = -amp; + break; + default: + AssertFatal(1==0,"Illegal modulation symbol %d for PUCCH %s\n",B2,pucch_format_string[fmt]); + break; + } + } + + +#ifdef DEBUG_PUCCH_TX + printf("[PHY] PUCCH2x: n2_pucch %d\n",n2_pucch); +#endif + + N_UL_symb = (fp->Ncp==0) ? 7 : 6; + data_ind = 0; + zptr = z; + nprime = 0; + for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) { + + if ((ns&1) == 0) + nprime = (n2_pucch < 12*NRB2) ? + n2_pucch % 12 : + (n2_pucch+Ncs1 + 1)%12; + else { + nprime = (n2_pucch < 12*NRB2) ? + ((12*(nprime+1)) % 13)-1 : + (10-n2_pucch)%12; + } + //loop over symbols in slot + for (l=0; l<N_UL_symb; l++) { + // Compute n_cs (36.211 p. 18) + n_cs = (ncs_cell[ns][l]+nprime)%12; + + alpha_ind = 0; + for (n=0; n<12; n++) + { + // this is r_uv^alpha(n) + ref_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15); + ref_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15); + + if ((l!=1)&&(l!=5)) { //these are PUCCH data symbols + ((int16_t *)&zptr[n])[0] = ((int32_t)d[data_ind]*ref_re - (int32_t)d[data_ind+1]*ref_im)>>15; + ((int16_t *)&zptr[n])[1] = ((int32_t)d[data_ind]*ref_im + (int32_t)d[data_ind+1]*ref_re)>>15; + //LOG_I(PHY,"slot %d ofdm# %d ==> d[%d,%d] \n",ns,l,data_ind,n); + } + else { + if ((l==1) || ( (l==5) && (fmt==pucch_format2) )) + { + ((int16_t *)&zptr[n])[0] = ((int32_t)amp*ref_re>>15); + ((int16_t *)&zptr[n])[1] = ((int32_t)amp*ref_im>>15); + } + // l == 5 && pucch format 2a + else if (fmt==pucch_format2a) + { + ((int16_t *)&zptr[n])[0] = ((int32_t)d[20]*ref_re>>15); + ((int16_t *)&zptr[n])[1] = ((int32_t)d[21]*ref_im>>15); + } + // l == 5 && pucch format 2b + else if (fmt==pucch_format2b) + { + ((int16_t *)&zptr[n])[0] = ((int32_t)d[20]*ref_re>>15); + ((int16_t *)&zptr[n])[1] = ((int32_t)d[21]*ref_im>>15); + } + } // l==1 || l==5 + alpha_ind = (alpha_ind + n_cs)%12; + } // n + zptr+=12; + + if ((l!=1)&&(l!=5)) //these are PUCCH data symbols so increment data index + data_ind+=2; + } // l + } //ns + + m = n2_pucch/12; + +#ifdef DEBUG_PUCCH_TX + LOG_D(PHY,"[PHY] PUCCH: n2_pucch %d m %d\n",n2_pucch,m); +#endif + + nsymb_slot0 = ((fp->Ncp==0) ? 7 : 6); + nsymb_pertti = nsymb_slot0 << 1; + + //nsymb = nsymb_slot0<<1; + + //for (j=0,l=0;l<(nsymb-1);l++) { + for (j=0,l=0; l<(nsymb_pertti); l++) { + + if ((l<nsymb_slot0) && ((m&1) == 0)) + re_offset = (m*6) + fp->first_carrier_offset; + else if ((l<nsymb_slot0) && ((m&1) == 1)) + re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12; + else if ((m&1) == 0) + re_offset = fp->first_carrier_offset + (fp->N_RB_DL - (m>>1) - 1)*12; + else + re_offset = ((m-1)*6) + fp->first_carrier_offset; + + if (re_offset > fp->ofdm_symbol_size) + re_offset -= (fp->ofdm_symbol_size); + + + + symbol_offset = (unsigned int)fp->ofdm_symbol_size*(l+(subframe*nsymb_pertti)); + txptr = &txdataF[0][symbol_offset]; + + //LOG_I(PHY,"ofdmSymb %d/%d, firstCarrierOffset %d, symbolOffset[sfn %d] %d, reOffset %d, &txptr: %x \n", l, nsymb, fp->first_carrier_offset, subframe, symbol_offset, re_offset, &txptr[0]); + + for (i=0; i<12; i++,j++) { + txptr[re_offset] = z[j]; + + re_offset++; + + if (re_offset==fp->ofdm_symbol_size) + re_offset -= (fp->ofdm_symbol_size); + +#ifdef DEBUG_PUCCH_TX + LOG_D(PHY,"[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]); +#endif + } + } +} + +/* PUCCH format3 >> */ +/* DFT */ +void pucchfmt3_Dft( int16_t *x, int16_t *y ) +{ + int16_t i, k; + int16_t tmp[2]; + int16_t calctmp[D_NSC1RB*2]={0}; + + for (i=0; i<D_NSC1RB; i++) { + for(k=0; k<D_NSC1RB; k++) { + tmp[0] = alphaTBL_re[(12-((i*k)%12))%12]; + tmp[1] = alphaTBL_im[(12-((i*k)%12))%12]; + + calctmp[2*i] += (((int32_t)x[2*k] * tmp[0] - (int32_t)x[2*k+1] * tmp[1])>>15); + calctmp[2*i+1] += (((int32_t)x[2*k+1] * tmp[0] + (int32_t)x[2*k] * tmp[1])>>15); + } + y[2*i] = (int16_t)( (double) calctmp[2*i] / sqrt(D_NSC1RB)); + y[2*i+1] = (int16_t)((double) calctmp[2*i+1] / sqrt(D_NSC1RB)); + } +} + +void generate_pucch3x(int32_t **txdataF, + LTE_DL_FRAME_PARMS *frame_parms, + uint8_t ncs_cell[20][7], + PUCCH_FMT_t fmt, + PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, + uint16_t n3_pucch, + uint8_t shortened_format, + uint8_t *payload, + int16_t amp, + uint8_t subframe, + uint16_t rnti) +{ + + uint32_t u, v; + uint16_t i, j, re_offset; + uint32_t z[12*14], *zptr; + uint32_t y_tilda[12*14]={}, *y_tilda_ptr; + uint8_t ns, nsymb, n_oc, n_oc0, n_oc1; + uint8_t N_UL_symb = (frame_parms->Ncp==0) ? 7 : 6; + uint8_t m, l; + uint8_t n_cs; + int16_t tmp_re, tmp_im, W_re=0, W_im=0; + int32_t *txptr; + uint32_t symbol_offset; + + uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30; + uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30; + uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; + uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; + + // variables for channel coding + uint8_t chcod_tbl_idx = 0; + //uint8_t chcod_dt[48] = {}; + + // variables for Scrambling + uint32_t cinit = 0; + uint32_t x1; + uint32_t s,s0,s1; + uint8_t C[48] ={}; + uint8_t scr_dt[48]={}; + + // variables for Modulation + int16_t d_re[24]={}; + int16_t d_im[24]={}; + + // variables for orthogonal sequence selection + uint8_t N_PUCCH_SF0 = 5; + uint8_t N_PUCCH_SF1 = (shortened_format==0)? 5:4; + uint8_t first_slot = 0; + int16_t rot_re=0; + int16_t rot_im=0; + + uint8_t dt_offset; + uint8_t sym_offset; + int16_t y_re[14][12]; //={0}; + int16_t y_im[14][12]; //={0}; + + // DMRS + uint8_t alpha_idx=0; + uint8_t m_alpha_idx=0; + + // TODO + // "SR+ACK/NACK" length is only 7 bits. + // This restriction will be lifted in the future. + // "CQI/PMI/RI+ACK/NACK" will be supported in the future. + + // Channel Coding + for (uint8_t i=0; i<7; i++) { + chcod_tbl_idx += (payload[i]<<i); + } + + // Scrambling + cinit = (subframe + 1) * ((2 * frame_parms->Nid_cell + 1)<<16) + rnti; + s0 = lte_gold_generic(&x1,&cinit,1); + s1 = lte_gold_generic(&x1,&cinit,0); + + for (i=0; i<48; i++) { + s = (i<32)? s0:s1; + j = (i<32)? i:(i-32); + C[i] = ((s>>j)&1); + } + + for (i=0; i<48; i++) { + scr_dt[i] = chcod_tbl[chcod_tbl_idx][i] ^ C[i]; + } + + // Modulation + for (uint8_t i=0; i<48; i+=2){ + if (scr_dt[i]==0 && scr_dt[i+1]==0){ + d_re[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp) >>15); + d_im[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp) >>15); + } else if (scr_dt[i]==0 && scr_dt[i+1]==1) { + d_re[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp) >>15); + d_im[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp) >>15); + } else if (scr_dt[i]==1 && scr_dt[i+1]==0) { + d_re[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp)>>15); + d_im[ i>>1] = ((ONE_OVER_SQRT2_Q15 * amp)>>15); + } else if (scr_dt[i]==1 && scr_dt[i+1]==1) { + d_re[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp)>>15); + d_im[ i>>1] = -1 * ((ONE_OVER_SQRT2_Q15 * amp)>>15); + } else { + //***log Modulation Error! + } + } + + // Calculate Orthogonal Sequence index + n_oc0 = n3_pucch % N_PUCCH_SF1; + if (N_PUCCH_SF1 == 5) { + n_oc1 = (3 * n_oc0) % N_PUCCH_SF1; + } else { + n_oc1 = n_oc0 % N_PUCCH_SF1; + } + + y_tilda_ptr = y_tilda; + zptr = z; + + // loop over 2 slots + for (ns=(subframe<<1), u=u0, v=v0; ns<(2+(subframe<<1)); ns++, u=u1, v=v1) { + first_slot = (ns==(subframe<<1))?1:0; + + //loop over symbols in slot + for (l=0; l<N_UL_symb; l++) { + rot_re = RotTBL_re[(uint8_t) ncs_cell[ns][l]/64] ; + rot_im = RotTBL_im[(uint8_t) ncs_cell[ns][l]/64] ; + + // Comput W_noc(m) (36.211 p. 19) + if ( first_slot == 0 && shortened_format==1) { // second slot and shortened format + n_oc = n_oc1; + + if (l<1) { // data + W_re=W4_fmt3[n_oc][l]; + W_im=0; + } else if (l==1) { // DMRS + W_re=W2[0]; + W_im=0; + } else if (l>=2 && l<5) { // data + W_re=W4_fmt3[n_oc][l-1]; + W_im=0; + } else if (l==5) { // DMRS + W_re=W2[1]; + W_im=0; + } else if ((l>=N_UL_symb-2)) { // data + ; + } else { + //***log W Select Error! + } + } else { + if (first_slot == 1) { // 1st slot or 2nd slot and not shortened + n_oc=n_oc0; + } else { + n_oc=n_oc1; + } + + if (l<1) { // data + W_re=W5_fmt3_re[n_oc][l]; + W_im=W5_fmt3_im[n_oc][l]; + } else if (l==1) { // DMRS + W_re=W2[0]; + W_im=0; + } else if (l>=2 && l<5) { // data + W_re=W5_fmt3_re[n_oc][l-1]; + W_im=W5_fmt3_im[n_oc][l-1]; + } else if (l==5) { // DMRS + W_re=W2[1]; + W_im=0; + } else if ((l>=N_UL_symb-1)) { // data + W_re=W5_fmt3_re[n_oc][l-N_UL_symb+5]; + W_im=W5_fmt3_im[n_oc][l-N_UL_symb+5]; + } else { + //***log W Select Error! + } + } // W Selection end + + // Compute n_cs (36.211 p. 18) + n_cs = ncs_cell[ns][l]; + if (N_PUCCH_SF1 == 5) { + alpha_idx = (n_cs + Np5_TBL[n_oc]) % 12; + } else { + alpha_idx = (n_cs + Np4_TBL[n_oc]) % 12; + } + + // generate pucch data + dt_offset = (first_slot == 1) ? 0:12; + sym_offset = (first_slot == 1) ? 0:7; + + for (i=0; i<12; i++) { + // Calculate yn(i) + tmp_re = (((int32_t) (W_re*rot_re - W_im*rot_im)) >>15); + tmp_im = (((int32_t) (W_re*rot_im + W_im*rot_re)) >>15); + y_re[l+sym_offset][i] = (((int32_t) (tmp_re*d_re[i+dt_offset] - tmp_im*d_im[i+dt_offset]))>>15); + y_im[l+sym_offset][i] = (((int32_t) (tmp_re*d_im[i+dt_offset] + tmp_im*d_re[i+dt_offset]))>>15); + + // cyclic shift + ((int16_t *)&y_tilda_ptr[(l+sym_offset)*12+(i-(ncs_cell[ns][l]%12)+12)%12])[0] = y_re[l+sym_offset][i]; + ((int16_t *)&y_tilda_ptr[(l+sym_offset)*12+(i-(ncs_cell[ns][l]%12)+12)%12])[1] = y_im[l+sym_offset][i]; + + // DMRS + m_alpha_idx = (alpha_idx * i) % 12; + if (l==1 || l==5) { + ((int16_t *)&zptr[(l+sym_offset)*12+i])[0] =(((((int32_t) alphaTBL_re[m_alpha_idx]*ul_ref_sigs[u][v][0][i<<1] - (int32_t) alphaTBL_im[m_alpha_idx] * ul_ref_sigs[u][v][0][1+(i<<1)])>>15) * (int32_t)amp)>>15); + ((int16_t *)&zptr[(l+sym_offset)*12+i])[1] =(((((int32_t) alphaTBL_re[m_alpha_idx]*ul_ref_sigs[u][v][0][1+(i<<1)] + (int32_t) alphaTBL_im[m_alpha_idx] * ul_ref_sigs[u][v][0][i<<1])>>15) * (int32_t)amp)>>15); + } + } + + } // l loop + } // ns + + // DFT for pucch-data + for (l=0; l<14; l++) { + if (l==1 || l==5 || l==8 || l==12) { + ; + } else { + pucchfmt3_Dft((int16_t*)&y_tilda_ptr[l*12],(int16_t*)&zptr[l*12]); + } + } + + + // Mapping + m = n3_pucch / N_PUCCH_SF0; + + if (shortened_format == 1) { + nsymb = (N_UL_symb<<1) - 1; + } else { + nsymb = (N_UL_symb<<1); + } + + for (j=0,l=0; l<(nsymb); l++) { + + if ((l<7) && ((m&1) == 0)) + re_offset = (m*6) + frame_parms->first_carrier_offset; + else if ((l<7) && ((m&1) == 1)) + re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; + else if ((m&1) == 0) + re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; + else + re_offset = ((m-1)*6) + frame_parms->first_carrier_offset; + + if (re_offset > frame_parms->ofdm_symbol_size) + re_offset -= (frame_parms->ofdm_symbol_size); + + symbol_offset = (unsigned int)frame_parms->ofdm_symbol_size*(l+(subframe*14)); + txptr = &txdataF[0][symbol_offset]; + + for (i=0; i<12; i++,j++) { + txptr[re_offset++] = z[j]; + + if (re_offset==frame_parms->ofdm_symbol_size) + re_offset = 0; + +#ifdef DEBUG_PUCCH_TX + msg("[PHY] PUCCH subframe %d (%d,%d,%d,%d) => %d,%d\n",subframe,l,i,re_offset-1,m,((int16_t *)&z[j])[0],((int16_t *)&z[j])[1]); +#endif + } + } + +} + + + diff --git a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c similarity index 100% rename from openair1/PHY/LTE_TRANSPORT/srs_modulation.c rename to openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c diff --git a/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c new file mode 100644 index 0000000000..03aabbd4b7 --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c @@ -0,0 +1,420 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/sss_ue.c +* \brief Top-level routines for decoding the secondary synchronization signal (SSS) V8.6 2009-03 +* \author R. Knopp +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr +* \note +* \warning +*/ +#include "PHY/defs.h" +#include "defs.h" +#include "PHY/extern.h" + +//#define DEBUG_SSS + + + + +int pss_ch_est(PHY_VARS_UE *ue, + int32_t pss_ext[4][72], + int32_t sss_ext[4][72]) +{ + + int16_t *pss; + int16_t *pss_ext2,*sss_ext2,*sss_ext3,tmp_re,tmp_im,tmp_re2,tmp_im2; + uint8_t aarx,i; + LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + + switch (ue->common_vars.eNb_id) { + + case 0: + pss = &primary_synch0[10]; + break; + + case 1: + pss = &primary_synch1[10]; + break; + + case 2: + pss = &primary_synch2[10]; + break; + + default: + pss = &primary_synch0[10]; + break; + } + + sss_ext3 = (int16_t*)&sss_ext[0][5]; + + for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + + sss_ext2 = (int16_t*)&sss_ext[aarx][5]; + pss_ext2 = (int16_t*)&pss_ext[aarx][5]; + + for (i=0; i<62; i++) { + + // This is H*(PSS) = R* \cdot PSS + tmp_re = (int16_t)(((pss_ext2[i<<1] * (int32_t)pss[i<<1])>>15) + ((pss_ext2[1+(i<<1)] * (int32_t)pss[1+(i<<1)])>>15)); + tmp_im = (int16_t)(((pss_ext2[i<<1] * (int32_t)pss[1+(i<<1)])>>15) - ((pss_ext2[1+(i<<1)] * (int32_t)pss[(i<<1)])>>15)); + // printf("H*(%d,%d) : (%d,%d)\n",aarx,i,tmp_re,tmp_im); + // This is R(SSS) \cdot H*(PSS) + tmp_re2 = (int16_t)(((tmp_re * (int32_t)sss_ext2[i<<1])>>15) - ((tmp_im * (int32_t)sss_ext2[1+(i<<1)]>>15))); + tmp_im2 = (int16_t)(((tmp_re * (int32_t)sss_ext2[1+(i<<1)])>>15) + ((tmp_im * (int32_t)sss_ext2[(i<<1)]>>15))); + + // printf("SSSi(%d,%d) : (%d,%d)\n",aarx,i,sss_ext2[i<<1],sss_ext2[1+(i<<1)]); + // printf("SSSo(%d,%d) : (%d,%d)\n",aarx,i,tmp_re2,tmp_im2); + // MRC on RX antennas + if (aarx==0) { + sss_ext3[i<<1] = tmp_re2; + sss_ext3[1+(i<<1)] = tmp_im2; + } else { + sss_ext3[i<<1] += tmp_re2; + sss_ext3[1+(i<<1)] += tmp_im2; + } + } + } + + // sss_ext now contains the compensated SSS + return(0); +} + + +int _do_pss_sss_extract(PHY_VARS_UE *ue, + int32_t pss_ext[4][72], + int32_t sss_ext[4][72], + uint8_t doPss, uint8_t doSss, + uint8_t subframe) // add flag to indicate extracting only PSS, only SSS, or both +{ + + + + uint16_t rb,nb_rb=6; + uint8_t i,aarx; + int32_t *pss_rxF,*pss_rxF_ext; + int32_t *sss_rxF,*sss_rxF_ext; + LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + uint8_t next_thread_id = ue->current_thread_id[subframe]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[subframe]+1); + + int rx_offset = frame_parms->ofdm_symbol_size-3*12; + uint8_t pss_symb,sss_symb; + + int32_t **rxdataF; + + //LOG_I(PHY,"do_pss_sss_extract subframe %d \n",subframe); + for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { + + if (frame_parms->frame_type == FDD) { + pss_symb = 6-frame_parms->Ncp; + sss_symb = pss_symb-1; + + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF; + pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; + sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; + + } else { + pss_symb = 2; + sss_symb = frame_parms->symbols_per_tti-1; + + if(subframe==5 || subframe==0) + { + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF; + sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; + + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF; + pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; + } + else if(subframe==6 || subframe==1) + { + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF; + pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; + + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF; + sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; + } + else + { + AssertFatal(0,""); + } + + } + //printf("extract_rbs: symbol_mod=%d, rx_offset=%d, ch_offset=%d\n",symbol_mod, + // (rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))*2, + // LTE_CE_OFFSET+ch_offset+(symbol_mod*(frame_parms->ofdm_symbol_size))); + + pss_rxF_ext = &pss_ext[aarx][0]; + sss_rxF_ext = &sss_ext[aarx][0]; + + for (rb=0; rb<nb_rb; rb++) { + // skip DC carrier + if (rb==3) { + if(frame_parms->frame_type == FDD) + { + sss_rxF = &rxdataF[aarx][(1 + (sss_symb*(frame_parms->ofdm_symbol_size)))]; + pss_rxF = &rxdataF[aarx][(1 + (pss_symb*(frame_parms->ofdm_symbol_size)))]; + } + else + { + if(subframe==5 || subframe==0) + { + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF; + sss_rxF = &rxdataF[aarx][(1 + (sss_symb*(frame_parms->ofdm_symbol_size)))]; + + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF; + pss_rxF = &rxdataF[aarx][(1 + (pss_symb*(frame_parms->ofdm_symbol_size)))]; + } + else if(subframe==6 || subframe==1) + { + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF; + pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symb*(frame_parms->ofdm_symbol_size)))]; + + rxdataF = ue->common_vars.common_vars_rx_data_per_thread[next_thread_id].rxdataF; + sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symb*(frame_parms->ofdm_symbol_size)))]; + } + else + { + AssertFatal(0,""); + } + } + } + + for (i=0; i<12; i++) { + if (doPss) {pss_rxF_ext[i]=pss_rxF[i];} + if (doSss) {sss_rxF_ext[i]=sss_rxF[i];} + } + + pss_rxF+=12; + sss_rxF+=12; + pss_rxF_ext+=12; + sss_rxF_ext+=12; + } + + } + + return(0); +} + +int pss_sss_extract(PHY_VARS_UE *phy_vars_ue, + int32_t pss_ext[4][72], + int32_t sss_ext[4][72], + uint8_t subframe) +{ + return _do_pss_sss_extract(phy_vars_ue, pss_ext, sss_ext, 1 /* doPss */, 1 /* doSss */, subframe); +} + +int pss_only_extract(PHY_VARS_UE *phy_vars_ue, + int32_t pss_ext[4][72], + uint8_t subframe) +{ + static int32_t dummy[4][72]; + return _do_pss_sss_extract(phy_vars_ue, pss_ext, dummy, 1 /* doPss */, 0 /* doSss */, subframe); +} + + +int sss_only_extract(PHY_VARS_UE *phy_vars_ue, + int32_t sss_ext[4][72], + uint8_t subframe) +{ + static int32_t dummy[4][72]; + return _do_pss_sss_extract(phy_vars_ue, dummy, sss_ext, 0 /* doPss */, 1 /* doSss */, subframe); +} + + +int16_t phase_re[7] = {16383, 25101, 30791, 32767, 30791, 25101, 16383}; +int16_t phase_im[7] = {-28378, -21063, -11208, 0, 11207, 21062, 28377}; + + +int rx_sss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *flip_max,uint8_t *phase_max) +{ + + uint8_t i; + int32_t pss_ext[4][72]; + int32_t sss0_ext[4][72],sss5_ext[4][72]; + uint8_t Nid2 = ue->common_vars.eNb_id; + uint8_t flip,phase; + uint16_t Nid1; + int16_t *sss0,*sss5; + LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; + int32_t metric; + int16_t *d0,*d5; + + if (frame_parms->frame_type == FDD) { +#ifdef DEBUG_SSS + + if (frame_parms->Ncp == NORMAL) + msg("[PHY][UE%d] Doing SSS for FDD Normal Prefix\n",ue->Mod_id); + else + msg("[PHY][UE%d] Doing SSS for FDD Extended Prefix\n",ue->Mod_id); + +#endif + // Do FFTs for SSS/PSS + // SSS + slot_fep(ue, + (frame_parms->symbols_per_tti/2)-2, // second to last symbol of + 0, // slot 0 + ue->rx_offset, + 0, + 1); + // PSS + slot_fep(ue, + (frame_parms->symbols_per_tti/2)-1, // last symbol of + 0, // slot 0 + ue->rx_offset, + 0, + 1); + } else { // TDD +#ifdef DEBUG_SSS + if (ue->frame_parms->Ncp == NORMAL) + msg("[PHY][UE%d] Doing SSS for TDD Normal Prefix\n",ue->Mod_id); + else + msg("[PHY][UE%d] Doing SSS for TDD Extended Prefix\n",ue->Mod_id); + +#endif + // SSS + slot_fep(ue, + (frame_parms->symbols_per_tti>>1)-1, // last symbol of + 1, // slot 1 + ue->rx_offset, + 0, + 1); + // PSS + slot_fep(ue, + 2, // symbol 2 of + 2, // slot 2 + ue->rx_offset, + 0, + 1); + } + // pss sss extract for subframe 0 + pss_sss_extract(ue, + pss_ext, + sss0_ext,0); + /* + write_output("rxsig0.m","rxs0",&ue->common_vars.rxdata[0][0],ue->frame_parms.samples_per_tti,1,1); + write_output("rxdataF0.m","rxF0",&ue->common_vars.rxdataF[0][0],2*14*ue->frame_parms.ofdm_symbol_size,2,1); + write_output("pss_ext0.m","pssext0",pss_ext,72,1,1); + write_output("sss0_ext0.m","sss0ext0",sss0_ext,72,1,1); + */ + + // get conjugated channel estimate from PSS (symbol 6), H* = R* \cdot PSS + // and do channel estimation and compensation based on PSS + + pss_ch_est(ue, + pss_ext, + sss0_ext); + + // write_output("sss0_comp0.m","sss0comp0",sss0_ext,72,1,1); + + if (ue->frame_parms.frame_type == FDD) { // FDD + + // SSS + slot_fep(ue, + (frame_parms->symbols_per_tti/2)-2, + 10, + ue->rx_offset, + 0,1); + // PSS + slot_fep(ue, + (frame_parms->symbols_per_tti/2)-1, + 10, + ue->rx_offset, + 0,1); + } else { // TDD + // SSS + slot_fep(ue, + (frame_parms->symbols_per_tti>>1)-1, + 11, + ue->rx_offset, + 0, + 1); + // PSS + slot_fep(ue, + 2, + 12, + ue->rx_offset, + 0, + 1); + } + + // pss sss extract for subframe 5 + pss_sss_extract(ue, + pss_ext, + sss5_ext,5); + + // write_output("sss5_ext0.m","sss5ext0",sss5_ext,72,1,1); + // get conjugated channel estimate from PSS (symbol 6), H* = R* \cdot PSS + // and do channel estimation and compensation based on PSS + + pss_ch_est(ue, + pss_ext, + sss5_ext); + + + + // now do the SSS detection based on the precomputed sequences in PHY/LTE_TRANSPORT/sss.h + + *tot_metric = -99999999; + + + sss0 = (int16_t*)&sss0_ext[0][5]; + sss5 = (int16_t*)&sss5_ext[0][5]; + + for (flip=0; flip<2; flip++) { // d0/d5 flip in RX frame + for (phase=0; phase<7; phase++) { // phase offset between PSS and SSS + for (Nid1 = 0 ; Nid1 <= 167; Nid1++) { // 168 possible Nid1 values + metric = 0; + + if (flip==0) { + d0 = &d0_sss[62*(Nid2 + (Nid1*3))]; + d5 = &d5_sss[62*(Nid2 + (Nid1*3))]; + } else { + d5 = &d0_sss[62*(Nid2 + (Nid1*3))]; + d0 = &d5_sss[62*(Nid2 + (Nid1*3))]; + } + + // This is the inner product using one particular value of each unknown parameter + for (i=0; i<62; i++) { + metric += (int16_t)(((d0[i]*((((phase_re[phase]*(int32_t)sss0[i<<1])>>19)-((phase_im[phase]*(int32_t)sss0[1+(i<<1)])>>19)))) + + (d5[i]*((((phase_re[phase]*(int32_t)sss5[i<<1])>>19)-((phase_im[phase]*(int32_t)sss5[1+(i<<1)])>>19)))))); + } + + // if the current metric is better than the last save it + if (metric > *tot_metric) { + *tot_metric = metric; + ue->frame_parms.Nid_cell = Nid2+(3*Nid1); + *phase_max = phase; + *flip_max=flip; +#ifdef DEBUG_SSS + msg("(flip,phase,Nid1) (%d,%d,%d), metric_phase %d tot_metric %d, phase_max %d, flip_max %d\n",flip,phase,Nid1,metric,*tot_metric,*phase_max,*flip_max); +#endif + + } + } + } + } + + return(0); +} + diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h new file mode 100644 index 0000000000..38e7f7301a --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h @@ -0,0 +1,335 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/defs.h +* \brief data structures for PDSCH/DLSCH/PUSCH/ULSCH physical and transport channel descriptors (TX/RX) +* \author R. Knopp +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it +* \note +* \warning +*/ +#ifndef __TRANSPORT_UE__H__ +#define __TRANSPORT_UE__H__ +#include "PHY/defs.h" +#include "PHY/impl_defs_lte.h" +#include "dci.h" +#include "mdci.h" +#include "uci_common.h" +#ifndef STANDALONE_COMPILE +#include "UTIL/LISTS/list.h" +#endif + +#include "../LTE_TRANSPORT/transport_common.h" + +// structures below implement 36-211 and 36-212 + +/** @addtogroup _PHY_TRANSPORT_ + * @{ + */ + + + +typedef struct { + /// Indicator of first transmission + uint8_t first_tx; + /// Last Ndi received for this process on DCI (used for C-RNTI only) + uint8_t DCINdi; + /// Flag indicating that this ULSCH has a new packet (start of new round) + // uint8_t Ndi; + /// Status Flag indicating for this ULSCH (idle,active,disabled) + SCH_status_t status; + /// Subframe scheduling indicator (i.e. Transmission opportunity indicator) + uint8_t subframe_scheduling_flag; + /// Subframe cba scheduling indicator (i.e. Transmission opportunity indicator) + uint8_t subframe_cba_scheduling_flag; + /// First Allocated RB + uint16_t first_rb; + /// Current Number of RBs + uint16_t nb_rb; + /// Last TPC command + uint8_t TPC; + /// Transport block size + uint32_t TBS; + /// The payload + CRC size in bits, "B" from 36-212 + uint32_t B; + /// Length of ACK information (bits) + uint8_t O_ACK; + /// Pointer to the payload + uint8_t *b; + /// Pointers to transport block segments + uint8_t *c[MAX_NUM_ULSCH_SEGMENTS]; + /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15) + uint32_t RTC[MAX_NUM_ULSCH_SEGMENTS]; + /// Index of current HARQ round for this ULSCH + uint8_t round; + /// MCS format of this ULSCH + uint8_t mcs; + /// Redundancy-version of the current sub-frame + uint8_t rvidx; + /// Turbo-code outputs (36-212 V8.6 2009-03, p.12 + uint8_t d[MAX_NUM_ULSCH_SEGMENTS][(96+3+(3*6144))]; + /// Sub-block interleaver outputs (36-212 V8.6 2009-03, p.16-17) + uint8_t w[MAX_NUM_ULSCH_SEGMENTS][3*6144]; + /// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) + uint32_t C; + /// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10) + uint32_t Cminus; + /// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10) + uint32_t Cplus; + /// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) + uint32_t Kminus; + /// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) + uint32_t Kplus; + /// Total number of bits across all segments + uint32_t sumKr; + /// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10) + uint32_t F; + /// Msc_initial, Initial number of subcarriers for ULSCH (36-212, v8.6 2009-03, p.26-27) + uint16_t Msc_initial; + /// Nsymb_initial, Initial number of symbols for ULSCH (36-212, v8.6 2009-03, p.26-27) + uint8_t Nsymb_initial; + /// n_DMRS for cyclic shift of DMRS (36.213 Table 9.1.2-2) + uint8_t n_DMRS; + /// n_DMRS2 for cyclic shift of DMRS (36.211 Table 5.5.1.1.-1) + uint8_t n_DMRS2; + /// Flag to indicate that this is a control only ULSCH (i.e. no MAC SDU) + uint8_t control_only; + /// Flag to indicate that this is a calibration ULSCH (i.e. no MAC SDU and filled with TDD calibration information) + // int calibration_flag; + /// Number of soft channel bits + uint32_t G; + + // decode phich + uint8_t decode_phich; +} LTE_UL_UE_HARQ_t; + +typedef struct { + /// Current Number of Symbols + uint8_t Nsymb_pusch; + /// SRS active flag + uint8_t srs_active; + /// Pointers to 8 HARQ processes for the ULSCH + LTE_UL_UE_HARQ_t *harq_processes[8]; + /// Pointer to CQI data (+1 for 8 bits crc) + uint8_t o[1+MAX_CQI_BYTES]; + /// Length of CQI data (bits) + uint8_t O; + /// Format of CQI data + UCI_format_t uci_format; + /// Rank information + uint8_t o_RI[2]; + /// Length of rank information (bits) + uint8_t O_RI; + /// Pointer to ACK + uint8_t o_ACK[4]; + /// Minimum number of CQI bits for PUSCH (36-212 r8.6, Sec 5.2.4.1 p. 37) + uint8_t O_CQI_MIN; + /// ACK/NAK Bundling flag + uint8_t bundling; + /// Concatenated "e"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) + uint8_t e[MAX_NUM_CHANNEL_BITS]; + /// Interleaved "h"-sequences (for definition see 36-212 V8.6 2009-03, p.17-18) + uint8_t h[MAX_NUM_CHANNEL_BITS]; + /// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14) + uint8_t b_tilde[MAX_NUM_CHANNEL_BITS]; + /// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14) + int32_t d[MAX_NUM_RE]; + /// Transform-coded "z"-sequences (for definition see 36-211 V8.6 2009-03, p.14-15) + int32_t z[MAX_NUM_RE]; + /// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27) + uint8_t q[MAX_CQI_PAYLOAD]; + /// coded and interleaved CQI bits + uint8_t o_w[(MAX_CQI_BITS+8)*3]; + /// coded CQI bits + uint8_t o_d[96+((MAX_CQI_BITS+8)*3)]; + /// coded ACK bits + uint8_t q_ACK[MAX_ACK_PAYLOAD]; + /// coded RI bits + uint8_t q_RI[MAX_RI_PAYLOAD]; + /// beta_offset_cqi times 8 + uint16_t beta_offset_cqi_times8; + /// beta_offset_ri times 8 + uint16_t beta_offset_ri_times8; + /// beta_offset_harqack times 8 + uint16_t beta_offset_harqack_times8; + /// power_offset + uint8_t power_offset; + // for cooperative communication + uint8_t cooperation_flag; + /// RNTI attributed to this ULSCH + uint16_t rnti; + /// f_PUSCH parameter for PUSCH power control + int16_t f_pusch; + /// Po_PUSCH - target output power for PUSCH + int16_t Po_PUSCH; + /// PHR - current power headroom (based on last PUSCH transmission) + int16_t PHR; + /// Po_SRS - target output power for SRS + int16_t Po_SRS; + /// num active cba group + uint8_t num_active_cba_groups; + /// num dci found for cba + uint8_t num_cba_dci[10]; + /// allocated CBA RNTI + uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP]; + /// UL max-harq-retransmission + uint8_t Mlimit; +} LTE_UE_ULSCH_t; + + + + +typedef struct { + /// Indicator of first transmission + uint8_t first_tx; + /// Last Ndi received for this process on DCI (used for C-RNTI only) + uint8_t DCINdi; + /// DLSCH status flag indicating + SCH_status_t status; + /// Transport block size + uint32_t TBS; + /// The payload + CRC size in bits + uint32_t B; + /// Pointer to the payload + uint8_t *b; + /// Pointers to transport block segments + uint8_t *c[MAX_NUM_DLSCH_SEGMENTS]; + /// RTC values for each segment (for definition see 36-212 V8.6 2009-03, p.15) + uint32_t RTC[MAX_NUM_DLSCH_SEGMENTS]; + /// Index of current HARQ round for this DLSCH + uint8_t round; + /// MCS format for this DLSCH + uint8_t mcs; + /// Qm (modulation order) for this DLSCH + uint8_t Qm; + /// Redundancy-version of the current sub-frame + uint8_t rvidx; + /// MIMO mode for this DLSCH + MIMO_mode_t mimo_mode; + /// soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) + int16_t w[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)]; + /// for abstraction soft bits for each received segment ("w"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) + double w_abs[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)]; + /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) + int16_t *d[MAX_NUM_DLSCH_SEGMENTS]; + /// Number of code segments (for definition see 36-212 V8.6 2009-03, p.9) + uint32_t C; + /// Number of "small" code segments (for definition see 36-212 V8.6 2009-03, p.10) + uint32_t Cminus; + /// Number of "large" code segments (for definition see 36-212 V8.6 2009-03, p.10) + uint32_t Cplus; + /// Number of bits in "small" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) + uint32_t Kminus; + /// Number of bits in "large" code segments (<6144) (for definition see 36-212 V8.6 2009-03, p.10) + uint32_t Kplus; + /// Number of "Filler" bits (for definition see 36-212 V8.6 2009-03, p.10) + uint32_t F; + /// Number of MIMO layers (streams) (for definition see 36-212 V8.6 2009-03, p.17) + uint8_t Nl; + /// current delta_pucch + int8_t delta_PUCCH; + /// Number of soft channel bits + uint32_t G; + /// Current Number of RBs + uint16_t nb_rb; + /// Current subband PMI allocation + uint16_t pmi_alloc; + /// Current RB allocation (even slots) + uint32_t rb_alloc_even[4]; + /// Current RB allocation (odd slots) + uint32_t rb_alloc_odd[4]; + /// distributed/localized flag + vrb_t vrb_type; + /// downlink power offset field + uint8_t dl_power_off; + /// trials per round statistics + uint32_t trials[8]; + /// error statistics per round + uint32_t errors[8]; + /// codeword this transport block is mapped to + uint8_t codeword; +} LTE_DL_UE_HARQ_t; + + +typedef struct { + /// HARQ process id + uint8_t harq_id; + /// ACK bits (after decoding) 0:NACK / 1:ACK / 2:DTX + uint8_t ack; + /// send status (for PUCCH) + uint8_t send_harq_status; + /// nCCE (for PUCCH) + uint8_t nCCE; + /// DAI value detected from DCI1/1a/1b/1d/2/2a/2b/2c. 0xff indicates not touched + uint8_t vDAI_DL; + /// DAI value detected from DCI0/4. 0xff indicates not touched + uint8_t vDAI_UL; +} harq_status_t; + +typedef struct { + /// RNTI + uint16_t rnti; + /// Active flag for DLSCH demodulation + uint8_t active; + /// Transmission mode + uint8_t mode1_flag; + /// amplitude of PDSCH (compared to RS) in symbols without pilots + int16_t sqrt_rho_a; + /// amplitude of PDSCH (compared to RS) in symbols containing pilots + int16_t sqrt_rho_b; + /// Current HARQ process id threadRx Odd and threadRx Even + uint8_t current_harq_pid; + /// Current subband antenna selection + uint32_t antenna_alloc; + /// Current subband RI allocation + uint32_t ri_alloc; + /// Current subband CQI1 allocation + uint32_t cqi_alloc1; + /// Current subband CQI2 allocation + uint32_t cqi_alloc2; + /// saved subband PMI allocation from last PUSCH/PUCCH report + uint16_t pmi_alloc; + /// HARQ-ACKs + harq_status_t harq_ack[10]; + /// Pointers to up to 8 HARQ processes + LTE_DL_UE_HARQ_t *harq_processes[8]; + /// Maximum number of HARQ processes(for definition see 36-212 V8.6 2009-03, p.17 + uint8_t Mdlharq; + /// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17) + uint8_t Kmimo; + /// Nsoft parameter related to UE Category + uint32_t Nsoft; + /// Maximum number of Turbo iterations + uint8_t max_turbo_iterations; + /// number of iterations used in last turbo decoding + uint8_t last_iteration_cnt; + /// accumulated tx power adjustment for PUCCH + int8_t g_pucch; +} LTE_UE_DLSCH_t; + + + + +/**@}*/ +#endif diff --git a/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c new file mode 100644 index 0000000000..9cef95ee13 --- /dev/null +++ b/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c @@ -0,0 +1,264 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file PHY/LTE_TRANSPORT/phich.c +* \brief Routines for generation of and computations regarding the uplink control information (UCI) for PUSCH. V8.6 2009-03 +* \author R. Knopp, F. Kaltenberger, A. Bhamri +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, ankit.bhamri@eurecom.fr +* \note +* \warning +*/ +#include "PHY/defs.h" +#include "PHY/extern.h" +#ifdef DEBUG_UCI_TOOLS +#include "PHY/vars.h" +#endif + +//#define DEBUG_UCI 1 + +uint64_t pmi2hex_2Ar1(uint32_t pmi) +{ + + uint64_t pmil = (uint64_t)pmi; + + return ((pmil&3) + (((pmil>>2)&3)<<4) + (((pmil>>4)&3)<<8) + (((pmil>>6)&3)<<12) + + (((pmil>>8)&3)<<16) + (((pmil>>10)&3)<<20) + (((pmil>>12)&3)<<24) + + (((pmil>>14)&3)<<28) + (((pmil>>16)&3)<<32) + (((pmil>>18)&3)<<36) + + (((pmil>>20)&3)<<40) + (((pmil>>22)&3)<<44) + (((pmil>>24)&3)<<48)); +} + +uint64_t pmi2hex_2Ar2(uint32_t pmi) +{ + + uint64_t pmil = (uint64_t)pmi; + return ((pmil&1) + (((pmil>>1)&1)<<4) + (((pmil>>2)&1)<<8) + (((pmil>>3)&1)<<12) + + (((pmil>>4)&1)<<16) + (((pmil>>5)&1)<<20) + (((pmil>>6)&1)<<24) + + (((pmil>>7)&1)<<28) + (((pmil>>8)&1)<<32) + (((pmil>>9)&1)<<36) + + (((pmil>>10)&1)<<40) + (((pmil>>11)&1)<<44) + (((pmil>>12)&1)<<48)); +} + +uint64_t cqi2hex(uint32_t cqi) +{ + + uint64_t cqil = (uint64_t)cqi; + return ((cqil&3) + (((cqil>>2)&3)<<4) + (((cqil>>4)&3)<<8) + (((cqil>>6)&3)<<12) + + (((cqil>>8)&3)<<16) + (((cqil>>10)&3)<<20) + (((cqil>>12)&3)<<24) + + (((cqil>>14)&3)<<28) + (((cqil>>16)&3)<<32) + (((cqil>>18)&3)<<36) + + (((cqil>>20)&3)<<40) + (((cqil>>22)&3)<<44) + (((cqil>>24)&3)<<48)); +} + + +void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL) +{ + + + switch(uci_format) { + case wideband_cqi_rank1_2A: +#ifdef DEBUG_UCI + LOG_D(PHY,"[PRINT CQI] flat_LA %d\n", flag_LA); + switch(N_RB_DL) { + case 6: + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id, + ((wideband_cqi_rank1_2A_1_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id, + ((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi, + pmi2hex_2Ar1(((wideband_cqi_rank1_2A_1_5MHz *)o)->pmi)); + break; + + case 25: + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id, + ((wideband_cqi_rank1_2A_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id, + ((wideband_cqi_rank1_2A_5MHz *)o)->pmi, + pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)o)->pmi)); + break; + + case 50: + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id, + ((wideband_cqi_rank1_2A_10MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id, + ((wideband_cqi_rank1_2A_10MHz *)o)->pmi, + pmi2hex_2Ar1(((wideband_cqi_rank1_2A_10MHz *)o)->pmi)); + break; + + case 100: + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id, + ((wideband_cqi_rank1_2A_20MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, pmi (%x) %8x\n",eNB_id, + ((wideband_cqi_rank1_2A_20MHz *)o)->pmi, + pmi2hex_2Ar1(((wideband_cqi_rank1_2A_20MHz *)o)->pmi)); + break; + } + +#endif //DEBUG_UCI + break; + + case wideband_cqi_rank2_2A: +#ifdef DEBUG_UCI + switch(N_RB_DL) { + case 6: + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_1_5MHz *)o)->cqi2); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_1_5MHz *)o)->pmi)); + break; + + case 25: + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_5MHz *)o)->cqi2); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_5MHz *)o)->pmi)); + break; + + case 50: + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_10MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_10MHz *)o)->cqi2); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_10MHz *)o)->pmi)); + break; + + case 100: + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((wideband_cqi_rank2_2A_20MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((wideband_cqi_rank2_2A_20MHz *)o)->cqi2); + LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 2: eNB %d, pmi %8x\n",eNB_id,pmi2hex_2Ar2(((wideband_cqi_rank2_2A_20MHz *)o)->pmi)); + break; + } + +#endif //DEBUG_UCI + break; + + case HLC_subband_cqi_nopmi: +#ifdef DEBUG_UCI + switch(N_RB_DL) { + case 6: + LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_1_5MHz *)o)->diffcqi1)); + break; + + case 25: + LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); + break; + + case 50: + LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_10MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_10MHz *)o)->diffcqi1)); + break; + + case 100: + LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_20MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi (no pmi) : eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_20MHz *)o)->diffcqi1)); + break; + } + +#endif //DEBUG_UCI + break; + + case HLC_subband_cqi_rank1_2A: +#ifdef DEBUG_UCI + switch(N_RB_DL) { + case 6: + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi); + break; + + case 25: + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi); + break; + + case 50: + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi); + break; + + case 100: + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank1_2A_5MHz *)o)->diffcqi1)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 1: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank1_2A_5MHz *)o)->pmi); + break; + } + +#endif //DEBUG_UCI + break; + + case HLC_subband_cqi_rank2_2A: +#ifdef DEBUG_UCI + switch(N_RB_DL) { + case 6: + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->cqi2); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi1)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->diffcqi2)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_1_5MHz *)o)->pmi); + break; + + case 25: + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->cqi2); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi1)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_5MHz *)o)->diffcqi2)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_5MHz *)o)->pmi); + break; + + case 50: + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->cqi2); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi1)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_10MHz *)o)->diffcqi2)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_10MHz *)o)->pmi); + break; + + case 100: + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi1 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi1); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, cqi2 %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->cqi2); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi1 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi1)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, diffcqi2 %8x\n",eNB_id,cqi2hex(((HLC_subband_cqi_rank2_2A_20MHz *)o)->diffcqi2)); + LOG_I(PHY,"[PRINT CQI] hlc_cqi rank 2: eNB %d, pmi %d\n",eNB_id,((HLC_subband_cqi_rank2_2A_20MHz *)o)->pmi); + break; + } + +#endif //DEBUG_UCI + break; + + case ue_selected: +#ifdef DEBUG_UCI + LOG_W(PHY,"[PRINT CQI] ue_selected CQI not supported yet!!!\n"); +#endif //DEBUG_UCI + break; + + default: +#ifdef DEBUG_UCI + LOG_E(PHY,"[PRINT CQI] unsupported CQI mode (%d)!!!\n",uci_format); +#endif //DEBUG_UCI + break; + } + +} + + + + + + diff --git a/openair1/PHY/TOOLS/defs.h b/openair1/PHY/TOOLS/tools_defs.h similarity index 100% rename from openair1/PHY/TOOLS/defs.h rename to openair1/PHY/TOOLS/tools_defs.h diff --git a/openair1/PHY/TOOLS/extern.h b/openair1/PHY/TOOLS/tools_extern.h similarity index 100% rename from openair1/PHY/TOOLS/extern.h rename to openair1/PHY/TOOLS/tools_extern.h diff --git a/openair1/PHY/TOOLS/vars.h b/openair1/PHY/TOOLS/tools_vars.h similarity index 100% rename from openair1/PHY/TOOLS/vars.h rename to openair1/PHY/TOOLS/tools_vars.h diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs_eNB.h similarity index 53% rename from openair1/PHY/defs.h rename to openair1/PHY/defs_eNB.h index 9ca33c9404..3071266a0d 100644 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs_eNB.h @@ -19,8 +19,8 @@ * contact@openairinterface.org */ -/*! \file PHY/defs.h - \brief Top-level defines and structure definitions +/*! \file PHY/defs_eNB.h + \brief Top-level defines and structure definitions for eNB \author R. Knopp, F. Kaltenberger \date 2011 \version 0.1 @@ -29,8 +29,8 @@ \note \warning */ -#ifndef __PHY_DEFS__H__ -#define __PHY_DEFS__H__ +#ifndef __PHY_DEFS_ENB__H__ +#define __PHY_DEFS_ENB__H__ #define _GNU_SOURCE @@ -57,235 +57,17 @@ #include "common_lib.h" #include "msc.h" -#include "openair2/PHY_INTERFACE/IF_Module.h" - -//#include <complex.h> -#include "assertions.h" -#ifdef MEX -# define msg mexPrintf -#endif -//use msg in the real-time thread context -#define msg_nrt printf -//use msg_nrt in the non real-time context (for initialization, ...) -#ifndef malloc16 -# ifdef __AVX2__ -# define malloc16(x) memalign(32,x) -# else -# define malloc16(x) memalign(16,x) -# endif -#endif -#define free16(y,x) free(y) -#define bigmalloc malloc -#define bigmalloc16 malloc16 -#define openair_free(y,x) free((y)) -#define PAGE_SIZE 4096 -#define free_and_zero(PtR) do { \ - if (PtR) { \ - free(PtR); \ - PtR = NULL; \ - } \ - } while (0) - -#define RX_NB_TH_MAX 2 -#define RX_NB_TH 2 - - -//! \brief Allocate \c size bytes of memory on the heap with alignment 16 and zero it afterwards. -//! If no more memory is available, this function will terminate the program with an assertion error. -static inline void* malloc16_clear( size_t size ) -{ -#ifdef __AVX2__ - void* ptr = memalign(32, size); -#else - void* ptr = memalign(16, size); -#endif - DevAssert(ptr); - memset( ptr, 0, size ); - return ptr; -} - - - -#define PAGE_MASK 0xfffff000 -#define virt_to_phys(x) (x) - -#define openair_sched_exit() exit(-1) - - -#define max(a,b) ((a)>(b) ? (a) : (b)) -#define min(a,b) ((a)<(b) ? (a) : (b)) - - -#define bzero(s,n) (memset((s),0,(n))) - -#define cmax(a,b) ((a>b) ? (a) : (b)) -#define cmin(a,b) ((a<b) ? (a) : (b)) - -#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c)) - -/// suppress compiler warning for unused arguments -#define UNUSED(x) (void)x; -#include "impl_defs_top.h" -#include "impl_defs_lte.h" - #include "PHY/TOOLS/time_meas.h" -#include "PHY/CODING/defs.h" -#include "PHY/TOOLS/defs.h" +#include "PHY/CODING/coding_defs.h" +#include "PHY/TOOLS/tools_defs.h" #include "platform_types.h" -#define MAX_NUM_RU_PER_eNB 64 - -#include "PHY/LTE_TRANSPORT/defs.h" +#include "PHY/LTE_TRANSPORT/transport_common.h" +#include "PHY/LTE_TRANSPORT/transport_eNB.h" #include <pthread.h> -#include "targets/ARCH/COMMON/common_lib.h" -#include "targets/COMMON/openairinterface5g_limits.h" - -#if defined(EXMIMO) || defined(OAI_USRP) -//#define NUMBER_OF_eNB_MAX 1 -//#define NUMBER_OF_UE_MAX 16 - -//#define NUMBER_OF_CONNECTED_eNB_MAX 3 -#else -#ifdef LARGE_SCALE -//#define NUMBER_OF_eNB_MAX 2 -//#define NUMBER_OF_UE_MAX 120 -//#define NUMBER_OF_CONNECTED_eNB_MAX 1 // to save some memory -#else -//#define NUMBER_OF_eNB_MAX 3 -//#define NUMBER_OF_UE_MAX 16 -//#define NUMBER_OF_RU_MAX 64 -//#define NUMBER_OF_CONNECTED_eNB_MAX 1 -#endif -#endif -#define NUMBER_OF_SUBBANDS_MAX 13 -#define NUMBER_OF_HARQ_PID_MAX 8 - -#define MAX_FRAME_NUMBER 0x400 - - - -#define NUMBER_OF_RN_MAX 3 -typedef enum {no_relay=1,unicast_relay_type1,unicast_relay_type2, multicast_relay} relaying_type_t; - - - -#define MCS_COUNT 28 -#define MCS_TABLE_LENGTH_MAX 64 - - -#define NUM_DCI_MAX 32 - -#define NUMBER_OF_eNB_SECTORS_MAX 3 - -#define NB_BANDS_MAX 8 - -#define MAX_BANDS_PER_RRU 4 - - -#ifdef OCP_FRAMEWORK -#include <enums.h> -#else -typedef enum {normal_txrx=0,rx_calib_ue=1,rx_calib_ue_med=2,rx_calib_ue_byp=3,debug_prach=4,no_L2_connect=5,calib_prach_tx=6,rx_dump_frame=7,loop_through_memory=8} runmode_t; - -/*! \brief Extension Type */ -typedef enum { - CYCLIC_PREFIX, - CYCLIC_SUFFIX, - ZEROS, - NONE -} Extension_t; - -enum transmission_access_mode { - NO_ACCESS=0, - POSTPONED_ACCESS, - CANCELED_ACCESS, - UNKNOWN_ACCESS, - SCHEDULED_ACCESS, - CBA_ACCESS}; - -typedef enum { - eNodeB_3GPP=0, // classical eNodeB function - NGFI_RAU_IF5, // RAU with NGFI IF5 - NGFI_RAU_IF4p5, // RAU with NFGI IF4p5 - NGFI_RRU_IF5, // NGFI_RRU (NGFI remote radio-unit,IF5) - NGFI_RRU_IF4p5, // NGFI_RRU (NGFI remote radio-unit,IF4p5) - MBP_RRU_IF5 // Mobipass RRU -} node_function_t; - -typedef enum { - - synch_to_ext_device=0, // synch to RF or Ethernet device - synch_to_other, // synch to another source_(timer, other RU) - synch_to_mobipass_standalone // special case for mobipass in standalone mode -} node_timing_t; -#endif - -typedef struct UE_SCAN_INFO_s { - /// 10 best amplitudes (linear) for each pss signals - int32_t amp[3][10]; - /// 10 frequency offsets (kHz) corresponding to best amplitudes, with respect do minimum DL frequency in the band - int32_t freq_offset_Hz[3][10]; -} UE_SCAN_INFO_t; - -/// Top-level PHY Data Structure for RN -typedef struct { - /// Module ID indicator for this instance - uint8_t Mod_id; - uint32_t frame; - // phy_vars_eNB - // phy_vars ue - // cuurently only used to store and forward the PMCH - uint8_t mch_avtive[10]; - uint8_t sync_area[10]; // num SF - LTE_UE_DLSCH_t *dlsch_rn_MCH[10]; - -} PHY_VARS_RN; - -/// Context data structure for RX/TX portion of subframe processing -typedef struct { - /// Component Carrier index - uint8_t CC_id; - /// timestamp transmitted to HW - openair0_timestamp timestamp_tx; - /// subframe to act upon for transmission - int subframe_tx; - /// subframe to act upon for reception - int subframe_rx; - /// frame to act upon for transmission - int frame_tx; - /// frame to act upon for reception - int frame_rx; - /// \brief Instance count for RXn-TXnp4 processing thread. - /// \internal This variable is protected by \ref mutex_rxtx. - int instance_cnt_rxtx; - /// pthread structure for RXn-TXnp4 processing thread - pthread_t pthread_rxtx; - /// pthread attributes for RXn-TXnp4 processing thread - pthread_attr_t attr_rxtx; - /// condition variable for tx processing thread - pthread_cond_t cond_rxtx; - /// mutex for RXn-TXnp4 processing thread - pthread_mutex_t mutex_rxtx; - /// scheduling parameters for RXn-TXnp4 thread - struct sched_param sched_param_rxtx; -} eNB_rxtx_proc_t; - -typedef struct { - struct PHY_VARS_eNB_s *eNB; - int UE_id; - int harq_pid; - int llr8_flag; - int ret; -} td_params; - -typedef struct { - struct PHY_VARS_eNB_s *eNB; - LTE_eNB_DLSCH_t *dlsch; - int G; - int harq_pid; -} te_params; +#include "openair2/PHY_INTERFACE/IF_Module.h" typedef struct RU_proc_t_s { /// Pointer to associated RU descriptor @@ -430,231 +212,7 @@ typedef struct RU_proc_t_s { struct RU_proc_t_s **slave_proc; } RU_proc_t; -/// Context data structure for eNB subframe processing -typedef struct eNB_proc_t_s { - /// Component Carrier index - uint8_t CC_id; - /// thread index - int thread_index; - /// timestamp received from HW - openair0_timestamp timestamp_rx; - /// timestamp to send to "slave rru" - openair0_timestamp timestamp_tx; - /// subframe to act upon for reception - int subframe_rx; - /// subframe to act upon for PRACH - int subframe_prach; -#ifdef Rel14 - /// subframe to act upon for reception of prach BL/CE UEs - int subframe_prach_br; -#endif - /// frame to act upon for reception - int frame_rx; - /// frame to act upon for transmission - int frame_tx; - /// frame to act upon for PRACH - int frame_prach; -#ifdef Rel14 - /// frame to act upon for PRACH BL/CE UEs - int frame_prach_br; -#endif - /// \internal This variable is protected by \ref mutex_td. - int instance_cnt_td; - /// \internal This variable is protected by \ref mutex_te. - int instance_cnt_te; - /// \internal This variable is protected by \ref mutex_prach. - int instance_cnt_prach; -#ifdef Rel14 - /// \internal This variable is protected by \ref mutex_prach for BL/CE UEs. - int instance_cnt_prach_br; -#endif - // instance count for over-the-air eNB synchronization - int instance_cnt_synch; - /// \internal This variable is protected by \ref mutex_asynch_rxtx. - int instance_cnt_asynch_rxtx; - /// pthread structure for eNB single processing thread - pthread_t pthread_single; - /// pthread structure for asychronous RX/TX processing thread - pthread_t pthread_asynch_rxtx; - /// flag to indicate first RX acquisition - int first_rx; - /// flag to indicate first TX transmission - int first_tx; - /// pthread attributes for parallel turbo-decoder thread - pthread_attr_t attr_td; - /// pthread attributes for parallel turbo-encoder thread - pthread_attr_t attr_te; - /// pthread attributes for single eNB processing thread - pthread_attr_t attr_single; - /// pthread attributes for prach processing thread - pthread_attr_t attr_prach; -#ifdef Rel14 - /// pthread attributes for prach processing thread BL/CE UEs - pthread_attr_t attr_prach_br; -#endif - /// pthread attributes for asynchronous RX thread - pthread_attr_t attr_asynch_rxtx; - /// scheduling parameters for parallel turbo-decoder thread - struct sched_param sched_param_td; - /// scheduling parameters for parallel turbo-encoder thread - struct sched_param sched_param_te; - /// scheduling parameters for single eNB thread - struct sched_param sched_param_single; - /// scheduling parameters for prach thread - struct sched_param sched_param_prach; -#ifdef Rel14 - /// scheduling parameters for prach thread - struct sched_param sched_param_prach_br; -#endif - /// scheduling parameters for asynch_rxtx thread - struct sched_param sched_param_asynch_rxtx; - /// pthread structure for parallel turbo-decoder thread - pthread_t pthread_td; - /// pthread structure for parallel turbo-encoder thread - pthread_t pthread_te; - /// pthread structure for PRACH thread - pthread_t pthread_prach; -#ifdef Rel14 - /// pthread structure for PRACH thread BL/CE UEs - pthread_t pthread_prach_br; -#endif - /// condition variable for parallel turbo-decoder thread - pthread_cond_t cond_td; - /// condition variable for parallel turbo-encoder thread - pthread_cond_t cond_te; - /// condition variable for PRACH processing thread; - pthread_cond_t cond_prach; -#ifdef Rel14 - /// condition variable for PRACH processing thread BL/CE UEs; - pthread_cond_t cond_prach_br; -#endif - /// condition variable for asynch RX/TX thread - pthread_cond_t cond_asynch_rxtx; - /// mutex for parallel turbo-decoder thread - pthread_mutex_t mutex_td; - /// mutex for parallel turbo-encoder thread - pthread_mutex_t mutex_te; - /// mutex for PRACH thread - pthread_mutex_t mutex_prach; -#ifdef Rel14 - /// mutex for PRACH thread for BL/CE UEs - pthread_mutex_t mutex_prach_br; -#endif - /// mutex for asynch RX/TX thread - pthread_mutex_t mutex_asynch_rxtx; - /// mutex for RU access to eNB processing (PDSCH/PUSCH) - pthread_mutex_t mutex_RU; - /// mutex for RU access to eNB processing (PRACH) - pthread_mutex_t mutex_RU_PRACH; - /// mutex for RU access to eNB processing (PRACH BR) - pthread_mutex_t mutex_RU_PRACH_br; - /// mask for RUs serving eNB (PDSCH/PUSCH) - int RU_mask; - /// mask for RUs serving eNB (PRACH) - int RU_mask_prach; -#ifdef Rel14 - /// mask for RUs serving eNB (PRACH) - int RU_mask_prach_br; -#endif - /// parameters for turbo-decoding worker thread - td_params tdp; - /// parameters for turbo-encoding worker thread - te_params tep; - /// set of scheduling variables RXn-TXnp4 threads - eNB_rxtx_proc_t proc_rxtx[2]; -} eNB_proc_t; - - -/// Context data structure for RX/TX portion of subframe processing -typedef struct { - /// index of the current UE RX/TX proc - int proc_id; - /// Component Carrier index - uint8_t CC_id; - /// timestamp transmitted to HW - openair0_timestamp timestamp_tx; - /// subframe to act upon for transmission - int subframe_tx; - /// subframe to act upon for reception - int subframe_rx; - /// frame to act upon for transmission - int frame_tx; - /// frame to act upon for reception - int frame_rx; - /// \brief Instance count for RXn-TXnp4 processing thread. - /// \internal This variable is protected by \ref mutex_rxtx. - int instance_cnt_rxtx; - /// pthread structure for RXn-TXnp4 processing thread - pthread_t pthread_rxtx; - /// pthread attributes for RXn-TXnp4 processing thread - pthread_attr_t attr_rxtx; - /// condition variable for tx processing thread - pthread_cond_t cond_rxtx; - /// mutex for RXn-TXnp4 processing thread - pthread_mutex_t mutex_rxtx; - /// scheduling parameters for RXn-TXnp4 thread - struct sched_param sched_param_rxtx; - /// internal This variable is protected by ref mutex_fep_slot1. - //int instance_cnt_slot0_dl_processing; - int instance_cnt_slot1_dl_processing; - /// pthread descriptor fep_slot1 thread - //pthread_t pthread_slot0_dl_processing; - pthread_t pthread_slot1_dl_processing; - /// pthread attributes for fep_slot1 processing thread - // pthread_attr_t attr_slot0_dl_processing; - pthread_attr_t attr_slot1_dl_processing; - /// condition variable for UE fep_slot1 thread; - //pthread_cond_t cond_slot0_dl_processing; - pthread_cond_t cond_slot1_dl_processing; - /// mutex for UE synch thread - //pthread_mutex_t mutex_slot0_dl_processing; - pthread_mutex_t mutex_slot1_dl_processing; - // - uint8_t chan_est_pilot0_slot1_available; - uint8_t chan_est_slot1_available; - uint8_t llr_slot1_available; - uint8_t dci_slot0_available; - uint8_t first_symbol_available; - //uint8_t channel_level; - /// scheduling parameters for fep_slot1 thread - struct sched_param sched_param_fep_slot1; - - int sub_frame_start; - int sub_frame_step; - unsigned long long gotIQs; -} UE_rxtx_proc_t; - -/// Context data structure for eNB subframe processing -typedef struct { - /// Component Carrier index - uint8_t CC_id; - /// Last RX timestamp - openair0_timestamp timestamp_rx; - /// pthread attributes for main UE thread - pthread_attr_t attr_ue; - /// scheduling parameters for main UE thread - struct sched_param sched_param_ue; - /// pthread descriptor main UE thread - pthread_t pthread_ue; - /// \brief Instance count for synch thread. - /// \internal This variable is protected by \ref mutex_synch. - int instance_cnt_synch; - /// pthread attributes for synch processing thread - pthread_attr_t attr_synch; - /// scheduling parameters for synch thread - struct sched_param sched_param_synch; - /// pthread descriptor synch thread - pthread_t pthread_synch; - /// condition variable for UE synch thread; - pthread_cond_t cond_synch; - /// mutex for UE synch thread - pthread_mutex_t mutex_synch; - /// instance count for eNBs - int instance_cnt_eNBs; - /// set of scheduling variables RXn-TXnp4 threads - UE_rxtx_proc_t proc_rxtx[RX_NB_TH]; -} UE_proc_t; typedef enum { LOCAL_RF =0, @@ -753,135 +311,451 @@ typedef struct RU_t_s{ /// function pointer to wakeup routine in lte-enb. void (*wakeup_prach_eNB)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe); #ifdef Rel14 - /// function pointer to wakeup routine in lte-enb. - void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe); + /// function pointer to wakeup routine in lte-enb. + void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe); +#endif + /// function pointer to eNB entry routine + void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string); + /// Timing statistics + time_stats_t ofdm_demod_stats; + /// Timing statistics (TX) + time_stats_t ofdm_mod_stats; + /// Timing statistics (RX Fronthaul + Compression) + time_stats_t rx_fhaul; + /// Timing statistics (TX Fronthaul + Compression) + time_stats_t tx_fhaul; + /// Timong statistics (Compression) + time_stats_t compression; + /// Timing statistics (Fronthaul transport) + time_stats_t transport; + /// RX and TX buffers for precoder output + RU_COMMON common; + /// beamforming weight vectors per eNB + int32_t **beam_weights[NUMBER_OF_eNB_MAX+1][15]; + + /// received frequency-domain signal for PRACH (IF4p5 RRU) + int16_t **prach_rxsigF; + /// received frequency-domain signal for PRACH BR (IF4p5 RRU) + int16_t **prach_rxsigF_br[4]; + /// sequence number for IF5 + uint8_t seqno; + /// initial timestamp used as an offset make first real timestamp 0 + openair0_timestamp ts_offset; + /// process scheduling variables + RU_proc_t proc; + /// stats thread pthread descriptor + pthread_t ru_stats_thread; +} RU_t; + + + +#define MAX_RRU_CONFIG_SIZE 1024 +typedef enum { + RAU_tick=0, + RRU_capabilities=1, + RRU_config=2, + RRU_MSG_max_num=3 +} rru_config_msg_type_t; + +typedef struct RRU_CONFIG_msg_s { + rru_config_msg_type_t type; + ssize_t len; + uint8_t msg[MAX_RRU_CONFIG_SIZE]; +} RRU_CONFIG_msg_t; + +typedef enum { + OAI_IF5_only =0, + OAI_IF4p5_only =1, + OAI_IF5_and_IF4p5 =2, + MBP_IF5 =3, + MAX_FH_FMTs =4 +} FH_fmt_options_t; + +#define MAX_BANDS_PER_RRU 4 + +typedef struct RRU_capabilities_s { + /// Fronthaul format + FH_fmt_options_t FH_fmt; + /// number of EUTRA bands (<=4) supported by RRU + uint8_t num_bands; + /// EUTRA band list supported by RRU + uint8_t band_list[MAX_BANDS_PER_RRU]; + /// Number of concurrent bands (component carriers) + uint8_t num_concurrent_bands; + /// Maximum TX EPRE of each band + int8_t max_pdschReferenceSignalPower[MAX_BANDS_PER_RRU]; + /// Maximum RX gain of each band + uint8_t max_rxgain[MAX_BANDS_PER_RRU]; + /// Number of RX ports of each band + uint8_t nb_rx[MAX_BANDS_PER_RRU]; + /// Number of TX ports of each band + uint8_t nb_tx[MAX_BANDS_PER_RRU]; + /// max DL bandwidth (1,6,15,25,50,75,100) + uint8_t N_RB_DL[MAX_BANDS_PER_RRU]; + /// max UL bandwidth (1,6,15,25,50,75,100) + uint8_t N_RB_UL[MAX_BANDS_PER_RRU]; +} RRU_capabilities_t; + +typedef struct RRU_config_s { + + /// Fronthaul format + RU_if_south_t FH_fmt; + /// number of EUTRA bands (<=4) configured in RRU + uint8_t num_bands; + /// EUTRA band list configured in RRU + uint8_t band_list[MAX_BANDS_PER_RRU]; + /// TDD configuration (0-6) + uint8_t tdd_config[MAX_BANDS_PER_RRU]; + /// TDD special subframe configuration (0-10) + uint8_t tdd_config_S[MAX_BANDS_PER_RRU]; + /// TX frequency + uint32_t tx_freq[MAX_BANDS_PER_RRU]; + /// RX frequency + uint32_t rx_freq[MAX_BANDS_PER_RRU]; + /// TX attenation w.r.t. max + uint8_t att_tx[MAX_BANDS_PER_RRU]; + /// RX attenuation w.r.t. max + uint8_t att_rx[MAX_BANDS_PER_RRU]; + /// DL bandwidth + uint8_t N_RB_DL[MAX_BANDS_PER_RRU]; + /// UL bandwidth + uint8_t N_RB_UL[MAX_BANDS_PER_RRU]; + /// 3/4 sampling rate + uint8_t threequarter_fs[MAX_BANDS_PER_RRU]; + /// prach_FreqOffset for IF4p5 + int prach_FreqOffset[MAX_BANDS_PER_RRU]; + /// prach_ConfigIndex for IF4p5 + int prach_ConfigIndex[MAX_BANDS_PER_RRU]; +#ifdef Rel14 + int emtc_prach_CElevel_enable[MAX_BANDS_PER_RRU][4]; + /// emtc_prach_FreqOffset for IF4p5 per CE Level + int emtc_prach_FreqOffset[MAX_BANDS_PER_RRU][4]; + /// emtc_prach_ConfigIndex for IF4p5 per CE Level + int emtc_prach_ConfigIndex[MAX_BANDS_PER_RRU][4]; +#endif +} RRU_config_t; + + +typedef struct { + /// \brief Pointers (dynamic) to the received data in the time domain. + /// - first index: rx antenna [0..nb_antennas_rx[ + /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[ + int32_t **rxdata; + /// \brief Pointers (dynamic) to the received data in the frequency domain. + /// - first index: rx antenna [0..nb_antennas_rx[ + /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[ + int32_t **rxdataF; + /// \brief holds the transmit data in the frequency domain. + /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //? + /// - first index: eNB id [0..2] (hard coded) + /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports. + /// - third index: sample [0..] + int32_t **txdataF; +} LTE_eNB_COMMON; + +typedef struct { + uint8_t num_dci; + uint8_t num_pdcch_symbols; + DCI_ALLOC_t dci_alloc[32]; +} LTE_eNB_PDCCH; + +typedef struct { + uint8_t hi; + uint8_t first_rb; + uint8_t n_DMRS; +} phich_config_t; + +typedef struct { + uint8_t num_hi; + phich_config_t config[32]; +} LTE_eNB_PHICH; + +typedef struct { + uint8_t num_dci; + eDCI_ALLOC_t edci_alloc[32]; +} LTE_eNB_EPDCCH; + +typedef struct { + /// number of active MPDCCH allocations + uint8_t num_dci; + /// MPDCCH DCI allocations from MAC + mDCI_ALLOC_t mdci_alloc[32]; + // MAX SIZE of an EPDCCH set is 16EREGs * 9REs/EREG * 8 PRB pairs = 2304 bits + uint8_t e[2304]; +} LTE_eNB_MPDCCH; + + +typedef struct { + /// \brief Hold the channel estimates in frequency domain based on SRS. + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index: ? [0..ofdm_symbol_size[ + int32_t **srs_ch_estimates; + /// \brief Hold the channel estimates in time domain based on SRS. + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index: ? [0..2*ofdm_symbol_size[ + int32_t **srs_ch_estimates_time; + /// \brief Holds the SRS for channel estimation at the RX. + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index: ? [0..ofdm_symbol_size[ + int32_t *srs; +} LTE_eNB_SRS; + +typedef struct { + /// \brief Holds the received data in the frequency domain for the allocated RBs in repeated format. + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index: ? [0..2*ofdm_symbol_size[ + int32_t **rxdataF_ext; + /// \brief Holds the received data in the frequency domain for the allocated RBs in normal format. + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index (definition from phy_init_lte_eNB()): ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ + int32_t **rxdataF_ext2; + /// \brief Hold the channel estimates in time domain based on DRS. + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index: ? [0..4*ofdm_symbol_size[ + int32_t **drs_ch_estimates_time; + /// \brief Hold the channel estimates in frequency domain based on DRS. + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ + int32_t **drs_ch_estimates; + /// \brief Holds the compensated signal. + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ + int32_t **rxdataF_comp; + /// \brief Magnitude of the UL channel estimates. Used for 2nd-bit level thresholds in LLR computation + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ + int32_t **ul_ch_mag; + /// \brief Magnitude of the UL channel estimates scaled for 3rd bit level thresholds in LLR computation + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ + int32_t **ul_ch_magb; + /// measured RX power based on DRS + int ulsch_power[2]; + /// \brief llr values. + /// - first index: ? [0..1179743] (hard coded) + int16_t *llr; +} LTE_eNB_PUSCH; + +#define PBCH_A 24 +typedef struct { + uint8_t pbch_d[96+(3*(16+PBCH_A))]; + uint8_t pbch_w[3*3*(16+PBCH_A)]; + uint8_t pbch_e[1920]; +} LTE_eNB_PBCH; + +#define MAX_NUM_RX_PRACH_PREAMBLES 4 + +typedef struct { + /// \brief ?. + /// first index: ? [0..1023] (hard coded) + int16_t *prachF; + /// \brief ?. + /// first index: ce_level [0..3] + /// second index: rx antenna [0..63] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx. + /// third index: frequency-domain sample [0..ofdm_symbol_size*12[ + int16_t **rxsigF[4]; + /// \brief local buffer to compute prach_ifft (necessary in case of multiple CCs) + /// first index: ce_level [0..3] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx. + /// second index: ? [0..63] (hard coded) + /// third index: ? [0..63] (hard coded) + int32_t **prach_ifft[4]; + + /// repetition number +#ifdef Rel14 + /// indicator of first frame in a group of PRACH repetitions + int first_frame[4]; + /// current repetition for each CE level + int repetition_number[4]; +#endif +} LTE_eNB_PRACH; + +#include "PHY/TOOLS/time_meas.h" +#include "PHY/CODING/coding_defs.h" +#include "PHY/TOOLS/tools_defs.h" +#include "PHY/LTE_TRANSPORT/transport_eNB.h" + +/// Context data structure for RX/TX portion of subframe processing +typedef struct { + /// Component Carrier index + uint8_t CC_id; + /// timestamp transmitted to HW + openair0_timestamp timestamp_tx; + /// subframe to act upon for transmission + int subframe_tx; + /// subframe to act upon for reception + int subframe_rx; + /// frame to act upon for transmission + int frame_tx; + /// frame to act upon for reception + int frame_rx; + /// \brief Instance count for RXn-TXnp4 processing thread. + /// \internal This variable is protected by \ref mutex_rxtx. + int instance_cnt_rxtx; + /// pthread structure for RXn-TXnp4 processing thread + pthread_t pthread_rxtx; + /// pthread attributes for RXn-TXnp4 processing thread + pthread_attr_t attr_rxtx; + /// condition variable for tx processing thread + pthread_cond_t cond_rxtx; + /// mutex for RXn-TXnp4 processing thread + pthread_mutex_t mutex_rxtx; + /// scheduling parameters for RXn-TXnp4 thread + struct sched_param sched_param_rxtx; +} eNB_rxtx_proc_t; + +typedef struct { + struct PHY_VARS_eNB_s *eNB; + int UE_id; + int harq_pid; + int llr8_flag; + int ret; +} td_params; + +typedef struct { + struct PHY_VARS_eNB_s *eNB; + LTE_eNB_DLSCH_t *dlsch; + int G; + int harq_pid; +} te_params; + +/// Context data structure for eNB subframe processing +typedef struct eNB_proc_t_s { + /// Component Carrier index + uint8_t CC_id; + /// thread index + int thread_index; + /// timestamp received from HW + openair0_timestamp timestamp_rx; + /// timestamp to send to "slave rru" + openair0_timestamp timestamp_tx; + /// subframe to act upon for reception + int subframe_rx; + /// subframe to act upon for PRACH + int subframe_prach; +#ifdef Rel14 + /// subframe to act upon for reception of prach BL/CE UEs + int subframe_prach_br; +#endif + /// frame to act upon for reception + int frame_rx; + /// frame to act upon for transmission + int frame_tx; + /// frame to act upon for PRACH + int frame_prach; +#ifdef Rel14 + /// frame to act upon for PRACH BL/CE UEs + int frame_prach_br; +#endif + /// \internal This variable is protected by \ref mutex_td. + int instance_cnt_td; + /// \internal This variable is protected by \ref mutex_te. + int instance_cnt_te; + /// \internal This variable is protected by \ref mutex_prach. + int instance_cnt_prach; +#ifdef Rel14 + /// \internal This variable is protected by \ref mutex_prach for BL/CE UEs. + int instance_cnt_prach_br; +#endif + // instance count for over-the-air eNB synchronization + int instance_cnt_synch; + /// \internal This variable is protected by \ref mutex_asynch_rxtx. + int instance_cnt_asynch_rxtx; + /// pthread structure for eNB single processing thread + pthread_t pthread_single; + /// pthread structure for asychronous RX/TX processing thread + pthread_t pthread_asynch_rxtx; + /// flag to indicate first RX acquisition + int first_rx; + /// flag to indicate first TX transmission + int first_tx; + /// pthread attributes for parallel turbo-decoder thread + pthread_attr_t attr_td; + /// pthread attributes for parallel turbo-encoder thread + pthread_attr_t attr_te; + /// pthread attributes for single eNB processing thread + pthread_attr_t attr_single; + /// pthread attributes for prach processing thread + pthread_attr_t attr_prach; +#ifdef Rel14 + /// pthread attributes for prach processing thread BL/CE UEs + pthread_attr_t attr_prach_br; +#endif + /// pthread attributes for asynchronous RX thread + pthread_attr_t attr_asynch_rxtx; + /// scheduling parameters for parallel turbo-decoder thread + struct sched_param sched_param_td; + /// scheduling parameters for parallel turbo-encoder thread + struct sched_param sched_param_te; + /// scheduling parameters for single eNB thread + struct sched_param sched_param_single; + /// scheduling parameters for prach thread + struct sched_param sched_param_prach; +#ifdef Rel14 + /// scheduling parameters for prach thread + struct sched_param sched_param_prach_br; +#endif + /// scheduling parameters for asynch_rxtx thread + struct sched_param sched_param_asynch_rxtx; + /// pthread structure for parallel turbo-decoder thread + pthread_t pthread_td; + /// pthread structure for parallel turbo-encoder thread + pthread_t pthread_te; + /// pthread structure for PRACH thread + pthread_t pthread_prach; +#ifdef Rel14 + /// pthread structure for PRACH thread BL/CE UEs + pthread_t pthread_prach_br; #endif - /// function pointer to eNB entry routine - void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string); - /// Timing statistics - time_stats_t ofdm_demod_stats; - /// Timing statistics (TX) - time_stats_t ofdm_mod_stats; - /// Timing statistics (RX Fronthaul + Compression) - time_stats_t rx_fhaul; - /// Timing statistics (TX Fronthaul + Compression) - time_stats_t tx_fhaul; - /// Timong statistics (Compression) - time_stats_t compression; - /// Timing statistics (Fronthaul transport) - time_stats_t transport; - /// RX and TX buffers for precoder output - RU_COMMON common; - /// beamforming weight vectors per eNB - int32_t **beam_weights[NUMBER_OF_eNB_MAX+1][15]; - - /// received frequency-domain signal for PRACH (IF4p5 RRU) - int16_t **prach_rxsigF; - /// received frequency-domain signal for PRACH BR (IF4p5 RRU) - int16_t **prach_rxsigF_br[4]; - /// sequence number for IF5 - uint8_t seqno; - /// initial timestamp used as an offset make first real timestamp 0 - openair0_timestamp ts_offset; - /// process scheduling variables - RU_proc_t proc; - /// stats thread pthread descriptor - pthread_t ru_stats_thread; -} RU_t; + /// condition variable for parallel turbo-decoder thread + pthread_cond_t cond_td; + /// condition variable for parallel turbo-encoder thread + pthread_cond_t cond_te; + /// condition variable for PRACH processing thread; + pthread_cond_t cond_prach; +#ifdef Rel14 + /// condition variable for PRACH processing thread BL/CE UEs; + pthread_cond_t cond_prach_br; +#endif + /// condition variable for asynch RX/TX thread + pthread_cond_t cond_asynch_rxtx; + /// mutex for parallel turbo-decoder thread + pthread_mutex_t mutex_td; + /// mutex for parallel turbo-encoder thread + pthread_mutex_t mutex_te; + /// mutex for PRACH thread + pthread_mutex_t mutex_prach; +#ifdef Rel14 + /// mutex for PRACH thread for BL/CE UEs + pthread_mutex_t mutex_prach_br; +#endif + /// mutex for asynch RX/TX thread + pthread_mutex_t mutex_asynch_rxtx; + /// mutex for RU access to eNB processing (PDSCH/PUSCH) + pthread_mutex_t mutex_RU; + /// mutex for RU access to eNB processing (PRACH) + pthread_mutex_t mutex_RU_PRACH; + /// mutex for RU access to eNB processing (PRACH BR) + pthread_mutex_t mutex_RU_PRACH_br; + /// mask for RUs serving eNB (PDSCH/PUSCH) + int RU_mask; + /// mask for RUs serving eNB (PRACH) + int RU_mask_prach; +#ifdef Rel14 + /// mask for RUs serving eNB (PRACH) + int RU_mask_prach_br; +#endif + /// parameters for turbo-decoding worker thread + td_params tdp; + /// parameters for turbo-encoding worker thread + te_params tep; + /// set of scheduling variables RXn-TXnp4 threads + eNB_rxtx_proc_t proc_rxtx[2]; +} eNB_proc_t; -typedef struct { - //unsigned int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (linear) - //unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (dB) - //unsigned short rx_avg_power_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //! estimated avg received signal power (dB) - // RRC measurements - uint32_t rssi; - int n_adj_cells; - unsigned int adj_cell_id[6]; - uint32_t rsrq[7]; - uint32_t rsrp[7]; - float rsrp_filtered[7]; // after layer 3 filtering - float rsrq_filtered[7]; - // common measurements - //! estimated noise power (linear) - unsigned int n0_power[NB_ANTENNAS_RX]; - //! estimated noise power (dB) - unsigned short n0_power_dB[NB_ANTENNAS_RX]; - //! total estimated noise power (linear) - unsigned int n0_power_tot; - //! total estimated noise power (dB) - unsigned short n0_power_tot_dB; - //! average estimated noise power (linear) - unsigned int n0_power_avg; - //! average estimated noise power (dB) - unsigned short n0_power_avg_dB; - //! total estimated noise power (dBm) - short n0_power_tot_dBm; - // UE measurements - //! estimated received spatial signal power (linear) - int rx_spatial_power[NUMBER_OF_CONNECTED_eNB_MAX][2][2]; - //! estimated received spatial signal power (dB) - unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2]; - - /// estimated received signal power (sum over all TX antennas) - //int wideband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; - int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; - /// estimated received signal power (sum over all TX antennas) - //int wideband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; - unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; - - /// estimated received signal power (sum over all TX/RX antennas) - int rx_power_tot[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW - /// estimated received signal power (sum over all TX/RX antennas) - unsigned short rx_power_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW - - //! estimated received signal power (sum of all TX/RX antennas, time average) - int rx_power_avg[NUMBER_OF_CONNECTED_eNB_MAX]; - //! estimated received signal power (sum of all TX/RX antennas, time average, in dB) - unsigned short rx_power_avg_dB[NUMBER_OF_CONNECTED_eNB_MAX]; - - /// SINR (sum of all TX/RX antennas, in dB) - int wideband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX]; - /// SINR (sum of all TX/RX antennas, time average, in dB) - int wideband_cqi_avg[NUMBER_OF_CONNECTED_eNB_MAX]; - //! estimated rssi (dBm) - short rx_rssi_dBm[NUMBER_OF_CONNECTED_eNB_MAX]; - //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation) - int rx_correlation[NUMBER_OF_CONNECTED_eNB_MAX][2]; - //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation) - int rx_correlation_dB[NUMBER_OF_CONNECTED_eNB_MAX][2]; - - /// Wideband CQI (sum of all RX antennas, in dB, for precoded transmission modes (3,4,5,6), up to 4 spatial streams) - int precoded_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX+1][4]; - /// Subband CQI per RX antenna (= SINR) - int subband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX]; - /// Total Subband CQI (= SINR) - int subband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX]; - /// Subband CQI in dB (= SINR dB) - int subband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX]; - /// Total Subband CQI - int subband_cqi_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX]; - /// Wideband PMI for each RX antenna - int wideband_pmi_re[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; - /// Wideband PMI for each RX antenna - int wideband_pmi_im[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; - ///Subband PMI for each RX antenna - int subband_pmi_re[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX]; - ///Subband PMI for each RX antenna - int subband_pmi_im[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX]; - /// chosen RX antennas (1=Rx antenna 1, 2=Rx antenna 2, 3=both Rx antennas) - unsigned char selected_rx_antennas[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX]; - /// Wideband Rank indication - unsigned char rank[NUMBER_OF_CONNECTED_eNB_MAX]; - /// Number of RX Antennas - unsigned char nb_antennas_rx; - /// DLSCH error counter - // short dlsch_errors; - -} PHY_MEASUREMENTS; typedef struct { //unsigned int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (linear) @@ -1155,11 +1029,6 @@ typedef struct PHY_VARS_eNB_s { time_stats_t ulsch_tc_intl1_stats; time_stats_t ulsch_tc_intl2_stats; -#ifdef LOCALIZATION - /// time state for localization - time_stats_t localization_stats; -#endif - int32_t pucch1_stats_cnt[NUMBER_OF_UE_MAX][10]; int32_t pucch1_stats[NUMBER_OF_UE_MAX][10*1024]; int32_t pucch1_stats_thres[NUMBER_OF_UE_MAX][10*1024]; @@ -1172,512 +1041,8 @@ typedef struct PHY_VARS_eNB_s { int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240]; } PHY_VARS_eNB; -#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg - -/// Top-level PHY Data Structure for UE -typedef struct { - /// \brief Module ID indicator for this instance - uint8_t Mod_id; - /// \brief Component carrier ID for this PHY instance - uint8_t CC_id; - /// \brief Mapping of CC_id antennas to cards - openair0_rf_map rf_map; - //uint8_t local_flag; - /// \brief Indicator of current run mode of UE (normal_txrx, rx_calib_ue, no_L2_connect, debug_prach) - runmode_t mode; - /// \brief Indicator that UE should perform band scanning - int UE_scan; - /// \brief Indicator that UE should perform coarse scanning around carrier - int UE_scan_carrier; - /// \brief Indicator that UE is synchronized to an eNB - int is_synchronized; - /// Data structure for UE process scheduling - UE_proc_t proc; - /// Flag to indicate the UE shouldn't do timing correction at all - int no_timing_correction; - /// \brief Total gain of the TX chain (16-bit baseband I/Q to antenna) - uint32_t tx_total_gain_dB; - /// \brief Total gain of the RX chain (antenna to baseband I/Q) This is a function of rx_gain_mode (and the corresponding gain) and the rx_gain of the card. - uint32_t rx_total_gain_dB; - /// \brief Total gains with maximum RF gain stage (ExpressMIMO2/Lime) - uint32_t rx_gain_max[4]; - /// \brief Total gains with medium RF gain stage (ExpressMIMO2/Lime) - uint32_t rx_gain_med[4]; - /// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime) - uint32_t rx_gain_byp[4]; - /// \brief Current transmit power - int16_t tx_power_dBm[10]; - /// \brief Total number of REs in current transmission - int tx_total_RE[10]; - /// \brief Maximum transmit power - int8_t tx_power_max_dBm; - /// \brief Number of eNB seen by UE - uint8_t n_connected_eNB; - /// \brief indicator that Handover procedure has been initiated - uint8_t ho_initiated; - /// \brief indicator that Handover procedure has been triggered - uint8_t ho_triggered; - /// \brief Measurement variables. - PHY_MEASUREMENTS measurements; - LTE_DL_FRAME_PARMS frame_parms; - /// \brief Frame parame before ho used to recover if ho fails. - LTE_DL_FRAME_PARMS frame_parms_before_ho; - LTE_UE_COMMON common_vars; - - // point to the current rxTx thread index - uint8_t current_thread_id[10]; - - LTE_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX+1]; // two RxTx Threads - LTE_UE_PDSCH_FLP *pdsch_vars_flp[NUMBER_OF_CONNECTED_eNB_MAX+1]; - LTE_UE_PDSCH *pdsch_vars_SI[NUMBER_OF_CONNECTED_eNB_MAX+1]; - LTE_UE_PDSCH *pdsch_vars_ra[NUMBER_OF_CONNECTED_eNB_MAX+1]; - LTE_UE_PDSCH *pdsch_vars_p[NUMBER_OF_CONNECTED_eNB_MAX+1]; - LTE_UE_PDSCH *pdsch_vars_MCH[NUMBER_OF_CONNECTED_eNB_MAX]; - LTE_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_eNB_MAX]; - LTE_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX]; - LTE_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_eNB_MAX]; - LTE_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX][2]; // two RxTx Threads - LTE_UE_ULSCH_t *ulsch[NUMBER_OF_CONNECTED_eNB_MAX]; - LTE_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_eNB_MAX]; - LTE_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_eNB_MAX]; - LTE_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_eNB_MAX]; - LTE_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_eNB_MAX]; - // This is for SIC in the UE, to store the reencoded data - LTE_eNB_DLSCH_t *dlsch_eNB[NUMBER_OF_CONNECTED_eNB_MAX]; - - //Paging parameters - uint32_t IMSImod1024; - uint32_t PF; - uint32_t PO; - - // For abstraction-purposes only - uint8_t sr[10]; - uint8_t pucch_sel[10]; - uint8_t pucch_payload[22]; - - UE_MODE_t UE_mode[NUMBER_OF_CONNECTED_eNB_MAX]; - /// cell-specific reference symbols - uint32_t lte_gold_table[7][20][2][14]; - - /// UE-specific reference symbols (p=5), TM 7 - uint32_t lte_gold_uespec_port5_table[20][38]; - - /// ue-specific reference symbols - uint32_t lte_gold_uespec_table[2][20][2][21]; - - /// mbsfn reference symbols - uint32_t lte_gold_mbsfn_table[10][3][42]; - - uint32_t X_u[64][839]; - - uint32_t high_speed_flag; - uint32_t perfect_ce; - int16_t ch_est_alpha; - int generate_ul_signal[NUMBER_OF_CONNECTED_eNB_MAX]; - - UE_SCAN_INFO_t scan_info[NB_BANDS_MAX]; - - char ulsch_no_allocation_counter[NUMBER_OF_CONNECTED_eNB_MAX]; - - - - unsigned char ulsch_Msg3_active[NUMBER_OF_CONNECTED_eNB_MAX]; - uint32_t ulsch_Msg3_frame[NUMBER_OF_CONNECTED_eNB_MAX]; - unsigned char ulsch_Msg3_subframe[NUMBER_OF_CONNECTED_eNB_MAX]; - PRACH_RESOURCES_t *prach_resources[NUMBER_OF_CONNECTED_eNB_MAX]; - int turbo_iterations, turbo_cntl_iterations; - /// \brief ?. - /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded) - uint32_t total_TBS[NUMBER_OF_CONNECTED_eNB_MAX]; - /// \brief ?. - /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded) - uint32_t total_TBS_last[NUMBER_OF_CONNECTED_eNB_MAX]; - /// \brief ?. - /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded) - uint32_t bitrate[NUMBER_OF_CONNECTED_eNB_MAX]; - /// \brief ?. - /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded) - uint32_t total_received_bits[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_errors[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_errors_last[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_received[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_received_last[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_fer[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_SI_received[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_SI_errors[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_ra_received[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_ra_errors[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_p_received[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_p_errors[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_mch_received_sf[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_mch_received[NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_mcch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_mtch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_mcch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_mtch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_mcch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX]; - int dlsch_mtch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX]; - int current_dlsch_cqi[NUMBER_OF_CONNECTED_eNB_MAX]; - unsigned char first_run_timing_advance[NUMBER_OF_CONNECTED_eNB_MAX]; - uint8_t generate_prach; - uint8_t prach_cnt; - uint8_t prach_PreambleIndex; - // uint8_t prach_timer; - uint8_t decode_SIB; - uint8_t decode_MIB; - int rx_offset; /// Timing offset - int rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP - int time_sync_cell; - int timing_advance; ///timing advance signalled from eNB - int hw_timing_advance; - int N_TA_offset; ///timing offset used in TDD - /// Flag to tell if UE is secondary user (cognitive mode) - unsigned char is_secondary_ue; - /// Flag to tell if secondary eNB has channel estimates to create NULL-beams from. - unsigned char has_valid_precoder; - /// hold the precoder for NULL beam to the primary eNB - int **ul_precoder_S_UE; - /// holds the maximum channel/precoder coefficient - char log2_maxp; - - /// if ==0 enables phy only test mode - int mac_enabled; - - /// Flag to initialize averaging of PHY measurements - int init_averaging; - - /// \brief sinr for all subcarriers of the current link (used only for abstraction). - /// - first index: ? [0..12*N_RB_DL[ - double *sinr_dB; - - /// \brief sinr for all subcarriers of first symbol for the CQI Calculation. - /// - first index: ? [0..12*N_RB_DL[ - double *sinr_CQI_dB; - - /// sinr_effective used for CQI calulcation - double sinr_eff; - - /// N0 (used for abstraction) - double N0; - - /// PDSCH Varaibles - PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX]; - - /// PUSCH Varaibles - PUSCH_CONFIG_DEDICATED pusch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX]; - - /// PUSCH contention-based access vars - PUSCH_CA_CONFIG_DEDICATED pusch_ca_config_dedicated[NUMBER_OF_eNB_MAX]; // lola - - /// PUCCH variables - - PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX]; - - uint8_t ncs_cell[20][7]; - - /// UL-POWER-Control - UL_POWER_CONTROL_DEDICATED ul_power_control_dedicated[NUMBER_OF_CONNECTED_eNB_MAX]; - - /// TPC - TPC_PDCCH_CONFIG tpc_pdcch_config_pucch[NUMBER_OF_CONNECTED_eNB_MAX]; - TPC_PDCCH_CONFIG tpc_pdcch_config_pusch[NUMBER_OF_CONNECTED_eNB_MAX]; - - /// CQI reporting - CQI_REPORT_CONFIG cqi_report_config[NUMBER_OF_CONNECTED_eNB_MAX]; - - /// SRS Variables - SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX]; - - /// Scheduling Request Config - SCHEDULING_REQUEST_CONFIG scheduling_request_config[NUMBER_OF_CONNECTED_eNB_MAX]; - - /// Transmission mode per eNB - uint8_t transmission_mode[NUMBER_OF_CONNECTED_eNB_MAX]; - - time_stats_t phy_proc[RX_NB_TH]; - time_stats_t phy_proc_tx; - time_stats_t phy_proc_rx[RX_NB_TH]; - - uint32_t use_ia_receiver; - - time_stats_t ofdm_mod_stats; - time_stats_t ulsch_encoding_stats; - time_stats_t ulsch_modulation_stats; - time_stats_t ulsch_segmentation_stats; - time_stats_t ulsch_rate_matching_stats; - time_stats_t ulsch_turbo_encoding_stats; - time_stats_t ulsch_interleaving_stats; - time_stats_t ulsch_multiplexing_stats; - - time_stats_t generic_stat; - time_stats_t generic_stat_bis[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; - time_stats_t ue_front_end_stat[RX_NB_TH]; - time_stats_t ue_front_end_per_slot_stat[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; - time_stats_t pdcch_procedures_stat[RX_NB_TH]; - time_stats_t pdsch_procedures_stat[RX_NB_TH]; - time_stats_t pdsch_procedures_per_slot_stat[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; - time_stats_t dlsch_procedures_stat[RX_NB_TH]; - - time_stats_t ofdm_demod_stats; - time_stats_t dlsch_rx_pdcch_stats; - time_stats_t rx_dft_stats; - time_stats_t dlsch_channel_estimation_stats; - time_stats_t dlsch_freq_offset_estimation_stats; - time_stats_t dlsch_decoding_stats[2]; - time_stats_t dlsch_demodulation_stats; - time_stats_t dlsch_rate_unmatching_stats; - time_stats_t dlsch_turbo_decoding_stats; - time_stats_t dlsch_deinterleaving_stats; - time_stats_t dlsch_llr_stats; - time_stats_t dlsch_llr_stats_parallelization[RX_NB_TH][LTE_SLOTS_PER_SUBFRAME]; - time_stats_t dlsch_unscrambling_stats; - time_stats_t dlsch_rate_matching_stats; - time_stats_t dlsch_turbo_encoding_stats; - time_stats_t dlsch_interleaving_stats; - time_stats_t dlsch_tc_init_stats; - time_stats_t dlsch_tc_alpha_stats; - time_stats_t dlsch_tc_beta_stats; - time_stats_t dlsch_tc_gamma_stats; - time_stats_t dlsch_tc_ext_stats; - time_stats_t dlsch_tc_intl1_stats; - time_stats_t dlsch_tc_intl2_stats; - time_stats_t tx_prach; - - /// RF and Interface devices per CC - - openair0_device rfdevice; -} PHY_VARS_UE; - -/* this structure is used to pass both UE phy vars and - * proc to the function UE_thread_rxn_txnp4 - */ -struct rx_tx_thread_data { - PHY_VARS_UE *UE; - UE_rxtx_proc_t *proc; -}; - -void exit_fun(const char* s); - -#include "UTIL/LOG/log_extern.h" -extern pthread_cond_t sync_cond; -extern pthread_mutex_t sync_mutex; -extern int sync_var; - - -#define MODE_DECODE_NONE 0 -#define MODE_DECODE_SSE 1 -#define MODE_DECODE_C 2 -#define MODE_DECODE_AVX2 3 - -#define DECODE_INITTD8_SSE_FPTRIDX 0 -#define DECODE_INITTD16_SSE_FPTRIDX 1 -#define DECODE_INITTD_AVX2_FPTRIDX 2 -#define DECODE_TD8_SSE_FPTRIDX 3 -#define DECODE_TD16_SSE_FPTRIDX 4 -#define DECODE_TD_C_FPTRIDX 5 -#define DECODE_TD16_AVX2_FPTRIDX 6 -#define DECODE_FREETD8_FPTRIDX 7 -#define DECODE_FREETD16_FPTRIDX 8 -#define DECODE_FREETD_AVX2_FPTRIDX 9 -#define ENCODE_SSE_FPTRIDX 10 -#define ENCODE_C_FPTRIDX 11 -#define ENCODE_INIT_SSE_FPTRIDX 12 -#define DECODE_NUM_FPTR 13 - - -typedef uint8_t(*decoder_if_t)(int16_t *y, - int16_t *y2, - uint8_t *decoded_bytes, - uint8_t *decoded_bytes2, - uint16_t n, - uint16_t f1, - uint16_t f2, - uint8_t max_iterations, - uint8_t crc_type, - uint8_t F, - time_stats_t *init_stats, - time_stats_t *alpha_stats, - time_stats_t *beta_stats, - time_stats_t *gamma_stats, - time_stats_t *ext_stats, - time_stats_t *intl1_stats, - time_stats_t *intl2_stats); - -typedef uint8_t(*encoder_if_t)(uint8_t *input, - uint16_t input_length_bytes, - uint8_t *output, - uint8_t F, - uint16_t interleaver_f1, - uint16_t interleaver_f2); - -#define MAX_RRU_CONFIG_SIZE 1024 -typedef enum { - RAU_tick=0, - RRU_capabilities=1, - RRU_config=2, - RRU_MSG_max_num=3 -} rru_config_msg_type_t; - -typedef struct RRU_CONFIG_msg_s { - rru_config_msg_type_t type; - ssize_t len; - uint8_t msg[MAX_RRU_CONFIG_SIZE]; -} RRU_CONFIG_msg_t; - -typedef enum { - OAI_IF5_only =0, - OAI_IF4p5_only =1, - OAI_IF5_and_IF4p5 =2, - MBP_IF5 =3, - MAX_FH_FMTs =4 -} FH_fmt_options_t; - -#define MAX_BANDS_PER_RRU 4 - -typedef struct RRU_capabilities_s { - /// Fronthaul format - FH_fmt_options_t FH_fmt; - /// number of EUTRA bands (<=4) supported by RRU - uint8_t num_bands; - /// EUTRA band list supported by RRU - uint8_t band_list[MAX_BANDS_PER_RRU]; - /// Number of concurrent bands (component carriers) - uint8_t num_concurrent_bands; - /// Maximum TX EPRE of each band - int8_t max_pdschReferenceSignalPower[MAX_BANDS_PER_RRU]; - /// Maximum RX gain of each band - uint8_t max_rxgain[MAX_BANDS_PER_RRU]; - /// Number of RX ports of each band - uint8_t nb_rx[MAX_BANDS_PER_RRU]; - /// Number of TX ports of each band - uint8_t nb_tx[MAX_BANDS_PER_RRU]; - /// max DL bandwidth (1,6,15,25,50,75,100) - uint8_t N_RB_DL[MAX_BANDS_PER_RRU]; - /// max UL bandwidth (1,6,15,25,50,75,100) - uint8_t N_RB_UL[MAX_BANDS_PER_RRU]; -} RRU_capabilities_t; - -typedef struct RRU_config_s { - /// Fronthaul format - RU_if_south_t FH_fmt; - /// number of EUTRA bands (<=4) configured in RRU - uint8_t num_bands; - /// EUTRA band list configured in RRU - uint8_t band_list[MAX_BANDS_PER_RRU]; - /// TDD configuration (0-6) - uint8_t tdd_config[MAX_BANDS_PER_RRU]; - /// TDD special subframe configuration (0-10) - uint8_t tdd_config_S[MAX_BANDS_PER_RRU]; - /// TX frequency - uint32_t tx_freq[MAX_BANDS_PER_RRU]; - /// RX frequency - uint32_t rx_freq[MAX_BANDS_PER_RRU]; - /// TX attenation w.r.t. max - uint8_t att_tx[MAX_BANDS_PER_RRU]; - /// RX attenuation w.r.t. max - uint8_t att_rx[MAX_BANDS_PER_RRU]; - /// DL bandwidth - uint8_t N_RB_DL[MAX_BANDS_PER_RRU]; - /// UL bandwidth - uint8_t N_RB_UL[MAX_BANDS_PER_RRU]; - /// 3/4 sampling rate - uint8_t threequarter_fs[MAX_BANDS_PER_RRU]; - /// prach_FreqOffset for IF4p5 - int prach_FreqOffset[MAX_BANDS_PER_RRU]; - /// prach_ConfigIndex for IF4p5 - int prach_ConfigIndex[MAX_BANDS_PER_RRU]; -#ifdef Rel14 - int emtc_prach_CElevel_enable[MAX_BANDS_PER_RRU][4]; - /// emtc_prach_FreqOffset for IF4p5 per CE Level - int emtc_prach_FreqOffset[MAX_BANDS_PER_RRU][4]; - /// emtc_prach_ConfigIndex for IF4p5 per CE Level - int emtc_prach_ConfigIndex[MAX_BANDS_PER_RRU][4]; -#endif -} RRU_config_t; -static inline void wait_sync(char *thread_name) { - printf( "waiting for sync (%s)\n",thread_name); - pthread_mutex_lock( &sync_mutex ); - - while (sync_var<0) - pthread_cond_wait( &sync_cond, &sync_mutex ); - - pthread_mutex_unlock(&sync_mutex); - - printf( "got sync (%s)\n", thread_name); - -} - -static inline int wait_on_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) { - if (pthread_mutex_lock(mutex) != 0) { - LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name); - exit_fun("nothing to add"); - return(-1); - } - - while (*instance_cnt < 0) { - // most of the time the thread is waiting here - // proc->instance_cnt_rxtx is -1 - pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again - } - - if (pthread_mutex_unlock(mutex) != 0) { - LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for %s\n",name); - exit_fun("nothing to add"); - return(-1); - } - return(0); -} - -static inline int wait_on_busy_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) { - - if (pthread_mutex_lock(mutex) != 0) { - LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name); - exit_fun("nothing to add"); - return(-1); - } - - while (*instance_cnt == 0) { - // most of the time the thread will skip this - // waits only if proc->instance_cnt_rxtx is 0 - pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again - } - - if (pthread_mutex_unlock(mutex) != 0) { - LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for %s\n",name); - exit_fun("nothing to add"); - return(-1); - } - return(0); -} - -static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *name) { - - if (pthread_mutex_lock(mutex) != 0) { - LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name); - exit_fun("nothing to add"); - return(-1); - } - - *instance_cnt=*instance_cnt-1; - - if (pthread_mutex_unlock(mutex) != 0) { - LOG_E( PHY, "[SCHED][eNB] error unlocking mutex for %s\n",name); - exit_fun("nothing to add"); - return(-1); - } - return(0); -} - - -#include "PHY/INIT/defs.h" -#include "PHY/LTE_REFSIG/defs.h" -#include "PHY/MODULATION/defs.h" -#include "PHY/LTE_TRANSPORT/proto.h" -#include "PHY/LTE_ESTIMATION/defs.h" - -#include "SIMULATION/ETH_TRANSPORT/defs.h" -#endif // __PHY_DEFS__H__ +#endif // __PHY_DEFS_eNB_H__ diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 066dc7012c..8ffe1fabf4 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -34,661 +34,9 @@ #define __PHY_IMPLEMENTATION_DEFS_LTE_H__ -#include "types.h" -#include "nfapi_interface.h" -//#include "defs.h" -#include "openair2/COMMON/platform_types.h" -#define RX_NB_TH_MAX 2 -#define RX_NB_TH 2 -#define LTE_SLOTS_PER_SUBFRAME 2 -#define LTE_NUMBER_OF_SUBFRAMES_PER_FRAME 10 -#define LTE_SLOTS_PER_FRAME 20 -#define LTE_CE_FILTER_LENGTH 5 -#define LTE_CE_OFFSET LTE_CE_FILTER_LENGTH -#define TX_RX_SWITCH_SYMBOL (NUMBER_OF_SYMBOLS_PER_FRAME>>1) -#define PBCH_PDU_SIZE 3 //bytes - -#define PRACH_SYMBOL 3 //position of the UL PSS wrt 2nd slot of special subframe - -#define NUMBER_OF_FREQUENCY_GROUPS (lte_frame_parms->N_RB_DL) - -#define SSS_AMP 1148 - -#define MAX_NUM_PHICH_GROUPS 56 //110 RBs Ng=2, p.60 36-212, Sec. 6.9 - -#define MAX_MBSFN_AREA 8 - -#define NB_RX_ANTENNAS_MAX 64 - -#ifdef OCP_FRAMEWORK -#include "enums.h" -#else -typedef enum {TDD=1,FDD=0} lte_frame_type_t; - -typedef enum {EXTENDED=1,NORMAL=0} lte_prefix_type_t; - -typedef enum {LOCALIZED=0,DISTRIBUTED=1} vrb_t; - -/// Enumeration for parameter PHICH-Duration \ref PHICH_CONFIG_COMMON::phich_duration. -typedef enum { - normal=0, - extended=1 -} PHICH_DURATION_t; - -/// Enumeration for parameter Ng \ref PHICH_CONFIG_COMMON::phich_resource. -typedef enum { - oneSixth=1, - half=3, - one=6, - two=12 -} PHICH_RESOURCE_t; -#endif -/// PHICH-Config from 36.331 RRC spec -typedef struct { - /// Parameter: PHICH-Duration, see TS 36.211 (Table 6.9.3-1). - PHICH_DURATION_t phich_duration; - /// Parameter: Ng, see TS 36.211 (6.9). \details Value oneSixth corresponds to 1/6, half corresponds to 1/2 and so on. - PHICH_RESOURCE_t phich_resource; -} PHICH_CONFIG_COMMON; - -/// PRACH-ConfigInfo from 36.331 RRC spec -typedef struct { - /// Parameter: prach-ConfigurationIndex, see TS 36.211 (5.7.1). \vr{[0..63]} - uint8_t prach_ConfigIndex; - /// Parameter: High-speed-flag, see TS 36.211 (5.7.2). \vr{[0..1]} 1 corresponds to Restricted set and 0 to Unrestricted set. - uint8_t highSpeedFlag; - /// Parameter: \f$N_\text{CS}\f$, see TS 36.211 (5.7.2). \vr{[0..15]}\n Refer to table 5.7.2-2 for preamble format 0..3 and to table 5.7.2-3 for preamble format 4. - uint8_t zeroCorrelationZoneConfig; - /// Parameter: prach-FrequencyOffset, see TS 36.211 (5.7.1). \vr{[0..94]}\n For TDD the value range is dependent on the value of \ref prach_ConfigIndex. - uint8_t prach_FreqOffset; -} PRACH_CONFIG_INFO; - - - -/// PRACH-ConfigSIB or PRACH-Config from 36.331 RRC spec -typedef struct { - /// Parameter: RACH_ROOT_SEQUENCE, see TS 36.211 (5.7.1). \vr{[0..837]} - uint16_t rootSequenceIndex; - /// prach_Config_enabled=1 means enabled. \vr{[0..1]} - uint8_t prach_Config_enabled; - /// PRACH Configuration Information - PRACH_CONFIG_INFO prach_ConfigInfo; -} PRACH_CONFIG_COMMON; - -#ifdef Rel14 - -/// PRACH-eMTC-Config from 36.331 RRC spec -typedef struct { - /// Parameter: High-speed-flag, see TS 36.211 (5.7.2). \vr{[0..1]} 1 corresponds to Restricted set and 0 to Unrestricted set. - uint8_t highSpeedFlag; -/// Parameter: \f$N_\text{CS}\f$, see TS 36.211 (5.7.2). \vr{[0..15]}\n Refer to table 5.7.2-2 for preamble format 0..3 and to table 5.7.2-3 for preamble format 4. - uint8_t zeroCorrelationZoneConfig; - /// Parameter: prach-FrequencyOffset, see TS 36.211 (5.7.1). \vr{[0..94]}\n For TDD the value range is dependent on the value of \ref prach_ConfigIndex. - - /// PRACH starting subframe periodicity, expressed in number of subframes available for preamble transmission (PRACH opportunities), see TS 36.211. Value 2 corresponds to 2 subframes, 4 corresponds to 4 subframes and so on. EUTRAN configures the PRACH starting subframe periodicity larger than or equal to the Number of PRACH repetitions per attempt for each CE level (numRepetitionPerPreambleAttempt). - uint8_t prach_starting_subframe_periodicity[4]; - /// number of repetitions per preamble attempt per CE level - uint8_t prach_numRepetitionPerPreambleAttempt[4]; - /// prach configuration index for each CE level - uint8_t prach_ConfigIndex[4]; - /// indicator for CE level activation - uint8_t prach_CElevel_enable[4]; - /// prach frequency offset for each CE level - uint8_t prach_FreqOffset[4]; - /// indicator for CE level hopping activation - uint8_t prach_hopping_enable[4]; - /// indicator for CE level hopping activation - uint8_t prach_hopping_offset[4]; -} PRACH_eMTC_CONFIG_INFO; - -/// PRACH-ConfigSIB or PRACH-Config from 36.331 RRC spec -typedef struct { - /// Parameter: RACH_ROOT_SEQUENCE, see TS 36.211 (5.7.1). \vr{[0..837]} - uint16_t rootSequenceIndex; - /// prach_Config_enabled=1 means enabled. \vr{[0..1]} - uint8_t prach_Config_enabled; - /// PRACH Configuration Information -#ifdef Rel14 - PRACH_eMTC_CONFIG_INFO prach_ConfigInfo; -#endif -} PRACH_eMTC_CONFIG_COMMON; - -#endif - -/// Enumeration for parameter \f$N_\text{ANRep}\f$ \ref PUCCH_CONFIG_DEDICATED::repetitionFactor. -typedef enum { - n2=0, - n4, - n6 -} ACKNAKREP_t; - -/// Enumeration for \ref PUCCH_CONFIG_DEDICATED::tdd_AckNackFeedbackMode. -typedef enum { - bundling=0, - multiplexing -} ANFBmode_t; - -/// PUCCH-ConfigDedicated from 36.331 RRC spec -typedef struct { - /// Flag to indicate ACK NAK repetition activation, see TS 36.213 (10.1). \vr{[0..1]} - uint8_t ackNackRepetition; - /// Parameter: \f$N_\text{ANRep}\f$, see TS 36.213 (10.1). - ACKNAKREP_t repetitionFactor; - /// Parameter: \f$n^{(1)}_\text{PUCCH,ANRep}\f$, see TS 36.213 (10.1). \vr{[0..2047]} - uint16_t n1PUCCH_AN_Rep; - /// Feedback mode, see TS 36.213 (7.3). \details Applied to both PUCCH and PUSCH feedback. For TDD, should always be set to bundling. - ANFBmode_t tdd_AckNackFeedbackMode; -} PUCCH_CONFIG_DEDICATED; - -/// PUCCH-ConfigCommon from 36.331 RRC spec -typedef struct { - /// Parameter: \f$\Delta^\text{PUCCH}_\text{shift}\f$, see TS 36.211 (5.4.1). \vr{[1..3]} \note the specification sais it is an enumerated value. - uint8_t deltaPUCCH_Shift; - /// Parameter: \f$N^{(2)}_\text{RB}\f$, see TS 36.211 (5.4). \vr{[0..98]} - uint8_t nRB_CQI; - /// Parameter: \f$N^{(1)}_\text{CS}\f$, see TS 36.211 (5.4). \vr{[0..7]} - uint8_t nCS_AN; - /// Parameter: \f$N^{(1)}_\text{PUCCH}\f$ see TS 36.213 (10.1). \vr{[0..2047]} - uint16_t n1PUCCH_AN; - - /// group hopping sequence for DRS \note not part of offical UL-PUCCH_CONFIG_COMMON ASN1 specification. - uint8_t grouphop[20]; - /// sequence hopping sequence for DRS \note not part of offical UL-PUCCH_CONFIG_COMMON ASN1 specification. - uint8_t seqhop[20]; -} PUCCH_CONFIG_COMMON; - -/// UL-ReferenceSignalsPUSCH from 36.331 RRC spec -typedef struct { - /// Parameter: Group-hopping-enabled, see TS 36.211 (5.5.1.3). \vr{[0..1]} - uint8_t groupHoppingEnabled; - /// Parameter: \f$\Delta SS\f$, see TS 36.211 (5.5.1.3). \vr{[0..29]} - uint8_t groupAssignmentPUSCH; - /// Parameter: Sequence-hopping-enabled, see TS 36.211 (5.5.1.4). \vr{[0..1]} - uint8_t sequenceHoppingEnabled; - /// Parameter: cyclicShift, see TS 36.211 (Table 5.5.2.1.1-2). \vr{[0..7]} - uint8_t cyclicShift; - /// nPRS for cyclic shift of DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification. - uint8_t nPRS[20]; - /// group hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification. - uint8_t grouphop[20]; - /// sequence hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification. - uint8_t seqhop[20]; -} UL_REFERENCE_SIGNALS_PUSCH_t; - -/// Enumeration for parameter Hopping-mode \ref PUSCH_CONFIG_COMMON::hoppingMode. -#ifndef OCP_FRAMEWORK -typedef enum { - interSubFrame=0, - intraAndInterSubFrame=1 -} PUSCH_HOPPING_t; -#endif - -/// PUSCH-ConfigCommon from 36.331 RRC spec. -typedef struct { - /// Parameter: \f$N_{sb}\f$, see TS 36.211 (5.3.4). \vr{[1..4]} - uint8_t n_SB; - /// Parameter: Hopping-mode, see TS 36.211 (5.3.4). - PUSCH_HOPPING_t hoppingMode; - /// Parameter: \f$N^{HO}_{RB}\f$, see TS 36.211 (5.3.4). \vr{[0..98]} - uint8_t pusch_HoppingOffset; - /// See TS 36.213 (8.6.1). \vr{[0..1]} 1 indicates 64QAM is allowed, 0 not allowed. - uint8_t enable64QAM; - /// Ref signals configuration - UL_REFERENCE_SIGNALS_PUSCH_t ul_ReferenceSignalsPUSCH; -} PUSCH_CONFIG_COMMON; - -/// UE specific PUSCH configuration. -typedef struct { - /// Parameter: \f$I^\text{HARQ-ACK}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-1). \vr{[0..15]} - uint16_t betaOffset_ACK_Index; - /// Parameter: \f$I^{RI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-2). \vr{[0..15]} - uint16_t betaOffset_RI_Index; - /// Parameter: \f$I^{CQI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-3). \vr{[0..15]} - uint16_t betaOffset_CQI_Index; -} PUSCH_CONFIG_DEDICATED; - -/// lola CBA information -typedef struct { - /// - uint16_t betaOffset_CA_Index; - /// - uint16_t cShift; -} PUSCH_CA_CONFIG_DEDICATED; - -/// PDSCH-ConfigCommon from 36.331 RRC spec -typedef struct { - /// Parameter: Reference-signal power, see TS 36.213 (5.2). \vr{[-60..50]}\n Provides the downlink reference-signal EPRE. The actual value in dBm. - int8_t referenceSignalPower; - /// Parameter: \f$P_B\f$, see TS 36.213 (Table 5.2-1). \vr{[0..3]} - uint8_t p_b; -} PDSCH_CONFIG_COMMON; - -/// Enumeration for Parameter \f$P_A\f$ \ref PDSCH_CONFIG_DEDICATED::p_a. -typedef enum { - dBm6=0, ///< (dB-6) corresponds to -6 dB - dBm477, ///< (dB-4dot77) corresponds to -4.77 dB - dBm3, ///< (dB-3) corresponds to -3 dB - dBm177, ///< (dB-1dot77) corresponds to -1.77 dB - dB0, ///< corresponds to 0 dB - dB1, ///< corresponds to 1 dB - dB2, ///< corresponds to 2 dB - dB3 ///< corresponds to 3 dB -} PA_t; - -/// PDSCH-ConfigDedicated from 36.331 RRC spec -typedef struct { - /// Parameter: \f$P_A\f$, see TS 36.213 (5.2). - PA_t p_a; -} PDSCH_CONFIG_DEDICATED; - -/// SoundingRS-UL-ConfigCommon Information Element from 36.331 RRC spec -typedef struct { - /// enabled flag=1 means SRS is enabled. \vr{[0..1]} - uint8_t enabled_flag; - /// Parameter: SRS Bandwidth Configuration, see TS 36.211 (table 5.5.3.2-1, 5.5.3.2-2, 5.5.3.2-3 and 5.5.3.2-4). \vr{[0..7]}\n Actual configuration depends on UL bandwidth. \note the specification sais it is an enumerated value. - uint8_t srs_BandwidthConfig; - /// Parameter: SRS SubframeConfiguration, see TS 36.211 (table 5.5.3.3-1 for FDD, table 5.5.3.3-2 for TDD). \vr{[0..15]} \note the specification sais it is an enumerated value. - uint8_t srs_SubframeConfig; - /// Parameter: Simultaneous-AN-and-SRS, see TS 36.213 (8.2). \vr{[0..1]} - uint8_t ackNackSRS_SimultaneousTransmission; - /// Parameter: srsMaxUpPts, see TS 36.211 (5.5.3.2). \details If this field is present, reconfiguration of \f$m^\text{max}_\text{SRS,0}\f$ applies for UpPts, otherwise reconfiguration does not apply. - uint8_t srs_MaxUpPts; -} SOUNDINGRS_UL_CONFIG_COMMON; - -/// \note UNUSED -typedef enum { - ulpc_al0=0, - ulpc_al04=1, - ulpc_al05=2, - ulpc_al06=3, - ulpc_al07=4, - ulpc_al08=5, - ulpc_al09=6, - ulpc_al11=7 -} UL_POWER_CONTROL_COMMON_alpha_t; - -/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format1. -typedef enum { - deltaF_PUCCH_Format1_deltaF_2 = 0, - deltaF_PUCCH_Format1_deltaF0 = 1, - deltaF_PUCCH_Format1_deltaF2 = 2 -} deltaF_PUCCH_Format1_t; - -/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format1b. -typedef enum { - deltaF_PUCCH_Format1b_deltaF1 = 0, - deltaF_PUCCH_Format1b_deltaF3 = 1, - deltaF_PUCCH_Format1b_deltaF5 = 2 -} deltaF_PUCCH_Format1b_t; - -/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2. -typedef enum { - deltaF_PUCCH_Format2_deltaF_2 = 0, - deltaF_PUCCH_Format2_deltaF0 = 1, - deltaF_PUCCH_Format2_deltaF1 = 2, - deltaF_PUCCH_Format2_deltaF2 = 3 -} deltaF_PUCCH_Format2_t; - -/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2a. -typedef enum { - deltaF_PUCCH_Format2a_deltaF_2 = 0, - deltaF_PUCCH_Format2a_deltaF0 = 1, - deltaF_PUCCH_Format2a_deltaF2 = 2 -} deltaF_PUCCH_Format2a_t; - -/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2b. -typedef enum { - deltaF_PUCCH_Format2b_deltaF_2 = 0, - deltaF_PUCCH_Format2b_deltaF0 = 1, - deltaF_PUCCH_Format2b_deltaF2 = 2 -} deltaF_PUCCH_Format2b_t; - -/// DeltaFList-PUCCH from 36.331 RRC spec -typedef struct { - deltaF_PUCCH_Format1_t deltaF_PUCCH_Format1; - deltaF_PUCCH_Format1b_t deltaF_PUCCH_Format1b; - deltaF_PUCCH_Format2_t deltaF_PUCCH_Format2; - deltaF_PUCCH_Format2a_t deltaF_PUCCH_Format2a; - deltaF_PUCCH_Format2b_t deltaF_PUCCH_Format2b; -} deltaFList_PUCCH_t; - -/// SoundingRS-UL-ConfigDedicated Information Element from 36.331 RRC spec -typedef struct { - /// This descriptor is active - uint8_t active; - /// This descriptor's frame - uint16_t frame; - /// This descriptor's subframe - uint8_t subframe; - /// rnti - uint16_t rnti; - /// Parameter: \f$B_\text{SRS}\f$, see TS 36.211 (table 5.5.3.2-1, 5.5.3.2-2, 5.5.3.2-3 and 5.5.3.2-4). \vr{[0..3]} \note the specification sais it is an enumerated value. - uint8_t srs_Bandwidth; - /// Parameter: SRS hopping bandwidth \f$b_\text{hop}\in\{0,1,2,3\}\f$, see TS 36.211 (5.5.3.2) \vr{[0..3]} \note the specification sais it is an enumerated value. - uint8_t srs_HoppingBandwidth; - /// Parameter: \f$n_\text{RRC}\f$, see TS 36.211 (5.5.3.2). \vr{[0..23]} - uint8_t freqDomainPosition; - /// Parameter: Duration, see TS 36.213 (8.2). \vr{[0..1]} 0 corresponds to "single" and 1 to "indefinite". - uint8_t duration; - /// Parameter: \f$k_\text{TC}\in\{0,1\}\f$, see TS 36.211 (5.5.3.2). \vr{[0..1]} - uint8_t transmissionComb; - /// Parameter: \f$I_\text{SRS}\f$, see TS 36.213 (table 8.2-1). \vr{[0..1023]} - uint16_t srs_ConfigIndex; - /// Parameter: \f$n^\text{CS}_\text{SRS}\f$. See TS 36.211 (5.5.3.1). \vr{[0..7]} \note the specification sais it is an enumerated value. - uint8_t cyclicShift; - // Parameter: internal implementation: UE SRS configured - uint8_t srsConfigDedicatedSetup; - // Parameter: cell srs subframe for internal implementation - uint8_t srsCellSubframe; - // Parameter: ue srs subframe for internal implementation - uint8_t srsUeSubframe; -} SOUNDINGRS_UL_CONFIG_DEDICATED; - -/// UplinkPowerControlDedicated Information Element from 36.331 RRC spec -typedef struct { - /// Parameter: \f$P_\text{0\_UE\_PUSCH}(1)\f$, see TS 36.213 (5.1.1.1), unit dB. \vr{[-8..7]}\n This field is applicable for non-persistent scheduling, only. - int8_t p0_UE_PUSCH; - /// Parameter: Ks, see TS 36.213 (5.1.1.1). \vr{[0..1]}\n en0 corresponds to value 0 corresponding to state “disabledâ€. en1 corresponds to value 1.25 corresponding to “enabledâ€. \note the specification sais it is an enumerated value. \warning the enumeration values do not correspond to the given values in the specification (en1 should be 1.25). - uint8_t deltaMCS_Enabled; - /// Parameter: Accumulation-enabled, see TS 36.213 (5.1.1.1). \vr{[0..1]} 1 corresponds to "enabled" whereas 0 corresponds to "disabled". - uint8_t accumulationEnabled; - /// Parameter: \f$P_\text{0\_UE\_PUCCH}(1)\f$, see TS 36.213 (5.1.2.1), unit dB. \vr{[-8..7]} - int8_t p0_UE_PUCCH; - /// Parameter: \f$P_\text{SRS\_OFFSET}\f$, see TS 36.213 (5.1.3.1). \vr{[0..15]}\n For Ks=1.25 (\ref deltaMCS_Enabled), the actual parameter value is pSRS_Offset value - 3. For Ks=0, the actual parameter value is -10.5 + 1.5*pSRS_Offset value. - int8_t pSRS_Offset; - /// Specifies the filtering coefficient for RSRP measurements used to calculate path loss, as specified in TS 36.213 (5.1.1.1).\details The same filtering mechanism applies as for quantityConfig described in 5.5.3.2. \note the specification sais it is an enumerated value. - uint8_t filterCoefficient; -} UL_POWER_CONTROL_DEDICATED; - -#ifndef OCP_FRAMEWORK -/// Enumeration for parameter \f$\alpha\f$ \ref UL_POWER_CONTROL_CONFIG_COMMON::alpha. -typedef enum { - al0=0, - al04=1, - al05=2, - al06=3, - al07=4, - al08=5, - al09=6, - al1=7 -} PUSCH_alpha_t; -#endif - -/// \note UNUSED -typedef enum { - deltaFm2=0, - deltaF0, - deltaF1, - deltaF2, - deltaF3, - deltaF5 -} deltaF_PUCCH_t; - -/// UplinkPowerControlCommon Information Element from 36.331 RRC spec \note this structure does not currently make use of \ref deltaFList_PUCCH_t. -typedef struct { - /// Parameter: \f$P_\text{0\_NOMINAL\_PUSCH}(1)\f$, see TS 36.213 (5.1.1.1), unit dBm. \vr{[-126..24]}\n This field is applicable for non-persistent scheduling, only. - int8_t p0_NominalPUSCH; - /// Parameter: \f$\alpha\f$, see TS 36.213 (5.1.1.1) \warning the enumeration values do not correspond to the given values in the specification (al04 should be 0.4, ...)! - PUSCH_alpha_t alpha; - /// Parameter: \f$P_\text{0\_NOMINAL\_PUCCH}\f$ See TS 36.213 (5.1.2.1), unit dBm. \vr{[-127..-96]} - int8_t p0_NominalPUCCH; - /// Parameter: \f$\Delta_\text{PREAMBLE\_Msg3}\f$ see TS 36.213 (5.1.1.1). \vr{[-1..6]}\n Actual value = IE value * 2 [dB]. - int8_t deltaPreambleMsg3; - /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 1, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value. - long deltaF_PUCCH_Format1; - /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 1a, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value. - long deltaF_PUCCH_Format1a; - /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 1b, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value. - long deltaF_PUCCH_Format1b; - /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 2, see TS 36.213 (5.1.2). \vr{[0..3]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value. - long deltaF_PUCCH_Format2; - /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 2a, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value. - long deltaF_PUCCH_Format2a; - /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 2b, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value. - long deltaF_PUCCH_Format2b; -} UL_POWER_CONTROL_CONFIG_COMMON; - -/// Union for \ref TPC_PDCCH_CONFIG::tpc_Index. -typedef union { - /// Index of N when DCI format 3 is used. See TS 36.212 (5.3.3.1.6). \vr{[1..15]} - uint8_t indexOfFormat3; - /// Index of M when DCI format 3A is used. See TS 36.212 (5.3.3.1.7). \vr{[1..31]} - uint8_t indexOfFormat3A; -} TPC_INDEX_t; - -/// TPC-PDCCH-Config Information Element from 36.331 RRC spec -typedef struct { - /// RNTI for power control using DCI format 3/3A, see TS 36.212. \vr{[0..65535]} - uint16_t rnti; - /// Index of N or M, see TS 36.212 (5.3.3.1.6 and 5.3.3.1.7), where N or M is dependent on the used DCI format (i.e. format 3 or 3a). - TPC_INDEX_t tpc_Index; -} TPC_PDCCH_CONFIG; - -/// Enumeration for parameter SR transmission \ref SCHEDULING_REQUEST_CONFIG::dsr_TransMax. -typedef enum { - sr_n4=0, - sr_n8=1, - sr_n16=2, - sr_n32=3, - sr_n64=4 -} DSR_TRANSMAX_t; - -/// SchedulingRequestConfig Information Element from 36.331 RRC spec -typedef struct { - /// Parameter: \f$n^{(1)}_\text{PUCCH,SRI}\f$, see TS 36.213 (10.1). \vr{[0..2047]} - uint16_t sr_PUCCH_ResourceIndex; - /// Parameter: \f$I_\text{SR}\f$, see TS 36.213 (10.1). \vr{[0..155]} - uint8_t sr_ConfigIndex; - /// Parameter for SR transmission in TS 36.321 (5.4.4). \details The value n4 corresponds to 4 transmissions, n8 corresponds to 8 transmissions and so on. - DSR_TRANSMAX_t dsr_TransMax; -} SCHEDULING_REQUEST_CONFIG; - -/// CQI-ReportPeriodic -typedef struct { - /// Parameter: \f$n^{(2)}_\text{PUCCH}\f$, see TS 36.213 (7.2). \vr{[0..1185]}, -1 indicates inactivity - int16_t cqi_PUCCH_ResourceIndex; - /// Parameter: CQI/PMI Periodicity and Offset Configuration Index \f$I_\text{CQI/PMI}\f$, see TS 36.213 (tables 7.2.2-1A and 7.2.2-1C). \vr{[0..1023]} - int16_t cqi_PMI_ConfigIndex; - /// Parameter: K, see 36.213 (4.2.2). \vr{[1..4]} - uint8_t K; - /// Parameter: RI Config Index \f$I_\text{RI}\f$, see TS 36.213 (7.2.2-1B). \vr{[0..1023]}, -1 indicates inactivity - int16_t ri_ConfigIndex; - /// Parameter: Simultaneous-AN-and-CQI, see TS 36.213 (10.1). \vr{[0..1]} 1 indicates that simultaneous transmission of ACK/NACK and CQI is allowed. - uint8_t simultaneousAckNackAndCQI; - /// parameter computed from Tables 7.2.2-1A and 7.2.2-1C - uint16_t Npd; - /// parameter computed from Tables 7.2.2-1A and 7.2.2-1C - uint16_t N_OFFSET_CQI; -} CQI_REPORTPERIODIC; - -/// Enumeration for parameter reporting mode \ref CQI_REPORT_CONFIG::cqi_ReportModeAperiodic. -typedef enum { - rm12=0, - rm20=1, - rm22=2, - rm30=3, - rm31=4 -} CQI_REPORTMODEAPERIODIC; - -/// CQI-ReportConfig Information Element from 36.331 RRC spec -typedef struct { - /// Parameter: reporting mode. Value rm12 corresponds to Mode 1-2, rm20 corresponds to Mode 2-0, rm22 corresponds to Mode 2-2 etc. PUSCH reporting modes are described in TS 36.213 [23, 7.2.1]. - CQI_REPORTMODEAPERIODIC cqi_ReportModeAperiodic; - /// Parameter: \f$\Delta_\text{offset}\f$, see TS 36.213 (7.2.3). \vr{[-1..6]}\n Actual value = IE value * 2 [dB]. - int8_t nomPDSCH_RS_EPRE_Offset; - CQI_REPORTPERIODIC CQI_ReportPeriodic; -} CQI_REPORT_CONFIG; - -/// MBSFN-SubframeConfig Information Element from 36.331 RRC spec \note deviates from specification. -typedef struct { - /// MBSFN subframe occurance. \details Radio-frames that contain MBSFN subframes occur when equation SFN mod radioFrameAllocationPeriod = radioFrameAllocationOffset is satisfied. When fourFrames is used for subframeAllocation, the equation defines the first radio frame referred to in the description below. Values n1 and n2 are not applicable when fourFrames is used. \note the specification sais it is an enumerated value {n1, n2, n4, n8, n16, n32}. - int radioframeAllocationPeriod; - /// MBSFN subframe occurance. \vr{[0..7]}\n Radio-frames that contain MBSFN subframes occur when equation SFN mod radioFrameAllocationPeriod = radioFrameAllocationOffset is satisfied. When fourFrames is used for subframeAllocation, the equation defines the first radio frame referred to in the description below. Values n1 and n2 are not applicable when fourFrames is used. - int radioframeAllocationOffset; - /// oneFrame or fourFrames. \vr{[0..1]} - int fourFrames_flag; - /// Subframe configuration. \vr{[0..63]} (\ref fourFrames_flag == 0) or \vr{[0..16777215]} (\ref fourFrames_flag == 1) - /// \par fourFrames_flag == 0 - /// "1" denotes that the corresponding subframe is allocated for MBSFN. The following mapping applies:\n FDD: The first/leftmost bit defines the MBSFN allocation for subframe #1, the second bit for #2, third bit for #3 , fourth bit for #6, fifth bit for #7, sixth bit for #8.\n TDD: The first/leftmost bit defines the allocation for subframe #3, the second bit for #4, third bit for #7, fourth bit for #8, fifth bit for #9. Uplink subframes are not allocated. The last bit is not used. - /// \par fourFrames_flag == 1 - /// A bit-map indicating MBSFN subframe allocation in four consecutive radio frames, "1" denotes that the corresponding subframe is allocated for MBSFN. The bitmap is interpreted as follows:\n FDD: Starting from the first radioframe and from the first/leftmost bit in the bitmap, the allocation applies to subframes #1, #2, #3 , #6, #7, and #8 in the sequence of the four radio-frames.\n TDD: Starting from the first radioframe and from the first/leftmost bit in the bitmap, the allocation applies to subframes #3, #4, #7, #8, and #9 in the sequence of the four radio-frames. The last four bits are not used. Uplink subframes are not allocated. - int mbsfn_SubframeConfig; -} MBSFN_config_t; - -typedef struct { - /// Number of resource blocks (RB) in DL - uint8_t N_RB_DL; - /// Number of resource blocks (RB) in UL - uint8_t N_RB_UL; - /// EUTRA Band - uint8_t eutra_band; - /// DL carrier frequency - uint32_t dl_CarrierFreq; - /// UL carrier frequency - uint32_t ul_CarrierFreq; - /// TX attenuation - uint32_t att_tx; - /// RX attenuation - uint32_t att_rx; - /// total Number of Resource Block Groups: this is ceil(N_PRB/P) - uint8_t N_RBG; - /// Total Number of Resource Block Groups SubSets: this is P - uint8_t N_RBGS; - /// Cell ID - uint16_t Nid_cell; - /// MBSFN Area ID - uint16_t Nid_cell_mbsfn; - /// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP) - lte_prefix_type_t Ncp; - /// Cyclic Prefix for UL (0=Normal CP, 1=Extended CP) - lte_prefix_type_t Ncp_UL; - /// shift of pilot position in one RB - uint8_t nushift; - /// Frame type (0 FDD, 1 TDD) - lte_frame_type_t frame_type; - /// TDD subframe assignment (0-7) (default = 3) (254=RX only, 255=TX only) - uint8_t tdd_config; - /// TDD S-subframe configuration (0-9) - uint8_t tdd_config_S; - /// srs extra symbol flag for TDD - uint8_t srsX; - /// indicates if node is a UE (NODE=2) or eNB (PRIMARY_CH=0). - uint8_t node_id; - /// Indicator that 20 MHz channel uses 3/4 sampling frequency - uint8_t threequarter_fs; - /// Size of FFT - uint16_t ofdm_symbol_size; - /// Number of prefix samples in all but first symbol of slot - uint16_t nb_prefix_samples; - /// Number of prefix samples in first symbol of slot - uint16_t nb_prefix_samples0; - /// Carrier offset in FFT buffer for first RE in PRB0 - uint16_t first_carrier_offset; - /// Number of samples in a subframe - uint32_t samples_per_tti; - /// Number of OFDM/SC-FDMA symbols in one subframe (to be modified to account for potential different in UL/DL) - uint16_t symbols_per_tti; - /// Number of OFDM symbols in DL portion of S-subframe - uint16_t dl_symbols_in_S_subframe; - /// Number of SC-FDMA symbols in UL portion of S-subframe - uint16_t ul_symbols_in_S_subframe; - /// Number of Physical transmit antennas in node - uint8_t nb_antennas_tx; - /// Number of Receive antennas in node - uint8_t nb_antennas_rx; - /// Number of common transmit antenna ports in eNodeB (1 or 2) - uint8_t nb_antenna_ports_eNB; - /// PRACH_CONFIG - PRACH_CONFIG_COMMON prach_config_common; -#ifdef Rel14 - /// PRACH_eMTC_CONFIG - PRACH_eMTC_CONFIG_COMMON prach_emtc_config_common; -#endif - /// PUCCH Config Common (from 36-331 RRC spec) - PUCCH_CONFIG_COMMON pucch_config_common; - /// PDSCH Config Common (from 36-331 RRC spec) - PDSCH_CONFIG_COMMON pdsch_config_common; - /// PUSCH Config Common (from 36-331 RRC spec) - PUSCH_CONFIG_COMMON pusch_config_common; - /// PHICH Config (from 36-331 RRC spec) - PHICH_CONFIG_COMMON phich_config_common; - /// SRS Config (from 36-331 RRC spec) - SOUNDINGRS_UL_CONFIG_COMMON soundingrs_ul_config_common; - /// UL Power Control (from 36-331 RRC spec) - UL_POWER_CONTROL_CONFIG_COMMON ul_power_control_config_common; - /// Number of MBSFN Configurations - int num_MBSFN_config; - /// Array of MBSFN Configurations (max 8 (maxMBSFN-Allocations) elements as per 36.331) - MBSFN_config_t MBSFN_config[8]; - /// Maximum Number of Retransmissions of RRCConnectionRequest (from 36-331 RRC Spec) - uint8_t maxHARQ_Msg3Tx; - /// Size of SI windows used for repetition of one SI message (in frames) - uint8_t SIwindowsize; - /// Period of SI windows used for repetition of one SI message (in frames) - uint16_t SIPeriod; - /// REGs assigned to PCFICH - uint16_t pcfich_reg[4]; - /// Index of first REG assigned to PCFICH - uint8_t pcfich_first_reg_idx; - /// REGs assigned to PHICH - uint16_t phich_reg[MAX_NUM_PHICH_GROUPS][3]; - - struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[MAX_MBSFN_AREA]; - -} LTE_DL_FRAME_PARMS; - -typedef enum { - /// TM1 - SISO=0, - /// TM2 - ALAMOUTI=1, - /// TM3 - LARGE_CDD=2, - /// the next 6 entries are for TM5 - UNIFORM_PRECODING11=3, - UNIFORM_PRECODING1m1=4, - UNIFORM_PRECODING1j=5, - UNIFORM_PRECODING1mj=6, - PUSCH_PRECODING0=7, - PUSCH_PRECODING1=8, - /// the next 3 entries are for TM4 - DUALSTREAM_UNIFORM_PRECODING1=9, - DUALSTREAM_UNIFORM_PRECODINGj=10, - DUALSTREAM_PUSCH_PRECODING=11, - TM7=12, - TM8=13, - TM9_10=14 -} MIMO_mode_t; - - -typedef enum { - /// MRT - MRT=0, - /// ZF - ZF=1, - /// MMSE - MMSE=2 -} PRECODE_TYPE_t; - -typedef struct { - /// \brief Pointers (dynamic) to the received data in the time domain. - /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[ - int32_t **rxdata; - /// \brief Pointers (dynamic) to the received data in the frequency domain. - /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[ - int32_t **rxdataF; - /// \brief holds the transmit data in the frequency domain. - /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //? - /// - first index: eNB id [0..2] (hard coded) - /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports. - /// - third index: sample [0..] - int32_t **txdataF; -} LTE_eNB_COMMON; typedef struct { /// \brief Holds the transmit data in the frequency domain. @@ -725,567 +73,9 @@ typedef struct { int32_t **tdd_calib_coeffs; } RU_COMMON; -typedef enum {format0, - format1, - format1A, - format1B, - format1C, - format1D, - format1E_2A_M10PRB, - format2, - format2A, - format2B, - format2C, - format2D, - format3, - format3A, - format4, - format5, - format6_0A, - format6_0B, - format6_1A, - format6_1B, - format6_2 - } DCI_format_t; - -typedef struct { - /// Length of DCI in bits - uint8_t dci_length; - /// Aggregation level - uint8_t L; - /// Position of first CCE of the dci - int firstCCE; - /// flag to indicate that this is a RA response - boolean_t ra_flag; - /// rnti - rnti_t rnti; - /// harq_pid - rnti_t harq_pid; - /// Format - DCI_format_t format; - /// DCI pdu - uint8_t dci_pdu[8]; -} DCI_ALLOC_t; - -#define MAX_EPDCCH_PRB 8 - -typedef struct { - /// Length of DCI in bits - uint8_t dci_length; - /// Aggregation level - uint8_t L; - /// Position of first CCE of the dci - int firstCCE; - /// flag to indicate that this is a RA response - boolean_t ra_flag; - /// rnti - rnti_t rnti; - /// Format - DCI_format_t format; - /// epdcch resource assignment (0=localized,1=distributed) - uint8_t epdcch_resource_assignment_flag; - /// epdcch index - uint16_t epdcch_id; - /// epdcch start symbol - uint8_t epdcch_start_symbol; - /// epdcch number of PRBs in set - uint8_t epdcch_num_prb; - /// vector of prb ids for set - uint8_t epdcch_prb_index[MAX_EPDCCH_PRB]; - /// LBT parameter for frame configuration - uint8_t dwpts_symbols; - /// LBT parameter for frame configuration - uint8_t initial_lbt_sf; - /// DCI pdu - uint8_t dci_pdu[8]; -} eDCI_ALLOC_t; - -typedef struct { - /// Length of DCI in bits - uint8_t dci_length; - /// Aggregation level - uint8_t L; - /// Position of first CCE of the dci - int firstCCE; - /// flag to indicate that this is a RA response - boolean_t ra_flag; - /// rnti - rnti_t rnti; - /// Format - DCI_format_t format; - /// harq process index - uint8_t harq_pid; - /// Narrowband index - uint8_t narrowband; - /// number of PRB pairs for MPDCCH - uint8_t number_of_prb_pairs; - /// mpdcch resource assignment (combinatorial index r) - uint8_t resource_block_assignment; - /// transmission type (0=localized,1=distributed) - uint8_t transmission_type; - /// mpdcch start symbol - uint8_t start_symbol; - /// CE mode (1=ModeA,2=ModeB) - uint8_t ce_mode; - /// 0-503 n_EPDCCHid_i - uint16_t dmrs_scrambling_init; - /// Absolute subframe of the initial transmission (0-10239) - uint16_t i0; - /// number of mdpcch repetitions - uint16_t reps; - /// current absolute subframe number - uint16_t absSF; - /// DCI pdu - uint8_t dci_pdu[8]; -} mDCI_ALLOC_t; - - -typedef struct { - uint8_t num_dci; - uint8_t num_pdcch_symbols; - DCI_ALLOC_t dci_alloc[32]; -} LTE_eNB_PDCCH; - -typedef struct { - uint8_t hi; - uint8_t first_rb; - uint8_t n_DMRS; -} phich_config_t; - -typedef struct { - uint8_t num_hi; - phich_config_t config[32]; -} LTE_eNB_PHICH; - -typedef struct { - uint8_t num_dci; - eDCI_ALLOC_t edci_alloc[32]; -} LTE_eNB_EPDCCH; - -typedef struct { - /// number of active MPDCCH allocations - uint8_t num_dci; - /// MPDCCH DCI allocations from MAC - mDCI_ALLOC_t mdci_alloc[32]; - // MAX SIZE of an EPDCCH set is 16EREGs * 9REs/EREG * 8 PRB pairs = 2304 bits - uint8_t e[2304]; -} LTE_eNB_MPDCCH; - - -typedef struct { - /// \brief Hold the channel estimates in frequency domain based on SRS. - /// - first index: rx antenna id [0..nb_antennas_rx[ - /// - second index: ? [0..ofdm_symbol_size[ - int32_t **srs_ch_estimates; - /// \brief Hold the channel estimates in time domain based on SRS. - /// - first index: rx antenna id [0..nb_antennas_rx[ - /// - second index: ? [0..2*ofdm_symbol_size[ - int32_t **srs_ch_estimates_time; - /// \brief Holds the SRS for channel estimation at the RX. - /// - first index: rx antenna id [0..nb_antennas_rx[ - /// - second index: ? [0..ofdm_symbol_size[ - int32_t *srs; -} LTE_eNB_SRS; - -typedef struct { - /// \brief Holds the received data in the frequency domain for the allocated RBs in repeated format. - /// - first index: rx antenna id [0..nb_antennas_rx[ - /// - second index: ? [0..2*ofdm_symbol_size[ - int32_t **rxdataF_ext; - /// \brief Holds the received data in the frequency domain for the allocated RBs in normal format. - /// - first index: rx antenna id [0..nb_antennas_rx[ - /// - second index (definition from phy_init_lte_eNB()): ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ - int32_t **rxdataF_ext2; - /// \brief Hold the channel estimates in time domain based on DRS. - /// - first index: rx antenna id [0..nb_antennas_rx[ - /// - second index: ? [0..4*ofdm_symbol_size[ - int32_t **drs_ch_estimates_time; - /// \brief Hold the channel estimates in frequency domain based on DRS. - /// - first index: rx antenna id [0..nb_antennas_rx[ - /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ - int32_t **drs_ch_estimates; - /// \brief Holds the compensated signal. - /// - first index: rx antenna id [0..nb_antennas_rx[ - /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ - int32_t **rxdataF_comp; - /// \brief Magnitude of the UL channel estimates. Used for 2nd-bit level thresholds in LLR computation - /// - first index: rx antenna id [0..nb_antennas_rx[ - /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ - int32_t **ul_ch_mag; - /// \brief Magnitude of the UL channel estimates scaled for 3rd bit level thresholds in LLR computation - /// - first index: rx antenna id [0..nb_antennas_rx[ - /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ - int32_t **ul_ch_magb; - /// measured RX power based on DRS - int ulsch_power[2]; - /// \brief llr values. - /// - first index: ? [0..1179743] (hard coded) - int16_t *llr; -} LTE_eNB_PUSCH; - -typedef struct { - - /// \brief Holds the received data in the frequency domain. - /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: symbol [0..28*ofdm_symbol_size[ - int32_t **rxdataF; - - /// \brief Hold the channel estimates in frequency domain. - /// - first index: eNB id [0..6] (hard coded) - /// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - third index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[ - int32_t **dl_ch_estimates[7]; - - /// \brief Hold the channel estimates in time domain (used for tracking). - /// - first index: eNB id [0..6] (hard coded) - /// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - third index: samples? [0..2*ofdm_symbol_size[ - int32_t **dl_ch_estimates_time[7]; -}LTE_UE_COMMON_PER_THREAD; - -typedef struct { - /// \brief Holds the transmit data in time domain. - /// For IFFT_FPGA this points to the same memory as PHY_vars->tx_vars[a].TX_DMA_BUFFER. - /// - first index: tx antenna [0..nb_antennas_tx[ - /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES[ - int32_t **txdata; - /// \brief Holds the transmit data in the frequency domain. - /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. - /// - first index: tx antenna [0..nb_antennas_tx[ - /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX[ - int32_t **txdataF; - - /// \brief Holds the received data in time domain. - /// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. - /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES+2048[ - int32_t **rxdata; - - LTE_UE_COMMON_PER_THREAD common_vars_rx_data_per_thread[RX_NB_TH_MAX]; - - /// holds output of the sync correlator - int32_t *sync_corr; - /// estimated frequency offset (in radians) for all subcarriers - int32_t freq_offset; - /// eNb_id user is synched to - int32_t eNb_id; -} LTE_UE_COMMON; - -typedef struct { - /// \brief Received frequency-domain signal after extraction. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **rxdataF_ext; - /// \brief Received frequency-domain ue specific pilots. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..12*N_RB_DL[ - int32_t **rxdataF_uespec_pilots; - /// \brief Received frequency-domain signal after extraction and channel compensation. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **rxdataF_comp0; - /// \brief Received frequency-domain signal after extraction and channel compensation for the second stream. For the SIC receiver we need to store the history of this for each harq process and round - /// - first index: ? [0..7] (hard coded) accessed via \c harq_pid - /// - second index: ? [0..7] (hard coded) accessed via \c round - /// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - fourth index: ? [0..168*N_RB_DL[ - int32_t **rxdataF_comp1[8][8]; - /// \brief Downlink channel estimates extracted in PRBS. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_estimates_ext; - /// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS. For the SIC receiver we need to store the history of this for each harq process and round - /// - first index: ? [0..7] (hard coded) accessed via \c harq_pid - /// - second index: ? [0..7] (hard coded) accessed via \c round - /// - third index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - fourth index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_rho_ext[8][8]; - /// \brief Downlink beamforming channel estimates in frequency domain. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[ - int32_t **dl_bf_ch_estimates; - /// \brief Downlink beamforming channel estimates. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_bf_ch_estimates_ext; - /// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_rho2_ext; - /// \brief Downlink PMIs extracted in PRBS and grouped in subbands. - /// - first index: ressource block [0..N_RB_DL[ - uint8_t *pmi_ext; - /// \brief Magnitude of Downlink Channel first layer (16QAM level/First 64QAM level). - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_mag0; - /// \brief Magnitude of Downlink Channel second layer (16QAM level/First 64QAM level). - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_mag1[8][8]; - /// \brief Magnitude of Downlink Channel, first layer (2nd 64QAM level). - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_magb0; - /// \brief Magnitude of Downlink Channel second layer (2nd 64QAM level). - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_magb1[8][8]; - /// \brief Cross-correlation of two eNB signals. - /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: symbol [0..] - int32_t **rho; - /// never used... always send dl_ch_rho_ext instead... - int32_t **rho_i; - /// \brief Pointers to llr vectors (2 TBs). - /// - first index: ? [0..1] (hard coded) - /// - second index: ? [0..1179743] (hard coded) - int16_t *llr[2]; - /// \f$\log_2(\max|H_i|^2)\f$ - int16_t log2_maxh; - /// \f$\log_2(\max|H_i|^2)\f$ //this is for TM3-4 layer1 channel compensation - int16_t log2_maxh0; - /// \f$\log_2(\max|H_i|^2)\f$ //this is for TM3-4 layer2 channel commpensation - int16_t log2_maxh1; - /// \brief LLR shifts for subband scaling. - /// - first index: ? [0..168*N_RB_DL[ - uint8_t *llr_shifts; - /// \brief Pointer to LLR shifts. - /// - first index: ? [0..168*N_RB_DL[ - uint8_t *llr_shifts_p; - /// \brief Pointers to llr vectors (128-bit alignment). - /// - first index: ? [0..0] (hard coded) - /// - second index: ? [0..] - int16_t **llr128; - /// \brief Pointers to llr vectors (128-bit alignment). - /// - first index: ? [0..0] (hard coded) - /// - second index: ? [0..] - int16_t **llr128_2ndstream; - //uint32_t *rb_alloc; - //uint8_t Qm[2]; - //MIMO_mode_t mimo_mode; - // llr offset per ofdm symbol - uint32_t llr_offset[14]; - // llr length per ofdm symbol - uint32_t llr_length[14]; -} LTE_UE_PDSCH; - -typedef struct { - /// \brief Received frequency-domain signal after extraction. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..] - int32_t **rxdataF_ext; - /// \brief Received frequency-domain signal after extraction and channel compensation. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..] - double **rxdataF_comp; - /// \brief Downlink channel estimates extracted in PRBS. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..] - int32_t **dl_ch_estimates_ext; - /// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..] - double **dl_ch_rho_ext; - /// \brief Downlink PMIs extracted in PRBS and grouped in subbands. - /// - first index: ressource block [0..N_RB_DL[ - uint8_t *pmi_ext; - /// \brief Magnitude of Downlink Channel (16QAM level/First 64QAM level). - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..] - double **dl_ch_mag; - /// \brief Magnitude of Downlink Channel (2nd 64QAM level). - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..] - double **dl_ch_magb; - /// \brief Cross-correlation of two eNB signals. - /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: ? [0..] - double **rho; - /// never used... always send dl_ch_rho_ext instead... - double **rho_i; - /// \brief Pointers to llr vectors (2 TBs). - /// - first index: ? [0..1] (hard coded) - /// - second index: ? [0..1179743] (hard coded) - int16_t *llr[2]; - /// \f$\log_2(\max|H_i|^2)\f$ - uint8_t log2_maxh; - /// \brief Pointers to llr vectors (128-bit alignment). - /// - first index: ? [0..0] (hard coded) - /// - second index: ? [0..] - int16_t **llr128; - //uint32_t *rb_alloc; - //uint8_t Qm[2]; - //MIMO_mode_t mimo_mode; -} LTE_UE_PDSCH_FLP; - -typedef struct { - /// \brief Pointers to extracted PDCCH symbols in frequency-domain. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **rxdataF_ext; - /// \brief Pointers to extracted and compensated PDCCH symbols in frequency-domain. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **rxdataF_comp; - /// \brief Pointers to extracted channel estimates of PDCCH symbols. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_estimates_ext; - /// \brief Pointers to channel cross-correlation vectors for multi-eNB detection. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..168*N_RB_DL[ - int32_t **dl_ch_rho_ext; - /// \brief Pointers to channel cross-correlation vectors for multi-eNB detection. - /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: ? [0..] - int32_t **rho; - /// \brief Pointer to llrs, 4-bit resolution. - /// - first index: ? [0..48*N_RB_DL[ - uint16_t *llr; - /// \brief Pointer to llrs, 16-bit resolution. - /// - first index: ? [0..96*N_RB_DL[ - uint16_t *llr16; - /// \brief \f$\overline{w}\f$ from 36-211. - /// - first index: ? [0..48*N_RB_DL[ - uint16_t *wbar; - /// \brief PDCCH/DCI e-sequence (input to rate matching). - /// - first index: ? [0..96*N_RB_DL[ - int8_t *e_rx; - /// number of PDCCH symbols in current subframe - uint8_t num_pdcch_symbols; - /// Allocated CRNTI for UE - uint16_t crnti; - /// 1: the allocated crnti is Temporary C-RNTI / 0: otherwise - uint8_t crnti_is_temporary; - /// Total number of PDU errors (diagnostic mode) - uint32_t dci_errors; - /// Total number of PDU received - uint32_t dci_received; - /// Total number of DCI False detection (diagnostic mode) - uint32_t dci_false; - /// Total number of DCI missed (diagnostic mode) - uint32_t dci_missed; - /// nCCE for PUCCH per subframe - uint8_t nCCE[10]; - //Check for specific DCIFormat and AgregationLevel - uint8_t dciFormat; - uint8_t agregationLevel; -} LTE_UE_PDCCH; - -#define PBCH_A 24 -typedef struct { - uint8_t pbch_d[96+(3*(16+PBCH_A))]; - uint8_t pbch_w[3*3*(16+PBCH_A)]; - uint8_t pbch_e[1920]; -} LTE_eNB_PBCH; - -typedef struct { - /// \brief Pointers to extracted PBCH symbols in frequency-domain. - /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: ? [0..287] (hard coded) - int32_t **rxdataF_ext; - /// \brief Pointers to extracted and compensated PBCH symbols in frequency-domain. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..287] (hard coded) - int32_t **rxdataF_comp; - /// \brief Pointers to downlink channel estimates in frequency-domain extracted in PRBS. - /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx - /// - second index: ? [0..287] (hard coded) - int32_t **dl_ch_estimates_ext; - /// \brief Pointer to PBCH llrs. - /// - first index: ? [0..1919] (hard coded) - int8_t *llr; - /// \brief Pointer to PBCH decoded output. - /// - first index: ? [0..63] (hard coded) - uint8_t *decoded_output; - /// \brief Total number of PDU errors. - uint32_t pdu_errors; - /// \brief Total number of PDU errors 128 frames ago. - uint32_t pdu_errors_last; - /// \brief Total number of consecutive PDU errors. - uint32_t pdu_errors_conseq; - /// \brief FER (in percent) . - uint32_t pdu_fer; -} LTE_UE_PBCH; - -typedef struct { - int16_t amp; - int16_t *prachF; - int16_t *prach; -} LTE_UE_PRACH; - -#define MAX_NUM_RX_PRACH_PREAMBLES 4 - -typedef struct { - /// \brief ?. - /// first index: ? [0..1023] (hard coded) - int16_t *prachF; - /// \brief ?. - /// first index: ce_level [0..3] - /// second index: rx antenna [0..63] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx. - /// third index: frequency-domain sample [0..ofdm_symbol_size*12[ - int16_t **rxsigF[4]; - /// \brief local buffer to compute prach_ifft (necessary in case of multiple CCs) - /// first index: ce_level [0..3] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx. - /// second index: ? [0..63] (hard coded) - /// third index: ? [0..63] (hard coded) - int32_t **prach_ifft[4]; - - /// repetition number -#ifdef Rel14 - /// indicator of first frame in a group of PRACH repetitions - int first_frame[4]; - /// current repetition for each CE level - int repetition_number[4]; -#endif -} LTE_eNB_PRACH; - -typedef struct { - /// Preamble index for PRACH (0-63) - uint8_t ra_PreambleIndex; - /// RACH MaskIndex - uint8_t ra_RACH_MaskIndex; - /// Target received power at eNB (-120 ... -82 dBm) - int8_t ra_PREAMBLE_RECEIVED_TARGET_POWER; - /// PRACH index for TDD (0 ... 6) depending on TDD configuration and prachConfigIndex - uint8_t ra_TDD_map_index; - /// Corresponding RA-RNTI for UL-grant - uint16_t ra_RNTI; - /// Pointer to Msg3 payload for UL-grant - uint8_t *Msg3; -} PRACH_RESOURCES_t; - - -typedef struct { - /// Downlink Power offset field - uint8_t dl_pow_off; - ///Subband resource allocation field - uint8_t rballoc_sub[50]; - ///Total number of PRBs indicator - uint8_t pre_nb_available_rbs; -} MU_MIMO_mode; - -typedef enum { - NOT_SYNCHED=0, - PRACH=1, - RA_RESPONSE=2, - PUSCH=3, - RESYNCH=4 -} UE_MODE_t; -typedef enum {SF_DL, SF_UL, SF_S} lte_subframe_t; -typedef enum { - /// do not detect any DCIs in the current subframe - NO_DCI = 0x0, - /// detect only downlink DCIs in the current subframe - UL_DCI = 0x1, - /// detect only uplink DCIs in the current subframe - DL_DCI = 0x2, - /// detect both uplink and downlink DCIs in the current subframe - UL_DL_DCI = 0x3} dci_detect_mode_t; #endif diff --git a/openair1/PHY/impl_defs_top.h b/openair1/PHY/impl_defs_top.h index 60d3fec5f4..263108371c 100644 --- a/openair1/PHY/impl_defs_top.h +++ b/openair1/PHY/impl_defs_top.h @@ -107,7 +107,7 @@ * @} */ -#include "defs.h" +#include "defs_eNB.h" #include "types.h" diff --git a/openair1/PHY/extern.h b/openair1/PHY/phy_extern.h similarity index 99% rename from openair1/PHY/extern.h rename to openair1/PHY/phy_extern.h index 5868c1c022..552163d308 100644 --- a/openair1/PHY/extern.h +++ b/openair1/PHY/phy_extern.h @@ -22,7 +22,7 @@ #ifndef __PHY_EXTERN_H__ #define __PHY_EXTERN_H__ -#include "PHY/defs.h" +#include "PHY/defs_common.h" #include "common/ran_context.h" extern char* namepointer_chMag ; diff --git a/openair1/PHY/vars.h b/openair1/PHY/phy_vars.h similarity index 100% rename from openair1/PHY/vars.h rename to openair1/PHY/phy_vars.h diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index df01fad136..ecb908e966 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -30,10 +30,6 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" #include "nfapi_interface.h" #include "fapi_l1.h" diff --git a/openair1/SCHED/fapi_l1.h b/openair1/SCHED/fapi_l1.h index f04e8581db..df990fa362 100644 --- a/openair1/SCHED/fapi_l1.h +++ b/openair1/SCHED/fapi_l1.h @@ -30,10 +30,10 @@ * \warning */ -#include "PHY/defs.h" -#include "PHY/extern.h" -#include "SCHED/defs.h" -#include "SCHED/extern.h" +#include "PHY/defs_eNB.h" +#include "PHY/phy_extern.h" +#include "SCHED/sched_eNB.h" +#include "SCHED/sched_extern_eNB.h" #include "nfapi_interface.h" void fill_uci_harq_indication(PHY_VARS_eNB *eNB,LTE_eNB_UCI *uci,int frame,int subframe,uint8_t *harq_ack,uint8_t tdd_mapping_mode,uint16_t tdd_multiplexing_mask); diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/sched_eNB.h similarity index 100% rename from openair1/SCHED/defs.h rename to openair1/SCHED/sched_eNB.h diff --git a/openair1/SCHED/extern.h b/openair1/SCHED/sched_eNB_extern.h similarity index 100% rename from openair1/SCHED/extern.h rename to openair1/SCHED/sched_eNB_extern.h diff --git a/openair1/SCHED/vars.h b/openair1/SCHED/sched_eNB_vars.h similarity index 100% rename from openair1/SCHED/vars.h rename to openair1/SCHED/sched_eNB_vars.h diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c similarity index 100% rename from openair1/SCHED/phy_procedures_lte_ue.c rename to openair1/SCHED_UE/phy_procedures_lte_ue.c diff --git a/openair1/SCHED/pucch_pc.c b/openair1/SCHED_UE/pucch_pc.c similarity index 100% rename from openair1/SCHED/pucch_pc.c rename to openair1/SCHED_UE/pucch_pc.c diff --git a/openair1/SCHED/pusch_pc.c b/openair1/SCHED_UE/pusch_pc.c similarity index 100% rename from openair1/SCHED/pusch_pc.c rename to openair1/SCHED_UE/pusch_pc.c diff --git a/openair1/SCHED/srs_pc.c b/openair1/SCHED_UE/srs_pc.c similarity index 100% rename from openair1/SCHED/srs_pc.c rename to openair1/SCHED_UE/srs_pc.c diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/mac.h similarity index 99% rename from openair2/LAYER2/MAC/defs.h rename to openair2/LAYER2/MAC/mac.h index e3f5d954f1..ceb8ced124 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/mac.h @@ -43,11 +43,12 @@ #include <stdlib.h> #include <string.h> -#include "PHY/defs.h" -#include "PHY/LTE_TRANSPORT/defs.h" +//#include "PHY/defs.h" +//#include "PHY/LTE_TRANSPORT/defs.h" #include "COMMON/platform_constants.h" #include "BCCH-BCH-Message.h" #include "RadioResourceConfigCommon.h" +#include "RadioResourceConfigCommonSIB.h" #include "RadioResourceConfigDedicated.h" #include "MeasGapConfig.h" #include "SchedulingInfoList.h" @@ -1355,6 +1356,6 @@ typedef struct { uint8_t n_adj_cells; } neigh_cell_id_t; -#include "proto.h" +#include "mac_proto.h" /*@}*/ #endif /*__LAYER2_MAC_DEFS_H__ */ diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/mac_extern.h similarity index 75% rename from openair2/LAYER2/MAC/extern.h rename to openair2/LAYER2/MAC/mac_extern.h index e7489ca8e6..618075aed9 100644 --- a/openair2/LAYER2/MAC/extern.h +++ b/openair2/LAYER2/MAC/mac_extern.h @@ -32,10 +32,10 @@ #ifndef __MAC_EXTERN_H__ #define __MAC_EXTERN_H__ -#include "PHY/defs.h" -#include "defs.h" +//#include "PHY/defs_common.h" +#include "mac.h" -#include "RRC/LITE/defs.h" +#include "RRC/LTE/rrc_defs.h" extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; //extern uint32_t EBSR_Level[63]; @@ -75,26 +75,5 @@ extern uint32_t RRC_CONNECTION_FLAG; extern uint8_t rb_table[34]; -extern DCI0_5MHz_TDD_1_6_t UL_alloc_pdu; - -extern DCI1A_5MHz_TDD_1_6_t RA_alloc_pdu; -extern DCI1A_5MHz_TDD_1_6_t DLSCH_alloc_pdu1A; -extern DCI1A_5MHz_TDD_1_6_t BCCH_alloc_pdu; - -extern DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu; -extern DCI1_5MHz_TDD_t DLSCH_alloc_pdu; - -extern DCI0_5MHz_FDD_t UL_alloc_pdu_fdd; - -extern DCI1A_5MHz_FDD_t DLSCH_alloc_pdu1A_fdd; -extern DCI1A_5MHz_FDD_t RA_alloc_pdu_fdd; -extern DCI1A_5MHz_FDD_t BCCH_alloc_pdu_fdd; - -extern DCI1A_5MHz_FDD_t CCCH_alloc_pdu_fdd; -extern DCI1_5MHz_FDD_t DLSCH_alloc_pdu_fdd; - -extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1; -extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2; -extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E; #endif //DEF_H diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/mac_proto.h similarity index 99% rename from openair2/LAYER2/MAC/proto.h rename to openair2/LAYER2/MAC/mac_proto.h index 2586c94f43..ce5d26d6f9 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/mac_proto.h @@ -29,7 +29,7 @@ #ifndef __LAYER2_MAC_PROTO_H__ #define __LAYER2_MAC_PROTO_H__ -#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/mac.h" /** \addtogroup _mac * @{ diff --git a/openair2/LAYER2/MAC/vars.h b/openair2/LAYER2/MAC/mac_vars.h similarity index 100% rename from openair2/LAYER2/MAC/vars.h rename to openair2/LAYER2/MAC/mac_vars.h diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 7c8f2dd033..12076c1b6c 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -67,7 +67,7 @@ #include "UTIL/LISTS/list.h" #endif //NON_ACCESS_STRATUM //----------------------------------------------------------------------------- -#include "RRC/LITE/defs.h" +#include "RRC/LTE/rrc_defs.h" #include "COMMON/platform_constants.h" #include "COMMON/platform_types.h" #include "DRB-ToAddMod.h" diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h index 2ee7d040ab..c69fd3766e 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h @@ -55,7 +55,7 @@ //----------------------------------------------------------------------------- #include "platform_types.h" #include "platform_constants.h" -#include "PHY/defs.h" +//#include "PHY/defs.h" /*! \struct rlc_am_info_t diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h index d2f0740b33..9dcc75223d 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_rx_list.h @@ -56,7 +56,7 @@ //----------------------------------------------------------------------------- #include "platform_types.h" #include "platform_constants.h" -#include "PHY/defs.h" +//#include "PHY/defs.h" //----------------------------------------------------------------------------- /*! \fn rlc_am_rx_pdu_status_t rlc_am_rx_list_check_duplicate_insert_pdu(const protocol_ctxt_t* const ctxt_pP,rlc_am_entity_t* const rlc_pP,mem_block_t* const tb_pP) diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h index e09189fcd6..41f214d7c6 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.h @@ -55,7 +55,7 @@ //----------------------------------------------------------------------------- #include "platform_types.h" #include "platform_constants.h" -#include "PHY/defs.h" +//#include "PHY/defs.h" //----------------------------------------------------------------------------- /*! \fn uint16_t rlc_am_read_bit_field (uint8_t** dataP, unsigned int* bit_posP, const signed int bits_to_readP) diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index ffd963204e..b33c47b559 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -47,7 +47,7 @@ # include "asn1_constants.h" # include "UTIL/LOG/log.h" # include "mem_block.h" -# include "PHY/defs.h" +//# include "PHY/defs.h" # include "RLC-Config.h" # include "DRB-ToAddMod.h" # include "DRB-ToAddModList.h" diff --git a/openair2/PHY_INTERFACE/IF_Module.h b/openair2/PHY_INTERFACE/IF_Module.h index 3b1c88dda0..ccce490c75 100644 --- a/openair2/PHY_INTERFACE/IF_Module.h +++ b/openair2/PHY_INTERFACE/IF_Module.h @@ -34,9 +34,10 @@ #include <stdint.h> -#include "openair1/PHY/LTE_TRANSPORT/defs.h" +//#include "openair1/PHY/LTE_TRANSPORT/transport_eNB.h" #include "nfapi_interface.h" - +#include "platform_constants.h" +#include "platform_types.h" #define MAX_NUM_DL_PDU 100 #define MAX_NUM_UL_PDU 100 diff --git a/openair2/RRC/LITE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c similarity index 100% rename from openair2/RRC/LITE/L2_interface.c rename to openair2/RRC/LTE/L2_interface.c diff --git a/openair2/RRC/LITE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c similarity index 100% rename from openair2/RRC/LITE/L2_interface_common.c rename to openair2/RRC/LTE/L2_interface_common.c diff --git a/openair2/RRC/LITE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c similarity index 100% rename from openair2/RRC/LITE/L2_interface_ue.c rename to openair2/RRC/LTE/L2_interface_ue.c diff --git a/openair2/RRC/LITE/MESSAGES/Makefile.inc b/openair2/RRC/LTE/MESSAGES/Makefile.inc similarity index 100% rename from openair2/RRC/LITE/MESSAGES/Makefile.inc rename to openair2/RRC/LTE/MESSAGES/Makefile.inc diff --git a/openair2/RRC/LITE/MESSAGES/README.txt b/openair2/RRC/LTE/MESSAGES/README.txt similarity index 100% rename from openair2/RRC/LITE/MESSAGES/README.txt rename to openair2/RRC/LTE/MESSAGES/README.txt diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1_msg.c rename to openair2/RRC/LTE/MESSAGES/asn1_msg.c diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.h b/openair2/RRC/LTE/MESSAGES/asn1_msg.h similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1_msg.h rename to openair2/RRC/LTE/MESSAGES/asn1_msg.h diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c rename to openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.h b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.h similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.h rename to openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.h diff --git a/openair2/RRC/LITE/MESSAGES/asn1_patch b/openair2/RRC/LTE/MESSAGES/asn1_patch similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1_patch rename to openair2/RRC/LTE/MESSAGES/asn1_patch diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/36331-860.txt b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-860.txt similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/36331-860.txt rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-860.txt diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/36331-a20.txt b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-a20.txt similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/36331-a20.txt rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-a20.txt diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/36331-ah0.txt b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-ah0.txt similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/36331-ah0.txt rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-ah0.txt diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/36331-c60.txt b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-c60.txt similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/36331-c60.txt rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/36331-c60.txt diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-86.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-86.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-86.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-86.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-a20.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-a20.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-a20.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-a20.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-ah0.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-ah0.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-ah0.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-ah0.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-c60.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-c60.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-c60.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-InterNodeDefinitions-c60.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn.orig b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn.orig similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn.orig rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn.orig diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-ah0.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-ah0.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-ah0.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-ah0.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-c60.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-c60.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-c60.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-c60.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-86.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-86.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-86.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-86.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-a20.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-a20.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-a20.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-a20.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-ah0.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-ah0.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-ah0.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-ah0.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-c60.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-c60.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-c60.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-UE-Variables-c60.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn diff --git a/openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/extract_asn1_from_spec.pl b/openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/extract_asn1_from_spec.pl similarity index 100% rename from openair2/RRC/LITE/MESSAGES/asn1c/ASN1_files/extract_asn1_from_spec.pl rename to openair2/RRC/LTE/MESSAGES/asn1c/ASN1_files/extract_asn1_from_spec.pl diff --git a/openair2/RRC/LITE/defs_NB_IoT.h b/openair2/RRC/LTE/defs_NB_IoT.h similarity index 100% rename from openair2/RRC/LITE/defs_NB_IoT.h rename to openair2/RRC/LTE/defs_NB_IoT.h diff --git a/openair2/RRC/LITE/extern_NB_IoT.h b/openair2/RRC/LTE/extern_NB_IoT.h similarity index 98% rename from openair2/RRC/LITE/extern_NB_IoT.h rename to openair2/RRC/LTE/extern_NB_IoT.h index f5e2f32575..f136b57b47 100644 --- a/openair2/RRC/LITE/extern_NB_IoT.h +++ b/openair2/RRC/LTE/extern_NB_IoT.h @@ -30,7 +30,7 @@ #ifndef __OPENAIR_RRC_EXTERN_NB_IOT_H__ #define __OPENAIR_RRC_EXTERN_NB_IOT_H__ -#include "RRC/LITE/defs_NB_IoT.h" +#include "RRC/LTE/defs_NB_IoT.h" #include "PHY_INTERFACE/IF_Module_NB_IoT.h" #include "LAYER2/RLC/rlc.h" #include "LogicalChannelConfig-NB-r13.h" diff --git a/openair2/RRC/LITE/plmn_data.h b/openair2/RRC/LTE/plmn_data.h similarity index 100% rename from openair2/RRC/LITE/plmn_data.h rename to openair2/RRC/LTE/plmn_data.h diff --git a/openair2/RRC/LITE/proto_NB_IoT.h b/openair2/RRC/LTE/proto_NB_IoT.h similarity index 99% rename from openair2/RRC/LITE/proto_NB_IoT.h rename to openair2/RRC/LTE/proto_NB_IoT.h index b2218517fc..de09d39fab 100644 --- a/openair2/RRC/LITE/proto_NB_IoT.h +++ b/openair2/RRC/LTE/proto_NB_IoT.h @@ -30,7 +30,7 @@ * @{ */ -#include "RRC/LITE/defs_NB_IoT.h" +#include "RRC/LTE/defs_NB_IoT.h" #include "pdcp.h" #include "rlc.h" #include "extern_NB_IoT.h" diff --git a/openair2/RRC/LITE/rrc_2_rrm_msg.c b/openair2/RRC/LTE/rrc_2_rrm_msg.c similarity index 100% rename from openair2/RRC/LITE/rrc_2_rrm_msg.c rename to openair2/RRC/LTE/rrc_2_rrm_msg.c diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c similarity index 100% rename from openair2/RRC/LITE/rrc_UE.c rename to openair2/RRC/LTE/rrc_UE.c diff --git a/openair2/RRC/LITE/rrc_UE_ral.c b/openair2/RRC/LTE/rrc_UE_ral.c similarity index 100% rename from openair2/RRC/LITE/rrc_UE_ral.c rename to openair2/RRC/LTE/rrc_UE_ral.c diff --git a/openair2/RRC/LITE/rrc_UE_ral.h b/openair2/RRC/LTE/rrc_UE_ral.h similarity index 100% rename from openair2/RRC/LITE/rrc_UE_ral.h rename to openair2/RRC/LTE/rrc_UE_ral.h diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LTE/rrc_common.c similarity index 100% rename from openair2/RRC/LITE/rrc_common.c rename to openair2/RRC/LTE/rrc_common.c diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LTE/rrc_defs.h similarity index 99% rename from openair2/RRC/LITE/defs.h rename to openair2/RRC/LTE/rrc_defs.h index 08ac30f836..9a2653e045 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -19,7 +19,7 @@ * contact@openairinterface.org */ -/*! \file RRC/LITE/defs.h +/*! \file RRC/LTE/defs.h * \brief RRC struct definitions and function prototypes * \author Navid Nikaein and Raymond Knopp * \date 2010 - 2014 @@ -37,13 +37,13 @@ #include "collection/tree.h" #include "rrc_types.h" -#include "PHY/defs.h" +//#include "PHY/phy_defs.h" #include "LAYER2/RLC/rlc.h" #include "COMMON/platform_constants.h" #include "COMMON/platform_types.h" -#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/mac.h" #include "SystemInformationBlockType1.h" #include "SystemInformation.h" @@ -667,7 +667,7 @@ typedef struct UE_PF_PO_s { uint32_t T; /* DRX cycle */ } UE_PF_PO_t; -#include "proto.h" +#include "rrc_proto.h" #endif /** @} */ diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c similarity index 100% rename from openair2/RRC/LITE/rrc_eNB.c rename to openair2/RRC/LTE/rrc_eNB.c diff --git a/openair2/RRC/LITE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c similarity index 100% rename from openair2/RRC/LITE/rrc_eNB_GTPV1U.c rename to openair2/RRC/LTE/rrc_eNB_GTPV1U.c diff --git a/openair2/RRC/LITE/rrc_eNB_GTPV1U.h b/openair2/RRC/LTE/rrc_eNB_GTPV1U.h similarity index 100% rename from openair2/RRC/LITE/rrc_eNB_GTPV1U.h rename to openair2/RRC/LTE/rrc_eNB_GTPV1U.h diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c similarity index 100% rename from openair2/RRC/LITE/rrc_eNB_S1AP.c rename to openair2/RRC/LTE/rrc_eNB_S1AP.c diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.h b/openair2/RRC/LTE/rrc_eNB_S1AP.h similarity index 100% rename from openair2/RRC/LITE/rrc_eNB_S1AP.h rename to openair2/RRC/LTE/rrc_eNB_S1AP.h diff --git a/openair2/RRC/LITE/rrc_eNB_UE_context.c b/openair2/RRC/LTE/rrc_eNB_UE_context.c similarity index 100% rename from openair2/RRC/LITE/rrc_eNB_UE_context.c rename to openair2/RRC/LTE/rrc_eNB_UE_context.c diff --git a/openair2/RRC/LITE/rrc_eNB_UE_context.h b/openair2/RRC/LTE/rrc_eNB_UE_context.h similarity index 100% rename from openair2/RRC/LITE/rrc_eNB_UE_context.h rename to openair2/RRC/LTE/rrc_eNB_UE_context.h diff --git a/openair2/RRC/LITE/rrc_eNB_ral.c b/openair2/RRC/LTE/rrc_eNB_ral.c similarity index 100% rename from openair2/RRC/LITE/rrc_eNB_ral.c rename to openair2/RRC/LTE/rrc_eNB_ral.c diff --git a/openair2/RRC/LITE/rrc_eNB_ral.h b/openair2/RRC/LTE/rrc_eNB_ral.h similarity index 100% rename from openair2/RRC/LITE/rrc_eNB_ral.h rename to openair2/RRC/LTE/rrc_eNB_ral.h diff --git a/openair2/RRC/LITE/extern.h b/openair2/RRC/LTE/rrc_extern.h similarity index 100% rename from openair2/RRC/LITE/extern.h rename to openair2/RRC/LTE/rrc_extern.h diff --git a/openair2/RRC/LITE/proto.h b/openair2/RRC/LTE/rrc_proto.h similarity index 99% rename from openair2/RRC/LITE/proto.h rename to openair2/RRC/LTE/rrc_proto.h index b920587419..7216ef6572 100644 --- a/openair2/RRC/LITE/proto.h +++ b/openair2/RRC/LTE/rrc_proto.h @@ -31,7 +31,7 @@ * @{ */ -#include "RRC/LITE/defs.h" +#include "RRC/LTE/rrc_defs.h" #include "flexran_agent_extern.h" diff --git a/openair2/RRC/LITE/rrc_rrm_interface.c b/openair2/RRC/LTE/rrc_rrm_interface.c similarity index 100% rename from openair2/RRC/LITE/rrc_rrm_interface.c rename to openair2/RRC/LTE/rrc_rrm_interface.c diff --git a/openair2/RRC/LITE/rrc_rrm_interface.h b/openair2/RRC/LTE/rrc_rrm_interface.h similarity index 100% rename from openair2/RRC/LITE/rrc_rrm_interface.h rename to openair2/RRC/LTE/rrc_rrm_interface.h diff --git a/openair2/RRC/LITE/rrc_types.h b/openair2/RRC/LTE/rrc_types.h similarity index 100% rename from openair2/RRC/LITE/rrc_types.h rename to openair2/RRC/LTE/rrc_types.h diff --git a/openair2/RRC/LITE/rrc_types_NB_IoT.h b/openair2/RRC/LTE/rrc_types_NB_IoT.h similarity index 100% rename from openair2/RRC/LITE/rrc_types_NB_IoT.h rename to openair2/RRC/LTE/rrc_types_NB_IoT.h diff --git a/openair2/RRC/LITE/vars.h b/openair2/RRC/LTE/rrc_vars.h similarity index 100% rename from openair2/RRC/LITE/vars.h rename to openair2/RRC/LTE/rrc_vars.h diff --git a/openair2/RRC/LITE/rrm_2_rrc_msg.c b/openair2/RRC/LTE/rrm_2_rrc_msg.c similarity index 100% rename from openair2/RRC/LITE/rrm_2_rrc_msg.c rename to openair2/RRC/LTE/rrm_2_rrc_msg.c diff --git a/openair2/RRC/LITE/utils.c b/openair2/RRC/LTE/utils.c similarity index 100% rename from openair2/RRC/LITE/utils.c rename to openair2/RRC/LTE/utils.c diff --git a/openair2/UTIL/MEM/mem_block.c b/openair2/UTIL/MEM/mem_block.c index 9c3a50467a..fe3a7a4c97 100644 --- a/openair2/UTIL/MEM/mem_block.c +++ b/openair2/UTIL/MEM/mem_block.c @@ -33,7 +33,7 @@ #include "mem_block.h" #include "mem_pool.h" #include "list.h" -#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/mac_extern.h" /* all function calls are protected by a mutex * to ensure that many threads calling them at -- GitLab